xmds-1.6.6/0000777000076500000240000000000011033374735007510 500000000000000xmds-1.6.6/acinclude.m40000644000076500000240000002315211033277571011620 00000000000000dnl By default, many hosts won't let programs access large files; dnl one must use special compiler options to get large-file access to work. dnl For more details about this brain damage please see: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html dnl Written by Paul Eggert . dnl $Id: acinclude.m4 1511 2007-08-20 12:50:56Z paultcochrane $ dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME) AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS], [AC_CACHE_CHECK([for $1 value to request large file support], ac_cv_sys_largefile_$1, [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || { ac_cv_sys_largefile_$1=no ifelse($1, CFLAGS, [case "$host_os" in # IRIX 6.2 and later require cc -n32. changequote(, )dnl irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) changequote([, ])dnl if test "$GCC" != yes; then ac_cv_sys_largefile_CFLAGS=-n32 fi ac_save_CC="$CC" CC="$CC $ac_cv_sys_largefile_CFLAGS" AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) CC="$ac_save_CC" esac]) }])]) dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL) AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND], [case $2 in no) ;; ?*) case "[$]$1" in '') $1=$2 ;; *) $1=[$]$1' '$2 ;; esac ;; esac]) dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE], [AC_CACHE_CHECK([for $1], $2, [$2=no changequote(, )dnl $4 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do case "$ac_flag" in -D$1) $2=1 ;; -D$1=*) $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; esac done changequote([, ])dnl ]) if test "[$]$2" != no; then AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) fi]) AC_DEFUN([AC_SYS_EXTRA_LARGEFILE], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) if test "$enable_largefile" != no; then AC_CHECK_TOOL(GETCONF, getconf) AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS) AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS) AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS) for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do case "$ac_flag" in no) ;; -D_FILE_OFFSET_BITS=*) ;; -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; -D_LARGE_FILES | -D_LARGE_FILES=*) ;; -D?* | -I?*) AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; *) AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; esac done AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, ac_cv_sys_file_offset_bits, [[Number of bits in a file offset, on hosts where this is settable.]]) [case "$host_os" in # HP-UX 10.20 and later hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) ac_cv_sys_file_offset_bits=64 ;; esac] AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, ac_cv_sys_largefile_source, [Define to make fseeko etc. visible, on some hosts.], [case "$host_os" in # HP-UX 10.20 and later hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) ac_cv_sys_largefile_source=1 ;; esac]) AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES, ac_cv_sys_large_files, [Define for large files, on AIX-style hosts.], [case "$host_os" in # AIX 4.2 and later aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) ac_cv_sys_large_files=1 ;; esac]) fi ]) dnl @synopsis AC_C_FIND_ENDIAN dnl dnl Determine endian-ness of target processor. dnl @version 1.1 Mar 03 2002 dnl @author Erik de Castro Lopo dnl dnl Majority written from scratch to replace the standard autoconf macro dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation dnl of the AC_TRY_RUN macro. dnl dnl Permission to use, copy, modify, distribute, and sell this file for any dnl purpose is hereby granted without fee, provided that the above copyright dnl and this permission notice appear in all copies. No representations are dnl made about the suitability of this software for any purpose. It is dnl provided "as is" without express or implied warranty. dnl Find endian-ness in the following way: dnl 1) Look in . dnl 2) If 1) fails, look in and . dnl 3) If 1) and 2) fails and not cross compiling run a test program. dnl 4) If 1) and 2) fails and cross compiling then guess based on target. AC_DEFUN([AC_C_FIND_ENDIAN], [AC_CACHE_CHECK(determining processor byte ordering, ac_cv_c_byte_order, # Initialize to unknown ac_cv_c_byte_order=unknown if test x$ac_cv_header_endian_h = xyes ; then # First try which should set BYTE_ORDER. [AC_TRY_LINK([ #include #if BYTE_ORDER != LITTLE_ENDIAN not big endian #endif ], return 0 ;, ac_cv_c_byte_order=little )] [AC_TRY_LINK([ #include #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ], return 0 ;, ac_cv_c_byte_order=big )] fi if test $ac_cv_c_byte_order = unknown ; then [AC_TRY_LINK([ #include #include #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ], return 0 ;, [AC_TRY_LINK([ #include #include #if BYTE_ORDER != LITTLE_ENDIAN not big endian #endif ], return 0 ;, ac_cv_c_byte_order=little )] [AC_TRY_LINK([ #include #include #if BYTE_ORDER != LITTLE_ENDIAN not big endian #endif ], return 0 ;, ac_cv_c_byte_order=little )] )] fi if test $ac_cv_c_byte_order = unknown ; then if test $cross_compiling = yes ; then # This is the last resort. Try to guess the target processor endian-ness # by looking at the target CPU type. [ case "$target_cpu" in alpha* | i?86* | mipsel* | ia64*) ac_cv_c_big_endian=0 ac_cv_c_little_endian=1 ;; m68* | mips* | powerpc* | hppa* | sparc*) ac_cv_c_big_endian=1 ac_cv_c_little_endian=0 ;; esac ] else AC_TRY_RUN( [[ int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long l ; char c [sizeof (long)] ; } u ; u.l = 1 ; return (u.c [sizeof (long) - 1] == 1); } ]], , ac_cv_c_byte_order=big, ac_cv_c_byte_order=unknown ) AC_TRY_RUN( [[int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long l ; char c [sizeof (long)] ; } u ; u.l = 1 ; return (u.c [0] == 1); }]], , ac_cv_c_byte_order=little, ac_cv_c_byte_order=unknown ) fi fi ) ] if test $ac_cv_c_byte_order = big ; then ac_cv_c_big_endian=1 ac_cv_c_little_endian=0 elif test $ac_cv_c_byte_order = little ; then ac_cv_c_big_endian=0 ac_cv_c_little_endian=1 else ac_cv_c_big_endian=0 ac_cv_c_little_endian=0 AC_MSG_WARN([[*****************************************************************]]) AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]]) AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]]) AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]]) AC_MSG_WARN([[*****************************************************************]]) fi )# AC_C_FIND_ENDIAN dnl @synopsis AC_C99_FUNC_LRINT dnl dnl Check whether C99's lrint function is available. dnl @version 1.3 Feb 12 2002 dnl @author Erik de Castro Lopo dnl dnl Permission to use, copy, modify, distribute, and sell this file for any dnl purpose is hereby granted without fee, provided that the above copyright dnl and this permission notice appear in all copies. No representations are dnl made about the suitability of this software for any purpose. It is dnl provided "as is" without express or implied warranty. dnl AC_DEFUN([AC_C99_FUNC_LRINT], [AC_CACHE_CHECK(for lrint, ac_cv_c99_lrint, [ lrint_save_CFLAGS=$CFLAGS CFLAGS="-O2 -lm" AC_TRY_LINK([ #define _ISOC9X_SOURCE 1 #define _ISOC99_SOURCE 1 #define __USE_ISOC99 1 #define __USE_ISOC9X 1 #include ], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no) CFLAGS=$lrint_save_CFLAGS ]) if test "$ac_cv_c99_lrint" = yes; then AC_DEFINE(HAVE_LRINT, 1, [Define if you have C99's lrint function.]) fi ])# AC_C99_FUNC_LRINT dnl @synopsis AC_C99_FUNC_LRINTF dnl dnl Check whether C99's lrintf function is available. dnl @version 1.3 Feb 12 2002 dnl @author Erik de Castro Lopo dnl dnl Permission to use, copy, modify, distribute, and sell this file for any dnl purpose is hereby granted without fee, provided that the above copyright dnl and this permission notice appear in all copies. No representations are dnl made about the suitability of this software for any purpose. It is dnl provided "as is" without express or implied warranty. dnl AC_DEFUN([AC_C99_FUNC_LRINTF], [AC_CACHE_CHECK(for lrintf, ac_cv_c99_lrintf, [ lrintf_save_CFLAGS=$CFLAGS CFLAGS="-O2 -lm" AC_TRY_LINK([ #define _ISOC9X_SOURCE 1 #define _ISOC99_SOURCE 1 #define __USE_ISOC99 1 #define __USE_ISOC9X 1 #include ], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no) CFLAGS=$lrintf_save_CFLAGS ]) if test "$ac_cv_c99_lrintf" = yes; then AC_DEFINE(HAVE_LRINTF, 1, [Define if you have C99's lrintf function.]) fi ])# AC_C99_FUNC_LRINTF xmds-1.6.6/aclocal.m40000644000076500000240000007704511033307500011263 00000000000000# generated automatically by aclocal 1.10 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_if(m4_PACKAGE_VERSION, [2.61],, [m4_fatal([this file was generated for autoconf 2.61. You have another version of autoconf. If you want to use that, you should regenerate the build system entirely.], [63])]) # Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10])dnl _AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) xmds-1.6.6/acx_mpi.m40000644000076500000240000000615411033276365011314 00000000000000dnl @synopsis ACX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl This macro tries to find out how to compile programs that dnl use MPI (Message Passing Interface), a standard API for dnl parallel process communication (see http://www-unix.mcs.anl.gov/mpi/) dnl dnl On success, it sets the MPICC, MPICXX, or MPIF77 output variable to dnl the name of the MPI compiler, depending upon the current language. dnl (This may just be $CC/$CXX/$F77, but is more often something like dnl mpicc/mpiCC/mpif77.) It also sets MPILIBS to any libraries that are dnl needed for linking MPI (e.g. -lmpi, if a special MPICC/MPICXX/MPIF77 dnl was not found). dnl dnl If you want to compile everything with MPI, you should set: dnl dnl CC="$MPICC" #OR# CXX="$MPICXX" #OR# F77="$MPIF77" dnl LIBS="$MPILIBS $LIBS" dnl dnl The user can force a particular library/compiler by setting the dnl MPICC/MPICXX/MPIF77 and/or MPILIBS environment variables. dnl dnl ACTION-IF-FOUND is a list of shell commands to run if an MPI dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, dnl the default action will define HAVE_MPI. dnl dnl @version $Id: acx_mpi.m4 1194 2006-12-18 12:59:46Z paultcochrane $ dnl @author Steven G. Johnson AC_DEFUN([ACX_MPI], [ AC_PREREQ(2.50) dnl for AC_LANG_CASE AC_LANG_CASE([C], [ AC_REQUIRE([AC_PROG_CC]) AC_CHECK_PROGS(MPICC, mpicc hcc mpcc mpcc_r mpxlc, $CC) acx_mpi_save_CC="$CC" CC="$MPICC" AC_SUBST(MPICC) ], [C++], [ AC_REQUIRE([AC_PROG_CXX]) AC_CHECK_PROGS(MPICXX, mpiCC mpCC, $CXX) acx_mpi_save_CXX="$CXX" CXX="$MPICXX" AC_SUBST(MPICXX) ], [Fortran 77], [ AC_REQUIRE([AC_PROG_F77]) AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf mpf77 mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r, $F77) acx_mpi_save_F77="$F77" F77="$MPIF77" AC_SUBST(MPIF77) ]) if test x = x"$MPILIBS"; then AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) AC_TRY_LINK([],[ call MPI_Init], [MPILIBS=" " AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) fi if test x = x"$MPILIBS"; then AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) fi if test x = x"$MPILIBS"; then AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) fi dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the dnl latter uses $CPP, not $CC (which may be mpicc). AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then AC_MSG_CHECKING([for mpi.h]) AC_TRY_COMPILE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" AC_MSG_RESULT(no)]) fi], [C++], [if test x != x"$MPILIBS"; then AC_MSG_CHECKING([for mpi.h]) AC_TRY_COMPILE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" AC_MSG_RESULT(no)]) fi]) AC_LANG_CASE([C], [CC="$acx_mpi_save_CC"], [C++], [CXX="$acx_mpi_save_CXX"], [Fortran 77], [F77="$acx_mpi_save_F77"]) AC_SUBST(MPILIBS) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x = x"$MPILIBS"; then $2 : else ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1]) : fi ])dnl ACX_MPI xmds-1.6.6/acx_pthread.m40000644000076500000240000002144011033276365012151 00000000000000dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl This macro figures out how to build C programs using POSIX dnl threads. It sets the PTHREAD_LIBS output variable to the threads dnl library and linker flags, and the PTHREAD_CFLAGS output variable dnl to any special C compiler flags that are needed. (The user can also dnl force certain compiler flags/libs to be tested by setting these dnl environment variables.) dnl dnl Also sets PTHREAD_CC to any special C compiler that is needed for dnl multi-threaded programs (defaults to the value of CC otherwise). dnl (This is necessary on AIX to use the special cc_r compiler alias.) dnl dnl If you are only building threads programs, you may wish to dnl use these variables in your default LIBS, CFLAGS, and CC: dnl dnl LIBS="$PTHREAD_LIBS $LIBS" dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" dnl CC="$PTHREAD_CC" dnl dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). dnl dnl ACTION-IF-FOUND is a list of shell commands to run if a threads dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, dnl the default action will define HAVE_PTHREAD. dnl dnl Please let the authors know if this macro fails on any platform, dnl or if you have any other suggestions or comments. This macro was dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread dnl macros posted by AFC to the autoconf macro repository. We are also dnl grateful for the helpful feedback of numerous users. dnl dnl @version $Id: acx_pthread.m4 1194 2006-12-18 12:59:46Z paultcochrane $ dnl @author Steven G. Johnson and Alejandro Forero Cuervo AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). AC_MSG_CHECKING([for joinable pthread attribute]) AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_JOINABLE;], ok=PTHREAD_CREATE_JOINABLE, ok=unknown) if test x"$ok" = xunknown; then AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_UNDETACHED;], ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, [Define to the necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_RESULT(${ok}) if test x"$ok" = xunknown; then AC_MSG_WARN([we do not know how to create joinable pthreads]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD xmds-1.6.6/AUTHORS0000644000076500000240000000071211033276365010474 00000000000000# $Id: AUTHORS 1194 2006-12-18 12:59:46Z paultcochrane $ Authors of XMDS Greg Collecutt Paul Cochrane Matthew Davis Graham Dennis Joe Hope Andrew Reid Clinton Roy Sebastian Wuester xmds-1.6.6/ChangeLog0000644000076500000240000124251511033277571011210 000000000000002008-07-02 08:46 grahamdennis * trunk/xmds-devel/source/xmds_complex.h, trunk/xpdeint/xpdeint/includes/xpdeint_complex.h: xmds & xpdeint: CRITICAL BUG FIX to complex arithmetic. The unary negation operator was incorrectly overloaded to modify the complex variable that was being negated. Note that this bug only applies to the 'complex' class and not to the 'fftw_complex' class. In more detail: Whenever code is written that requires the negative of a complex variable (of type complex, this bug is not present for the fftw_complex type), instead of simply returning the negative of that variable, the variable itself was modified to be the negative as well. Consider the following code: complex a = 7.0 + 3*i; // a = 7 + 3i, everything is fine complex b = -a; // b = -7 - 3i as expected, but additionally // a = -7 - 3i Note that this bug will not be triggered by a subtraction operation. b = a-c will have been correct. Additionally, if the complex number is part of a larger expression, this bug will only matter if the complex variable is first. i.e. z = -0.5*a would have been fine, but z = -a*0.5 would not. Note that the variable 'i' was not affected by this because it is defined as 'const', so expressions like z = -i*a were safe. Likewise any other 'const' complex constants would have also been safe. From what I can gather from the repository logs, this bug has been present in xmds (and xpdeint) since the original commit, i.e. February 3, 2003. This bug could have affected any simulation since then, though you would need to be unlucky to hit it. Most simulations would be fine as the evolution equations are typically written in the form: dphi_dt = L[phi] + stuff; The L[phi] term will prevent the unary negation operation from being called. Unfortunately, some simulations will have hit this. The only example script that hit this was the xmds van_der_pol.xmds script where its evolution equations are: dx_dt = xdot; dxdot_dt = -x - epsilon*(x*x - 1)*xdot; The '-x' term in the second line triggered the bug, but the calculation of the x*x term is safe as although x is a complex variable, its imaginary part is zero, and the memory that 'x' is stored in is immediately overwritten after this line with the value of 'dx_dt * _step', and so although this simulation did hit the bug, due to a coincidence it did not affect the results. This update should be considered critical and anyone following the development versions should update both xmds and xpdeint. Joe: Can we do an xmds-1 release? 2008-04-22 03:49 andyferris * trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc: xmds: Output fixes. * Now when using binary and the -o option the .dat files are stored with the prefix given by -o and not the one in the .xmds file. * Removed a few compiler warnings by removing excess arguments passed to printf. 2008-04-16 23:59 andyferris * trunk/xmds-devel/source/xsil2graphics.cc: xsil2graphics: Allow multiple input file names. e.g. "xsil2graphics *.xsil" now works. 2008-04-11 05:40 paultcochrane * trunk/xmds-devel/admin/cygwin/xmds.README: Updated the version information for building and installing xmds for cygwin 2008-04-11 05:24 paultcochrane * trunk/xmds-devel/admin/cygwin/xmds-1.6.5-1.sh: Updated the cygwin configure options to enable fftw3 2008-04-11 04:32 paultcochrane * trunk/xmds-devel/admin/cygwin/xmds-1.6.5-1.sh: Added the generic xmds build script for building on cygwin. This hasn't yet been adjusted for xmds-specfics yet. 2008-04-11 04:29 paultcochrane * trunk/xmds-devel/admin/cygwin/setup.hint: Added the setup.hint file for use with cygwin's setup.exe 2008-04-11 04:28 paultcochrane * trunk/xmds-devel/admin/cygwin/xmds.README: Added the cygwin readme file for the cygwin xmds package. 2008-04-11 04:19 paultcochrane * trunk/xmds-devel/admin/cygwin: Added a cygwin subdirectory for cygwin-port related files 2008-04-09 10:55 paultcochrane * ., trunk/xmds-devel/admin/xmds-1.6.5-r1.ebuild: Added the Gentoo ebuild used to build xmds on that distro 2008-04-09 10:44 paultcochrane * ., trunk/xmds-devel/admin/xmds-1.6.5-Makefile_DATA.patch, trunk/xmds-devel/configure.in, trunk/xmds-devel/xmds-1.6.5-Makefile_DATA.patch: Added patch to the wrong directory, duh. 2008-04-09 10:42 paultcochrane * ., trunk/xmds-devel/configure.in: 2008-04-09 10:41 paultcochrane * ., trunk/xmds-devel/configure.in: - replaced hard tabs with spaces - added a coda for emacs and vim so that formatting is automatically consistent in these editors - indented the code a bit more consistently 2008-04-09 10:34 paultcochrane * trunk/xmds-devel/xmds-1.6.5-Makefile_DATA.patch: Added the actual patch to Makefile.am which I used to build the Fedora 8 RPM 2008-04-09 09:05 paultcochrane * trunk/xmds-devel/admin/Makefile_in_update.patch, trunk/xmds-devel/admin/aclocal_update.patch, trunk/xmds-devel/admin/configure_update.patch: Added the patches which enabled me to get xmds to build on openSuSE's build service 2008-04-09 00:51 paultcochrane * trunk/xmds-devel/admin/xmds_suse.spec: Added a spec file which enables xmds to build SuSE Linux RPMs. This was developed with the help of the openSuSE build service: http://build.opensuse.org 2008-04-09 00:42 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_simulation.h, trunk/xmds-devel/source/xsil2graphics.cc: Applied patch courtesy of Rafael Laboissiere from Debian which fixes a build error when using gcc 4.3 (yay the Debian automated build service!) 2008-04-08 05:55 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Reverted incorrect BuildRequires option accidentally commited in the last commit 2008-04-08 05:42 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Corrected the spec file's release number information 2008-04-07 09:54 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: Added a title to plots generated with the xsil2graphics '-p' option. This effectively closes the long overdue ticket (feature request tracker item) #1600312. 2008-04-07 09:19 paultcochrane * trunk/xmds-devel/admin/Makefile_DATA.patch: Added (for future reference) the patch, used to get the 1.6.5 xmds version able to build the rpm properly, to the repository 2008-04-07 09:09 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Updates to get the rpm spec file buildign again. A patch had to be added to modify the root Makefile.am in order to fix a problem where we were using automake 1.10 version features, however rpmbuild requires version automake version 1.6. Updated the file list, and made it more generic (replaced "xmds" with %{name}-%{version} which is more flexible. Updated the changelog and header appropriately 2008-03-28 02:23 grahamdennis * trunk/xmds-devel/source/xmds_integrate_ex.cc: xmds (not xpdeint!): Using OpenMP with an EX algorithm was broken. Oops. This bug is not present in xpdeint. 2008-03-27 03:15 grahamdennis * trunk/xmds-devel/source/xmds_simulation.cc: xmds (not xpdeint!): Fixed bug Paul introduced in r1760 where the output filename would be determined by the simulation name, not by the filename specified in the tag. 2008-03-18 16:07 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Added a note of where one can pick up a copy of xsltproc for those who don't have Gnome installed by default 2008-03-18 16:03 paultcochrane * trunk/xmds-devel: Added ChangeLog to svn:ignore list 2008-03-18 15:54 paultcochrane * trunk/xmds-devel/ChangeLog: Removed the ChangeLog file from the repository: it's now automatically generated. See admin/xmdsReleaseProcedure.pod for details of how to generate this file. 2008-03-18 15:53 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Updated the release procedure text to reflect that ChangeLog is now automatically generated. Also tidied up the text a little. 2008-03-18 15:50 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Having thought about the ChangeLog usage somewhat more (and having noticed that we actually have a NEWS file in the distro), we should really use ChangeLog as we had been using it, and that's essentially as a list of svn log entries hence effectively reverting Joe's FullChangeLog change of quite a while ago. 2008-03-18 15:48 paultcochrane * trunk/xmds-devel/NEWS: Added recent news items to the news file (duh, paul...) 2008-03-18 15:41 paultcochrane * trunk/xmds-devel/README, trunk/xmds-devel/configure.in, trunk/xmds-devel/source/Doxyfile: Updated the version information to 1.6.6 (we've already released 1.6.5) 2008-03-18 15:29 paultcochrane * trunk/xmds-devel/examples, trunk/xmds-devel/source: Updated the svn:ignore property to ignore .exe (for cygwin) and Makefiles 2008-03-18 15:25 paultcochrane * trunk/xmds-devel/examples/Makefile.am: Updated the clean target within the examples/ subdirectory 2008-03-18 15:24 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc: Updated the copyright date information 2008-03-18 13:32 paultcochrane * trunk/xmds-devel/configure.in: When building with --with-user, the examples were set to be installed in /usr/local/share/doc which of course a user can't do. This updates the location of the installed example files to $HOME/doc/xmds, which hopefully is a much better location, and will avoid users getting nasty errors when installing xmds locally. 2008-03-04 06:36 grahamdennis * trunk/xmds-devel/source/xmds_complex.h, trunk/xpdeint/source/FieldElement.tmpl, trunk/xpdeint/source/ScriptElement.tmpl: Add in operator overloads for the complex type multiplied by longs... ... and don't multiply them by longs when integrating over integer-valued dimensions (in xpdeint). 2008-02-26 10:08 paultcochrane * trunk/xmds-devel/admin/release_notification.txt: Added the release notification text used to inform the various newsgroups about the current release. 2008-02-26 03:35 joehope * trunk/xmds-devel/MANIFEST: Update for new version. 2008-02-26 03:31 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README: Updating for new version release. 2008-02-06 21:48 paultcochrane * trunk/xmds-devel/ChangeLog: Removed some old ChangeLog entries which got added in for some reason. Added a summary of recent changes to repository. Would others be able to summarise their changes here as well? Please? 2008-02-06 21:43 paultcochrane * trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc: One can now specify the output data filename at the command line with the -o/--outfilename simulation command line argument. This provides the feature requested by Christopher Coleman-Smith on the xmds-user mailing list. 2008-02-06 21:37 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Implemented automatically generating matlab/octave plot commands when running xsil2graphics. When the user uses the -p (--plot) command line argument to xsil2graphics (and when the number of independent variables is either 1 or 2) then basic plotting output is generated. This commit also corrects some typos in the help output of xsil2graphics, updates some error messages, and adds some comments and todo items. 2008-02-06 21:30 paultcochrane * trunk/xmds-devel/examples/Makefile.am: Extending the clean target to clean up more files. 2008-02-06 07:03 grahamdennis * trunk/xmds-devel/source/xmds_breakpoint.cc: xmds: Revert Paul's r1607 commit. In Paul's commit, he changed the order of a couple of operations. This caused the first coordinate value not to be written, and instead the second was the first written, and the end point was written when it shouldn't be. The upshot of this is that you could not use the XSIL file for initialising another simulation. At least I know my sanity-checking code for XSIL loading works. While I'm at it, make sure that the revision number for XMDS is put in breakpoint XSIL files as well as XSIL files created from moment groups. 2008-01-31 06:00 michaelhush * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: Fixed error estimation in adaptive algorithms so zero valued functions no longer cause nan errors and thus time steps 2008-01-30 07:19 gmcmanus * trunk/xmds-devel/BUGS, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_output.cc: fix bug: properly escape strings when outputting xmds file - we need to escape backslashes \ and quotation marks ", which we do with escapeStringC on sim{Header,Footer,Body}Text (these are only used for source generation, so they are the right variables to escape). We no longer escape quotation marks in simulationText. - we also need to avoid percentage signs, so generate code like: printf("%s", "..."); instead of printf("..."); - similar bugs probably exist, so create a BUGS file and note it. 2008-01-30 07:18 gmcmanus * trunk/xmds-devel/source/main.cc: new function in main: escapeStringC - given a string, escape backslashes and quotation marks in the string with a backslash. This allows the string to be read properly in C source. - To do: for strict correctness, perhaps more characters should be escaped (e.g. non-printable characters)? 2008-01-30 06:53 grahamdennis * trunk/xmds-devel/source/xmds_integrate_rk4.cc: Increase the order of the cross-propagation integration from 2nd order to 4th by calculating midpoints more correctly. 2008-01-29 23:21 paultcochrane * trunk/xmds-devel/source/Doxyfile: The api docs don't get dumped into the documentation directory of xmds.org anymore. So put them locally. 2008-01-29 22:06 paultcochrane * trunk/xmds-devel/source/xmds_output.cc: Removed a lot of auto-generate code which produced only commented out code. 2008-01-29 04:42 gmcmanus * trunk/xmds-devel/examples/infinite.xmds: New example: ODE with singularity in derivative - to test min_time_step feature 2008-01-29 04:42 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: min_time_step: halt adaptive integration pass if time step becomes too small - by default, have a min_time_step of 1e-13 - the checking can be disabled if min_time_step = 0 - Implemented by adding the writeStepCheckingCode method to xmdsIntegrate. This is not ideal, but reduces code duplication; see comments in the source. - we only check the size of the step when the error is intolerable, so there is no cost when the integration is running successfully. - writeHaltCode can now print more verbose warning messages; however, the caller needs to be careful about escaped characters. It's easiest to avoid them altogether rather than double-quoting them. A function to quote raw strings with C escape codes would be useful. - also, use doxygen style comments in xmds_integrate.h 2008-01-29 04:42 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h: xmdsIntegrate: separate function to write halting code This is in preparation of the minimum step-size check, and leads to less code duplication in the generation code. It does lead to more code duplication in the generated code, but in non-critical areas (it is code to halt the integration). 2008-01-29 04:41 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc: more accurate comment for non-finite number check In most simulations, the components of the main vector are coupled together. So even if there is no Fourier transform, the components are quickly mixed together. Also, we check for any non-finite numbers (not just NaNs). 2008-01-29 04:40 gmcmanus * trunk/xmds-devel/examples/nan.xmds: remove left over comment in nan example 2008-01-26 23:07 paultcochrane * trunk/xmds-devel/Makefile.am: Improvement of the make examples target so that we can finally build the examples properly on OpenSolaris. 2008-01-26 22:55 paultcochrane * trunk/xmds-devel/Makefile.am: Updated the base Makefile.am to build the examples directory with the same interface as previously. make examples and make examples-clean works as expected. 2008-01-26 22:52 paultcochrane * trunk/xmds-devel/configure.in: Added examples/Makefile to list of Makefiles to be automatically built 2008-01-26 22:52 paultcochrane * trunk/xmds-devel/examples/Makefile.am: Added an automake Makefile template to build the examples scripts. 2008-01-26 22:51 paultcochrane * trunk/xmds-devel/examples: Updated the svn:ignore property on the examples/ subdirectory 2008-01-26 22:50 paultcochrane * trunk/xmds-devel/examples/Makefile: Removed examples Makefile as this is now created by a Makefile.am (autoconf tools) 2008-01-25 02:47 gmcmanus * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: fix bug: check to halt before resetting the segment in adaptive integration - otherwise, the segment may always be reset to before a NaN, which would then never be detected and the integration would enter an infinite loop. 2008-01-25 02:06 joehope * trunk/xmds-devel/Makefile.am: Fix for namespace issue with certain compilers. 2008-01-25 01:04 gmcmanus * trunk/xmds-devel/source/xmds_integrate_siip.cc: fix syntax error in generated code for SIIP - C requires a statement after every label, so we insert an empty statemeny after the _SEGMENT*_END label - This bug was revealed by always printing the labels. Previously it was a bug when using both SIIP and runtime_limit. 2008-01-25 00:25 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc: only print default value message if verbose - fix indentation too 2008-01-25 00:22 gmcmanus * trunk/xmds-devel/Makefile.am: added nan.xmds to examples in Makefile.am - removed trailing and leading spaces too 2008-01-24 23:44 gmcmanus * trunk/xmds-devel/examples/nan.xmds: example that has a NaN in the derivative 2008-01-24 23:43 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc: read halt_non_finite tag in xmdsIntegrate - the task of reading a bool from a tag, reading the list and printing messages accordingly should be a separate function 2008-01-24 23:43 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h: Add the non-finite number checking and halting code - modify writeHaltCheckingCode to check the main vector for non-finite numbers - non-finite numbers are the infinities (e.g. 1/0) and NaN (e.g. 0/0). - The Fourier transform will mix together all the elements of the main vector, so we only need to check one component - we exit the same as if overtime - print useful notices when stopping the integration - new parameter in xmdsIntegrate: myHaltNonFinite (set to false for now) 2008-01-24 23:42 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc: prepare for check to halt on non-finite numbers - generalize writeRuntimeCheckingCode to writeHaltCheckingCode, and slightly rewrite it. - print a notice if the simulation is halted prematurely - in non-adaptive integration, move halt checks to just before samples. - in adaptive integration, move halt checks to end of time-step loop. - write SEGMENT*_END label unconditionally 2008-01-24 23:42 gmcmanus * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: small refactoring: use && instead of nested ifs 2008-01-24 23:41 gmcmanus * trunk/xmds-devel/source/xmds_integrate.cc: improve verbose messages - more consistency - fix spelling errors - fix spacing 2008-01-24 23:41 gmcmanus * trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc: indentation to shorten lines 2008-01-22 06:31 gmcmanus * trunk/xmds-devel/source/xmds_integrate_rk4.cc: Comments about sampling code - Code is repeated in other integrate classes. - Why use multiplication and division instead of mod (%)? Perhaps former is faster, depending on architecture. 2008-01-22 06:31 gmcmanus * trunk/xmds-devel/source/xmds_integrate.h: Why pass a reference to a constant int? It makes some sense to pass references to constant objects, so that the entire object doesn't have to be copied onto the stack. But ints are (about) the same size as pointers. 2008-01-22 06:31 gmcmanus * trunk/xmds-devel/source/xmds_integrate.h: improved documentation for xmdsIntegrate methods - completed documentation for methods that return bool - added documentation for writeRuntimeCheckingCode 2008-01-21 23:13 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Realistically this is the spec for xmds-1.6.5. Changed the comment to reflect this. Also, in the last commit, I updated the comments for the given xmds.spec version to document what has been altered. 2008-01-21 23:11 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Updated the name of the pdf documentation to add into the rpm Added relevant files which are now installed to list of files to include in the rpm 2008-01-21 22:55 paultcochrane * trunk/xmds-devel/admin/xmds.spec: We're now packaging for xmds-1.6.5 so changed the version number to reflect this. We're not able to install the files into /usr/lib/xmds and /usr/include/xmds due to the fact that we determine where the libraries and headers go at configure time, so revert back to using the standard locations. 2008-01-21 22:44 paultcochrane * trunk/xmds-devel/ChangeLog: Added a note about new configuration and installation changes. 2008-01-21 22:26 paultcochrane * trunk/xmds-devel/admin/xmds.spec: The patches for Fedora are no longer necessary as the issues they addressed have now been applied in the trunk. 2008-01-21 22:23 paultcochrane * trunk/xmds-devel/Makefile.am: The examples now go into an examples/ subdirectory of the doc/xmds directory when installed. 2008-01-21 22:15 paultcochrane * trunk/xmds-devel/Makefile.am: Actually, come to think of it, the examples, NEWS, COPYING and AUTHORS should also go into the /usr/share/doc/xmds dir. 2008-01-21 22:12 paultcochrane * trunk/xmds-devel/Makefile.am, trunk/xmds-devel/source/Makefile.am: Changing the location of where loadxsil.m is installed. It now goes in /usr/local/share/doc/xmds/ (or equivalent). The README and README.Windows now also go into this directory when make install is run. 2008-01-21 21:43 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Now using the correct version information for finding the xmds source, and for the release number of the .rpm 2008-01-21 19:28 paultcochrane * trunk/xmds-devel/TODO: Minor textual cleanup to fit with my old-fashioned tastes ;-) 2008-01-21 03:52 joehope * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Added in the command for auto-ChangeLog generation. Even if it isn't our officially released set of changes, it's a useful document. 2008-01-21 03:39 joehope * trunk/xmds-devel/TODO: Removing trailing space. 2008-01-21 03:03 joehope * trunk/xmds-devel/TODO: Updated TODO before discussion with Gabriel. 2008-01-21 00:14 joehope * trunk/xmds-devel/source/xmds_integrate_ip.cc: Fixed bug from interaction picture replacements. Have to watch people using the vector version incorrectly, and my cleanup test was buggy. 2008-01-20 14:35 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc: Reformatted code, and made indenting more consistent. No functional improvements but hopefully reads a bit more easily. Also made some notes on places where the code could be refactored 2008-01-19 16:16 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_vector.cc: Adding spacing around parentheses for readability 2008-01-19 16:11 paultcochrane * trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc: Banishing hard tabs. 2008-01-19 16:03 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Updated release procedure to reflect the change in the way the ChangeLog is handled. 2008-01-19 16:02 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xsil_field.cc: Removed trailing space. 2008-01-19 16:01 paultcochrane * trunk/xmds-devel/configure.in: Updated xmds version number to the current development version (xmds-1.6.4 has been released) 2008-01-19 16:01 paultcochrane * trunk/xmds-devel/source/Doxyfile: Updated the xmds version number to 1.6.5 which is what we're working on now. 2008-01-19 14:54 paultcochrane * trunk/xmds-devel/ChangeLog: Added a list of recent changes to the change log 2008-01-19 14:52 paultcochrane * trunk/xmds-devel/ChangeLog: Completely altered the ChangeLog. The file now gives a summary of the changes for each version of xmds. This is a far better overview of what has been happening in xmds than the overly detailed change log we used to have. If anyone is interested in the detailed version, they can just go 'svn log'. 2008-01-19 14:20 paultcochrane * trunk/xmds-devel/source/xmds_vector_element.cc: consting constant charater arrays as per patch courtesy of Rafael Laboissiere. 2008-01-19 14:18 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: Applying patch for C-string to C++-string casts comparison courtesy of Rafael Laboissiere. 2008-01-19 14:15 paultcochrane * trunk/xmds-devel/source: Ignoring TAGS files in svn status output 2008-01-19 12:40 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: *This* time converted tabs to spaces 2008-01-19 12:38 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: Converted hard tabs to spaces 2008-01-18 14:18 paultcochrane * trunk/xmds-devel/source/Makefile.am: Applying patch supplied by Rafael Laboissiere to remove the xmds_config.h file from the release tarball and to remove the file when running make distclean 2008-01-16 00:12 joehope * trunk/xmds-devel/Makefile.am: Fix for the missing examples. 2008-01-15 02:03 joehope * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: More direct way of moving the files onto the website. Must change privileges as well, apparently. 2008-01-10 04:20 joehope * trunk/xmds-devel/MANIFEST, trunk/xmds-devel/Makefile.am: More version 1.6.4 release preparation. 2008-01-10 04:13 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README, trunk/xmds-devel/README.Windows: Preparing for new version release. 2008-01-10 02:55 joehope * trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-doc/latex/functionality.tex, trunk/xmds-doc/latex/languageReference.tex, trunk/xmds-doc/latex/misc_defs.tex, trunk/xmds-doc/latex/moreExamples.tex, trunk/xmds-doc/latex/tutFromScratch.tex, trunk/xmds-doc/latex/xmds_doc.tex, trunk/xmds-doc/latex/xsil2graphics.tex: Update of the documentation for the new version. Some older bits were updated, though not thoroughly, and the new component array abilities are mentioned, referenced, and included in the examples. 2008-01-10 00:11 joehope * trunk/xmds-devel/examples/HighdimPlotExample.nb, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/highdim_vector_version.xmds, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_vector.cc: Added vector functionality for the fields in XMDS. This only works for the main fields, as I believe that is the only time it is required. highdim_vector_version.xmds has been added as a shorthand to the syntax. It is an identical program to highdim.xmds, but written using the new syntax. Essentially, components can be described as vectors by adding their length in parentheses: phi(200) They are then addressed by phi(j), where j may range from 1 to the maximum value. Values for j are not range checked, so be careful. Propagation and transverse derivatives are described by dphi_dt(j) and Loperator[phi](j) respectively. Disadvantages of using vector syntax: If the k-space operator of any of the components of a vector are required, all of them are calculated. This makes, for example, highdim_vector_version.xmds slower than the old version. IMPORTANT: For interaction picture algorithms, if a k-space operator is applied to any component of a vector, then it is applied to ALL OF THEM. This means that highdim_vector_version.xmds only solves the correct equations when used with an EX algorithm. Noises do not currently have a vector option, but it would be easy to add if anyone was interested. 2008-01-07 00:02 joehope * trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc: Processing for vector components. More to be done, but this is a transparent milestone. 2008-01-01 06:07 joehope * trunk/xmds-devel/configure.in: Replacing Paul's fix. Was I imagining problems? 2007-12-31 04:00 joehope * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector.h, trunk/xmds-devel/source/xmds_vector_element.cc: Preliminary structures for definition of vector components. These changes currently have no functional effect at all. Also includes a backout of Paul's recent configure.in changes. We need to find a script that works on all systems. 2007-12-30 17:34 paultcochrane * ., trunk/xmds-devel/configure.in: Converted 'test x$var != x' tests to use 'test -n' instead. This is to try to fix Joe's current configuration problems. It seems that for some reason even though FFTW_LIB_PATH and FFTW3_LIB_PATH aren't set taht the true paths of the if statements were still being taken and therefore -L was being incorrectly added to the LDFLAGS variable at configuration check time. 2007-12-30 17:34 paultcochrane * ., trunk/xmds-devel/source/xmds_globals.cc: Minor tidyups to try to improve code readability 2007-12-30 17:34 paultcochrane * ., trunk/xmds-devel/source/xmds_filter.cc: Tidy up code a bit, add spacing and try to make autogenerated code a bit easier to read. 2007-12-22 15:19 paultcochrane * trunk/xmds-devel/configure.in: Removed FFTW_LIB_PATH from arguments to AC_CHECK_LIB() where extra libraries are required, rather than extra paths to libraries. The paths to libraries should already have been set in LDFLAGS if we have them in some non-standard location. 2007-12-22 14:57 paultcochrane * trunk/xmds-devel/configure.in: Only appending to the LDFLAGS when the FFTW*_LIB_PATH variable is set 2007-12-22 12:56 joehope * trunk/xmds-devel/examples/HighdimPlotExample.nb, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc: The new version of Mathematica now inputs all files. The structure of that data is tidied up as well. 2007-12-21 18:51 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: Fixed a bug where a comparison between a C string and a character array caused the incorrect path to be taken. The long version of the story is this: we had instances of typeName == "complex" which works in C++, but not when typeName is a const char * (i.e. not a C++ string object). The correct thing to do here is to use strcmp() (or make typeName into a string object). So, I took the shorter path and added strcmp() comparisons instead. This was picked up by the Sun C++ compiler (why didn't gcc or icc pick this up?), and flagged as an error. 2007-12-21 18:26 paultcochrane * trunk/xmds-devel/source/xmds_simulation.cc: The math.h in Sun's CC doesn't define INFINITY. However, it does define HUGE_VAL, so use this instead of INFINITY if INFINITY isn't defined. 2007-12-21 17:46 paultcochrane * trunk/xmds-devel/configure.in: Configuring xmds with Sun's C compiler on Open Solaris means that we need to have the library paths *before* the libraries. Also we need to set the LDFLAGS variable so that configure is able to find the appropriate libraries when we use --with-fftw-path. 2007-12-21 17:05 paultcochrane * trunk/xmds-devel/configure.in: Sun's C compiler doesn't handle -Wall, hence only turning on warnings flags for gcc. 2007-12-21 16:14 paultcochrane * trunk/xmds-devel/configure.in: Correcting a piece of error text when fftw3 isn't found. 2007-12-16 04:01 joehope * trunk/xmds-devel/examples/HighdimPlotExample.nb, trunk/xmds-devel/examples/highdim.xmds: Plotting examples for the Mathematica input. 2007-12-16 04:00 joehope * trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Support for binary input into the lastest version of Mathematica. ASCII support for latest version and binary support for old version are not yet implemented. 2007-12-15 19:52 joehope * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: Never say final: This is the ultimate fix for the multi-block error. 2007-12-14 02:42 michaelhush * trunk/xmds-devel/source/xmds_integrate_ark89.cc: fixed problem with cycle tag when using ark89 2007-12-12 07:23 joehope * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: When multiple sequence elements are used for any reason, the sample times were wrong for the adaptive algorithms. Fixed. I can't believe no-one noticed this one. Further bugs to come. 2007-11-26 04:11 grahamdennis * trunk/xmds-devel/source/xmds_breakpoint.cc: Correct compiler warning when compiling scripts that use the breakpoint auto-naming feature. 2007-11-25 03:52 grahamdennis * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_breakpoint.h, trunk/xmds-devel/source/xmds_simulation.cc: If there isn't a filename tag for a breakpoint element, then the breakpoints will be named 1.xsil, 2.xsil, 3.xsil etc. Note that this is not reset for half-step integration. The naming increments for all breakpoints in the simulation that lack a filename tag. 2007-11-18 23:17 paultcochrane * ., trunk/xmds-devel/source/xmds_field.cc: Merged more fprintf statements together. 2007-11-18 23:17 paultcochrane * ., trunk/xmds-devel/source/xmds_field.cc: Changed the following variables in xmdsField::writeDefines(): dimI->domain.begin.c_str() and dimI->domain.end.c_str() to use shorter, but as descriptive, names. 2007-11-18 23:17 paultcochrane * ., trunk/xmds-devel/source/xmds_field.cc: Replaced occurrences of myName.c_str() with a constant fieldName variable in xmdsField::writeDefines() 2007-11-18 23:16 paultcochrane * ., trunk/xmds-devel/source/xmds_field.cc: Compacted more fprintf statements into fewer. Attempting to make the generated code look as "normal" as possible. 2007-11-18 23:16 paultcochrane * ., trunk/xmds-devel/source/xmds_field.cc: More spacing-out of code and compression of fprintf statements into one. 2007-11-18 23:16 paultcochrane * ., trunk/xmds-devel/source/xmds_element.cc: Minor formatting changes. Dunno if it helped readability that much ... 2007-11-18 20:20 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Further expansion of generated code. Some more formatting changes. 2007-11-18 20:19 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Wrote some of the generated code a bit more longhand so that it's easier to read in the xmds code. 2007-11-18 20:19 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Further compression of code to be generated into single fprintf statements 2007-11-18 20:19 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Caught a mistake in one of the format strings. 2007-11-18 20:19 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Merged some fprintf statements into one, to try to make code to be generated easier to read. 2007-11-18 20:19 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Moved 'coordinate' variable increment into body of 'for' loop instead of residing in 'for' loop header itself. This is in the generated code. BTW: the last commit added braces around this 'for' loop. 2007-11-18 20:19 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: More formatting changes. I'm doing this in little bits on this file to try enable us to pinpoint where something went wrong if at all. 2007-11-18 18:47 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc: Code formatting improvements. Hopefully a bit easier to read now. 2007-11-18 18:47 paultcochrane * ., trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_field.h: Putting declaration of initialiseFieldFromXSILFile() back in xmds_complex.h so that diffusion2.xmds can build again. Maybe we need an xmds_utils.h header? 2007-11-18 18:47 paultcochrane * ., trunk/xmds-devel/source/xmds_argv.cc: Minor code format change. 2007-11-18 18:47 paultcochrane * ., trunk/xmds-devel/source/xmds_arg_element.cc: Minor textual changes; code readability improvements. 2007-11-18 18:46 paultcochrane * ., trunk/xmds-devel/source/kissdom.cc: Minor code tidyups; trying to improve readability a bit. 2007-11-17 14:15 paultcochrane * ., trunk/xmds-devel/TODO: Minor textual tidyups 2007-11-17 13:42 paultcochrane * ., trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_parser.h: Spacing code out a bit more for readability. 2007-11-17 13:41 paultcochrane * ., trunk/xmds-devel/source/xmds_simulation.cc: - Added spaces around commas and semicolons - Removed superfluous trailing semicolon in _dtdWstore struct in generated code. 2007-11-17 13:41 paultcochrane * ., trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xsil_field.cc: Adding spacing around commas and semicolons to try to improve readability 2007-11-17 13:41 paultcochrane * ., trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: Rolled lots of fprintf statements into one fprintf statement where possible. Hopefully this makes the code to be generated easier to read. 2007-11-17 13:41 paultcochrane * ., trunk/xmds-devel/source/xml_basics.h: Removed unused XMLBASICS define. Minor docstring tidyups 2007-11-17 13:40 paultcochrane * ., trunk/xmds-devel/source/xmds_vector.h, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Updated some Doxygen docs. 2007-11-17 13:40 paultcochrane * ., trunk/xmds-devel/source/kissdom.h: Removed unused #define variable. 2007-11-17 13:40 paultcochrane * ., trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_field.h: Moved declaration of initialiseFieldFromXSILFile to xmds_field.h. Updated some of the doxygen docs in xmds_field.h 2007-11-13 07:49 paultcochrane * ., trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_parser.cc: Adjusted spacing around parentheses for consistency and readability 2007-11-13 07:48 paultcochrane * ., trunk/xmds-devel/source/xmds_moment_group.h, trunk/xmds-devel/source/xml_parser.h, trunk/xmds-devel/source/xsil_field.h: Correcting filenames in doxygen documentation. 2007-11-13 07:47 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: Updated Doxyfile format. 2007-11-11 22:01 paultcochrane * trunk/xmds-devel/test/coding_stds/c_parens.t: Added C-language parenthesis spacing coding standards test from the Parrot project: www.parrotcode.org. Adjusted the test for the xmds source. 2007-11-11 21:55 paultcochrane * ., trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xsil_field.cc: Adjusted parenthesis spacing for more consistent formatting. 2007-11-11 21:55 paultcochrane * ., trunk/xmds-devel/test/coding_stds/cuddled_else.t, trunk/xmds-devel/test/coding_stds/tabs.t, trunk/xmds-devel/test/coding_stds/trailing_space.t: Removed old Parrot-specific comments from coding standards test files. 2007-11-11 21:06 paultcochrane * ., trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Removed trailing whitespace 2007-11-11 21:05 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_vector_element.cc: Removed cuddled else instances. 2007-11-11 21:05 paultcochrane * ., trunk/xmds-devel/test/coding_stds/cuddled_else.t, trunk/xmds-devel/test/coding_stds/trailing_space.t: Removed non-existent filename from list of files to test coding standards. 2007-11-11 20:21 paultcochrane * ., trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_moment_group.cc: Converted hard tabs into spaces 2007-11-11 20:21 paultcochrane * ., trunk/xmds-devel/test/coding_stds/tabs.t: Removed now non-existent file from coding standards test 2007-11-11 20:20 paultcochrane * ., trunk/xmds-devel/configure.in: Rolled xmds version information into a variable. Updated the variable to be xmds-1.6.4 as we've already released xmds-1.6.3. 2007-11-11 20:20 paultcochrane * ., trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_output.cc: Removed superfluous comma in xmds output info text. 2007-11-11 20:19 paultcochrane * ., trunk/xmds-devel/source/Doxyfile, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_simulation.h, trunk/xmds-devel/source/xsil2graphics.cc: Realistically speaking, we don't need the RELEASE variable as a part of the xmds version information; it's superfluous. Hence, I've removed it, and we can just define minor releases of xmds (i.e. xmds-x.x.y) with just the VERSION variable. This has the positive side effect of removing some superfluous code to handle the RELEASE information, and making sure that in each location where xmds version info is printed that the format is the same. Also, it makes packaging xmds easier for downstream packagers, and when we make a release ourselves (with 'make dits') the .tar.gz file comes out with the full version information instead of just the major version. 2007-10-23 04:28 andyferris * trunk/xmds-devel/source/xmds_moment_group.cc: Fixed typo "dobule" 2007-10-23 02:35 andyferris * trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xml_parser.cc: * xmds now reports the line number of elements and the parents when encountering an xmdsException. * The XML parser now assigns attributes xmdsLineNumber and xmdsColumnNumber to EVERY element. This isn't what I'd call XML compliant but it does the job. 2007-10-22 03:51 andyferris * trunk/xmds-devel/TODO, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h: can now be specified with C-code. 2007-10-19 14:27 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Further updates to spec (although not yet complete) after more comments from Patrice Dumas 2007-10-19 14:25 paultcochrane * trunk/xmds-devel/README: Added mention of Octave to README 2007-10-17 08:39 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Several updates to get spec file to conform to Fedora guidelines. 2007-10-17 00:30 andyferris * trunk/xmds-devel/TODO, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_simulation.h: Some more tags are now allowed to have C-code inside them: * is now interpretted as a string and thus works. If code is inserted here then it assumed paths > 1 (so mean_ and sd_ data is produced). * used to work for non-adaptive code; now it works always. * now allows arbitrary code, not just command-line args. * Added a discussion in TODO. 2007-09-20 12:40 grahamdennis * trunk/xmds-devel/source/xmds_moment_group.cc: Fix a subtle bug when outputting data that has the propagation dimension fourier transformed. This bug was introduced when the runtime_limit code was added, and occurs even without a runtime_limit. I think I implemented the runtime_limit in an awful way. 2007-09-18 11:12 joehope * trunk/xmds-devel/source/xmds_moment_group.cc: Precision = double actually increases the precision of ascii output. 2007-09-04 00:18 grahamdennis * trunk/xmds-devel/source/xmds_complex.h: Correct the branch cut for the complex argument function (hence also fixing the branch cut for the c_sqrt function). This should happen at z = -x (phi = +/- pi), not at z=-i y (phi = 3pi/2, -pi/2). 2007-08-31 06:23 grahamdennis * trunk/xmds-devel/source/loadxsil.m: Fix loadxsil.m for matlab. I'm hoping this works for Octave (Paul?) 2007-08-27 05:59 joehope * trunk/xmds-devel/TODO: Another feature requested. Will take a day. 2007-08-24 08:54 paultcochrane * trunk/xmds-devel/test/generated_code/Makefile: Improved the generated <-> reference comparison test by grepping out changable content. 2007-08-24 02:54 grahamdennis * trunk/xmds-devel/source/loadxsil.m: Fix broken loadxsil.m since r1543. 2007-08-24 01:13 grahamdennis * trunk/xmds-devel/source/xmds_simulation.cc: Instead of defining an isfinite that is always true, define one that should work on systems that lack a built-in isfinite. 2007-08-24 01:03 grahamdennis * trunk/xmds-devel/source/xmds_simulation.cc: Compile fix for systems that don't have isfinite. This defines isfinite as true, which is kinda hackish. 2007-08-23 22:12 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Fixed another problem associated with matlab handling structures in a more non-standard manner than octave. Also indented the generated code for eval() so that one can read it a bit more easily. 2007-08-23 22:01 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Further spacing out of code. 2007-08-23 22:00 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Made if(debug) statements more explicit 2007-08-23 22:00 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Spaced out the code a little bit. 2007-08-23 22:00 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Correcting address of FSF 2007-08-23 22:00 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Now just cleaning up the text a bit. 2007-08-23 21:59 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Unindented some over-zealous indentation. 2007-08-23 21:59 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Removed old commented-out code 2007-08-23 21:59 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Finally found the extra level of indentation I was looking for. 2007-08-23 21:59 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Trying to reindent the code so that it makes some sense. I wish someone would be able to tell me that I never wrote this code... *sigh* 2007-08-23 21:58 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Replaced hard tabs with spaces. 2007-08-23 21:58 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Added a vim comment to set tabstops and so-on properly 2007-08-23 21:58 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Octave needs the return character to be properly escaped when loading data from ascii data files. This change means that both matlab and octave can load data, however the matlab informative output doesn't look as nice any more. We'll need to think more carefully about how to make this work on both systems. 2007-08-23 21:58 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: When debug is at a level other than 0, then the assignin call doesn't need to be run (this fixes a problem with running loadxsil.m with debuggin on). 2007-08-23 21:58 paultcochrane * ., trunk/xmds-devel/source/loadxsil.m: Applied patch correcting octave-related compatibility issues. Patch courtesy of Rafael Laboissiere 2007-08-23 10:32 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: Corrected some superfluous character output issues when generating command file output for R. 2007-08-22 17:00 paultcochrane * trunk/xmds-devel/source/main.cc: Now exiting properly when we are unable to determine the current directory. 2007-08-22 16:57 paultcochrane * trunk/xmds-devel/source/main.cc: Now exiting properly when we aren't able to properly determine the user's home directory. 2007-08-22 16:46 paultcochrane * trunk/xmds-devel/source/main.cc: Should have been checking for .fail() instead of equality with null in file opening checking code for templates. 2007-08-22 16:43 paultcochrane * trunk/xmds-devel/source/main.cc: The template text variable is now a string instead of being assigned const char *, which isn't very C++. This removes a couple of todo items as well... 2007-08-22 16:39 paultcochrane * trunk/xmds-devel/source/main.cc: Template output code now uses C++ completely for output instead of a mixture between standard C and C++. 2007-08-22 16:24 paultcochrane * trunk/xmds-devel/source/main.cc: Some cout's should have been cerr's so that the output was directed to stderr as opposed to just stdout 2007-08-22 15:48 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: Removed repeated code in writeAsFormat() 2007-08-22 15:47 paultcochrane * trunk/xmds-devel/examples: Added *.gnu and *.R to files to be ignored. 2007-08-22 15:45 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Added rudimentary support for the R programming and graphics language. One can now load variables into R at the R command prompt using something like: > source("sine.R") > ls() > plot(t_1, c_1) At present this doesn't handle multi-dimensional data (I'm not sure if R handles that at all), but it's a start at least. 2007-08-22 10:55 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Added rudimentary handling of gnuplot output to xsil2graphics. This basically just outputs the data file as is and doesn't generate a variable loading file as one doesn't require one for gnuplot to display the data. This is effectively the same functionality as for the other display options, namely: generate a data file, and optionally a variable-loading command file such that from within the relevant environment one can then display the data. 2007-08-22 07:39 paultcochrane * trunk/xmds-devel/source/xmds_simulation.cc: Added a check for an inconsistent value of the tag when xmds is built with only fftw3 support. Many thanks to Graham for pointing this situation out. 2007-08-21 17:30 paultcochrane * ., trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Added some notes on making the documentation (now it's possible to use make instead of aap) and making a distribution of the docs. 2007-08-21 17:30 paultcochrane * ., trunk/xmds-devel/examples/Makefile: Now removing files generated by gcov as part of clean target 2007-08-21 17:30 paultcochrane * ., trunk/xmds-devel/COPYING, trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/branch.xmds, trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/catcycle.xmds, trunk/xmds-devel/examples/chain.xmds, trunk/xmds-devel/examples/chemkin.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/diffusion2.xmds, trunk/xmds-devel/examples/duffing.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/groundstate.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/hires.xmds, trunk/xmds-devel/examples/krebs.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lane_emden.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/lotka_volterra.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/paraxial_wave.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/ring_modulator.xmds, trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/thermkin.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/van_der_pol.xmds, trunk/xmds-devel/examples/vibstring.xmds: Correcting address of Free Software Foundation. 2007-08-21 17:28 paultcochrane * ., trunk/xmds-devel/configure.in: Corrected location of FFTW3_LIBS and FFTW3_THREADLIBS variables so that they are seen in the proper scope 2007-08-21 14:06 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.h: Removed old todo item. Breakpoints have already been implemented. 2007-08-21 13:47 paultcochrane * trunk/xmds-devel/source/xsil_field.h: Did some rearranging to make the text (hopefully) a bit easier to read. 2007-08-21 13:18 paultcochrane * trunk/xmds-devel/source/xmds_simulation.cc: Trying to tidy up further... 2007-08-21 13:04 paultcochrane * trunk/xmds-devel/source/xmds_simulation.cc: Removed old commented-out code. 2007-08-21 13:01 paultcochrane * trunk/xmds-devel/source/xmds_simulation.cc: More text tidyups. 2007-08-21 12:12 paultcochrane * trunk/xmds-devel/test/generated_code/reference/diffusion.cc, trunk/xmds-devel/test/generated_code/reference/diffusion2.cc, trunk/xmds-devel/test/generated_code/reference/fibre.cc, trunk/xmds-devel/test/generated_code/reference/nlse.cc, trunk/xmds-devel/test/generated_code/reference/sech_soliton.cc, trunk/xmds-devel/test/generated_code/reference/sech_soliton_tdepk.cc: Updated fftw3 references after Graham's recent xmds bugfix. 2007-08-21 12:09 paultcochrane * trunk/xmds-devel/source/xmds_simulation.cc: Making use of the new FFTW_THREE_ONLY #defined variable to choose fftw3 as the default if fftw2 isn't detected at configure time, but fftw3 is. This allows systems with fftw3 only to build almost completely "out of the box", and to build and run the examples. Graham: could you confirm whether or not this breaks your build? I'm not able to test a dual fftw2/fftw3 system. 2007-08-21 12:07 paultcochrane * trunk/xmds-devel/configure.in: Trying to get fftw3-only builds working properly. This change checks for fftw3 in the absence of fftw2 and if so sets up the FFTW_LIBS appropriately and sets a flag to later tell xmds that it only has access to fftw3. Did some quoting tidyups at the same time. (I should really have done these in a separate commit...) 2007-08-21 10:09 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: Further spacing-out of code. Made a note of an odd-looking for loop. If it actually does anything it should have a comment next to it explaining what it does. 2007-08-21 09:46 paultcochrane * trunk/xmds-devel/source/xsil_field.cc: More generic tidyups. Added braces to if/else statements. Added space to try to improve readability. 2007-08-21 08:21 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark45.cc: Should have been using boolean AND instead of bitwise AND in some if statements. Also removed some superfluous brackets and added some more spacing. 2007-08-21 08:17 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark45.cc: Minor touchups. Trying to see if I can make the code to be autogenerated a bit easier to read before it is generated. 2007-08-20 12:51 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark45.cc: Adding some whitespace for readability. 2007-08-20 12:50 paultcochrane * trunk/xmds-devel/acinclude.m4: Removing some underquoted variable warnings in generation of autoconf files. 2007-08-15 10:30 paultcochrane * trunk/xmds-devel/configure.in: Configure now no longer barfs on fftw2 if it doesn't exist. However, it will now barf if both fftw2 and fftw3 aren't available. 2007-08-15 09:47 paultcochrane * trunk/xmds-devel/source/xmds_arg.h, trunk/xmds-devel/source/xmds_arg_element.h, trunk/xmds-devel/source/xmds_argv.h, trunk/xmds-devel/source/xmds_breakpoint.h, trunk/xmds-devel/source/xmds_common.h, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.h, trunk/xmds-devel/source/xmds_field.h, trunk/xmds-devel/source/xmds_filter.h, trunk/xmds-devel/source/xmds_globals.h, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.h, trunk/xmds-devel/source/xmds_integrate_ark45ex.h, trunk/xmds-devel/source/xmds_integrate_ark45ip.h, trunk/xmds-devel/source/xmds_integrate_ark89.h, trunk/xmds-devel/source/xmds_integrate_ark89ex.h, trunk/xmds-devel/source/xmds_integrate_ark89ip.h, trunk/xmds-devel/source/xmds_integrate_ex.h, trunk/xmds-devel/source/xmds_integrate_ip.h, trunk/xmds-devel/source/xmds_integrate_rk4.h, trunk/xmds-devel/source/xmds_integrate_rk4ex.h, trunk/xmds-devel/source/xmds_integrate_rk4ip.h, trunk/xmds-devel/source/xmds_integrate_rk9.h, trunk/xmds-devel/source/xmds_integrate_rk9ex.h, trunk/xmds-devel/source/xmds_integrate_rk9ip.h, trunk/xmds-devel/source/xmds_integrate_si.h, trunk/xmds-devel/source/xmds_integrate_siex.h, trunk/xmds-devel/source/xmds_integrate_siip.h, trunk/xmds-devel/source/xmds_moment_group.h, trunk/xmds-devel/source/xmds_output.h, trunk/xmds-devel/source/xmds_segment.h, trunk/xmds-devel/source/xmds_sequence.h, trunk/xmds-devel/source/xmds_simulation.h, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.h, trunk/xmds-devel/source/xmds_vector_element.h: Added copyright info to the new headers. 2007-08-15 09:31 paultcochrane * trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xsil_field.cc: Corrected 'file' field in doxygen documentation 2007-08-15 09:28 paultcochrane * trunk/xmds-devel/source/main.cc: Removed superfluous text from doxygen docs. 2007-08-15 09:25 paultcochrane * trunk/xmds-devel/source/Makefile.am: No longer building the latex docs with the api target 2007-08-15 09:24 paultcochrane * trunk/xmds-devel/source/main.cc: Updated version information for doxygen 2007-08-15 09:15 paultcochrane * trunk/xmds-devel/source/Doxyfile: Updated the version number to be current with xmds 2007-08-15 08:49 paultcochrane * trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc: More spacing and textual cleanups. 2007-08-15 08:06 paultcochrane * trunk/xmds-devel/source/kissdom.cc: Minor textual tidyups. 2007-08-15 08:06 paultcochrane * trunk/xmds-devel/configure.in: The configure script shouldn't barf on not finding fftw2 when --enable-fftw3 is set. Hence now only running the fftw2-specific checks when --enable-fftw3 isn't set when running the configure script. 2007-08-15 07:52 paultcochrane * trunk/xmds-devel/test/generated_code/reference_fftw2/diffusion.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/diffusion2.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/fibre.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/nlse.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/sech_soliton.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/sech_soliton_tdepk.cc: Updated reference files after recent change by grahamdennis which fixed an issue with error calculations in adaptive algorithms. 2007-08-15 07:50 paultcochrane * trunk/xmds-devel/Makefile.am, trunk/xmds-devel/test/Makefile: Added test-fftw2 targets to makefiles further up the directory structure. 2007-08-14 14:31 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Further code tidy-ups and c++ isms. 2007-08-14 14:19 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Added some space to the code to try to improve readability 2007-08-14 14:14 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Using c++ io output instead of standard c. This allows us to use stdout and stderr more easily. is then no longer needed. Also added usage output when no input file is specified to be consistent with xmds behaviour. 2007-08-14 13:57 paultcochrane * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc: Now using xmds_common.h in .cc source files. 2007-08-14 13:56 paultcochrane * trunk/xmds-devel/source/Makefile.am: I should have added xmds_common.h in the last commit. Duh. 2007-08-14 13:54 paultcochrane * trunk/xmds-devel/source/Makefile.am: Removing xmds_classes.h from dependencies list. 2007-08-14 13:53 paultcochrane * trunk/xmds-devel/source/xmds_common.h: Getting the order of the headers correct. 2007-08-14 13:41 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/getopt_xmds.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg.h, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_arg_element.h, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_argv.h, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_breakpoint.h, trunk/xmds-devel/source/xmds_common.h, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_element.h, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_field.h, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_filter.h, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_globals.h, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45.h, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.h, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.h, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89.h, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.h, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.h, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ex.h, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_ip.h, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4.h, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.h, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.h, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9.h, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.h, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.h, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_si.h, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siex.h, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_integrate_siip.h, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_moment_group.h, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_output.h, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_segment.h, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_sequence.h, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_simulation.h, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector.h, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xmds_vector_element.h, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_basics.h, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xml_parser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Set the svn:keywords property on all .cc and .h files. 2007-08-14 13:38 paultcochrane * trunk/xmds-devel/source/xmds_common.h: Should have written xml_basics.h. duh. 2007-08-14 13:35 paultcochrane * trunk/xmds-devel/source/xmds_common.h: Added a file to wrap the common headers used in (almost) all xmds source files. I know this seems to do the same job as what xmds_classes.h did, however the name is an important functional change, and we've managed to remove the overall dependence on (which wasn't used) and on which is only used in certain places. 2007-08-14 12:24 paultcochrane * trunk/xmds-devel/source/xmds_classes.h: We no longer need xmds_classes.h. Deleting... 2007-08-14 12:13 paultcochrane * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_classes.h: main.cc no longer requires xmds_classes.h 2007-08-14 12:12 paultcochrane * trunk/xmds-devel/source/xmds_classes.h: xmds_utils.h no longer necessary in xmds_classes.h 2007-08-14 12:11 paultcochrane * trunk/xmds-devel/source/xmds_classes.h: xmds_element.h no longer necessary in xmds_classes.h 2007-08-14 12:10 paultcochrane * trunk/xmds-devel/source/xmds_classes.h: xmds_globals.h no longer necessary in xmds_classes.h 2007-08-14 12:10 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_field.cc: xmds_field.h no longer necessary in xmds_classes.h 2007-08-14 12:09 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_vector.cc: xmds_vector.h no longer necessary in xmds_classes.h 2007-08-14 12:08 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_vector_element.cc: xmds_vector_element.h no longer necessary in xmds_classes.h 2007-08-14 12:07 paultcochrane * trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_classes.h: xmds_argv.h no longer necessary in xmds_classes.h 2007-08-14 12:06 paultcochrane * trunk/xmds-devel/source/xmds_classes.h: xmds_arg.h no longer necessary in xmds_classes.h 2007-08-14 12:05 paultcochrane * trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_classes.h: xmds_arg_element.h no longer necessary in xmds_classes.h 2007-08-14 12:03 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_moment_group.cc: xmds_moment_group.h no longer necessary in xmds_classes.h 2007-08-14 12:02 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_output.cc: xmds_output.h no longer necessary in xmds_classes.h 2007-08-14 11:54 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_segment.cc: xmds_segment.h no longer needed in xmds_classes.h 2007-08-14 11:53 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_filter.cc: xmds_filters.h wasn't needed in xmds_classes.h 2007-08-14 11:51 paultcochrane * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc: Disentangled xmds_simulation.h from xmds_classes.h 2007-08-14 10:32 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_sequence.cc: Removed xmds_sequence.h from xmds_classes.h 2007-08-14 10:25 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate.cc: xmds_integrate.h removed from xmds_classes.h 2007-08-14 10:23 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_sequence.cc: Disentangled xmds_breakpoint.h from xmds_classes.h 2007-08-14 10:14 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_sequence.cc: Removed the remaining xmds_classes.h dependenices from the algorithm-related class files. 2007-08-14 05:16 grahamdennis * trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc: Finally, the bug I wanted to fix... Due to the way errors were calculated for adaptive algorithms, in really bad situations (where the field becomes infinite due to overly large step sizes), small errors would be reported instead of really large errors. This is particularly noticeable for situations with density-dependent loss. This caused the rest of the simulation to fail. 2007-08-14 04:42 grahamdennis * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_sequence.cc: Fixing warnings due to size_t's being passed to printf where the format specifier %i was used instead of %zi. 2007-08-14 04:32 grahamdennis * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/xmds_simulation.cc: Reverting changes in r1379 and 1453 (making it possible to build xmds without FFTW2) because it broke the ability to build xmds with FFTW2 and FFTW3. 2007-08-14 04:16 grahamdennis * trunk/xmds-devel/Makefile.am: Fixing broken Makefile.am 2007-08-13 15:52 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_sequence.cc: RK4 subclasses now no longer depend upon xmds_classes.h 2007-08-13 10:35 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_sequence.cc: RK9 headers disentangled from xmds_classes.h 2007-08-13 10:29 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_sequence.cc: Removed ark45 header dependencies from xmds_classes.h 2007-08-13 08:28 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_sequence.cc: xmds_classes.h no longer depends upon xmds_integrate_ark89ip.h 2007-08-13 08:24 paultcochrane * trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_sequence.cc: xmds_classes.h now no longer depends upon xmds_integrate_ark89ex.h 2007-08-13 08:12 paultcochrane * trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_filter.h, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_output.h, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_simulation.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector.h, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xmds_vector_element.h: Each .cc file now includes its own header. Also needed to add some explicit header dependencies to various sub headers to get things to compile again. 2007-08-13 07:46 paultcochrane * trunk/xmds-devel/source/xmds_arg_element.h, trunk/xmds-devel/source/xmds_breakpoint.h, trunk/xmds-devel/source/xmds_filter.h, trunk/xmds-devel/source/xmds_integrate.h, trunk/xmds-devel/source/xmds_integrate_ark45.h, trunk/xmds-devel/source/xmds_integrate_ark45ex.h, trunk/xmds-devel/source/xmds_integrate_ark45ip.h, trunk/xmds-devel/source/xmds_integrate_ark89.h, trunk/xmds-devel/source/xmds_integrate_ark89ex.h, trunk/xmds-devel/source/xmds_integrate_ark89ip.h, trunk/xmds-devel/source/xmds_integrate_ex.h, trunk/xmds-devel/source/xmds_integrate_ip.h, trunk/xmds-devel/source/xmds_integrate_rk4.h, trunk/xmds-devel/source/xmds_integrate_rk4ex.h, trunk/xmds-devel/source/xmds_integrate_rk4ip.h, trunk/xmds-devel/source/xmds_integrate_rk9.h, trunk/xmds-devel/source/xmds_integrate_rk9ex.h, trunk/xmds-devel/source/xmds_integrate_rk9ip.h, trunk/xmds-devel/source/xmds_integrate_si.h, trunk/xmds-devel/source/xmds_integrate_siex.h, trunk/xmds-devel/source/xmds_integrate_siip.h, trunk/xmds-devel/source/xmds_moment_group.h, trunk/xmds-devel/source/xmds_output.h, trunk/xmds-devel/source/xmds_segment.h, trunk/xmds-devel/source/xmds_sequence.h, trunk/xmds-devel/source/xmds_simulation.h, trunk/xmds-devel/source/xmds_vector_element.h: Added header dependencies for objects inheriting directly from other objects. 2007-08-13 07:07 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark45ex.h, trunk/xmds-devel/source/xmds_integrate_ark45ip.h, trunk/xmds-devel/source/xmds_integrate_ark89ex.h, trunk/xmds-devel/source/xmds_integrate_ark89ip.h, trunk/xmds-devel/source/xmds_integrate_rk4ex.h, trunk/xmds-devel/source/xmds_integrate_rk4ip.h, trunk/xmds-devel/source/xmds_integrate_rk9ex.h, trunk/xmds-devel/source/xmds_integrate_rk9ip.h, trunk/xmds-devel/source/xmds_simulation.h: Moved the remaining class declarations out of xmds_classes.h into their own header files. Now to try and unravel the header dependencies so that if something changes in a header, absolutely everything needs to get rebuilt... 2007-08-11 15:50 paultcochrane * ., trunk/xmds-devel/test/generated_code/Makefile, trunk/xmds-devel/test/generated_code/reference_fftw2, trunk/xmds-devel/test/generated_code/reference_fftw2/atomlaser.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/branch.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/brusselator.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/catcycle.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/chain.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/chemkin.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/diffusion.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/diffusion2.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/duffing.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/fibre.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/fisher_reaction_diffusion.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/fullpos3D.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/groundstate.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/hires.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/krebs.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/kubo.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/lane_emden.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/lorenz.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/lotka_volterra.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/ndparamp.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/nlse.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/oregonator.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/paraxial_wave.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/pendulum.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/ring_modulator.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/sech_soliton.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/sech_soliton_tdepk.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/sine.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/soliton.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/thermkin.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/tla.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/van_der_pol.cc, trunk/xmds-devel/test/generated_code/reference_fftw2/vibstring.cc: FFTW2 and FFTW3 generated output is different, so we need different references depending upon which version xmds is built with. Here is a quick hack of the test Makefile to handle this, and the appropriate reference files. 2007-08-10 18:41 paultcochrane * ., trunk/xmds-devel/configure.in: I'd failed to properly initialise USING_FFTW3. This has been fixed. 2007-08-10 18:41 paultcochrane * ., trunk/xmds-devel/admin/cvs2cl.pl: We're using svn now, so don't need the script anymore. 2007-08-10 15:34 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark89.h, trunk/xmds-devel/source/xmds_integrate_rk4.h, trunk/xmds-devel/source/xmds_integrate_rk9.h, trunk/xmds-devel/source/xmds_integrate_siex.h, trunk/xmds-devel/source/xmds_integrate_siip.h: I know I should do these as individual commits as then one has more fine-grained control over when things have broken if at all. However, it can't hurt to separate some of the xmdsIntegrate* declarations in one go, can it? ;-) 2007-08-10 15:02 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ark45.h: Moved xmdsIntegrateARK45 declarations into xmds_integrate_ark45.h 2007-08-10 14:59 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_si.h: Moved xmdsIntegrateSI declarations into xmds_integrate_si.h 2007-08-10 14:55 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ex.h: Moved xmdsIntegrateEX declarations into xmds_integrate_ex.h 2007-08-10 14:45 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate_ip.h: Moved xmdsIntegrateIP stuff into xmds_integrate_ip.h 2007-08-10 14:33 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_breakpoint.h, trunk/xmds-devel/source/xmds_classes.h: Moved xmdsBreakpoint declarations into xmds_breakpoint.h 2007-08-10 14:30 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_filter.h: Moved xmdsFilter declarations into xmds_filter.h 2007-08-10 14:27 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_integrate.h: Moved xmdsIntegrate declarations into xmds_integrate.h 2007-08-10 14:24 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_sequence.h: Moved xmdsSequence declarations into xmds_sequence.h 2007-08-10 14:20 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_segment.h: Moved xmdsSegment declarations into xmds_segment.h 2007-08-10 14:20 paultcochrane * trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg.h, trunk/xmds-devel/source/xmds_argv.cc: Trying to improve header dependencies further. Not getting far though... 2007-08-10 13:58 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_output.h: Moved xmdsOutput declarations into xmds_output.h 2007-08-10 13:43 paultcochrane * trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_globals.cc: Starting to remove dependencies upon xmds_classes.h 2007-08-10 13:30 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_arg_element.h, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_moment_group.h: Moved xmdsArgElement and xmdsMomentGroup declarations into their own headers. 2007-08-10 13:20 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_arg.h, trunk/xmds-devel/source/xmds_classes.h: Moved xmdsArg declarations into xmds_arg.h 2007-08-10 13:11 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_argv.h, trunk/xmds-devel/source/xmds_classes.h: Moved declarations of xmdsArgv into xmds_argv.h 2007-08-10 13:10 paultcochrane * trunk/xmds-devel/source/xmds_element.h: We should have been #including xmds_utils.h here... Oops. Fixed that. 2007-08-10 13:02 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_vector_element.h: Moved xmdsVectorElement declarations into xmds_vector_element.h 2007-08-10 12:58 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_vector.h: Moved xmdsVector declarations into xmds_vector.h 2007-08-10 08:25 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_field.h: Moved xmdsField declarations int xmds_field.h 2007-08-10 08:12 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_globals.h: Moved xmdsGloabls declarations into xmds_globals.h 2007-08-10 08:12 paultcochrane * trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xml_basics.cc: Removed old commented-out code. 2007-08-10 07:44 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_element.h: Moved xmdsElement delcarations from xmds_classes.h into its own header. Added the relevant references to the Makefile and to xmds_classes.h so that the other classes can find everything properly. 2007-08-10 07:42 paultcochrane * trunk/xmds-devel/source/xmds_utils.h: Put header guards in xmds_utils.h 2007-08-10 07:22 paultcochrane * trunk/xmds-devel/source/xmds_classes.h: Added a guard for the header, this is to protect against multiple calls of the header once I've broken up the header a bit (I'm going to try to modularise the code a bit more). 2007-08-09 16:39 paultcochrane * trunk/xmds-devel/source/xmds_field.cc: Trying to get the code to look ok within 80 chars. 2007-08-09 16:20 paultcochrane * trunk/xmds-devel/source/xmds_field.cc: Added spaces, braces and other minor cleanups 2007-08-09 15:50 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_utils.cc: Cleaning up after myself (just removing trailing whitespace) 2007-08-09 15:46 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc: Trying even harder to get things within 80 chars, or at least make things a bit easier to work out what's going on. 2007-08-09 15:42 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_utils.cc: More line-length shortening... 2007-08-09 15:33 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc: Some bitwise ANDs should have been boolean ANDs 2007-08-09 12:43 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc: Split long lines across multiple lines; again, trying to improve the readability of the code. 2007-08-09 12:39 paultcochrane * trunk/xmds-devel/test/generated_code/Makefile, trunk/xmds-devel/test/generated_code/reference/atomlaser.cc, trunk/xmds-devel/test/generated_code/reference/branch.cc, trunk/xmds-devel/test/generated_code/reference/brusselator.cc, trunk/xmds-devel/test/generated_code/reference/catcycle.cc, trunk/xmds-devel/test/generated_code/reference/chain.cc, trunk/xmds-devel/test/generated_code/reference/chemkin.cc, trunk/xmds-devel/test/generated_code/reference/diffusion.cc, trunk/xmds-devel/test/generated_code/reference/diffusion2.cc, trunk/xmds-devel/test/generated_code/reference/duffing.cc, trunk/xmds-devel/test/generated_code/reference/fibre.cc, trunk/xmds-devel/test/generated_code/reference/fisher_reaction_diffusion.cc, trunk/xmds-devel/test/generated_code/reference/fullpos3D.cc, trunk/xmds-devel/test/generated_code/reference/groundstate.cc, trunk/xmds-devel/test/generated_code/reference/hires.cc, trunk/xmds-devel/test/generated_code/reference/krebs.cc, trunk/xmds-devel/test/generated_code/reference/kubo.cc, trunk/xmds-devel/test/generated_code/reference/lane_emden.cc, trunk/xmds-devel/test/generated_code/reference/lorenz.cc, trunk/xmds-devel/test/generated_code/reference/lotka_volterra.cc, trunk/xmds-devel/test/generated_code/reference/ndparamp.cc, trunk/xmds-devel/test/generated_code/reference/nlse.cc, trunk/xmds-devel/test/generated_code/reference/oregonator.cc, trunk/xmds-devel/test/generated_code/reference/paraxial_wave.cc, trunk/xmds-devel/test/generated_code/reference/pendulum.cc, trunk/xmds-devel/test/generated_code/reference/ring_modulator.cc, trunk/xmds-devel/test/generated_code/reference/sech_soliton.cc, trunk/xmds-devel/test/generated_code/reference/sech_soliton_tdepk.cc, trunk/xmds-devel/test/generated_code/reference/sine.cc, trunk/xmds-devel/test/generated_code/reference/soliton.cc, trunk/xmds-devel/test/generated_code/reference/thermkin.cc, trunk/xmds-devel/test/generated_code/reference/tla.cc, trunk/xmds-devel/test/generated_code/reference/van_der_pol.cc, trunk/xmds-devel/test/generated_code/reference/vibstring.cc: The generated output changes as soon as the version information changes. Now grepping out this dynamic output, and have removed the relevant lines from the references. 2007-08-09 12:06 paultcochrane * trunk/xmds-devel/source: Updated svn:ignore property to ignore files generated by gcov 2007-08-09 12:00 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc: Continuing with code tidying. Extra spaces, more brackets in places etc. etc. 2007-08-09 09:56 paultcochrane * trunk/xmds-devel/source/xmds_utils.cc: Whitespace *within* code, however, is a good thing. It makes code easier to read. Hence I've just added some... 2007-08-09 09:11 paultcochrane * trunk/xmds-devel/configure.in: Removed extra gcc-specific warnings options (I only wanted to use them for testing purposes, sorry for the extra commit) 2007-08-09 09:00 paultcochrane * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_basics.h, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xsil_field.cc: There shouldn't be semicolons at the end of class/function etc. definitions. Hence removed them. 2007-08-09 07:30 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/getopt_xmds.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_basics.h, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xml_parser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Purged the source of trailing whitespace 2007-08-08 16:25 paultcochrane * trunk/xmds-devel/test/coding_stds/trailing_space.t: This adds a test for trailing spaces in source code. This is fairly aesthetic but trailing spaces *are* yuckky. 2007-08-08 16:21 paultcochrane * trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xml_basics.h, trunk/xmds-devel/source/xml_parser.h, trunk/xmds-devel/source/xsil_field.h: Banishing hard tabs from the source. 2007-08-08 16:20 paultcochrane * trunk/xmds-devel/test/generated_code/reference/fibre.cc: Removing hard tabs from the sources altered the fibre.cc reference. This commit updates the reference. 2007-08-08 16:08 paultcochrane * trunk/xmds-devel/test/coding_stds/tabs.t: Added a coding standards test to test for hard tabs (hard tabs aren't portable across editors, however spaces are). I.e. this will help ensure that the source looks the same wherever you are, and what you use to view it. 2007-08-08 15:57 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xsil_field.cc: Banishing cuddled else's from the source (they make if/else statments harder to read). 2007-08-08 15:40 paultcochrane * trunk/xmds-devel/test/coding_stds, trunk/xmds-devel/test/coding_stds/cuddled_else.t: Added the first of a set of coding standards tests which will help clean up the xmds source. These tests are borrowed from the Parrot project (http://www.parrotcode.org) and are licensed in a way which plays with the gpl 2007-08-08 15:03 paultcochrane * trunk/xmds-devel/configure.in: Beginning to add warning flags to gcc when building xmds to help pick up common errors. 2007-08-08 14:46 paultcochrane * trunk/xmds-devel/source/xmds_vector_element.cc: Removed superfluous argument from dollar-sign POSIX extended fprintf() statement. 2007-08-08 14:45 paultcochrane * trunk/xmds-devel/test/generated_code/Makefile: No longer compiling the test examples before comparing them with the examples. This saves a *lot* of time when running the tests often. The xmds output is compared to a reference C output anyway... 2007-08-08 14:41 paultcochrane * trunk/xmds-devel/source/xmds_vector_element.cc: Dollar signs were missing within POSIX extended fprintf() statement 2007-08-08 14:34 paultcochrane * trunk/xmds-devel/source/xmds_integrate.cc: Corrected a leftover comparison between signed and unsigned 2007-08-08 14:33 paultcochrane * trunk/xmds-devel/Makefile.am: Made the test suite dependent upon xmds being built first. 2007-08-08 13:18 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark89.cc: Corrected potential bug whereby an argument was missing to an fprintf() statement. 2007-08-08 13:09 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_vector_element.cc: Corrected more integer length issues in fprintf() statements. 2007-08-08 12:23 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc: Removed remaining superfluous fprintf() arguments. 2007-08-08 12:06 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark89.cc: Removing excess arguments to fprintf() functions. 2007-08-08 10:31 paultcochrane * trunk/xmds-devel/source/xmds_integrate_ark45.cc: Removed extra (and therefore unused) arguments to fprintf() statements. 2007-08-08 10:22 paultcochrane * trunk/xmds-devel/source/dom3.h: Giving a destructor to those objects lacking one. 2007-08-08 10:14 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_vector_element.cc: Removed unused variables 2007-08-08 10:14 paultcochrane * trunk/xmds-devel/test/generated_code: Corrected svn:ignore property 2007-08-08 09:57 paultcochrane * trunk/xmds-devel/test/generated_code: Updated svn:ignore property 2007-08-08 09:55 paultcochrane * trunk/xmds-devel/Makefile.am, trunk/xmds-devel/test/Makefile, trunk/xmds-devel/test/generated_code/Makefile: First rough cut at getting the generated code test suite to do something meaningful 2007-08-08 09:13 paultcochrane * trunk/xmds-devel/test/generated_code, trunk/xmds-devel/test/generated_code/atomlaser.xmds, trunk/xmds-devel/test/generated_code/branch.xmds, trunk/xmds-devel/test/generated_code/brusselator.xmds, trunk/xmds-devel/test/generated_code/catcycle.xmds, trunk/xmds-devel/test/generated_code/chain.xmds, trunk/xmds-devel/test/generated_code/chemkin.xmds, trunk/xmds-devel/test/generated_code/diffusion.xmds, trunk/xmds-devel/test/generated_code/diffusion2.xmds, trunk/xmds-devel/test/generated_code/duffing.xmds, trunk/xmds-devel/test/generated_code/fibre.xmds, trunk/xmds-devel/test/generated_code/fisher_reaction_diffusion.xmds, trunk/xmds-devel/test/generated_code/fullpos3D.xmds, trunk/xmds-devel/test/generated_code/groundstate.xmds, trunk/xmds-devel/test/generated_code/hires.xmds, trunk/xmds-devel/test/generated_code/krebs.xmds, trunk/xmds-devel/test/generated_code/kubo.xmds, trunk/xmds-devel/test/generated_code/lane_emden.xmds, trunk/xmds-devel/test/generated_code/lorenz.xmds, trunk/xmds-devel/test/generated_code/lotka_volterra.xmds, trunk/xmds-devel/test/generated_code/ndparamp.xmds, trunk/xmds-devel/test/generated_code/nlse.xmds, trunk/xmds-devel/test/generated_code/oregonator.xmds, trunk/xmds-devel/test/generated_code/paraxial_wave.xmds, trunk/xmds-devel/test/generated_code/pendulum.xmds, trunk/xmds-devel/test/generated_code/reference, trunk/xmds-devel/test/generated_code/reference/atomlaser.cc, trunk/xmds-devel/test/generated_code/reference/branch.cc, trunk/xmds-devel/test/generated_code/reference/brusselator.cc, trunk/xmds-devel/test/generated_code/reference/catcycle.cc, trunk/xmds-devel/test/generated_code/reference/chain.cc, trunk/xmds-devel/test/generated_code/reference/chemkin.cc, trunk/xmds-devel/test/generated_code/reference/diffusion.cc, trunk/xmds-devel/test/generated_code/reference/diffusion2.cc, trunk/xmds-devel/test/generated_code/reference/duffing.cc, trunk/xmds-devel/test/generated_code/reference/fibre.cc, trunk/xmds-devel/test/generated_code/reference/fisher_reaction_diffusion.cc, trunk/xmds-devel/test/generated_code/reference/fullpos3D.cc, trunk/xmds-devel/test/generated_code/reference/groundstate.cc, trunk/xmds-devel/test/generated_code/reference/hires.cc, trunk/xmds-devel/test/generated_code/reference/krebs.cc, trunk/xmds-devel/test/generated_code/reference/kubo.cc, trunk/xmds-devel/test/generated_code/reference/lane_emden.cc, trunk/xmds-devel/test/generated_code/reference/lorenz.cc, trunk/xmds-devel/test/generated_code/reference/lotka_volterra.cc, trunk/xmds-devel/test/generated_code/reference/ndparamp.cc, trunk/xmds-devel/test/generated_code/reference/nlse.cc, trunk/xmds-devel/test/generated_code/reference/oregonator.cc, trunk/xmds-devel/test/generated_code/reference/paraxial_wave.cc, trunk/xmds-devel/test/generated_code/reference/pendulum.cc, trunk/xmds-devel/test/generated_code/reference/ring_modulator.cc, trunk/xmds-devel/test/generated_code/reference/sech_soliton.cc, trunk/xmds-devel/test/generated_code/reference/sech_soliton_tdepk.cc, trunk/xmds-devel/test/generated_code/reference/sine.cc, trunk/xmds-devel/test/generated_code/reference/soliton.cc, trunk/xmds-devel/test/generated_code/reference/thermkin.cc, trunk/xmds-devel/test/generated_code/reference/tla.cc, trunk/xmds-devel/test/generated_code/reference/van_der_pol.cc, trunk/xmds-devel/test/generated_code/reference/vibstring.cc, trunk/xmds-devel/test/generated_code/ring_modulator.xmds, trunk/xmds-devel/test/generated_code/sech_soliton.xmds, trunk/xmds-devel/test/generated_code/sech_soliton_tdepk.xmds, trunk/xmds-devel/test/generated_code/sine.xmds, trunk/xmds-devel/test/generated_code/soliton.xmds, trunk/xmds-devel/test/generated_code/thermkin.xmds, trunk/xmds-devel/test/generated_code/tla.xmds, trunk/xmds-devel/test/generated_code/van_der_pol.xmds, trunk/xmds-devel/test/generated_code/vibstring.xmds: Added a directory to test the generated C code of xmds. This includes most of the current example xmds files, and a directory of the current C output from an xmds run using fftw3. 2007-08-08 08:58 paultcochrane * trunk/xmds-devel/test: Added a test directory (as a base for a more extended test suite) 2007-08-08 08:48 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xsil_field.cc: Correcting comparisons between signed and unsigned integers 2007-08-08 08:22 paultcochrane * trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_vector.cc: Correcting format strings in fprintf() statements to use the appropriate long and in some cases short) format. 2007-08-07 14:09 paultcochrane * trunk/xmds-devel/source/main.cc: Minor code reformatting. 2007-08-07 13:54 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_basics.h, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xml_parser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h: Indented the code using emacs' built in formatting engine. 2007-08-07 13:06 paultcochrane * trunk/xmds-devel/Makefile.am, trunk/xmds-devel/configure.in, trunk/xmds-devel/source, trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_complex.h, trunk/xmds-devel/source/xmds_element.cc, trunk/xmds-devel/source/xmds_field.cc, trunk/xmds-devel/source/xmds_filter.cc, trunk/xmds-devel/source/xmds_globals.cc, trunk/xmds-devel/source/xmds_integrate.cc, trunk/xmds-devel/source/xmds_integrate_ark45.cc, trunk/xmds-devel/source/xmds_integrate_ark45ex.cc, trunk/xmds-devel/source/xmds_integrate_ark45ip.cc, trunk/xmds-devel/source/xmds_integrate_ark89.cc, trunk/xmds-devel/source/xmds_integrate_ark89ex.cc, trunk/xmds-devel/source/xmds_integrate_ark89ip.cc, trunk/xmds-devel/source/xmds_integrate_ex.cc, trunk/xmds-devel/source/xmds_integrate_ip.cc, trunk/xmds-devel/source/xmds_integrate_rk4.cc, trunk/xmds-devel/source/xmds_integrate_rk4ex.cc, trunk/xmds-devel/source/xmds_integrate_rk4ip.cc, trunk/xmds-devel/source/xmds_integrate_rk9.cc, trunk/xmds-devel/source/xmds_integrate_rk9ex.cc, trunk/xmds-devel/source/xmds_integrate_rk9ip.cc, trunk/xmds-devel/source/xmds_integrate_si.cc, trunk/xmds-devel/source/xmds_integrate_siex.cc, trunk/xmds-devel/source/xmds_integrate_siip.cc, trunk/xmds-devel/source/xmds_moment_group.cc, trunk/xmds-devel/source/xmds_output.cc, trunk/xmds-devel/source/xmds_segment.cc, trunk/xmds-devel/source/xmds_sequence.cc, trunk/xmds-devel/source/xmds_simulation.cc, trunk/xmds-devel/source/xmds_utils.cc, trunk/xmds-devel/source/xmds_utils.h, trunk/xmds-devel/source/xmds_vector.cc, trunk/xmds-devel/source/xmds_vector_element.cc, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegrateark89ex.cc, trunk/xmds-devel/source/xmdsintegrateark89ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xml_basics.cc, trunk/xmds-devel/source/xml_basics.h, trunk/xmds-devel/source/xml_parser.cc, trunk/xmds-devel/source/xml_parser.h, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsil_field.cc, trunk/xmds-devel/source/xsil_field.h, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Added underscores to remaining filenames for increased readability 2007-08-07 12:27 paultcochrane * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmds_breakpoint.cc, trunk/xmds-devel/source/xmds_classes.h, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegrateark89ex.cc, trunk/xmds-devel/source/xmdsintegrateark89ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Added underscores to filenames for better readability 2007-08-07 12:15 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/branch.xmds, trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/catcycle.xmds, trunk/xmds-devel/examples/chain.xmds, trunk/xmds-devel/examples/chemkin.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/diffusion2.xmds, trunk/xmds-devel/examples/duffing.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/hires.xmds, trunk/xmds-devel/examples/krebs.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lane_emden.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/lotka_volterra.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/paraxial_wave.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/ring_modulator.xmds, trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/thermkin.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/van_der_pol.xmds, trunk/xmds-devel/examples/vibstring.xmds: Updated more copyright dates 2007-08-07 12:11 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/loadxsil.m, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegrateark89ex.cc, trunk/xmds-devel/source/xmdsintegrateark89ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Updated copyright date 2007-08-07 11:44 paultcochrane * trunk/xmds-devel/source: Now ignoring the version.h file and vim-generated .swp files 2007-08-07 11:42 paultcochrane * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/xmdssimulation.cc: Some first steps at getting xmds to configure and work properly on systems which only have fftw3 installed. 2007-08-03 07:12 joehope * trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Making Poissonian noise sources work. dpsi_dt = n_1 for a poissonian noise now works like dpsi = dn Not implemented for adaptive algorithms, but there's an exception. 2007-07-30 05:52 grahamdennis * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fix for bug introduced in r1350 where it was possible to cause an integer overflow when writing moment groups. This only affected stochastic simulations or simulations with error checking, and then only those moment groups that had a very large number of time samples. 2007-07-13 02:31 grahamdennis * trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: There was a bug in the adaptive timestep algorithms for deterministic MPI simulations caused when the number of points in the first dimension isn't divisible by the number of CPUs. The problem was that it was assumed that on each rank, total_local_size was the size of the grid on that node, and this is not necessarily the case, as it is just the maximum of the grid size on the node (as the swapped and unswapped cases can use different amounts of memory). This mistake is fairly widespread but mostly it isn't a problem, it's just a small wastage of CPU cycles (when the first dimension isn't divisible by the number of CPUs), however the adaptive timestep algorithms need to calculate the maximum of the vectors on the grid and this is where it does cause a problem. 2007-07-11 06:22 grahamdennis * trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc: Significantly reduce memory consumption caused by output moment groups for deterministic MPI simulations. (Memory consumption is only reduced for ranks other than 0). 2007-07-09 04:20 grahamdennis * trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsglobals.cc: Allow elements to work when you don't have a element. 2007-07-03 07:25 grahamdennis * trunk/xmds-devel/source/xmdssimulation.cc: Fixed bug with the runtime limit for deterministic simulations using MPI where it was possible for some nodes to decide they were running overtime, but others could think otherwise. Prevented the runtime limit code being used for stochastic simulations until I work out how to do that properly. 2007-07-02 05:15 grahamdennis * trunk/xmds-devel/source/xmdssequence.cc: Fix for another bug introduced in r1368. 2007-06-28 08:51 grahamdennis * trunk/xmds-devel/source/xmdsintegrateark89.cc: Fix for a serious bug in ARK89 (when using MPI on more than one CPU) where ranks other than 0 would sample at any time greater (potentially much greater) than the sample time, but not at the sample time. Rank 0 was unaffected. For strongly convergent paths, this could lead to the path far overshooting the entire time-range of the simulation. 2007-06-28 05:17 grahamdennis * trunk/xmds-devel/source/xmdssequence.cc: Ooops. I made a mistake in my last commit. 2007-06-28 02:01 grahamdennis * trunk/xmds-devel/TODO, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Fix for an issue when using MPI to distribute a stochastic simulation that only has 1 path when using the Uniform MPI_Method on more than one CPU. 2007-06-27 06:55 joehope * trunk/xmds-devel/ChangeLog: Bump for bugfix release. 2007-06-27 06:32 joehope * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Added notes for the website updates. 2007-06-27 03:24 joehope * trunk/xmds-devel/TODO, trunk/xmds-devel/configure.in, trunk/xmds-devel/source/xmdsvector.cc: Fixed a very rarely occurring bug when sampling in mixed Fourier and normal space on uneven grids. Turns out FFTW didn't work exactly as I expected, but all is well, now. 2007-06-26 02:40 grahamdennis * trunk/xmds-devel/source/loadxsil.m: When I made loadxsil.m deal with missing moment groups (produced by simulations that have hit a run-time limit) it didn't work for when the last moment group was missing. Fixed. 2007-06-23 13:29 joehope * trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdsvector.cc: Minor fixes while hunting for the mixed space bug. 2007-06-21 01:31 joehope * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc: Extra includes to allow compilation with g++ 4.3 Submitted by Rafael Laboissiere, rafael@debian.org 2007-06-20 06:03 grahamdennis * trunk/xmds-devel/source/xmdsintegrateark89.cc: Bug fixes for ARK89. There was a bug in ARK89 where infrequently it would not sample exactly at the correct sample times, but earlier (usually only slightly earlier), and these incorrect sample times would not be the same for all paths. There was a second 'bug' due to the finite precision of doubles that infrequently led to smaller-than-necessary timesteps being calculated. This bug did not affect simulation results, it only slightly increased the time taken for simulations. 2007-06-15 01:45 joehope * trunk/xmds-devel/MANIFEST, trunk/xmds-devel/admin/xmdsReleaseProcedure.pod, trunk/xmds-devel/configure.in: Trivial updates for the xmds-1.6-2 bugfix release. 2007-06-14 04:56 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README, trunk/xmds-devel/configure.in: Version bumps for bugfix release. 2007-06-12 03:34 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc: Breakpoints for vectors of type double would be written incorrectly (the same data would be written multiple times) if MPI was used for deterministic simulations. This is a regression since r1179 (2006-12-14). 2007-06-08 07:33 grahamdennis * trunk/xmds-devel/source/xmdssequence.cc: Rest of Scheduling fix. 2007-06-08 07:14 joehope * trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Partial fix for the Scheduler bug. Has to be finished for Scheduling+Error checking. Fix for argv fix. Fix for IntelMKL case. 2007-06-08 01:31 grahamdennis * trunk/xmds-devel/source/xmdssimulation.cc: Make XMDS not crash when there isn't an ARGV element. 2007-06-07 05:51 grahamdennis * trunk/xmds-devel/TODO, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Add (optional) for using the Intel MKL for generating random numbers. For Gaussian numbers, Intel MKL is ~5x faster than our current implementation of "gaussFast" (when generating 1000 numbers). Note that MKL is a vector library, and so will not necessarily be faster than the current implementation for single-dimensional problems. In terms of real-world performance, this sped up the kubo oscillator by 2.5x (when using a transverse dimension for paths). The tag to enable Intel MKL is , and it defaults to 'no'. 2007-06-06 06:50 andyferris * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: * Allowed command-line arguments to be used as the random seed. This might be useful when analysing trajectory data using a batch script rather than XMDS's internal sampling. * This pretty much mitigates my desire for XMDS to dump all its trajectory data as the same thing can be done with a batch script and without hacking the output .cc code (as I was previously forced to do). * XMDS checks whether the seed element contains positive integers or strings matching one of the names. I have now made the first element to be processed to accommodate this search. * In future, we might want to consider allowing many of the tags to be replaced by a command-line arg. Unfortunately, most numbers are #define'd rather than initialised, making things difficult to generalise... 2007-06-05 01:19 grahamdennis * trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Fix for compiler warning caused by the runtime limit code when there is no runtime limit. 2007-06-03 05:10 grahamdennis * trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/loadxsil.m, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/testsuite/test_xmds.pl: Runtime-limiting support. Add the tag to the simulation to specify an *advisory* maximum running time. The format for this string is HH:MM, HH:MM:SS or SSSS. Note that HH can be greater than 24. Once each timestep, the simulation will determine if it is running overtime. If it is, then any pending samples *for that integrate element* will be sampled, and all remaining integrate and filter elements will be skipped. The only elements that will execute after the runtime limit has been hit are breakpoint elements. Note that if a moment group is never sampled, then it won't get written to the XSIL file, and a .dat file will not be created (for binary output). This patch adds support for XSIL files with 'missing' moment groups and fixes a bug in loadxsil when loading breakpoints from an XMDS script that uses ASCII output. 2007-06-01 05:57 joehope * trunk/xmds-devel/TODO: Results of the Brainstorm. This will be handy later too. Andy and Grahama are great. 2007-05-22 04:14 grahamdennis * trunk/xmds-devel/source/main.cc: Forgot a space... oops. 2007-05-22 01:45 grahamdennis * trunk/xmds-devel/source/main.cc: Make sure that the revision is printed when xmds processes scripts (I didn't notice this when adding the revision information. 2007-05-21 05:16 grahamdennis * trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc: Prevented the ARK algorithms from printing large amounts of information when there is more than one path, as otherwise this information will swamp everything else. 2007-05-10 06:51 joehope * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Whoops, and again. 2007-05-10 06:50 joehope * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: More admin notes moved to svn 2007-05-09 07:16 joehope * trunk/xmds-devel/configure.in: Seeding the version script so it works on a clean install. It would be better to run version.sh at the top of every make, if we knew how to force that through autoconf. 2007-05-09 05:24 joehope * trunk/xmds-devel/MANIFEST: Near release adjustment. 2007-05-09 05:18 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README, trunk/xmds-devel/README.Windows, trunk/xmds-devel/admin/xmdsReleaseProcedure.pod, trunk/xmds-devel/configure.in, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds: Misc changes before release. 2007-05-08 06:52 grahamdennis * trunk/xmds-devel/source/Makefile.am: Moving the version.h make target to the top of the automake file so that maybe make will be able to find it... 2007-05-07 10:51 grahamdennis * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/version.sh: I forgot that the version.h file wouldn't get updated once it existed. So I've made version.h depend on all of the other xmds sources in the automake file. There's probably a cleaner way, but I can't think of one. 2007-05-07 10:31 grahamdennis * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/version.sh, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssimulation.cc: Add the subversion revision number to the end of the version number reported by the application, and saved to XSIL files. This makes it easier for those of us living on the bleeding edge to track down exactly which revision number was used to create a script (for example, for tracking performance regressions). 2007-05-05 09:10 grahamdennis * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc: Move allocation of k_operator_field's to one place in both the xmds source, and the source generated from scripts. This makes it easier to control when the fields are allocated, so that they are allocated only while they are needed, and are free'd after the segment they belong to has completed. Previously, the k_operator_field's were leaked. 2007-05-03 08:08 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: For large data files, the size of each component could be larger than can fit into a long, so an off_t should be used. 2007-05-03 02:14 joehope * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc: Multiple bugfixes. SIEX is now restored in the post FFTW 3 age. Cross-propagation now works with stochastic equations. 2007-05-03 00:59 joehope * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Quick update to the release procedures. 2007-05-03 00:58 joehope * trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc: Start of another bugfix. 2007-05-02 10:22 joehope * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc: Force initialisation of moment group data if post-propagation is performed. Most importantly, this initialises the Fourier space tag. Strictly speaking, the rest of the initialisation is unnecessary unless at least one transverse dimension is integrated, or the system is stochastic with multiple paths, but it is always safe to do, and should have approximately zero impact on speed. 2007-05-02 07:18 joehope * trunk/xmds-devel/source/xsilfield.cc: Suppress unnecessary output when loading data into Mathematica. 2007-04-26 07:46 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: When I added the noises to the XSIL loading code, I forgot to make sure they were deleted at the end. 2007-04-24 05:45 grahamdennis * trunk/xmds-devel/source/xmdssimulation.cc: Just because there's a use_openmp tag, and use_mpi is true doesn't mean that someone actually wants to use both OpenMP and MPI... 2007-04-23 03:33 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: It wasn't possible to use noises in the CDATA section when initialising a vector from an XSIL file. 2007-04-05 13:17 paultcochrane * trunk/xmds-devel/examples/groundstate.xmds: Added groundstate.xmds back in. 2007-04-05 13:17 paultcochrane * trunk/xmds-devel/examples/groundstate.xmds: Temporarily deleting groundstate.xmds to see if can remove the executable bit from the file as it stands in the repository. 2007-04-05 12:58 paultcochrane * ., trunk/xmds-devel/examples/groundstate.xmds: Changed the copyright info in an attempt to change the executable mode on the file (causes problems when building the Debian package). Can only see if this will work... 2007-04-02 00:28 grahamdennis * trunk/xmds-devel/source/loadxsil.m: loadxsil couldn't load 4-dimensional (or higher) arrays (correctly). xsil2graphics generated correct code, just loadxsil didn't. 2007-03-28 07:17 grahamdennis * trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc: Increase precision of field limits so that when changing the size of fields which don't have nice round sizes we don't confuse the XSIL loading code which expects the grids to line up almost exactly. 2007-03-22 03:43 joehope * trunk/xmds-devel/examples/nlse.xmds: Give an example with the adaptive 9(8) RK algorithm. 2007-03-22 03:41 joehope * trunk/xmds-devel/MANIFEST, trunk/xmds-devel/admin/svn2cl.xsl: Still updating for 1.6 release. 2007-03-22 03:34 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README, trunk/xmds-devel/admin/xmdsReleaseProcedure.pod, trunk/xmds-devel/configure.in: Preparing for release of version 1.6. 2007-03-20 01:26 michaelhush * trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdssimulation.cc: Fixed memory leak in ARK89EX and ARK89IP methods for stochastic problem 2007-03-12 00:58 joehope * trunk/xmds-devel/source/xmdssequence.cc: Fixed a bug where the scheduler didn't handle lack of error checking properly. 2007-02-23 05:55 michaelhush * trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Fixed bug triggered when multiple segements were created using the ARK89 methods 2007-02-14 13:59 paultcochrane * ., trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmds_arg.cc, trunk/xmds-devel/source/xmds_arg_element.cc, trunk/xmds-devel/source/xmds_argv.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc: Moved argument parsing sources to filenames with names a bit easier to read. 2007-02-14 13:58 paultcochrane * ., trunk/xmds-devel/source/Makefile.am: Swapped the names of two source files to group the names better 2007-02-14 13:58 paultcochrane * ., trunk/xmds-devel/source/Makefile.am: Moved XML parsing sources and argument parsing sources into their own variable. 2007-02-14 13:58 paultcochrane * ., trunk/xmds-devel/source/Makefile.am: Separated the sources specific to algorithm processing into its own variable. 2007-02-14 13:58 paultcochrane * ., trunk/xmds-devel/source/Makefile.am: Expanded source listing so makes it easier to add files as needed 2007-02-12 03:40 grahamdennis * trunk/xmds-devel/source/main.cc: Adding -openmp to compile options when compiling a threaded OpenMP simulation 2007-02-12 03:20 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc: Breakpoints would be written incorrectly when writing more than one field when one of the fields was of type complex. Oops. 2007-02-12 03:02 grahamdennis * trunk/xmds-devel/source/loadxsil.m: Enable loadxsil.m to work with XSIL files produced from breakpoints. 2007-02-11 03:43 andyferris * trunk/xmds-devel/configure.in: Reverted my change to the configure script. The previous problem was misdiagnosed. Note that the libraries are tested by configure using the "cc" command, and thus uses the CC=... option. However, these libraries are only ever linked to programs compiled by the XMDS_CC=... In this case my fftw3_threads library was incompatible with gcc on my computer, when I set XMDS_CC=icc. 2007-02-08 06:35 andyferris * trunk/xmds-devel/configure.in: Changed configure.in to use the fftw library path when searching for or using the fftw3_threads library. 2007-02-08 03:18 grahamdennis * trunk/xmds-devel/source/xmdsvector.cc: Unbreak moment groups for MPI (broken yesterday when fixing buffer overflow bug). 2007-02-07 03:58 grahamdennis * trunk/xmds-devel/source/xmdsvector.cc: There was a bug in xmdsVector initialisation (not xmdsVectorElement initialisation) that caused a buffer overflow. I think this only affected MPI simulations that used explicit picture integration algorithms (e.g. RK4EX). It certainly only affected MPI simulations. 2007-02-05 06:46 grahamdennis * trunk/xmds-devel/source/xmdsfield.cc: Make deterministic simulations that use MPI but not fourier transforms work. 2007-02-05 05:08 grahamdennis * trunk/xmds-devel/source/loadxsil.m: Make loadxsil work for zero-dimensional variables stored in XSIL files. 2007-02-05 01:30 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Output more information for debugging when input grids don't match simulation grids. 2007-01-31 02:51 grahamdennis * trunk/xmds-devel/examples/Makefile: Actually cause 'make run' in the examples directory to run the examples instead of just pretending to do so. 2007-01-30 20:43 paultcochrane * ., trunk/xmds-devel/admin/build-and-test.sh: Initial import to repository. An initial first cut at a build and test script to run on the sourceforge compile farm. 2007-01-29 21:42 paultcochrane * ., trunk/xmds-devel/examples: Updated svn:ignore property to ignore gcov-generated files. 2007-01-29 21:42 paultcochrane * ., trunk/xmds-devel/examples/Makefile: Added a default target. Added a run target so that can run all simulations as well as just build them. 2007-01-29 21:42 paultcochrane * ., trunk/xmds-devel/source/getopt_xmds.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegrateark89ex.cc, trunk/xmds-devel/source/xmdsintegrateark89ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc: Banishing hard tabs from the source. Replaced with relevant number of spaces. 2007-01-29 21:40 paultcochrane * ., trunk/xmds-devel/source: Updated svn:ignore property to ignore *.bak files 2007-01-29 21:40 paultcochrane * ., trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc: Added emacs/vim coda to load common editor settings 2007-01-29 21:39 paultcochrane * ., trunk/xmds-devel/Makefile.am: Removed latexdocs variable 2007-01-25 05:46 michaelhush * trunk/xmds-devel/source/xmdsintegrateark89.cc: Changed adaptive time step algorithm, so step size is halved after a failure to improve stability 2007-01-18 03:31 michaelhush * trunk/xmds-devel/source/xmdssequence.cc: fixed problem with benchmark changes I made 2007-01-18 02:50 michaelhush * trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdssequence.cc: Fixed time step for ARK89EX and IP for non stochastic problems and changed bemchmark so it displays a more accurate time 2007-01-16 03:03 joehope * trunk/xmds-devel/Makefile.am: Adding the missing examples into the distribution packages 2007-01-11 08:07 michaelhush * trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegrateark89ip.cc: ARK89EX and ARK89IP both now work for normal and simple stochastic problems 2007-01-11 04:35 michaelhush * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrateark89.cc, trunk/xmds-devel/source/xmdsintegrateark89ex.cc: ARK89EX now working and convergerges on diffusion.xmds and a simple stochastic problem 2007-01-07 23:52 paultcochrane * ., trunk/xmds-devel/source/xmdsintegraterk9.cc: Corrected docstring; was throwing a warning from doxygen. 2007-01-07 23:52 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: Explicitly specifying the patterns to look for when searching for source files. 2007-01-07 23:51 paultcochrane * ., trunk/xmds-devel/source/dom3.h: Reformatted docstrings and made most of the lines of code within 80 character limits. 2007-01-07 19:34 paultcochrane * ., trunk/xmds-devel/source/Makefile.am: Building the pdf as well as the html version of the api when running 'make api' 2007-01-07 19:34 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: CALL_GRAPH and CALLER_GRAPH set to YES 2007-01-07 19:33 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: GENERATE_MAN set to NO 2007-01-07 19:33 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: WARN_NO_PARAMDOC set to YES 2007-01-07 19:33 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: Tab size set to 4. 2007-01-07 19:33 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: Updated to current version of doxygen (1.5.1) 2007-01-07 19:32 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: Moved link to where documentation should be output to be in the xmds.org directory. 2007-01-05 01:21 michaelhush * trunk/xmds-devel/source/xmdsintegrateark89.cc: Another file I forgot to add for ARK89 methods 2007-01-04 06:48 michaelhush * trunk/xmds-devel/source/xmdsintegrateark89ex.cc, trunk/xmds-devel/source/xmdsintegrateark89ip.cc: Added ARK89 classes I forgot 2007-01-04 06:46 michaelhush * trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdssequence.cc: RK9IP now works with diffusion and sech_soliton examples, added ARK89EX and ARK89IP classes but functionality still to come 2006-12-28 15:58 paultcochrane * ., trunk/xmds-devel/configure.in: A test was missing for the fftw3.h header file (which is what fftw installs this header as by default, I would guess so that one can run fftw2 and fftw3 on the same system), this hopefully fixes bug #1600319 2006-12-28 15:58 paultcochrane * ., trunk/xmds-devel/examples/Makefile: Added the xmds binary as a dependency so that when xmds is rebuilt, one doesn't have to run 'make examples-clean; make examples' one can just run 'make examples' 2006-12-28 15:58 paultcochrane * ., trunk/xmds-devel/examples/pendulum.xmds: Fixed typo. 2006-12-25 21:05 paultcochrane * ., trunk/xmds-devel/source/main.cc: Changed some output info and added some more todo items. 2006-12-25 21:05 paultcochrane * ., trunk/xmds-devel/source/main.cc: Minor formatting changes. 2006-12-25 21:05 paultcochrane * ., trunk/xmds-devel/source/main.cc: Changed some more printf statements to cout. 2006-12-25 21:05 paultcochrane * ., trunk/xmds-devel/source/main.cc: Converted many printf statements to cout statements (more C++ like). Generic code formatting and tidying. 2006-12-25 21:04 paultcochrane * ., trunk/xmds-devel/source/main.cc: Added a todo item to improve an if-elseif sequence (no book handy atm to make it properly clean). 2006-12-25 21:04 paultcochrane * ., trunk/xmds-devel/source/main.cc: Added a note to the parsePrefs() routine about possibly making it more object oriented to reduce the number of params passed to the routine. 2006-12-25 21:04 paultcochrane * ., trunk/xmds-devel/source: Updated svn:ignore property. 2006-12-25 21:04 paultcochrane * ., trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xsilfield.cc: Reduced length of comments used as spacers between code sections (it fits within an 80 character window nicely now). 2006-12-25 21:03 paultcochrane * ., trunk/xmds-devel/examples/Makefile: Allowing all examples to run even if one fails. This is useful if one hasn't compiled xmds for mpi, and in which case highdim will fail. 2006-12-25 21:03 paultcochrane * ., trunk/xmds-devel/Makefile.am: Added "examples" and "examples-clean" rules for running the examples from the base xmds-devel directory. 2006-12-25 21:02 paultcochrane * ., trunk/xmds-devel/Makefile.am, trunk/xmds-devel/source/Makefile.am: Added an api rule to the makefiles so that one can build the Doxygen-generated api docs using "make api" 2006-12-25 21:02 paultcochrane * ., trunk/xmds-devel/source/Doxyfile: Updated the version number of xmds for the api documentation. 2006-12-25 21:02 paultcochrane * ., trunk/xmds-devel/source/main.cc: Changed the variable c to currentChar in parsePrefs() Some more basic reformatting of code for readability. 2006-12-25 21:02 paultcochrane * ., trunk/xmds-devel/source/main.cc: Some basic code reformatting in parsePrefs() 2006-12-25 21:02 paultcochrane * ., trunk/xmds-devel/source/main.cc: Basic reformat of parsePrefs() argument list to try to improve readability. Also reformatted some comments. 2006-12-25 21:01 paultcochrane * ., trunk/xmds-devel/source/main.cc: Tried to improve the display_usage() code formatting both internally, and that of the text printed to the screen. 2006-12-25 21:01 paultcochrane * ., trunk/xmds-devel/source/main.cc: Reformatted some of the comment/documentation text. 2006-12-20 07:26 paultcochrane * ., trunk/xmds-devel/admin/xmdsNewsPost.pl, trunk/xmds-devel/admin/xmdsNewsPost.txt: Deleted. No longer necessary, or a good idea. 2006-12-20 05:35 michaelhush * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk9.cc, trunk/xmds-devel/source/xmdsintegraterk9ex.cc, trunk/xmds-devel/source/xmdsintegraterk9ip.cc, trunk/xmds-devel/source/xmdssequence.cc: Classes added for the 9th order stochastically safe rk method, ex is working but ip is still being completed 2006-12-18 13:03 paultcochrane * ., trunk/xmds-devel/.cvsignore, trunk/xmds-devel/examples/.cvsignore, trunk/xmds-devel/source/.cvsignore, trunk/xmds-devel/testsuite/.cvsignore, trunk/xmds-doc/latex/.cvsignore, trunk/xmds-doc/latex/figures/.cvsignore: Removed old .cvsignore files. 2006-12-18 12:59 paultcochrane * ., trunk/xmds-devel/AUTHORS, trunk/xmds-devel/INSTALL, trunk/xmds-devel/Makefile.am, trunk/xmds-devel/NEWS, trunk/xmds-devel/README, trunk/xmds-devel/README.Windows, trunk/xmds-devel/acinclude.m4, trunk/xmds-devel/acx_mpi.m4, trunk/xmds-devel/acx_pthread.m4, trunk/xmds-devel/admin/xmdsNewsPost.pl, trunk/xmds-devel/admin/xmdsReleaseProcedure.pod, trunk/xmds-devel/benchmark/bench, trunk/xmds-devel/benchmark/fullpos3D_16.xmds, trunk/xmds-devel/benchmark/fullpos3D_32.xmds, trunk/xmds-devel/benchmark/fullpos3D_64.xmds, trunk/xmds-devel/benchmark/gaugeatomlaser.xmds, trunk/xmds-devel/benchmark/gaugeatomlaser_128.xmds, trunk/xmds-devel/benchmark/ndparamp_100.xmds, trunk/xmds-devel/benchmark/ndparamp_200.xmds, trunk/xmds-devel/benchmark/ndparamp_50.xmds, trunk/xmds-devel/benchmark/ndparamp_500.xmds, trunk/xmds-devel/benchmark/nlse_100.xmds, trunk/xmds-devel/benchmark/nlse_1000.xmds, trunk/xmds-devel/benchmark/nlse_10000.xmds, trunk/xmds-devel/benchmark/nlse_500.xmds, trunk/xmds-devel/benchmark/nlse_5000.xmds, trunk/xmds-devel/benchmark/runbenchmarks, trunk/xmds-devel/configure.in, trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/branch.xmds, trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/catcycle.xmds, trunk/xmds-devel/examples/chain.xmds, trunk/xmds-devel/examples/chemkin.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/diffusion2.xmds, trunk/xmds-devel/examples/duffing.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/hires.xmds, trunk/xmds-devel/examples/krebs.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lane_emden.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/lotka_volterra.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/paraxial_wave.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/ring_modulator.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/thermkin.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/van_der_pol.xmds, trunk/xmds-devel/examples/vibstring.xmds, trunk/xmds-devel/source/Doxyfile, trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/getopt_xmds.c, trunk/xmds-devel/source/getopt_xmds.h, trunk/xmds-devel/source/getopt_xmds1.c, trunk/xmds-devel/source/getopt_xmds_init.c, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/loadxsil.m, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h, trunk/xmds-devel/testsuite/atomlaser.xmds, trunk/xmds-devel/testsuite/fibre.xmds, trunk/xmds-devel/testsuite/fullpos3D.xmds, trunk/xmds-devel/testsuite/gaugeatomlaser.xmds, trunk/xmds-devel/testsuite/kubo.xmds, trunk/xmds-devel/testsuite/ndparamp.xmds, trunk/xmds-devel/testsuite/nlse.xmds, trunk/xmds-devel/testsuite/sine.xmds, trunk/xmds-devel/testsuite/soliton.xmds, trunk/xmds-devel/testsuite/test_xmds.pl, trunk/xmds-devel/testsuite/tla.xmds: Updated svn keywords property to make the "Id" keyword be expanded in source files. 2006-12-17 15:31 paultcochrane * ., trunk/xmds-devel/configure.in, trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/branch.xmds, trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/catcycle.xmds, trunk/xmds-devel/examples/chain.xmds, trunk/xmds-devel/examples/chemkin.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/diffusion2.xmds, trunk/xmds-devel/examples/duffing.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/groundstate.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/hires.xmds, trunk/xmds-devel/examples/krebs.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lane_emden.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/lotka_volterra.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/paraxial_wave.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/ring_modulator.xmds, trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/thermkin.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/van_der_pol.xmds, trunk/xmds-devel/examples/vibstring.xmds, trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Updated copyright date information. 2006-12-17 15:29 paultcochrane * ., trunk/xmds-devel/configure.in, trunk/xmds-devel/source/main.cc: Updated revision number (1.5-3 has been released) 2006-12-17 15:00 paultcochrane * ., trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds: Added copyright notice. 2006-12-17 15:00 paultcochrane * ., trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds: The line at the top of each xmds file should read: not for the file to be a well formed xml document. 2006-12-17 11:17 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc: Added emacs/vim coda to help with formatting of code. 2006-12-17 11:15 paultcochrane * trunk/xmds-devel/examples/groundstate.xmds: Changed simulation name to match filename: this helps the examples makefile correctly work out dependencies. 2006-12-17 11:15 paultcochrane * trunk/xmds-devel/examples/Makefile: Initial import to repository. This makefile is used to build the examples. We probably need to add this as part of autoconf, however, this does the job at present. 2006-12-16 18:16 paultcochrane * trunk/xmds-devel/preconf: Removed; this command would have worked nicely for older versions of the autoconf suite (i.e. those used when the original scripts were written), however now there exists the autoreconf program which comes with the autoconf suite, and so makes the preconf script obsolete. 2006-12-14 09:17 sebwuester * trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc: added underscores to some variables in ark45 which didn't have them; also added underscores to akfield etc. in rk4 and siip siex 2006-12-14 08:00 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Fix bug in earlier commit causing some simulations to not compile (those that use XSIL files to initialise non-main fields). 2006-12-14 07:46 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc: Significantly sped up writing breakpoints when using MPI (removed unnecessary fseeks). For an example of the reduction, in examples/fullpos3D.xmds, the number of fseeks when writing the field data (in a breakpoint) was reduced from 393216 to 48. Also caught a bug where the data was being sent as the incorrect type when using MPI breakpoints. I continue to be astonished that this has worked in the past on the AC. 2006-12-14 05:39 joehope * trunk/xmds-devel/configure.in: Recovering 'out of the box' compilation for Mac OS X by defaulting to c++ compiler Still to achieve this for OPENMPI without passing MPI compiler explicitly as mpic++ 2006-12-14 01:57 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Significantly reduced the number of fseeks during loading of XSIL files. This is particularly important for large simulations as fseeks significantly slow down the loading procedure. 2006-12-01 05:44 paultcochrane * trunk/xmds-devel/configure.in: No longer automatically checking for icc during the configuration stage. If the user wants to use icc they can use the syntax: XMDS_CC=icc ./configure --with-user --enable-mpi (for example) 2006-12-01 04:54 paultcochrane * trunk/xmds-devel/preconf: Initial import to repository. This is a script to run to perform the autoconf preconfiguration dance before running ./configure after one has changed the configure.in or Makefile.am files. Maybe this will save some hands from RSI. 2006-12-01 04:39 paultcochrane * trunk/xmds-devel/Makefile.am: Removed trailing space. This was causing a warning from automake. 2006-12-01 04:33 paultcochrane * trunk/xmds-devel/testsuite/test_xmds.pl: Corrected a typo, and added cvs Id keyword. 2006-12-01 04:20 paultcochrane * trunk/xmds-devel, trunk/xmds-devel/.cvsignore: Initial import to repository. Getting cvs to ignore some of the autogenerated files in the root xmds-devel directory. 2006-11-30 00:13 joehope * trunk/xmds-devel/configure.in: Changing PREFIX behaviour on installation. This is one less patch separating the CVS from the Debian version. 2006-11-27 13:41 paultcochrane * trunk/xmds-devel/testsuite, trunk/xmds-devel/testsuite/.cvsignore: Initial import to repository. This file helps 'cvs status' ignore several files in the testsuite/ directory. 2006-11-27 00:05 joehope * trunk/xmds-devel/Makefile.am: Including lorentzInput.dat in the distribution tarball, as posted by Rafael Laboissiere 2006-11-24 13:08 paultcochrane * trunk/xmds-devel/source/main.cc: Updated copyright information (2004 -> 2006) 2006-11-24 13:07 paultcochrane * trunk/xmds-devel/source, trunk/xmds-devel/source/.cvsignore: Ignoring automatically generated files. 2006-11-24 12:44 paultcochrane * trunk/xmds-devel/examples, trunk/xmds-devel/examples/.cvsignore: Added .wisdom files to list to ignore, and the names of the output example executables. 2006-11-24 12:31 paultcochrane * trunk/xmds-devel/examples, trunk/xmds-devel/examples/.cvsignore: Added a .cvsignore file so that cvs status doesn't generate so much unwanted output. 2006-11-21 04:41 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc: Significantly sped up writing breakpoints to disk by reordering the fwrites so that fseeks are mostly not needed. 2006-11-18 08:57 grahamdennis * trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsintegrateip.cc: I hereby swear to try to make sure my xmds variables start with an underscore. Fixed OpenMP slowdown 2006-11-17 07:18 grahamdennis * trunk/xmds-devel/source/xmdsintegrateip.cc: I forgot to mark the k operators as thread-private in my previous commit. 2006-11-17 05:26 grahamdennis * trunk/xmds-devel/source/xmdsintegrateip.cc: Loop index variables must be signed for OpenMP to work 2006-11-17 05:21 grahamdennis * trunk/xmds-devel/source/xmdsintegrateip.cc: Parallelised (OpenMP) k_propagate and calculate_k_operator_field for ARK45. This should have a decent effect on performance with OpenMP 2006-11-17 04:19 grahamdennis * trunk/xmds-devel/source/xmdsintegrateark45ip.cc: It worked on my machine... Fix crash 2006-11-17 04:15 grahamdennis * trunk/xmds-devel/source/xmdsintegrateark45ip.cc: Combined ARK45IP for loops for cleaner code and better OpenMP compatibility This can be done for all algorithms, I'll do it as I go 2006-11-17 02:49 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: One day I will remember to use underscores in variable names written by XMDS. (Fix compile warning for scripts using XSIL input) 2006-11-03 18:57 paultcochrane * trunk/xmds-devel/NEWS: Updated to the current version of xmds, and added all news items from between xmds-1.3-2 and xmds-1.5-3. 2006-11-03 18:28 paultcochrane * trunk/xmds-devel/AUTHORS: Updated the author list, and reordered all names (except for Greg's - he wrote it to start with, well, that's my reasoning) in alphabetical order by last name. 2006-11-03 14:02 paultcochrane * trunk/xmds-devel/configure.in: Moved fftw3-path help information over a bit so that it lines up with the other text when one does ./configure --help. (yes, I'm pedantic) 2006-10-17 04:59 grahamdennis * trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc: Fixed a problem with how description elements were being read which caused xmds to crash when reading certain examples (e.g. branch.xmds) 2006-10-05 00:57 grahamdennis * trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/source/xmdssimulation.cc: Changing the example lorenz.xmds not to require an input file as the options can be supplied on the command line Fix a bug in the byte-swapping routines due to a choice in the variable name which would result in problems for simulations that define the variable 'x'. 2006-09-19 04:49 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/MANIFEST: Update of MANIFEST and ChangeLog 2006-09-19 04:46 joehope * trunk/xmds-devel/README, trunk/xmds-devel/README.Windows, trunk/xmds-devel/configure.in: Version updates prior to release 2006-09-19 04:01 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Fixes for a collection of MPI scheduler bugs (1558333,1551791,1551790). Single path runs are now handled by the "Uniform" scheduler automatically. Trying to run stochastic simulations without MPI no longer bombs. 2006-08-30 03:33 grahamdennis * trunk/xmds-devel/source/xmdssequence.cc: Flushing output after each path for stochastic simulations at Mattias' request. 2006-08-24 00:54 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc: For MPI breakpoints, I was sending and receiving some values with the wrong datatype (double instead of int). I'm honestly surprised that this even worked for some systems before. 2006-08-23 23:50 grahamdennis * trunk/xmds-devel/examples/atomlaser.xmds: Removed the old-style breakpoint element from the example atomlaser.xmds as that style breakpoint was never implemented. And we don't want any confusion arising with new-style breakpoints. 2006-08-22 05:52 matt0064 * trunk/xmds-devel/source/loadxsil.m: Added code to loadxsil.m to initialise multi-dimensional arrays when loading in binary data. This can be a significant speed up. 2006-08-09 00:54 grahamdennis * trunk/xmds-devel/source/main.cc: Fixing a compile bug for stochastic MPI simulations with FFTW3. Thanks Andy! 2006-08-03 06:17 grahamdennis * trunk/xmds-devel/source/xsilfield.cc: Fixing a bug in the matlab output of xsil2graphics that would cause the script not to load the data from a binary file if the data is a scalar (zero dimensional) 2006-07-31 01:50 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Fixing bugs with the breakpoint code. I'm fairly sure that it works now. 2006-07-28 05:09 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Adding rank number to diagnostic output when an error occurs while loading an XSIL file (with MPI). 2006-07-21 03:39 grahamdennis * trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/diffusion2.xmds, trunk/xmds-devel/source/xmdsbreakpoint.cc: I have fixed the breakpoint code for non-MPI simulations, and breakpoints should now also work for deterministic MPI simulations (it makes no sense to use breakpoints for stochastic MPI simulations). I have also modified the diffusion example to use a breakpoint and then to continue from that breakpoint (with a larger simulation grid) in a second diffusion example. 2006-07-19 03:28 joehope * trunk/xmds-devel/source/xmdsintegrateex.cc: Fix for a tiny bug temporarily introduced with the openMP code, which broke compilation of *EX algorithms. 2006-06-29 07:33 grahamdennis * trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/source/xmdssimulation.cc: Fixing a bug where a simulation with ascii output and a breakpoint element would not compile 2006-06-29 07:24 grahamdennis * trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xsilfield.cc: First crack at the breakpoint code. Currently it only works for simulations that aren't both deterministic and use MPI. Of course, the whole point of this code is for the deterministic MPI case, but for the moment, the vast majority of the helper code has been written. Changes to behaviour: when loading double-type variables with the XSIL loading code, it looks for a variable with an 'R' suffix instead of a variable of the same name. As it is impossible to have an output moment group variable of the same name as a field variable. 2006-06-23 01:54 grahamdennis * trunk/xmds-devel/source/xsilfield.cc: Increased verbosity of some errors when loading XSIL files to mention what the probable cause of the error was. 2006-06-21 07:33 grahamdennis * trunk/xmds-devel/source/xmdsvector.cc: Parallelised the multiplication loop at the end of the *go_space routines. This was causing a massive slowdown on NUMA architecture machines because the whole field was accessed from a single node. 2006-06-20 02:20 grahamdennis * trunk/xmds-devel/source/xmdssequence.cc: Added a fflush() after the 'beginning integration ...' printf lines to better keep track of simulations run with a buffered output stream (e.g. simulations run through batch queueing systems) 2006-06-20 01:59 grahamdennis * trunk/xmds-devel/source/xsilfield.cc: Increased the verbosity of one of the error shown when loading XSIL files when none of the variables to be loaded have been found. This is typically due to the wrong moment group being set. 2006-06-16 04:17 joehope * trunk/xmds-devel/source/xmdsvector.cc: Fix for the MPI version of mixed space Fourier transforms. It was simply wrong previously. 2006-06-07 06:40 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README.Windows, trunk/xmds-devel/configure.in, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Fix for multiple bugs when using moment groups in filter and integrate blocks. The bugs were all specific to MPI specific code implementation. 2006-05-28 10:34 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Correction to my previous commit: It helps to actually set the field to zero instead of just looping over it. 2006-05-28 10:24 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Fix for OpenMP so that each field is initialised by the thread that will use it. This is important for NUMA-architecture supercomputers (e.g. ANU's ac) 2006-05-25 03:19 grahamdennis * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: OpenMP support. Use the tag yes in the simulation element to use this. This does not work with deterministic MPI simulations, and doesn't really make sense to use it with stochastic MPI simulations. To make use of this, you will need a compiler that supports OpenMP such as icc or gcc 4.4 (currently unreleased). Note that one will get best performance if FFTW is compiled using OpenMP threads instead of pthreads. 2006-05-13 01:12 grahamdennis * trunk/xmds-devel/source/xmdsmomentgroup.cc: Forcing a fflush() after writing the 'sampled field...' lines. This way, it is easier to keep track of the progress of jobs on supercomputers 2006-05-12 07:49 grahamdennis * trunk/xmds-devel/source/xmdsvectorelement.cc: Fixed binary importing to not load the entire file into memory. This is needed for MPI situations where the initialisation data won't fit into memory. Also, previously, it was just plain wrong when used with deterministic MPI simulations. 2006-05-12 06:54 grahamdennis * trunk/xmds-devel/source/xsilfield.cc: Removing text claiming that the XSIL loading code does not support byte-swapping (it does) 2006-05-12 06:27 grahamdennis * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/xmdsvectorelement.cc: Reducing the verbosity of the XSIL loading code Adding a --with-fftw3-path to the configure script so that the location of fftw3 can be specified independently of fftw2. Note that the path for fftw3 defaults to the path for fftw2 2006-05-12 04:23 grahamdennis * trunk/xmds-devel/source/xmdssimulation.cc: Fixing a missing \n in a printf statement 2006-05-12 01:48 grahamdennis * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Vector initialisation from XSIL moment groups (binary format only) This should work for MPI simulations (it doesn't load the entire binary file into memory, this is why the this code does not support importing data in ASCII format from XSIL files) This should deal with byte-swapping if necessary. (Not tested, but I'm going to). The input moment group grid does not have to match up exactly with the simulation grid, there are two modes for importing, 'strict' mode and 'loose' mode. In 'strict' mode, the initialisation geometry must match the simulation geometry to within 1% of the step size in each dimension. In 'loose' mode, the step size in each initialisation dimension (you may initialise from a mix of x- and k-space) must match the simulation step size in each dimension, but the start and end points (and the number of points) may be different. Documentation is forthcoming after I have given this a bit more testing. 2006-05-07 09:39 pharaoh84 * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/main.cc: Fixing threads for fftw3 2006-05-07 03:10 pharaoh84 * trunk/xmds-devel/configure.in: Fixing my previous fix for systems with requiring explicit linking of the thread libraries. Also, the agressive CFLAGS are now used for systems that don't require explicit linking of the thread libraries (removed a pointless test) I hate autoconf. 2006-05-07 02:48 pharaoh84 * trunk/xmds-devel/configure.in: Fixing configure.in for fftw3 for systems that require explicit linking of thread libraries 2006-05-05 06:20 pharaoh84 * trunk/xmds-devel/configure.in: Fixing the configure.in script... I hate autoconf. 2006-05-05 06:10 pharaoh84 * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/main.cc: configure.in has been modified to support fftw3. Now you need to provide the option --enable-fftw3 in order to get fftw3 support. One thing I forgot to mention in my previous commit comment was that the tag required to use fftw3 is . This tag belongs in the simulation element. The default is 2 (fftw2), and set it to 3 to use fftw3. 2006-05-04 07:53 pharaoh84 * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvector.cc: Initial support for fftw3. It should work for simulations that are not deterministic MPI simulations with the following caveats: You are not permitted to use fftw_complex in your simulation script (fftw3 uses a different format for their fftw_complex type than is used by fftw2), instead you should be using the 'complex' type. autoconf does not yet detect fftw3, so to get your scripts to compile, you will need to insert a 'FFTW3_LIBS = ' line defining the fftw3 libraries to link in (-lfftw3 and optionally -lfftw3_threads) and the path to find the library if needed. Note that fftw3 uses a different format for wisdom, and this is stored under the new filename ~/.xmds/wisdom/hostname.wisdom.fftw3 or ~/.xmds/wisdom/hostname.wisdom.fftw3_threads for threaded-simulations. I have tested threaded, non-threaded, deterministic and stochastic simulations. I have not tested MPI-based stochastic simulations yet, however the scripts do compile. 2006-04-20 00:47 pharaoh84 * trunk/xmds-devel/examples/groundstate.xmds: Modifying this example to use the new tag for output groups 2006-04-18 07:15 pharaoh84 * trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-doc/latex/languageReference.tex: Added a tag to the element for outputs. If this is set to 'double' then the output type is forced to type double. It defaults to 'complex' 2006-04-07 04:17 pharaoh84 * trunk/xmds-devel/source/xmdssequence.cc: Fixing the elapsed time for non-MPI simulations 2006-04-07 03:35 pharaoh84 * trunk/xmds-devel/source/xsil2graphics.cc: Fix spelling mistake 'Proccessing...' --> 'Processing..' 2006-03-29 00:34 athiator * trunk/xmds-devel/source/xsilfield.cc: Also prints created variables to screen when executing Mathematica instructions 2006-03-15 04:27 athiator * trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Changes to xsil2graphics to output a file with commands to read simulation data into Mathematica 2006-01-27 01:04 joehope * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fixed error in MPI reduction for deterministic systems. The problem only affected some moment groups that used post_propagation. 2005-11-23 23:44 joehope * trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/groundstate.xmds: Adding imaginary time evolution algorithm to the examples. It is often requested, demonstrates filters and moment_groups, and saves mailing it regularly. 2005-10-31 00:34 joehope * trunk/xmds-devel/source/xmdsintegraterk4ip.cc: Avoid warning for one case where it does not apply. 2005-10-27 07:01 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/MANIFEST, trunk/xmds-devel/admin/xmds.spec: Final updates before 1.5-2 release 2005-10-27 00:58 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Fixed adaptive scheduler to compile cleanly on other systems. 2005-10-26 03:46 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/README, trunk/xmds-devel/README.Windows, trunk/xmds-devel/configure.in, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Added new scheduling option for stochastic MPI calculations. It uses an adaptive scheduler to allocate batches of work to individual nodes, making for large speed increases on heterogenous systems. Bumped version numbers. 2005-10-24 22:40 joehope * trunk/xmds-devel/source/xmdssequence.cc: Fix for new timer. 2005-10-24 04:11 joehope * trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Changed timer to work better on MPI systems. 2005-10-18 23:33 joehope * trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Fix for stack overflow in binary read from file. Preliminary support for MPI Scheduling options. 2005-10-13 00:45 joehope * trunk/xmds-devel/source/xmdssequence.cc: MPI runs only print out the benchmark time from the master node. 2005-10-12 04:34 joehope * trunk/xmds-devel/source/xmdsvectorelement.cc: Fix for crashing bug when loading from file in stochastic simulations. 2005-09-29 05:35 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/source/xmdsmomentgroup.cc: Fix compile error for error-free stochastic binary output. 2005-08-12 05:46 sebwuester * trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrateark45.cc: -Bugfixes in ARK45: -current step now states last accepted step instead of current forecast -fixed problems with timescales <10^-24 -fixed problem with N_samples=N_steps -Cosmetic in ARK45 - rephrased "cutoff defaulting to" not to contain the word error 2005-07-27 06:57 joehope * trunk/xmds-devel/source/xmdsintegratesiip.cc: Fixed an error in the cross propagation routines of the SIIP algorithm. Boundary conditions that are independent of the propagation dimension are now correct. 2005-07-05 10:13 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/MANIFEST: Updating Changelog and MANIFEST prior to release 2005-07-05 09:37 joehope * trunk/xmds-devel/README, trunk/xmds-devel/README.Windows, trunk/xmds-devel/examples/highdim.xmds: Adjusting READMEs and examples for version 1.5-1x 2005-06-30 07:44 sebwuester * trunk/xmds-devel/source/xmdsintegrateark45.cc: Minor Bugfixes: Corrected typo in on-screen message and call to noise generator in the case of errorchecking 2005-05-25 03:33 paultcochrane * trunk/xmds-devel/examples/highdim.xmds: Fixed xml header. 2005-05-24 03:54 paultcochrane * trunk/xmds-devel/configure.in: Doing a check to see if the library lammpi++ exists in the mpicc -showme output, and if not adds -llammpi++ to the MPI_LIBS variable. This should only affect users of lam 7.x.x, this problem didn't occur in 6.x.x. 2005-05-19 05:46 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Outputting standard C argument stuff even when is not defined. This fixes a problem where I didn't check for all possible paths in an if loop 2005-05-19 03:50 joehope * trunk/xmds-devel/ChangeLog: Update of ChangeLog 2005-05-19 03:42 joehope * trunk/xmds-devel/source/xsilfield.cc: The m file now closes files when it is done to avoid excess file pointer usage in Matlab. 2005-05-17 06:01 sebwuester * trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc: Fixed bug in warning about RK4IP and t-dep k operators. Made ARK45 error determination routine more efficient for ODEs 2005-05-10 03:40 paultcochrane * trunk/xmds-devel/source/main.cc: Moved -o .cc to just behind the mpicc call in the mpi compilation calls. This gets around problems with mpicc not finding various libraries. In particular, when getopt was turned on for mpi problems, mpicc wasn't finding -lxmds. 2005-05-10 01:23 paultcochrane * trunk/xmds-devel/configure.in: Changed ordering of MPICCFLAGS so that XMDS_LIBS is at the end. This should stop problems with mpicc not finding the xmds libraries. 2005-05-05 09:34 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Hopefully fixed problem with mpi not being able to make use of the arugment parsing code. Added -h as a valid option; --help was only possible before. 2005-05-02 05:42 sebwuester * trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds, trunk/xmds-devel/source/xmdsintegrateark45.cc: Fixed float precision issue in ARK45 sampling and typos in examples. 2005-05-02 02:35 sebwuester * trunk/xmds-devel/examples/sech_soliton.xmds, trunk/xmds-devel/examples/sech_soliton_tdepk.xmds, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Added ARK45IP and ARK45EX adaptive timestep algorithms. Added example files sech_soliton.xmds, sech_soliton_tdepk.xmds Added parallel initialisation from file (ascii only) 2005-04-28 05:21 joehope * trunk/xmds-devel/source/loadxsil.m: Fix for loadxsil loading of 64 bit binaries 2005-04-27 05:44 joehope * trunk/xmds-devel/source/xmdsfield.cc: Andy's fix for cluster nodes testing the same filesystem simultaneously with the same files. 2005-04-24 04:31 joehope * trunk/xmds-devel/source/xsilfield.h: Final commit for previous fix. 2005-04-21 06:32 joehope * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xsilfield.cc: Added test for the size of unsigned longs in the configure script. This, like endianness, is stored in the xsil file for binary output, and then used when generating the MATLAB script. Fixes bug with moving binary data between machines. 2005-04-12 07:25 joehope * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc: Set up template for passing the adaptive boolean to the xmdsintegrate class. 2005-04-12 05:44 joehope * trunk/xmds-devel/source/xsilfield.cc: Fixed matlab error message when using binary files without the output file 2005-04-06 06:41 paultcochrane * trunk/xmds-devel/examples/lorenzInput.dat: Initial import to repository. This is the data file associated with the lorenz.xmds example. 2005-04-06 05:54 joehope * trunk/xmds-devel/examples/branch.xmds, trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/catcycle.xmds, trunk/xmds-devel/examples/chain.xmds, trunk/xmds-devel/examples/chemkin.xmds, trunk/xmds-devel/examples/duffing.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/hires.xmds, trunk/xmds-devel/examples/krebs.xmds, trunk/xmds-devel/examples/lane_emden.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/lotka_volterra.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/ring_modulator.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/thermkin.xmds, trunk/xmds-devel/examples/van_der_pol.xmds: Fixing all examples to conform with the (post 1.4-1) rule to always specify the used vectors in integrate blocks. 2005-04-06 02:22 joehope * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fix for potential problem with handling sample spaces when there are no transverse dimensions. 2005-04-06 01:43 joehope * trunk/xmds-devel/source/xmdsmomentgroup.cc: Made verbose output on the moment groups more consistent with the numbering of the groups. 2005-04-05 23:23 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/configure.in: Version bump 2005-04-05 07:23 joehope * trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrateark45.cc, trunk/xmds-devel/source/xmdsintegrateark45ex.cc, trunk/xmds-devel/source/xmdsintegrateark45ip.cc, trunk/xmds-devel/source/xmdssequence.cc: Adding in shell files for new ARK45 algorithms and bumping versions. 2005-04-05 05:32 joehope * trunk/xmds-devel/examples/diffusion.xmds: Fixed sampling in example. 2004-12-06 04:58 paultcochrane * trunk/xmds-devel/source/xsilfield.cc: Now orienting independent variable vectors for binary input to agree with that from ascii input. 2004-12-06 04:42 paultcochrane * trunk/xmds-devel/source/xsilfield.cc: Changed ordering of variables in binary input to matlab. Should work the same as ascii now. Some changes to comments. 2004-11-17 23:35 joehope * trunk/xmds-devel/source/xsilfield.cc: Fixed a bug when using MATLAB import of output moment groups of >2 dimensions in binary format. 2004-11-17 04:54 joehope * trunk/xmds-devel/source/xsilfield.cc: Adding explicit include line to avoid problem with non-standard compilers. 2004-11-02 22:51 joehope * trunk/xmds-devel/examples/atomlaser.xmds: Changing this example to demo binary output, now that it works without explosions. 2004-11-02 22:48 joehope * trunk/xmds-devel/ChangeLog: New ChangeLog for the new version 2004-11-02 22:47 joehope * trunk/xmds-devel/MANIFEST: New manifest for the new version. 2004-11-02 22:43 joehope * trunk/xmds-devel/source/xsilfield.cc: Fix for an error where an integer overflow lead to dramatic problems with bianry output. 2004-10-25 06:02 joehope * trunk/xmds-devel/configure.in, trunk/xmds-devel/source/main.cc: Bumping the release version in preparation for a new release. 2004-10-22 08:04 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Made mention that one should update the xmds version and release numbers in configure.in. Gave a more complete explanation of generating a distribution, including checking out a temporary copy of the xmds-devel repository and going through the relevant steps to be able to do a make dist. 2004-10-22 01:16 paultcochrane * trunk/xmds-devel/source/xsilfield.cc: Added some error text for when a user tries to use binary output and then load the data using scilab. Also put in some hopefully helpful information about how to use scilab and data that comes out of xmds. Basically this means just using ascii output. 2004-10-21 10:01 paultcochrane * trunk/xmds-devel/source/xsilfield.h: Correction log for previously stuffed up commit without a log. Added extra variables to implement binary data handling of xsil2graphics. 2004-10-21 10:00 paultcochrane * trunk/xmds-devel/source/xsilfield.cc: Simple commit to actually add a log for the previous commit, because I stuffed up. Major changes. Binary files are now handled by xsil2graphics. Unfortunately, only the matlab script is produced at this stage. The scilab version is to come. 2004-10-21 09:51 paultcochrane * trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: xsilfield.cc 2004-10-21 09:51 paultcochrane * trunk/xmds-devel/source/xmdsvectorelement.cc: Changed some return statements to exit statements. Basically, the program could keep going at this point as opposed to barfing which would be far more logical in the circumstances. 2004-10-21 09:50 paultcochrane * trunk/xmds-devel/source/xmdsvector.cc: Changed unsigned long to unsigned long int. I must have been in a pedantic mood. 2004-10-21 09:49 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Added xmdsOutputFileName() function. This is so that I can properly determine what the output binary data filename should be, and base that upon the name of the xsil filename as opposed to the simulation filename. 2004-10-21 09:48 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Major changes. Added more attributes to the Metalink tag of the xsil file that gets output so that can load binary data properly using xsil2graphics. Implemented a better way of constructing the output binary data filename. It is now based upon the xsilFilename rather than the simulation name (these can be different). Fixed major bug where if there is only one sample in the entire simulation (possible but not common) then data was being written over as an array was incorrectly sized. This is all happy now, and I even tested it. Yay. 2004-10-21 09:42 paultcochrane * trunk/xmds-devel/source/xmdsfilter.cc: Added a Doxygen docstring. 2004-10-21 09:41 paultcochrane * trunk/xmds-devel/source/xmdscomplex.h: Fixed problem with there being no newline at the end of the file. 2004-10-21 09:40 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Was pedantic again and changed some unsigned constants to long unsigned ints. Added the getOutputFileName() function, and its Doxygen docstring. 2004-10-21 09:39 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Removed some superfluous code in the binary loading section. Made loading of the binary data file part of the eval, as opposed to running it here. Added some strings to say that the text that follows isn't actually just informative, it is actually the code that is being executed. 2004-10-21 09:37 paultcochrane * trunk/xmds-devel/source/getopt_xmds1.c, trunk/xmds-devel/source/getopt_xmds_init.c: Added some Doxygen docstrings. 2004-10-21 09:36 paultcochrane * trunk/xmds-devel/source/getopt_xmds.c: Reformat of the C code. Documentation with Doxygen docstrings. 2004-10-21 09:34 paultcochrane * trunk/xmds-devel/configure.in: Updated version number to interim release number. 2004-10-15 07:53 joehope * trunk/xmds-devel/configure.in: Various fixes to the mpi autoconf testing. It now works with non-gcc mpi. 2004-10-11 04:06 joehope * trunk/xmds-devel/configure.in: Removed a "-Wall -pedantic" check that broke compilation when cc/mpicc were gnu/non-gnu compilers. 2004-10-06 07:52 joehope * trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Fixed a memory leak on strict compilers that didn't know that "delete(pointer)" means "delete[] pointer" for pointer arrays. 2004-10-06 07:50 joehope * trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/van_der_pol.xmds: These, and possibly others, now need elements in the integrate blocks. 2004-09-30 03:27 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Fixed binary loading support. This now works for mutli-dimensional matrices (ie greater than two dims). Probably should be tested a bit more extensively than I've tested it, but it seems to go well in the tests that I've done. The ascii loading takes ages, especially for large output data files, so I've added a message saying that it will take ages, and have added progress output to keep the user amused while they're waiting. Realistically for large files people should use binary as it loads a couple of orders of magnitude faster than ascii. I've also implemented preallocation of matrices to help the ascii loading to run more quickly. Using this script turns out to be a better option for very large files as it doesn't use up as much memory as xsil2graphics does. For some sims I've been doing recently, xsil2graphics maxes out the memory on my machine when it's trying to generate the matlab file and data file, however, loadxsil sits there quite happily and doesn't even bother making the machine page to disk. This implies that there could be a memory leak in xsil2graphics, or that something could be done a bit more carefully concerning memory useage. 2004-09-24 03:29 paultcochrane * trunk/xmds-devel/Makefile.am: Fixed typo in orgeonator name. 2004-09-15 06:01 joehope * trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc: Fix for flag in RK4 algorithms. 2004-09-15 04:46 joehope * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Added flag that turns off the noise generation in an integration or filter element. This allows deterministic elements in stochastic simulations (e.g. the noise is in the initial state only) to run faster. Activated by the flag yes, and the default is to turn off this feature. 2004-09-15 04:27 joehope * trunk/xmds-devel/ChangeLog: Updated with cvs2cl.pl 2004-08-03 05:29 paultcochrane * trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/chain.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/thermkin.xmds: Added GPL header. 2004-08-02 10:04 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Changed long to long unsigned int, which gets rid of a compiler warning, and appears only because compilers can choose which sign ints can take, hence being pedantic is the way to go. 2004-08-02 10:02 paultcochrane * trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Changed longs to long unsigned ints. Also fixed warnings that appear due to a .size() call on a list (which returns int) being given a format in a printf statement as being a long int. If this isn't quite the right thing to do then one probably needs to overload/override the .size() method to return long ints as opposed to just ints. 2004-08-02 09:59 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Changed longs to long unsigned ints. 2004-08-02 09:57 paultcochrane * trunk/xmds-devel/Makefile.am: Added new example simulations to list of files to be added when doing a make dist. 2004-08-02 08:50 paultcochrane * trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Reformatted code so it looks nicer. 2004-08-02 08:47 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Changed long to long unsigned int. This is a really pedantic change I know, but we need to be really explicit so that the code is really pedantically ansi compliant, and hopefully therefore more portable. 2004-08-02 08:45 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Changed variables declared as longs to be long unsigned ints. This gets rid of some compiler warnings, especially between compilers that define ints to be signed or unsigned on their whim. 2004-08-02 08:16 paultcochrane * trunk/xmds-devel/examples/chain.xmds: Initial import to repository. This is another chemical kinetics reaction I found lying around in my sandbox. 2004-08-02 08:10 paultcochrane * trunk/xmds-devel/examples/brusselator.xmds, trunk/xmds-devel/examples/oregonator.xmds, trunk/xmds-devel/examples/thermkin.xmds: Initial import to repository. These are some more example simulations of chemical kinetics type reactions. 2004-08-02 08:04 paultcochrane * trunk/xmds-devel/benchmark/ndparamp_100.xmds, trunk/xmds-devel/benchmark/ndparamp_200.xmds, trunk/xmds-devel/benchmark/ndparamp_50.xmds, trunk/xmds-devel/benchmark/ndparamp_500.xmds, trunk/xmds-devel/benchmark/nlse_100.xmds, trunk/xmds-devel/benchmark/nlse_1000.xmds, trunk/xmds-devel/benchmark/nlse_10000.xmds, trunk/xmds-devel/benchmark/nlse_500.xmds, trunk/xmds-devel/benchmark/nlse_5000.xmds: Removed the binary_output tag as it is now obsolete. 2004-08-02 08:02 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Stopped storing all of the description text; we weren't using it anyway. There is now a message added to say that the description has been found, and to look in the xmds file for more info. The reason for this change is because if the description is too big, then this causes a buffer overflow and all kinds of wierd things can happen. I have commented out the original code that read the description in. 2004-07-30 07:43 joehope * trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsvector.cc: Allowed integrate moment groups to deal with mixed spaces and MPI transposed spaces properly. 2004-07-30 06:56 joehope * trunk/xmds-devel/source/xmdsfield.cc: Fixed the close_loops function which used to be simply wrong for mixed spaces. 2004-07-30 06:02 joehope * trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsvector.cc: Fixed a bug where some mixed spaces were incorrectly recognised as being in the transposed order for deterministic MPI solutions. 2004-07-29 08:28 joehope * trunk/xmds-devel/examples/highdim.xmds: Added example syntax for the new elements in the evolution. 2004-07-29 08:27 joehope * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Added the option of putting elements as well as elements in blocks. elements let you define moments that are integrated through any number of transverse dimensions, so XMDS can now evolve equations that depend on integrals of the fields. Also added and elements to elements. You can put as many as you like, of any dimension, in any order. The element defines the position of the or code, so it is now mandatory. Sample syntax will be added to an example. 2004-07-27 07:33 paultcochrane * trunk/xmds-devel/source/xmlparser.cc: Cast a variable as unsigned. This stopped a warning message turning up in the compiler output due to an integer which should have been cast as unsigned. 2004-07-27 07:31 paultcochrane * trunk/xmds-devel/source/xmdsvectorelement.cc: Fixed error whereby an extra comma was added to a fprintf statement, and hence caused incorrect output when generating the code for reading in an input file. 2004-07-27 06:45 paultcochrane * trunk/xmds-devel/source/getopt_xmds_init.c: Replaced C++ comments with C-style comments. This stops some compilers complaining. 2004-07-23 07:27 joehope * trunk/xmds-devel/source/xmdsfield.cc: Fixes problem when multiple FFTW plans were created using wisdom. The variables used for the wisdom manipulation are all now local variables, so there are no more multiple definitions. 2004-07-21 05:45 joehope * trunk/xmds-devel/source/xmdsoutput.cc: Added the command line variables to the element in the output tag. This will make the xsil file completely self documenting. 2004-07-19 03:59 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Found a command to put on its own line that I'd missed. 2004-07-19 03:57 paultcochrane * trunk/xmds-devel/MANIFEST: Updated manifest to xmds-1.3-5. 2004-07-19 03:56 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Put all of the commands to run on their own line. 2004-07-19 03:53 paultcochrane * trunk/xmds-devel/ChangeLog: Updated with cvs2cl.pl 2004-07-19 03:52 paultcochrane * trunk/xmds-devel/README, trunk/xmds-devel/README.Windows: Changed xmds-1.3-4 to xmds 1.3-5. 2004-07-19 03:43 paultcochrane * trunk/xmds-devel/ChangeLog: Updated with cvs2cl.pl 2004-07-19 03:42 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Now detecting when there are more than two independent variables when loading binary data and output an error saying that one should use ascii data and xsil2graphics to get around the problem. The file still works for less than two independent variables (or less) with binary data and for any number of variables with ascii data (but one might as well just use xsil2graphics in that case). 2004-07-19 03:40 paultcochrane * trunk/xmds-devel/source/getopt_xmds.h: Fixed warnings that were produced as a result of having C++ comments within a C file (and when using -pedantic and -ansi). Having C++ style comments isn't a problem with modern compilers, however it's nice for users to not have warnings come up when xmds compiles. 2004-07-16 04:02 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Removed precision=single bit from output tag. 2004-07-16 03:46 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Added more detailed info about how to perform a release of the xmds documentation. Put the tagging commands earlier in the list of things to do before making a release, and mentioned the format of the tag to use. Also added the actual commands to use. 2004-07-16 03:25 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Changed the order of when the Readmes are updated and when the ChangeLog is updated. Added a line explaining how one should check to see if the cvs and/or the local repository needs updating before running a make dist. 2004-07-16 03:20 paultcochrane * trunk/xmds-devel/ChangeLog: Updated to current output of cvs2cl.pl. 2004-07-16 03:19 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: We're now automatically generating the ChangeLog with cvs2cl.pl, so have changed what to do as far as that is concerned. 2004-07-16 03:16 paultcochrane * trunk/xmds-devel/ChangeLog: Updated to current output of cvs2cl.pl. 2004-07-16 03:12 paultcochrane * trunk/xmds-devel/README.Windows: Made mention of the fact that fftw must be installed after cygwin is installed. Also added a description of the steps required to build and install fftw. Fixed up the step numbering as necessary. Added --with-fftw-path=/usr/local to the configure option to the xmds build procedure, as this *should* be where fftw is installed, assuming that the user followed the instructions higher up in the file. Removed some comments reminding me to do stuff. 2004-07-16 01:27 paultcochrane * trunk/xmds-devel/admin/cvs2cl.pl: Initial import to repository. This is the cvs to ChangeLog script that generates the ChangeLog. 2004-07-15 07:27 joehope * trunk/xmds-devel/source/xmdsoutput.cc: Moved tags down above the data to make the XSIL file valid XML. This fixed a parsing error from xsil2graphics. 2004-07-14 11:48 paultcochrane * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsoutput.cc: Finally got grabbing and splitting up and escaping quote issues in the script code grabbing code. This is quite a big change, and means that xmds produced scripts now compile ok on linux and the APAC sc. I haven't tested anything else, but it's 10pm, and I've finally fixed the damned thing, and I'm going home (yay). 2004-07-14 06:37 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/hires.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/ring_modulator.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds, trunk/xmds-devel/source/main.cc: Changed the examples and template to ascii output until binary output is robust. 2004-07-14 04:27 joehope * trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Fixed bug where nested subsequences could count moment samples incorrectly. The field moment samples were being counted at the start of each sequence rather than at the start of the simulation. 2004-07-14 01:32 joehope * trunk/xmds-devel/source/xmdsmomentgroup.cc: Verbose mode now mentions the addition of samples to the moment groups. 2004-07-13 08:46 paultcochrane * trunk/xmds-devel/source/xmdsargelement.cc: Removed a trigraph. Added a test to see if a short option was actually found, and if no short option could be worked out, then xmds barfs with a reasonably helpful error message. Also fixed a typo in one of the comments. 2004-07-13 07:52 paultcochrane * trunk/xmds-devel/configure.in: Added the threads checking stuff back in. However, to enable this option, one needs to use --enable-threads at the configuration step. I put this back in so that if someone does want to use threads, then at least the checking and configuration is built in. The code that was originally there is now wrapped in an if loop, and is only executed if --enable-threads is set. 2004-07-13 07:25 paultcochrane * trunk/xmds-devel/configure.in: added -pedantic flag to CFLAGS and CXXFLAGS variables for building of xmds and the -ansi flag to the CXXFLAGS variable. 2004-07-13 07:24 paultcochrane * trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmlbasics.h: Removed fake trigraphs (obsolecent feature of C) that were in the comments. 2004-07-13 06:16 paultcochrane * trunk/xmds-devel/source/xmdsutils.h: Fixed problem with trailing comma in enumeration. This was found by using the -pedantic flag to gcc. 2004-07-13 05:29 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc: Added braces to if, while and for statements. They weren't necessary, however, it does make the code a bit nicer, in terms of style, it might save a few bugs in the future, and it really should be used when the if, while or for has nested if, while or for statements. I hope this reduces someone's pain in the future. 2004-07-09 06:47 joehope * trunk/xmds-devel/source/xmdsfield.cc: cstr() should be c_str() 2004-07-09 06:35 joehope * trunk/xmds-devel/source/xmdsfield.cc: Attempt to stop a very rare crash when a deterministic MPI script is written without any Fourier space elements anywhere. Forces plans to always be written. This could be done with slightly greater finesse by testing for the existence of "main_forward_plan" and setting the appropriate variables manually if it doesn't exist. 2004-07-09 05:29 joehope * trunk/xmds-devel/source/xmdsvectorelement.cc: Forcing abort when input file is misread. 2004-07-01 05:26 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc: Added braces to if, while and for statements. They weren't necessary, however, it does make the code a bit nicer, in terms of style, it might save a few bugs in the future, and it really should be used when the if, while or for has nested if, while or for statements. This exercise fixed two possible bugs where there was a trailing semicolon on the statement. I hope this reduces someone's pain in the future. 2004-06-30 10:23 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Commented out some legacy code that's not doing anything anymore. I'm keeping it around for a while before I delete it (doesn't hurt). 2004-06-30 10:22 paultcochrane * trunk/xmds-devel/source/main.cc: Updated the documentation version numbering output from xmds-1.3-4 to xmds-1.3-5. 2004-06-30 10:20 paultcochrane * trunk/xmds-devel/source/getopt_xmds_init.c: Added a dummy statement to avoid a warning that some compilers throw up when the ifdef isn't executed, and hence there aren't any executable statements in the file. Also added some comments explaining this. 2004-06-30 10:18 paultcochrane * trunk/xmds-devel/configure.in: Changed the release number from 4 to 5. Added a check for the Tru64 compiler and then set the __USE_STD_IOSTREAM appropriately if it is. Added a check for if mpicc is *not* set, but mpi is enabled and then if so, setting MPICC to the system C++ compiler. Fixed bug whereby LIBS variable should have been XMDS_LIBS, and CFLAGS should have been XMDS_CFLAGS. Hopefully this stuff gets xmds configuring and compiling better on Tru64 machines. 2004-06-30 10:15 paultcochrane * trunk/xmds-devel/README.Windows: Added some more helpful comments about how to use the configure script, where to look for more information, and how to solve the common fftw path problem. 2004-06-30 10:14 paultcochrane * trunk/xmds-devel/README: Tidied up the formatting of the text somewhat. Hopefully made a bit clearer that the switches are directly to do with the configure command. 2004-06-30 07:26 paultcochrane * trunk/xmds-devel/man, trunk/xmds-devel/man/loadxsil.1, trunk/xmds-devel/man/xmds.1, trunk/xmds-devel/man/xsil2graphics.1: Initial import to repository. These are the automatically generated man pages from the pod in the xmds-doc project. 2004-06-30 07:20 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Removed some whitespace. 2004-06-30 07:19 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Implemented breakup of simulation text into header, body and footer. I reconstruct this text here. A lot of the changes in this commit are commenting out lines of code in the generated code (ie the stuff that is generated isn't actually executed and is in fact ignored by the compiler). I left the code in at this stage as this is still an experimental process and it will be easier to back out the changes by leaving the legacy stuff in there. This change has removed the need for xmds simulations to use the system() call and the split system command to be able to write the output. I also put some info text into the output xml/xsil which tells which version of xmds produced the file. 2004-06-30 07:15 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fixed error whereby the Metalink xml tag should have had a /> at the end instead of just >. 2004-06-30 07:14 paultcochrane * trunk/xmds-devel/source/main.cc: Implemented the splitting up of the xmds simulation text before the parsing starts. I split the text into a header, body and footer, and then recombine these later when getting the simulation to write the xsil file. This removes the need to use the split system command, and removes some more of the system() calls in the xmds engine. Added heaps of comments of how I'm going about stuff, and added some verbose output to make sure it's doing what it should be doing. At present I'm implementing this as global variables; perhaps this really should be done through and object interface, however, this is easy and it works, we just have to be careful. Also updated the documentation version number to xmds-1.3-4. 2004-06-29 07:21 joehope * trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Fix for problem in if statements. 2004-06-29 07:13 joehope * trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Allows number of samples in an integrate block to be zero without trouble. 2004-06-26 05:29 paultcochrane * trunk/xmds-devel/source/main.cc: Grabbing the simulation text for splitting up the xmds script for later use at the output stage. 2004-06-25 05:28 joehope * trunk/xmds-devel/configure.in, trunk/xmds-devel/examples/atomlaser.xmds: Removed redundant code to do with choosing thread-compliant compilers for the code generator. 2004-06-24 08:12 joehope * trunk/xmds-devel/source/getopt_xmds.c, trunk/xmds-devel/source/getopt_xmds.h, trunk/xmds-devel/source/getopt_xmds1.c, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xsil2graphics.cc: Changing names of extern variables in getopt functions. Removes further conflicts. 2004-06-24 07:19 joehope * trunk/xmds-devel/source/xmdscomplex.h: Forcing the operator overloads to be C++. This was not automatic for all compilers. 2004-06-24 06:42 joehope * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/MANIFEST, trunk/xmds-devel/admin/xmds.spec, trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/getopt_xmds.c, trunk/xmds-devel/source/getopt_xmds.h, trunk/xmds-devel/source/getopt_xmds1.c, trunk/xmds-devel/source/getopt_xmds_init.c, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xsil2graphics.cc: Adjusted getopt to getopt_xmds to remove conflicts with predefined functions in the standard libraries of some systems 2004-06-23 08:21 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Removed newsgroup posting instruction, because this is not a good thing to do, and I got a bit stung from doing it this time. 2004-06-22 10:44 paultcochrane * trunk/xmds-devel/Makefile.am: Added new examples to be added at make dist time. 2004-06-22 10:18 paultcochrane * trunk/xmds-devel/examples/duffing.xmds: Intitial import to repository. This is an example simulation of Duffing's equations. 2004-06-22 10:18 paultcochrane * trunk/xmds-devel/examples/krebs.xmds: Initial import to repository. This is an example simulation of a simplified Krebs cycle of biochemical reations. 2004-06-22 10:17 paultcochrane * trunk/xmds-devel/examples/chemkin.xmds: Initial import to repository. This is an example simulation of a chemical kinetic reation in chemistry. 2004-06-22 10:16 paultcochrane * trunk/xmds-devel/examples/catcycle.xmds: Initial import to repository. This is an example simulation of a catalytical cycle reation in chemistry. 2004-06-22 10:16 paultcochrane * trunk/xmds-devel/examples/branch.xmds: Initial import to repository. This is an example simulation of a branching reaction in chemistry. 2004-06-21 09:28 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Still trying to get the .spec file to work. Tried changing the prefix sent to configure. I think I need to rework the configuration step of xmds to iron out these wrinkles. 2004-06-20 23:48 paultcochrane * trunk/xmds-devel/admin/xmdsNewsPost.pl: Removed sci.math.research as this is a moderated group, and posting xmds announcements isn't appropriate. 2004-06-18 06:51 paultcochrane * trunk/xmds-devel/admin/xmds.spec: Initial import to repository. This is the rpm .spec file that Greg Collecutt used to use to build xmds. I'm now trying to hack it to build the current version(s). 2004-06-18 06:28 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Added comment that the source files should be tagged appropriately. That xmds.org needs updating. That an email to xmds-announce is a good idea. And that sending a post to the relevant newsgroups, by using the xmdsNewsPost.pl script would be a (possibly) good idea. 2004-06-18 06:25 paultcochrane * trunk/xmds-devel/admin/xmdsNewsPost.pl: Fixed a bug whereby the subject and newsgroup kept getting prepended to the message text, so eventually everyone in the last newsgroup to be posted to, could tell where else I'd posted the message. Not happy that this happened. Really not happy. 2004-06-18 06:09 paultcochrane * trunk/xmds-devel/admin/xmdsNewsPost.txt: Initial import to repository. This file is the news post sent as a result of running the xmdsNewsPost.pl script. This file needs to be updated whenever a new xmds version is released, and posted appropriately. 2004-06-18 06:08 paultcochrane * trunk/xmds-devel/admin/xmdsNewsPost.pl: Initial import to repository. This is a perl script to automatically post the xmds release announcement to a list of possibly interested newsgroups. 2004-06-18 01:58 paultcochrane * trunk/xmds-devel/admin/xmdsReleaseProcedure.pod: Initial import to repository. This is the procedure one should perform to properly release xmds onto the sourceforge site (and the world in general). 2004-06-18 01:31 paultcochrane * trunk/xmds-devel/README.Windows: Converted from dos format to unix format. Updated to xmds-1.3-4, and to new syntax for xsil2graphics. 2004-06-18 01:26 paultcochrane * trunk/xmds-devel/README: Updated to current version of xmds (1.3-4). Added a comment on how to access the man pages that are now installed as part of xmds. Updated the xsil2graphics syntax in the example given. Expanded the description of what xmds is at the top of the file. 2004-06-17 07:18 paultcochrane * trunk/xmds-devel/ChangeLog: Updated changelog to current version of xmds, highlighting the current set of major changes to the code base. 2004-06-17 06:00 paultcochrane * trunk/xmds-devel/MANIFEST: Updated to current version of xmds (1.3-4). 2004-06-17 05:45 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Added a mention of the xmds web site in the usage output. Also tidied some of the text in the display_usage function. 2004-06-16 03:49 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Changed display usage to use less printf calls. Also makes the code look better 2004-06-16 02:04 paultcochrane * trunk/xmds-devel/source/main.cc: Changed an exit statement to a return 0 to be more consistent with the other returning conventions. Don't know if the current convention is that great as it reports that everything went ok, as opposed to if something went wrong. Again, this is something to chuck into the todo list. 2004-06-16 02:02 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: converted xsil2graphics argument parsing to the gnu getopt form. It therefore changes the old style arguments of -matlab and -scilab to --matlab and --scilab respectively. Also, it requires -o or --outfile if one wants to specify and alternative output filename, so one can't do xsil2graphics blah.xsil moo.m anymore, it must be xsil2graphics blah.xsil --output moo.m. Also added some more helpful output information. 2004-06-15 12:22 paultcochrane * trunk/xmds-devel/source/main.cc: Converted the command line argument parsing code to use the getopt library. Now we have long and short options and a mix if we so desire. Also changed some of the formatting of the template code, and changed the display_usage() output so that it is a bit more accurate, informative and a little better looking. One big thing to note here is the change of the compilation flag, this is now either -n or --nocompile, note that previously this was -c, although I don't think that many people actually used it. 2004-06-15 12:19 paultcochrane * trunk/xmds-devel/configure.in: Added -lxmds and -L. to the LIBS variable, so that xmds gets built with libxmds and so it can see the getopt libraries within libxmds. 2004-06-15 09:18 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Tidied up a problem I found with the xsil output when using binary. I'd just changed the output filename of binary files for more consistent naming wrt moment group output, and hadn't set the correct filename in the .xsil output. 2004-06-15 09:08 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Made the output moment group number for binary output data files agree with what the moment group number actually is. 2004-06-15 09:06 paultcochrane * trunk/xmds-devel/source/Makefile.am: Added a target for loadxsil.m to be automatically installed at make install time for xmds. It goes in the bindir at this stage, so will get installed in the user's bin directory (if --with-users is set) or in the /usr/local/bin directory if root is doing the installing. 2004-06-15 09:05 paultcochrane * trunk/xmds-devel/Makefile.am: Moved position of loadxsil.m entry. The only reason I did this was so that I could comment it out when testing some code. 2004-06-15 06:46 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Fixed bug with incorrect parsing of noises tag. I'd used a suite of if statements instead of an if-else if-else loop construction. Added some debugging code as well, for when xmds -d is used. 2004-06-15 01:30 paultcochrane * trunk/xmds-devel/examples/diffusion.xmds: Made the lattice size of the transverse dimension a multiple of two so that the numerics are faster 2004-06-15 01:29 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds: Removed text about deprecated feature of binary_output and use_double tags. This is actually now an obsolete syntax 2004-06-15 01:16 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Tidied up the text that is printed to screen. Some of output enclosed in an if loop controlled by the new debug variable. More informative output as to whether data is single or double precision. 2004-06-14 10:22 paultcochrane * trunk/xmds-devel/configure.in: Added mandir assignments so that the man pages are installed in the correct locations depending upon whether the defaults are given, a prefix, or xmds is being user installed 2004-06-14 10:21 paultcochrane * trunk/xmds-devel/Makefile.am: Added fisher_reaction_diffusion.xmds to list of examples to distribute. Added a manfiles variable with the man pages to be installed. Added the manfiles variable to the EXTRA_DIST variable so that the files are added to the distro and installed with make install 2004-06-14 10:07 paultcochrane * trunk/xmds-devel/examples/fisher_reaction_diffusion.xmds: Initial import to repository. This is an example simulation of the Fisher reaction diffusion equation for use in theoretical population genetics. 2004-06-14 06:41 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Added code to print an audible bell character at the end of a simulation if the tag is set to yes. This is a tag to optionally add a noise letting the user know when the simulation is complete. 2004-06-14 06:40 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added boolean variable holding value of whether or not the tag is set to yes or no. This is a tag to optionally add a noise letting the user know when the simulation is complete. 2004-06-14 06:39 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added parsing code for the tag. This is a tag to optionally add a noise letting the user know when the simulation is complete. 2004-06-14 06:37 paultcochrane * trunk/xmds-devel/MANIFEST: Updated to current list of files in xmds-1.3-3 release 2004-06-14 06:37 paultcochrane * trunk/xmds-devel/configure.in: Updated release number to current (pre) release number of 1.3-4 2004-06-14 06:36 paultcochrane * trunk/xmds-devel/Makefile.am: Added hires, lane_emden, paraxial_wave, ring_modulator and van_der_pol examples to list of examples to add to distribution. Removed dependence of latexdocs and apifiles for EXTRA_DIST variable since they are in separate parts of the overall xmds project now 2004-06-14 06:32 paultcochrane * trunk/xmds-devel/examples/hires.xmds: Initial import to repository. This is the high irradiance response in photomorphogenesis example simulation. 2004-06-14 05:57 paultcochrane * trunk/xmds-devel/examples/ring_modulator.xmds: Initial import to repository. This is an example simulation of the ring modulator circuit of electronics. 2004-06-12 09:42 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Added a comment so that users know when output is being generated. This can be handy to know when large files are being output, so that one can wait and not think that the process has hung. 2004-06-12 09:41 paultcochrane * trunk/xmds-devel/source/main.cc: Fixed error whereby the CC variable was used as the C compiler that xmds uses, whereas should have been XMDS_CC. The MPICC variable being printf-ed separately caused a warning message to come up in compilation of xmds. I moved this into one of the other statements so that when MPICC was a null variable, no warning is printed. 2004-06-05 05:40 paultcochrane * trunk/xmds-devel/examples/paraxial_wave.xmds: Fixed up some of the numbers and the equations defining the slits etc. 2004-06-04 03:35 paultcochrane * trunk/xmds-devel/examples/paraxial_wave.xmds: Fixed minor bug. I had a superfluous y variable floating around. 2004-06-04 03:33 paultcochrane * trunk/xmds-devel/examples/paraxial_wave.xmds: Initial import to repository. This is an example simulation of the paraxial wave equation for double slit interference. 2004-05-31 06:01 paultcochrane * trunk/xmds-devel/ChangeLog: Updated to current version of xmds; namely 1.3-3. Described new features in this version. 2004-05-31 04:08 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Fixed problem with loadxsil associated with change made a few versions of xmds ago to deprecate the use of and which are now implemented as attributes of the tag. 2004-05-31 03:26 paultcochrane * trunk/xmds-devel/examples/van_der_pol.xmds: Initial import to repository. This is an example simulation of the Van der Pol oscillator. 2004-05-31 03:15 paultcochrane * trunk/xmds-devel/examples/lane_emden.xmds: Initial import to repository. This is an example simulation of the Lane-Emden equation in astrophysics. 2004-05-19 10:07 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Now barfing when xmds finds the binary_output and/or use_double tags and prints a message telling the user how to fix the problem (basically to use the new/right syntax). Thanks to Joe Hope for the idea. 2004-05-18 10:25 paultcochrane * trunk/xmds-devel/source/xmdsutils.cc: Implemented throwing an exception when the poissonian attribute is given but no mean attribute given. Also noticed that the implementation of getAttributeStrings is suboptimal in that it borrows far too much from getAssignmentStrings and doesn't actually check everything properly. This needs to be tidied. The code works atm, but it is ugly and needs to be improved. This issue has been added to the todo list for output into doxygen 2004-05-18 10:22 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Implemented a Poissonian noise distribution based on that in chapter 7 of Numerical Recipes. The output looks good at this stage, but more testing is necessary. Added the correct prototype declarations for each of the noise options as well, and made sure that when the poissonian noise is called, that the mean attribute is also specified. 2004-05-18 10:19 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added a declaration for the mean of a poissonian noise distribution 2004-05-18 10:18 paultcochrane * trunk/xmds-devel/examples/kubo.xmds: Switched off mpi, and implemented the kind attribute of the noises tag. 2004-05-18 10:02 paultcochrane * trunk/xmds-devel/configure.in: Updated the version and release numbers to their current values (1.3-3). 2004-05-18 07:46 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Implemented parsing code for having a kind attribute to the noises tag. This at present accepts gaussian, poissonian (not yet implemented), gaussFast (a slightly faster version of the gaussian generation routines) and uniform. Gaussian, gaussFast and uniform have been implemented and tested and seem to go alright. Tests show between 7 and 20 percent increase in speed if gaussFast is used. 2004-05-18 07:42 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added declaration for the XMLString holding the variable that defines the kind of noise to generate 2004-05-12 06:18 paultcochrane * trunk/xmds-devel/MANIFEST: Updated manifest to current release version (1.3-2). 2004-05-12 06:16 paultcochrane * trunk/xmds-devel/NEWS: Updated to current version of xmds, ready for release 2004-05-12 06:11 paultcochrane * trunk/xmds-devel/ChangeLog: Trivial change 2004-05-12 06:08 paultcochrane * trunk/xmds-devel/ChangeLog: Added changes to xmds since last release 2004-05-12 05:31 paultcochrane * trunk/xmds-devel/Makefile.am: Made an explicit list of the example xmds files to include in the distribution. Previously all of my test xmds scripts were added, and that just didn't look good 2004-04-29 03:23 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: More completely documented the code using doxygen. Still lots of stuff that needs doing, some stuff isn't documented at all, just marked as Undocumented and a todo command left also signifying that this needs work. Most of the functions and variables, however, have at least a brief description of what they are (or what they look like the could be, as it is quite often *not* obvious as to what a function or variable does or means. 2004-04-29 03:19 paultcochrane * trunk/xmds-devel/source/main.cc: Documented the code using doxygen. Fixed up some of the spacing in the template output code. 2004-04-28 05:31 paultcochrane * trunk/xmds-devel/source/main.cc: Moved the comment regarding global system parameters and system functionality (for generation of a template code) to just below the name and description elements 2004-04-28 05:12 paultcochrane * trunk/xmds-devel/examples/lotka_volterra.xmds: Initial import to repository. This is an example simulation of the Lotka-Volterra system used as a model of undamped oscillations in autocatalytic chemical reactions. From initial reading of (mathematical chemistry) paper to completed xmds script was about 10 minutes! Wow. Ok, now I'm impressed. 2004-04-28 01:04 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds: Fixed up author and description tags so that is a bit more uniform over all of the examples 2004-04-28 00:58 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds: Added CVS Id tag. 2004-04-28 00:56 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds: Added copyright statement to example files 2004-04-28 00:43 paultcochrane * trunk/xmds-devel/configure.in: Added copyright statement. 2004-04-28 00:29 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Updated copyright statement to current year 2004-04-28 00:01 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Fixed format of procTime output. Moved masterData assignment into file test if loop. Removed use warnings pragma as not supported in older versions of perl, and the warnings aren't really needed atm. Also added a variable for the progInfoFname. 2004-04-27 23:56 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc: Added an @file command so that doxygen finds and documents the stuff in the file 2004-04-27 23:55 paultcochrane * trunk/xmds-devel/source/Doxyfile: Changed some of the functionality of the Doxyfile. Added more explicit warnings and more in-depth documentation of the code (including private bits, which I don't know if that's a good idea or not). 2004-04-20 03:51 paultcochrane * trunk/xmds-devel/source/main.cc: Added some nice intro text so that one knows that one has just executed xmds, and that a template is being output and what the filename is. 2004-04-20 03:44 paultcochrane * trunk/xmds-devel/source/main.cc: Implemented the use of a template output option of xmds. One merely has to use the -t flag at the command line for a template xmds script to be output to stdout. If a filename is given, then the script is sent to that file, and xmds returns. This is to help those who want to write a script basically from scratch, but don't want to have to remember where everything goes and the exact set of tags that are necessary. The template is currently the one in the tutTemplateStart.tex file of the latex documentation, and has more tags than necessary to make a simulation. 2004-04-19 09:22 paultcochrane * trunk/xmds-devel/configure.in: Updated version and release numbers 2004-04-19 09:14 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssequence.cc: I finally got sick of seeing 042's everywhere, and replaced them with double quotes. It does make things easier to read. 2004-04-19 08:59 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Stuff it, I might as well chuck in an info footer as well as a header, it doesn't increase the file size that much. So, I did. 2004-04-19 08:51 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Moved nice version information stuff that is to be put into the .xsil file here as opposed to in xmdsmomentgroup.cc. This way it's only mentioned the once, as opposed to each time a moment group is written out to file. Also moved where the tag is written, and added some comments (my God! comments!) to the code. 2004-04-19 08:48 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Moved nice version information stuff into a better location (namely xmdsoutput.cc) 2004-04-19 08:40 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added the version and release numbers to the list of simulation parameters. Can now pass these bits of info around so that can generate xmds version information at parsing and compiling, and in the output .xsil file. 2004-04-19 08:37 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Added an information section using tags in the moment group output. This is so that it is documented which version of xmds generated the output .xsil file, and so that xmds and its web page get another plug. 2004-04-19 08:32 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added the version and release numbers to the list of simulation parameters so that can use these values in the output at the start of parsing and compiling a simulation, and at the end in the output of the simulations. 2004-04-19 08:31 paultcochrane * trunk/xmds-devel/source/main.cc: Printing out some info about xmds at the start of parsing and compiling a simulation. Also tidied some of the output when parsing and compiling a simulation. 2004-04-19 08:28 paultcochrane * trunk/xmds-devel/depcomp, trunk/xmds-devel/ltmain.sh: Updated. 2004-04-06 11:10 paultcochrane * trunk/xmds-devel/benchmark/gaugeatomlaser_128.xmds: Initial import to repository. This is now the correct file to use instead of gaugeatomlaser.xmds, as the benchmarking code is now much more general. 2004-04-06 11:09 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: I think I've got it all working now. The masterData variable is being updated properly, and output to file properly, and then reread properly, so all good there. Tested on G3, AMD, and P4. Have now changed the test bench subroutine to bench_test and the bench2 subroutine is now bench, so have to do a proper run now... 2004-04-06 10:45 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: The last message was a stuff up, however, this one is ok. Now printing all cpus listed in masterData hash 2004-04-06 10:42 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Added cpu information to master data hash table 2004-04-06 10:40 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Added cpu information to master data hash table 2004-04-06 10:29 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Implemented output of html of benchmark data. Implemented dumping of data using Data::Dumper, and reading the data back in (hopefully). Implemented html output of the verbose cpu information, which is linked to the main benchmarks html file. 2004-04-06 08:26 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Added some comments and removed some superfluous code. 2004-04-06 08:20 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Added the code of bench as a subroutine to runbenchmarks. Also added a testing subroutine so that I don't have to wait for all of the sims to finish before I can make sure that the code works. Implemented the use of the bench subroutine and collection of the average time into the benchData hash. 2004-04-06 07:51 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Added a check for linux, if so, then cpuinfo is obtained (which is slightly different for LinuxPPC and for LinuxX86) and then a shorter version of this information is kept. If not linux, then the system info is determined by using the Config module of Perl and the info that configured Perl on that system. 2004-04-06 06:58 paultcochrane * trunk/xmds-devel/benchmark/bench: Implemented shorter version of previous code using timeit instead of the Benchmark objects 2004-04-06 06:53 paultcochrane * trunk/xmds-devel/benchmark/runbenchmarks: Initial import to repository. This is the wrapper script that runs the bench script on all of the various xmds scripts. 2004-04-06 06:52 paultcochrane * trunk/xmds-devel/benchmark/nlse_100.xmds, trunk/xmds-devel/benchmark/nlse_1000.xmds, trunk/xmds-devel/benchmark/nlse_10000.xmds, trunk/xmds-devel/benchmark/nlse_500.xmds, trunk/xmds-devel/benchmark/nlse_5000.xmds: Initial import to repository. This is the nonlinear Schroedinger equation simulation for various lattice sizes. 2004-04-06 06:51 paultcochrane * trunk/xmds-devel/benchmark/ndparamp_100.xmds, trunk/xmds-devel/benchmark/ndparamp_200.xmds, trunk/xmds-devel/benchmark/ndparamp_50.xmds, trunk/xmds-devel/benchmark/ndparamp_500.xmds: Initial import to repository. This is the N-dimensional parametric oscillator simulation for various lattice sizes. 2004-04-06 06:50 paultcochrane * trunk/xmds-devel/benchmark/gaugeatomlaser.xmds: Initial import to repository. This is the gaugeatomlaser simulation which is used to really test how hard the cpu can go (sims take about three hours on new 64 bit AMD machines). 2004-04-06 06:49 paultcochrane * trunk/xmds-devel/benchmark/fullpos3D_16.xmds, trunk/xmds-devel/benchmark/fullpos3D_32.xmds, trunk/xmds-devel/benchmark/fullpos3D_64.xmds: Initial import to repository. This is the fullpos3D simulation for various lattice sizes. 2004-04-06 06:45 paultcochrane * trunk/xmds-devel/benchmark, trunk/xmds-devel/benchmark/bench: Initial import to repository. This is the basic script that compiles, runs a first go of a simulation and then runs the simulation a few times (at present three) giving an output of the average time for the simulation. 2004-03-08 10:14 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added a check for the author and description tags. If they aren't found, then a warning is issued to the effect that adding such a tag would be a good idea. This is just to get users to document their code better. We might have to back this out someday... 2004-03-08 10:12 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added authorName and description to the list of simulation parameters. Not exactly necessary, since they are likely never to be used in a simulation as such, but they do help document the simulation source code better. Whether or not actually storing them in xmds is a good question... 2004-03-05 05:06 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Added copyright statement. 2004-03-05 05:05 paultcochrane * trunk/xmds-devel/source/Doxyfile: Updated file to current version of Doxygen (some stuff was obsolete etc). 2004-03-05 05:04 paultcochrane * trunk/xmds-devel/source/xsilfield.cc: Fixed bug whereby the output from xsil2graphics didn't include the correct variable name when calling fscanfMat in the generated scilab script file. 2004-01-30 04:31 paultcochrane * trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds: Fixed spelling error. 2004-01-30 04:21 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Fixed bug whereby attributes were parsed incorrectly. 2004-01-30 03:48 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Now reports errors in parsing element correctly. 2004-01-30 02:10 paultcochrane * trunk/xmds-devel/testsuite/fibre.xmds, trunk/xmds-devel/testsuite/fullpos3D.xmds, trunk/xmds-devel/testsuite/gaugeatomlaser.xmds, trunk/xmds-devel/testsuite/ndparamp.xmds, trunk/xmds-devel/testsuite/nlse.xmds, trunk/xmds-devel/testsuite/soliton.xmds: Fixed problems concerning gcc 3.x needing floats inside such functions as log and sqrt instead of ints. Just a problem of adding .0 ad the end of what was previously an integer. 2004-01-30 02:04 paultcochrane * trunk/xmds-devel/testsuite/atomlaser.xmds, trunk/xmds-devel/testsuite/fibre.xmds, trunk/xmds-devel/testsuite/fullpos3D.xmds, trunk/xmds-devel/testsuite/gaugeatomlaser.xmds, trunk/xmds-devel/testsuite/kubo.xmds, trunk/xmds-devel/testsuite/ndparamp.xmds, trunk/xmds-devel/testsuite/nlse.xmds, trunk/xmds-devel/testsuite/sine.xmds, trunk/xmds-devel/testsuite/soliton.xmds, trunk/xmds-devel/testsuite/tla.xmds: Fixed up formatting of files using HTML tidy. Command used: tidy -im -xml .xmds Then some hand-tidying of the files. 2004-01-30 01:38 paultcochrane * trunk/xmds-devel/AUTHORS, trunk/xmds-devel/INSTALL, trunk/xmds-devel/Makefile.am, trunk/xmds-devel/NEWS, trunk/xmds-devel/README, trunk/xmds-devel/README.Windows, trunk/xmds-devel/acinclude.m4, trunk/xmds-devel/configure.in, trunk/xmds-devel/testsuite/atomlaser.xmds, trunk/xmds-devel/testsuite/fibre.xmds, trunk/xmds-devel/testsuite/fullpos3D.xmds, trunk/xmds-devel/testsuite/gaugeatomlaser.xmds, trunk/xmds-devel/testsuite/kubo.xmds, trunk/xmds-devel/testsuite/ndparamp.xmds, trunk/xmds-devel/testsuite/nlse.xmds, trunk/xmds-devel/testsuite/sine.xmds, trunk/xmds-devel/testsuite/soliton.xmds, trunk/xmds-devel/testsuite/tla.xmds: Added CVS Id keyword. 2004-01-30 01:25 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Added CVS Id keyword. 2004-01-28 04:44 paultcochrane * trunk/xmds-devel/source/Doxyfile, trunk/xmds-devel/source/Makefile.am, trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsbreakpoint.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Added CVS Id keyword. 2004-01-28 04:37 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Still testing the CVS Id keyword expansion. 2004-01-28 04:35 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Testing adding the CVS Id keyword. 2004-01-27 07:02 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Updated to new element syntax: output format and output precision now being given as attributes of element rather than in simulation options section. Also added syntax for the break point feature to come. 2004-01-27 07:00 paultcochrane * trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds: Updated to new element syntax: output format and output precision now being given as attributes of element rather than in simulation options section. 2004-01-27 06:29 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added attributes to element to control whether output format is binary or ascii (ascii still default), and whether the output precision is double or single (double is still default). These are to replace the and tags. The new syntax is , which is a lot more logical. 2004-01-27 06:26 paultcochrane * trunk/xmds-devel/source/Doxyfile: Changed option so that man pages are now generated. 2004-01-14 08:34 paultcochrane * trunk/xmds-devel/examples/fullpos3D.xmds: Fixed problem whereby gcc/g++ see sqrt(2) as the sqrt of an integer which doesn't work in C++, these have been changed to sqrt(2.0) so that the input is float/double. 2004-01-13 10:16 paultcochrane * trunk/xmds-devel/source/xmdsutils.h: Trivial change made during code testing. 2004-01-13 10:15 paultcochrane * trunk/xmds-devel/source/xmdsutils.cc: Fixed bug in getAttributeBools where the string comparison was being performed incorrectly. 2004-01-13 10:14 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Implemented parsing of enabled attribute of breakpoint element correctly. 2004-01-13 10:13 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Changed some formatting. 2004-01-13 10:11 paultcochrane * trunk/xmds-devel/source/xmdsbreakpoint.cc: Removed some legacy code that was commented out anyway. Polished and tested the breakpoint parsing code. Now do a test to see if a file exists at the parsing stage when the file status is set to "old", and barf with an error message if not found. 2004-01-13 02:03 paultcochrane * trunk/xmds-devel/source/xmdsutils.h: Corrected one of the documentation strings. 2004-01-13 01:28 paultcochrane * trunk/xmds-devel/source/main.cc: Added a debug option to parsePrefs(), and changed the output generated so that stuff that should be in the debugging output is not in the verbose output. 2004-01-12 09:10 paultcochrane * trunk/xmds-devel/source/xmdsutils.h: Added the DEEP and NOT_DEEP variables to the global anonymous enum. 2004-01-12 09:09 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Added stuff to find and process the tag. Started to implement the use of DEEP and NOT_DEEP variables in getElementsByTagName() and friends as opposed to just 1 and 0 respectively (it makes the code more readable). 2004-01-12 09:07 paultcochrane * trunk/xmds-devel/source/xmdsbreakpoint.cc: Initial import to repository. Basic stuff at this stage, actually does nothing other than report what the settings are as found in the .xmds script. 2004-01-12 09:06 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added xmdsBreakPoint object declarations (just basic stuff at this stage). Added (to xmdsOutput) a bpEnabledFlag variable to note if breakpoints are enabled, and declaration of a function to create an xmdsBreakPoint object. 2004-01-12 09:03 paultcochrane * trunk/xmds-devel/source/Makefile.am: Added xmdsbreakpoint.cc 2003-12-30 10:38 paultcochrane * trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds: Updated , and tags where appropriate. 2003-12-23 04:01 paultcochrane * trunk/xmds-devel/ChangeLog, trunk/xmds-devel/MANIFEST, trunk/xmds-devel/NEWS, trunk/xmds-devel/README: Updated to reflect changes in current release (1.3-1) 2003-12-23 03:47 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/examples/vibstring.xmds: Tidied formatting, added some comments. 2003-12-23 01:15 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Commented out using of binary input file. Now is back to being initialised by code. Better this way since it's an example file. 2003-12-23 01:13 paultcochrane * trunk/xmds-devel/source/main.cc: Put preferences parsing code into a function. It's a bit neater, and only one section of code to modify instead of two. Also changed a couple of warnings to only be printed out when verbose flag is set. 2003-12-22 06:56 paultcochrane * trunk/xmds-devel/Makefile.am: Updated to include the README.Windows file in the distribution. 2003-12-22 06:55 paultcochrane * trunk/xmds-devel/README.Windows: Initial import to repository. 2003-12-22 06:01 paultcochrane * trunk/xmds-devel/examples/tla.xmds: Minor formatting improvement. 2003-12-22 06:00 paultcochrane * trunk/xmds-devel/examples/nlse.xmds: Added test code for output arguments. This needs to be fixed up, not a good example file really. 2003-12-22 05:59 paultcochrane * trunk/xmds-devel/examples/ndparamp.xmds: Added binary output and benchmark tags. 2003-12-22 05:58 paultcochrane * trunk/xmds-devel/examples/highdim.xmds: Fixed integer where float should be problem. 2003-12-22 05:57 paultcochrane * trunk/xmds-devel/examples/gaugeatomlaser.xmds: Renamed simulation and .xsil file to reflect name of "gaugeatomlaser". 2003-12-22 05:56 paultcochrane * trunk/xmds-devel/examples/fullpos3D.xmds: Some minor reformatting. 2003-12-22 05:55 paultcochrane * trunk/xmds-devel/examples/fibre.xmds: Fixed a divide by integer problem which has only really become evident since gcc3. Added and tags. 2003-12-22 05:52 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Tidied the code slightly. Added an and element (may be used in the future. Added some comments to the file. Removed test code, and now acually use variables in the simulation as command line arguments. Also added some new syntax to work in xmds-1.3-1. 2003-12-22 05:49 paultcochrane * trunk/xmds-devel/testsuite/atomlaser_reference.xsil, trunk/xmds-devel/testsuite/ndparamp_reference.xsil, trunk/xmds-devel/testsuite/nlse_reference.xsil, trunk/xmds-devel/testsuite/soliton_reference.xsil, trunk/xmds-devel/testsuite/tla_reference.xsil: Updated the _reference.xsil files. 2003-12-22 05:40 paultcochrane * trunk/xmds-devel/source/main.cc: Added some documentation as introduction to xmds for output to api documentation. Also added some installation instructions as well. 2003-12-22 04:42 paultcochrane * trunk/xmds-devel/source/Doxyfile: Updated to refelect the current project number. Also removed some obsolete Doxygen commands. 2003-12-22 04:39 paultcochrane * trunk/xmds-devel/source/dom3.h: Completed documenting the DOM functions and classes as they are outlined in the W3C Working Draft of 05 June 2001. No functional changes, although the big difference is that the api documentation is now significantly better than it was before. 2003-12-19 07:17 paultcochrane * trunk/xmds-devel/source/dom3.h: Started documenting the DOM functions and classes as they are outlined in the W3C Working Draft of 05 June 2001. No functional changes, although the big difference is that the api documentation is now significantly better than it was before (and I haven't finished yet!). 2003-12-17 09:35 paultcochrane * trunk/xmds-devel/source/xmdsvectorelement.cc: Implemented binary input for use in the tag of the element. 2003-12-17 09:33 paultcochrane * trunk/xmds-devel/source/xmdsutils.h: Added an enum to specify two booleans, REQD and NOT_REQD. I will eventually implement this further so that some of the calls used of getAssignmentStrings() etc are a little more understandable. Also added declarations for getAttributeStrings() and getAttributeBools(). 2003-12-17 09:31 paultcochrane * trunk/xmds-devel/source/xmdsutils.cc: Added two new functions: getAttributeStrings() and getAttributeBools(). This was in order to implement binary and ascii input of data files (in tag of element). However, this is a more general addition, the two functions being used to get strings and booleans out of attributes of element tags respectively. 2003-12-17 09:29 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Minor change to the xmdsVectorElement class to implement binary and ascii input files. 2003-12-17 06:18 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xsilfield.cc: Fixed bug whereby temp.dat was still being used instead of x.dat for input data to matlab/scilab. 2003-12-17 06:17 paultcochrane * trunk/xmds-devel/source/xmdsvector.cc: Fixed formatting a bit. No real changes to code. 2003-12-17 06:16 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc: Tidied some fprintf statements. 2003-12-17 06:15 paultcochrane * trunk/xmds-devel/source/xmdsutils.cc: Fixed some spelling errors and debugging reporting information. 2003-12-17 06:12 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Tidied some fprintf statements by combining most of the text (and hence removing heaps of fprintf statements and making the code easier to read). 2003-12-17 06:09 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added a usePrefs variable to the simulationParamtersStruct in order to implement preferences. 2003-12-17 06:08 paultcochrane * trunk/xmds-devel/source/main.cc: Implemented a first go at preferences for xmds. It can be tidied a lot, but it works at present. One needs a ~/.xmds/xmds.prefs file or an xmds.prefs file in the local directory to the script one is trying to compile. The prefs file format is = , e.g. XMDS_CC = gcc. One can also use comments. All text after (and including) a hash character (#) is ignored. 2003-12-17 06:03 paultcochrane * trunk/xmds-devel/configure.in: Updated to show version information as 1.3-1. 2003-12-07 03:25 paultcochrane * trunk/xmds-devel/ChangeLog: Added comments about current changes to xmds. 2003-12-07 03:24 paultcochrane * trunk/xmds-devel/configure.in: Altered release number to current release: 1.2-2 2003-11-27 05:50 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added the inclusion of the sstream (string streams) header. 2003-11-27 05:49 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Fixed segfaulting of mpi programs using wisdom. Now have more C++ type code to implement creation of the host_rank_%i.stuff etc files and for their deletion. Writing and reading from these files was causing the segfault. 2003-11-27 01:33 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Fixed bug whereby the useWisdom option wasn't passed through to writePlanCreationCalls properly. 2003-11-27 01:14 paultcochrane * trunk/xmds-devel/configure.in: Changed way that mpiccTest was checked for the compiler running mpicc. 2003-11-25 08:19 paultcochrane * trunk/xmds-devel/ChangeLog: Added comments advising of changes up to current version of xmds. 2003-11-25 08:18 paultcochrane * trunk/xmds-devel/configure.in: Corrected version numbers to agree with current release. 2003-11-25 08:17 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Fixed host.stuff and home.stuff file writing with mpi, I'd fixed this before in one place in the code but missed this extra place. 2003-11-25 01:37 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Modified moment group number reporting at the terminal, so matches what is given in xsil2graphics and output files. 2003-11-24 10:10 paultcochrane * trunk/xmds-devel/configure.in: Fixed problem with optimisation settings not flowing through for script compilation when using gcc. Now check if $ac_compiler_gnu is "yes" instead of if XMDS_CC is gcc (can be g++, for example). 2003-11-24 10:07 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fixed binary output bug where k-space variables weren't ordered correctly before output. 2003-11-20 06:00 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fixed misreporting of filename if unable to open the output file for binary output. 2003-11-07 00:28 paultcochrane * trunk/xmds-devel/configure.in: Changed release number to pre1, ready for the pre1 release. (funnily enough...) 2003-11-06 10:18 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Hopefully fixed problem with loading data in more than one moment group by appending _[momentGroupNumber] to variable names as is done in xsil2graphics. 2003-11-06 09:59 paultcochrane * trunk/xmds-devel/configure.in: Now pointing XMDS_CC to CXX if necessary. 2003-11-06 06:02 paultcochrane * trunk/xmds-devel/configure.in: Fixed bug where a test for null should have been non-null. 2003-11-06 01:47 paultcochrane * trunk/xmds-devel/source/xsilfield.h: Altered call to writeAsFormat so can implement writing data files as xsil filename_momentGroup.dat as opposed to temp_momentGroup.dat as before. 2003-11-06 01:46 paultcochrane * trunk/xmds-devel/source/xsilfield.cc: The output filename is the xsil base filename (the bit without the .xsil on the end) with the moment group number plus .dat, instead of just temp1.dat, temp2.dat. Not a great comment, but I implemented this idea anyway... 2003-11-06 01:44 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Some reformatting of code. Main change being the altering of the xsilField::writeAsFormat call, by passing through the xsil filename's base name (ie that bit without the .xsil on the end). 2003-11-06 01:42 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Removed the output of the (commented out in the final code anyway) unistd.h statement. 2003-11-06 01:41 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: (Hopefully) fixed problem with writing, reading and deleting host.stuff and home.stuff files when using mpi. The files now append the rank to the file name, so this problem should be fixed. 2003-11-06 01:38 paultcochrane * trunk/xmds-devel/source/main.cc: Removed XMDS_CXX stuff. Removed clibs being added to one of mpicc compile strings. This produced inconsistent compilation flags when mpicc uses a different compiler to XMDS_CC. 2003-11-06 01:16 paultcochrane * trunk/xmds-devel/admin/manifestGen.pl: Documented a far simpler way of generating the manifest. 2003-11-06 01:15 paultcochrane * trunk/xmds-devel/configure.in: Removed references to XMDS_CXX* variables, they were superfluous and caused confusion. Made some tests more stringent, so that user supplied arguments at the command line to configure can be passed through properly. If the user has specified command line options to xmds, the script now also checks if some required flags are missing from these options and appends them if necessary. 2003-11-06 01:11 paultcochrane * trunk/xmds-devel/README: Added description of configuration options that are now available in xmds-1.2, and tidied up the text a bit. Also fixed a couple of bugs with the scilab execution of the xsil file. 2003-11-06 01:09 paultcochrane * trunk/xmds-devel/Makefile.am: Removed latexdocs from being included in distribution temporarily. Will probably add back in when docs catch up to current version of xmds. 2003-11-06 01:08 paultcochrane * trunk/xmds-devel/MANIFEST: Updated to reflect current list of files for distribution. 2003-11-04 08:27 paultcochrane * trunk/xmds-devel/Makefile.am: No change, just added something and took it away, but it wants to be updated nevertheless. 2003-11-04 08:22 paultcochrane * trunk/xmds-devel/MANIFEST: Initial import to repository. 2003-11-04 08:18 paultcochrane * trunk/xmds-devel/ChangeLog: Updated to reflect changes that have happened so far since xmds-1.1. 2003-11-04 07:54 paultcochrane * trunk/xmds-devel/README: Updated to agree with current configuration options. 2003-11-04 07:53 paultcochrane * trunk/xmds-devel/AUTHORS: Updated email addresses of authors. 2003-11-04 06:59 paultcochrane * trunk/xmds-devel/configure.in: MPICCFLAGS needs $PTHREADS_CFLAGS as well. Tidied XMDS_CFLAGS and XMDS_CXXFLAGS by putting AGGRESSIVE_* instead of the explicit declaration. Removed the check for enable_mpicc_aggressive. Removed --enable-*-aggressive options. 2003-11-04 06:32 paultcochrane * trunk/xmds-devel/configure.in: Fixed bug where one actually needs the $PTHREAD_CFLAGS variable inserted into XMDS_CFLAGS. 2003-11-04 05:20 paultcochrane * trunk/xmds-devel/configure.in: Removed explicit check for MPI_Init in -lmpi since -lmpi must work if passed -llam test, AND the library arguments be in the right order. This simplifies the checking slightly. 2003-11-03 04:46 paultcochrane * trunk/xmds-devel/configure.in: The flags for gcc, icc, g++ etc all now default to the aggressive version. If the user wants other flags, they should set them at the command line at build time. 2003-11-03 04:03 paultcochrane * trunk/xmds-devel/configure.in: Changed implementation of how xmdsconfig.h is made. It's now a cp from config.h. 2003-11-03 04:01 paultcochrane * trunk/xmds-devel/Makefile.am: Added the m4 files acx_mpi.m4 and acx_pthread.m4 so that will be added to distribution output. 2003-11-03 03:58 paultcochrane * trunk/xmds-devel/examples/diffusion.xmds, trunk/xmds-devel/examples/lorenz.xmds, trunk/xmds-devel/examples/pendulum.xmds, trunk/xmds-devel/examples/vibstring.xmds: Initial import to repository. 2003-10-31 07:04 joehope * trunk/xmds-devel/configure.in, trunk/xmds-devel/examples/fibre.xmds: Making stable autoconf on MacOSX 2003-10-30 07:07 paultcochrane * trunk/xmds-devel/source/Doxyfile: Now set to produce pdf documentation as well. 2003-10-30 07:05 paultcochrane * trunk/xmds-devel/configure.in: Fixed problem with not finding lam properly. Fixed bug whereby forgot to add -lxmds to XMDS_LIBS variable. 2003-10-30 03:40 paultcochrane * trunk/xmds-devel/configure.in: No longer assuming lam, nor does one need to put --with-mpi-libs="-llam" on the command line for the script to find either the lam or mpich implementations of mpi. Fixed minor big with -I in wrong place. Now determines how mpicc is run, which in itself is dependent upon the mpi implementation, but the script detects the differences between lam and mpi and is still able to check what CC is used for mpicc. 2003-10-30 03:35 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmdsclasses.h: Did some reformatting and updated docstrings. 2003-10-28 01:42 paultcochrane * trunk/xmds-devel/configure.in: Added a check for how mpicc is run, and then alter MPICCFLAGS accordingly. Also added a check for mpicc-aggressive and if on, then uses the icc-aggressive or gcc-aggressive flags if mpicc is run by icc or gcc. 2003-10-28 00:48 paultcochrane * trunk/xmds-devel/admin, trunk/xmds-devel/admin/manifestGen.pl: Initial import to repository. 2003-10-27 10:50 paultcochrane * trunk/xmds-devel/configure.in: Implemented the --with-mpi-path option better. Used the MPI_LIB_PATH to help configure look for fftw_mpi. Added the MPI_LIB_PATH to the MPICCFLAGS. 2003-10-27 10:47 paultcochrane * trunk/xmds-devel/Makefile.am: Added loadxsil.m to EXTRA_DIST files. 2003-10-27 08:13 paultcochrane * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Added GPL statement. 2003-10-27 08:01 paultcochrane * trunk/xmds-devel/source/dom3.h: Changed some docstrings. Added GPL statement. 2003-10-27 07:52 paultcochrane * trunk/xmds-devel/configure.in: Hopefully fixed bloody headers problem this time!! Fixed other problems wrt getting mpi to get the correct options. Seems to go on the SC now, so that's good. 2003-10-24 01:50 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Added more helpful (ie usage) output for when arguments to simulation binary are incorrect. 2003-10-24 01:46 paultcochrane * trunk/xmds-devel/source/main.cc: Fixed bug where insufficient number of format specifiers in a string for number of arguments to sprintf. This caused a problem with mpi not seeing the fftw libraries. 2003-10-23 10:36 paultcochrane * trunk/xmds-devel/configure.in: Now handling the case when someone uses --prefix better now. Basically I just make the USER_* and *dir variables point to the directory pointed to by the $prefix. 2003-10-23 10:11 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Minor terminal output touch up. 2003-10-23 10:11 paultcochrane * trunk/xmds-devel/source/main.cc: Now using XMDS_CC, XMDS_CXX, and XMDS_CFLAGS instead of the non-XMDS_* versions. 2003-10-23 10:07 paultcochrane * trunk/xmds-devel/configure.in: Hopefully now fixed the config headers not recreating themselves problem. Did some reformatting of help output. Added --with-mpi-compiler so that the user can choose what compiler to use for mpi, --enable-mpi (not default option) so that mpi is checked for and added to variables, --enable-icc-aggressive, so that aggressive optimisation settings are chosen when using icc, --enable-gcc-aggressive so that both gcc and g++ use aggressive optimisation settings, --enable-mpicc-aggressive so that mpicc will use the gcc-aggressive compiler settings. Fixed a bug where CXXFLAGS lacked an S. Needed to add the PTHREAD_CFLAGS variable to XMDS_CFLAGS and XMDS_CXXFLAGS. Removed old (and commented anyway) mpi checking code. Put mpi stuff into an if loop, and is processed only when --enable-mpi is used. Am now actually using XMDS_CFLAGS and XMDS_CXXFLAGS. Now configure script outputs nicely formatted option and variable information once configuration is complete. 2003-10-22 06:13 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Minor change to terminal output. 2003-10-22 06:12 paultcochrane * trunk/xmds-devel/source/main.cc: Changed INCLUDES and LIBS to be XMDS_INCLUDES and XMDS_LIBS, so is specific to the xmds simulations rather than xmds itself. 2003-10-22 06:10 paultcochrane * trunk/xmds-devel/configure.in: Corrected some *config.h errors. Relabelled some of the variables to be specific to the xmds simulations as opposed to xmds itself. Removed some superfluous function checks. Got MPI running cleaner and better. 2003-10-22 03:25 paultcochrane * trunk/xmds-devel/acx_mpi.m4: Initial import to repository. 2003-10-22 00:39 paultcochrane * trunk/xmds-devel/source/Makefile.am: Changed config.h to xmdsconfig.h 2003-10-22 00:39 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Changed inclusion of config.h to inclusion of xmdsconfig.h to stop possible name clashes when installing on the system instead of in the user's directory. 2003-10-22 00:38 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fixed minor error with incorrect format in printf statement. 2003-10-22 00:23 paultcochrane * trunk/xmds-devel/source/main.cc: Improved mpi flag handling, and added a FFTW_MPI_LIBS variable. 2003-10-22 00:22 paultcochrane * trunk/xmds-devel/configure.in: Removed some superfluous variables, and some superfluous output at configure time. Improved the ordering and determination of flags for use with mpi. 2003-10-21 23:27 paultcochrane * trunk/xmds-devel/configure.in: Now generating source/xmdsconfig.h as well as source/config.h so that simulation binaries can have more benefit from configuration headers. Added -lxmds to LIBS variable (this isn't the right thing to do, and will be fixed shortly). 2003-10-20 01:14 joehope * trunk/xmds-devel/examples/highdim.xmds: Trivial fix for occasional, minor compiler confusion: sqrt(int) 2003-10-18 10:55 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Removed inclusion of endian.h for binaryOutput. Now including config.h when binaryOutput is true. 2003-10-18 10:54 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Changed checks for FLOAT_WORD_ORDER etc to CPU_IS_BIG_ENDIAN etc. 2003-10-18 10:53 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Now determining endian-ness by the variables CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN. 2003-10-18 10:51 paultcochrane * trunk/xmds-devel/source/Makefile.am: Now adding the config.h generated in the configuration of xmds. This adds the variables CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN to check for endian-ness of the processor. 2003-10-18 10:48 paultcochrane * trunk/xmds-devel/configure.in: Removed check for endian.h and added code to search for endian-ness of processor copied from configure.ac in libsndfile. Also am now including the acinclude.m4 of libsndfile. 2003-10-18 10:07 paultcochrane * trunk/xmds-devel/acinclude.m4: Initial import to repository. 2003-10-17 04:53 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Instead of adding "#include getopt.h" every time a simulation code is written, it is only added now when the .xmds script contains an argv tag set, and therefore the simulation can take arguments at the command line. 2003-10-17 04:50 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Changed getopt_long_only to getopt_long. 2003-10-17 04:49 paultcochrane * trunk/xmds-devel/source/main.cc: Removed FFTWMPILIBS variable (now superfluous). Removed superfluous %s formatting string. 2003-10-17 04:48 paultcochrane * trunk/xmds-devel/source/Makefile.am: Added the getopt sources and headers to make the libxmds library. 2003-10-17 04:36 paultcochrane * trunk/xmds-devel/config.guess, trunk/xmds-devel/depcomp, trunk/xmds-devel/ltmain.sh: Updated to current version. 2003-10-17 04:32 paultcochrane * trunk/xmds-devel/configure.in: Added underscores to some variables to improve readability. Made sure that the directory libxmds.a is put in is the same as xmdscomplex.h (on installation). Made sure that script doesn't write over previously defined (eg in the user's shell) any environment variables used (eg CFLAGS). Made sure that gcc gets the -Wall option (don't really know why... historical I guess). Changed FFTW_THREADS_* to XMDS_THREADS_*. These may be deleted in the future. Cleaned up the flags that mpi gets eventually. Further cleaning will ensue however. icc currently only used if set as CC and or CXX flags in the shell. Moved the AC_SUBSTs at the end of the script to before all of the AC_DEFINES. Made sure that -lxmds is added to LIBS. Some echos added for testing purposes. 2003-10-17 04:24 paultcochrane * trunk/xmds-devel/Makefile.am: Commented out the inclusion of xmds api documentation. 2003-10-10 05:02 joehope * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Replace //** with // ** (often allows proper syntax colouring) 2003-10-09 06:29 paultcochrane * trunk/xmds-devel/testsuite, trunk/xmds-devel/testsuite/atomlaser.xmds, trunk/xmds-devel/testsuite/atomlaser_reference.xsil, trunk/xmds-devel/testsuite/fibre.xmds, trunk/xmds-devel/testsuite/fibre_reference.xsil, trunk/xmds-devel/testsuite/fullpos3D.xmds, trunk/xmds-devel/testsuite/fullpos3D_reference.xsil, trunk/xmds-devel/testsuite/gaugeatomlaser.xmds, trunk/xmds-devel/testsuite/gaugeatomlaser_reference.xsil, trunk/xmds-devel/testsuite/genRefData.pl, trunk/xmds-devel/testsuite/kubo.xmds, trunk/xmds-devel/testsuite/kubo_reference.xsil, trunk/xmds-devel/testsuite/ndparamp.xmds, trunk/xmds-devel/testsuite/ndparamp_reference.xsil, trunk/xmds-devel/testsuite/nlse.xmds, trunk/xmds-devel/testsuite/nlse_reference.xsil, trunk/xmds-devel/testsuite/sine.xmds, trunk/xmds-devel/testsuite/sine_reference.xsil, trunk/xmds-devel/testsuite/soliton.xmds, trunk/xmds-devel/testsuite/soliton_reference.xsil, trunk/xmds-devel/testsuite/test_xmds.pl, trunk/xmds-devel/testsuite/tla.xmds, trunk/xmds-devel/testsuite/tla_reference.xsil: Initial import to repository. 2003-10-09 02:18 offaxis * trunk/xmds-devel/source/xmdsglobals.cc: Globals from elements now read in _before_ those from the element. 2003-10-07 05:28 paultcochrane * trunk/xmds-devel/depcomp: Initial import to repository. 2003-10-07 05:01 paultcochrane * trunk/xmds-devel/acx_pthread.m4: Initial import to repository. Copied from the fftw distribution (many thanks). 2003-10-07 04:59 paultcochrane * trunk/xmds-devel/configure.in: Many, many changes. Updated to call xmds version 1.2. Added a path to one's mpi distribution if different from /usr or /usr/local. Added a check for vendor's cc and c++ compiler, and using them to compile both xmds and the simulation binaries. If the compiler is gcc then adds the -Wall compiler flag. Checks for getopt and getopt_long. Checks for the various thread libraries (code copied and modified from the fftw configure.in). Added a FFTW_LIBS variable. This may be used a bit better in the future. Checks for the Intel c compiler and if so then uses that compiler for xmds and the simulation binaries. Removed some superfluous definitions and subst's. 2003-10-07 04:52 paultcochrane * trunk/xmds-devel/examples/nlse.xmds: Removed tag, just for testing purposes. Fixed problem with log(2) being incorrect for more recent versions of c++: one must now use log(2.0). 2003-10-07 04:50 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added config.h to headers list. Using the HAVE_ENDIAN_H variable defined therein to specify what the __BYTE_ORDER and __FLOAT_WORD_ORDER macros should be equal to. Hopefully this fixes the endian issues xmds could have, although I'm not sure yet. 2003-10-07 04:48 paultcochrane * trunk/xmds-devel/source/main.cc: Added cxx variable set equal to the CXX variable found by the configure script. This is then used for compilation of the simulation binary. Also specifying the FFTW_LIBS variable as well. Added the fftwlibs variable to the compilation of the simulation binary. 2003-10-07 04:45 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Fixed a line that was missing a . 2003-10-06 04:21 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Removed multiline string literals by adding heaps of fprintf statements. This caused problems with some compilers. 2003-10-06 04:20 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Removed multiline string literals by adding heaps of fprintf statements. 2003-09-30 11:50 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Now contains more tags test code. Doesn't actually do anything... 2003-09-30 11:48 paultcochrane * trunk/xmds-devel/source/xmdsutils.h: Reformatted the text. 2003-09-30 11:47 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Removed test code. Fixed code to implement the gnu getopt library for command line options for the simulation binary. 2003-09-30 11:46 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Completed code to implement gnu getopt command line options for the simulation binary. 2003-09-30 11:44 paultcochrane * trunk/xmds-devel/source/xmdsglobals.cc: Added global variables code to be output for when command line arguments are specified in the .xmds file. 2003-09-30 11:42 paultcochrane * trunk/xmds-devel/source/xmdscomplex.h: Reformatted text. 2003-09-30 11:42 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Deleted some superfluous code (eg writeArgvIntialisationCode, writeArgvFinalisationCode). Removed test object: argvList. Fixed header so that can use an argvStruct to store information about the command line arguments specified in tags. 2003-09-30 11:39 paultcochrane * trunk/xmds-devel/source/xmdsargv.cc: Deleted some superfluous code (eg writeArgvIntialisationCode, writeArgvFinalisationCode). 2003-09-30 11:38 paultcochrane * trunk/xmds-devel/source/xmdsargelement.cc: Finally worked out how to get the argument names, short options, types, default_values etc into the simulation object. Deleted some superfluous code (eg writeArgDeclaration, writeArgCode). 2003-09-30 11:36 paultcochrane * trunk/xmds-devel/source/xmdsarg.cc: Removed some superfluous function definitions. Namely type(), setType(), default_value() and setDefaultValue() 2003-09-30 11:34 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.h: Reformatted text nicely. 2003-09-29 09:57 paultcochrane * trunk/xmds-devel/Makefile.am: Removed superfluous files from being added when performing a make dist. Needs to be improved further. 2003-09-29 09:56 paultcochrane * trunk/xmds-devel/configure.in: Better checking, and some testing done on platforms other than linux. 2003-09-29 08:00 paultcochrane * trunk/xmds-devel/configure.in: Actually fixed the checks now, instead of not (aarrgghh). 2003-09-29 03:28 paultcochrane * trunk/xmds-devel/configure.in: Fixed some more checks and added a check for fftw_mpi. 2003-09-29 02:02 paultcochrane * trunk/xmds-devel/configure.in: Fixed bug with incorrectly using alternative paths to fftw. 2003-09-15 10:16 paultcochrane * trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc: Implemented the use of a command line flag to xmds for toggling debugging information output (-d). 2003-09-15 10:14 paultcochrane * trunk/xmds-devel/source/xsil2graphics.cc: Modified to implement the -d xmds debugging flag and -x the xml debugging flag. 2003-09-15 10:13 paultcochrane * trunk/xmds-devel/source/xmlbasics.cc: Removed DEBUG macro. This is now implemented as a command line switch to xmds. Specifically -x, for xml debugging information. This change is really only useful for developers. 2003-09-15 10:12 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Removed DEBUG macro. This is now implemented as a command line switch to xmds. 2003-09-15 10:10 paultcochrane * trunk/xmds-devel/source/main.cc: Implemented some new command line options to xmds the program. -c switches compilation of the output binary OFF. This is useful for checking is xmds outputs the correct code, or if one wants to hack the output source and not have to worry about compilation, or even if the output code is not to be used on a unix system and therefore needs some hacking to work on another system. -d switches debugging output on excluding xml parsing debugging output (same as setting the DEBUG macro in the code, except that xmds doesn't have to be recompiled every time one wants to change that). -x switches debugging output of just the xml parsing on. 2003-09-15 09:57 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Improved indentation of xml. Added code to test the tag set. 2003-09-15 06:56 paultcochrane * trunk/xmds-devel/ChangeLog: Initial import to repository. 2003-09-15 06:49 paultcochrane * trunk/xmds-devel/source/xmdsarg.cc, trunk/xmds-devel/source/xmdsargelement.cc, trunk/xmds-devel/source/xmdsargv.cc: Initial import to repository. 2003-09-15 06:48 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Improved indentation of source code. Added some code for the parsing of the element. 2003-09-15 06:45 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Improved indentation of source code, no functional changes. 2003-09-15 06:43 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added declarations for xmdsArgv, xmdsArg, and xmdsArgElement classes. Also added an argvStruct structure to store the relevant information found by parsing the new etc syntax. This may or may not be used at this stage, so consider this commit as strictly temporary. 2003-09-15 06:38 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h: No functional changes, just indented the source code nicely 2003-09-15 06:31 paultcochrane * trunk/xmds-devel/source/Makefile.am: Added xmdsargv.cc xmdsarg.cc and xmdsargelement.cc to the list of xmds sources 2003-09-09 04:30 paultcochrane * trunk/xmds-devel/config.guess, trunk/xmds-devel/config.sub: Initial import to repository 2003-08-06 05:38 paultcochrane * trunk/xmds-devel/configure.in: Added a check for the endian.h header file. 2003-08-06 04:42 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: If binary output is specified, then include the header. 2003-08-06 04:41 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Added code to output C code to check for the definitions of __FLOAT_WORD_ORDER and __BYTE_WORD order. If the first doesn't exist, then it uses the next, if that doesn't exist, then the program exits. 2003-08-06 04:38 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Added code to output C code that checks for littleendian or bigendian binary format, and assigns the string encodingStr accordingly, for then use in the .xsil output file of the simulation. 2003-08-06 04:35 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Modified to allow for reading of bigendian or littleendian binary, as specified in the .xsil file. 2003-08-05 07:54 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added argvList to myParameters assignment block in xmdsSimulation constructor. Added code to process the argv element and put the command line arguments into the argvList for use in xmdsglobals.cc. 2003-08-05 07:51 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Added code to accept arguments on the command line for the xmds executable, only if the argvList defined via the tag is non-zero. If the incorrect number of arguments, the program gives a usage output and exits. 2003-08-05 07:49 paultcochrane * trunk/xmds-devel/source/xmdsglobals.cc: Added code to look for tag in section and append the relevant code to the myGlobalCode variable, to be output in the globals definition section of the .cc file. This implements part of allowing arguments to be passed to the executable at the command line. 2003-08-05 07:47 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Included header. Added argvList string list to parametersStruct to implement the passing of arguments to the output binary at the command line. 2003-08-04 10:27 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Included the vector header. Now "using namespace std" by default. 2003-08-04 10:26 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Fixed a spelling error in console output. 2003-08-04 10:24 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Output binary files now have the moment group field name appended. This stops output binary files writing all over one another. Implemented a better technique of binary output: redundancy inherent in ascii output format has been removed. 2003-08-04 10:20 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: The std:: namespace is now "used". The temporary files host.stuff and home.stuff are removed after being used. 2003-08-04 10:18 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Modified to allow for changes in binary output format. 2003-07-28 09:42 paultcochrane * trunk/xmds-devel/Makefile.am: examples directory is now included in EXTRA_DIST instead of SUBDIRS. This stops examples from being compiled at build time. 2003-07-28 09:41 paultcochrane * trunk/xmds-devel/configure.in: No longer produces Makefile in examples directory. 2003-07-28 09:13 paultcochrane * trunk/xmds-devel/source/Doxyfile: Initial import to repository 2003-07-28 09:12 paultcochrane * trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsilfield.h: Documented for use with Doxygen. Quite basic and incomplete, but with placeholders where necessary for further addition and improvement of the api documentation. 2003-07-28 09:08 paultcochrane * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdssequence.cc: Added some documentation to the file. Mainly just to test out Doxygen, automatic api documentation generator. 2003-07-23 04:24 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/fibre.xmds: Added tag 2003-07-23 04:23 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Implemented code to process tag properly. Added header so that can actually do the benchmarking. 2003-07-23 04:21 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Added output code to implement boolean 2003-07-23 04:20 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Fixed issues with gcc 3+ not finding ifstream, ofstream, string etc. Need to prepend with std:: to use the correct namespace. 2003-07-23 04:19 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added benchmark boolean to simulationParametersStruct 2003-07-23 04:17 paultcochrane * trunk/xmds-devel/configure.in: Fixed problems with not getting flags passed to mpicc right. Still not perfect though... 2003-07-23 04:16 paultcochrane * trunk/xmds-devel/Makefile.am: Altered to allow building of example binaries in the examples subdirectory 2003-07-12 05:19 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Loads binary data, and ascii data. Is now callable as a function and returns variables into calling script or functions variable space. Handles multiple moment groups. 2003-07-11 05:03 paultcochrane * trunk/xmds-devel/source/loadxsil.m: Initial import to repository. Is able to parse .xsil files and automatically generate the code to load binary data in from file. This is still under heavy development, need to be able to load ascii data from .xsil files and need to actually implement as a function as opposed to a script. Nevertheless, the checkin was necessary/ 2003-07-09 04:44 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added useDouble boolean to myParameters. Implemented finding use_double element in xmds file, and setting accordingly if found. 2003-07-09 04:43 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Added C++ header. Added a check for the value of the useDouble boolean, if so, set output precison and cast (if necessary) accordingly. Implemented single or double precision for output of binary data depending on value of useDouble boolean. Default is to use double. 2003-07-09 04:40 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Added useDouble boolean to simulationParametersStruct (to implement the choice of using double or single precision in binary output. 2003-07-09 03:57 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Implemented binaryOutput boolean. Implemented checking for element in xmds code. Added some more headers to xmds generated cc file so that can use more C++ features. 2003-07-09 03:55 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Addition of myBoolList variable in order to implement binary output 2003-07-09 03:54 paultcochrane * trunk/xmds-devel/source/xmdsmomentgroup.cc: Implemented binary output of data if boolean set to yes. 2003-07-09 03:53 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Added some informative messages to output concerning what program is doing. Changed dodgy C-like implementation of wisdom and hostName/homeDir to a more robust C++ implementation. 2003-07-09 03:50 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Modified to turn debugging on. Modified to add binaryOutput boolean to myParameters. 2003-07-09 03:49 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Added and flags to file. 2003-07-07 06:02 paultcochrane * trunk/xmds-devel/examples/atomlaser.xmds: Made minor changes to formatting of file. 2003-07-07 06:01 paultcochrane * trunk/xmds-devel/source/xmdssimulation.cc: Added code to look for tag in .xmds file, and implement if necessary. 2003-07-07 05:59 paultcochrane * trunk/xmds-devel/source/xmdssequence.cc: Updated writePlanCreationCalls() call so that includes new arguments due to inclusion of wisdom 2003-07-07 05:57 paultcochrane * trunk/xmds-devel/source/xmdsoutput.cc: Changed writePlanCreationCalls() to allow for wisdom implementation 2003-07-07 05:56 paultcochrane * trunk/xmds-devel/source/xmdsfield.cc: Implemented the use of wisdom via the tag. xmds simulation binary now outputs more progress information: when building forward and backward plans for fftw; when importing wisdom; when exporting wisdom; when using current directory instead of ~/.xmds/wisdom for .wisdom files. Simulation binary now checks for the existence of ~/.xmds/wisdom directory for storage of .wisdom files. 2003-07-07 05:52 paultcochrane * trunk/xmds-devel/source/xmdsclasses.h: Changed simulationParametersStruct to include useWisdom boolean. Updated writePlanCreationCalls to include useWisdom in function call. 2003-07-07 05:49 paultcochrane * trunk/xmds-devel/configure.in: Added checking for icc. Removed superfluous AC_SUBST calls. Fixed some issues with building and running xmds on machines with icc, the only problem being that configure script is now becoming a bit ugly. 2003-07-03 04:15 paultcochrane * trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h: Fixed xml parsing so compiles and works on LinuxPPC. Problem was to do with different implementations of char for different compilers. Basically, the PPC gcc was setting some comparisons to always true or always false, because the char data type was really unsigned char. What was actually desired (and I believe used by Linux_x86 gcc) was signed char, but this only affected a few cases. XML files are now parsed properly and produce correct output (although there are subtle differences in numerical output at the e-12 level between LinuxPPC and LinuxI386, and I haven't checked that in depth as yet). 2003-07-03 04:11 paultcochrane * trunk/xmds-devel/source/Makefile.am: Initial import to repository 2003-07-01 08:56 paultcochrane * trunk/xmds-devel/AUTHORS, trunk/xmds-devel/COPYING, trunk/xmds-devel/INSTALL, trunk/xmds-devel/Makefile.am, trunk/xmds-devel/NEWS, trunk/xmds-devel/README, trunk/xmds-devel/configure.in, trunk/xmds-devel/install-sh, trunk/xmds-devel/ltmain.sh, trunk/xmds-devel/missing, trunk/xmds-devel/mkinstalldirs: Added initial version to repository 2003-07-01 08:55 paultcochrane * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xsil2graphics.cc: Minor alterations to standardise the naming conventions (e.g. VER is now VERSION) 2003-06-25 02:30 joehope * trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Making (MPI) size a global variable. Good for debugging. 2003-06-03 02:30 joehope * trunk/xmds-devel/source/xmdsintegrate.cc: Fixing case sensitive TRUE and FALSE 2003-05-31 08:21 joehope * trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Added element in . Places code before the integration loop. This is good for time dependent functions. 2003-05-31 05:53 joehope * trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc: Fixing two bugs for 0D systems with post-propagation output in fourier space. Allowing FFTWPLANS all the time, and fixing a verbose range check. 2003-04-17 06:22 joehope * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fix range on if statement for x-space moment group with a cross-section in the first transverse dimension (deterministic MPI only) 2003-04-17 04:52 joehope * trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc: Made rank a global variable. Good for debugging. 2003-04-17 01:55 joehope * trunk/xmds-devel/source/xmdsmomentgroup.cc: Fixed pointer initialisation in moment groups for a deterministic MPI simulation with a cross section in normal space for the first transverse dimension. 2003-04-16 07:05 joehope * trunk/xmds-devel/source/xmdsvector.cc: Fixed a compiler warning in renormalisation for deterministic MPI. 2003-04-16 05:43 joehope * trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsvector.cc: Two range fixes for deterministic MPI. 2003-04-16 02:49 joehope * trunk/xmds-devel/source/xmdscomplex.h: Made the promotion of complex to fftw_complex non-explicit. Less warnings, and it should be safe. 2003-04-16 02:46 joehope * trunk/xmds-devel/source/xmdscomplex.h: Fixed three errors in the algebra for the complex overload operators. Specifically: - (z), z*=double and z/=double were all broken! 2003-04-04 00:23 joehope * trunk/xmds-devel/examples/highdim.xmds: Making highdim.xmds an MPI-enabled script with fewer outputs. 2003-04-04 00:22 joehope * trunk/xmds-devel/examples/gaugeatomlaser.xmds: Reverted stochastic Fourier-space output to local-in-x form. 2003-04-04 00:01 joehope * trunk/xmds-devel/examples/ndparamp.xmds: Pre-version 1.0 cruft removal from examples 2003-03-28 03:03 joehope * trunk/xmds-devel/source/xmdsvector.cc: Extra print variable cruft removed 2003-03-27 07:43 joehope * trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/source/xmdssequence.cc: Nested subsequences now call their initialisation functions. 2003-03-27 07:29 joehope * trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/source/xmdsvector.cc: Mixed space transforms added for deterministic MPI. 2003-03-27 02:45 joehope * trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsvector.cc: Put TRUE and FALSE into lowercase. Needed for linux (for icc, at least). 2003-03-26 06:07 joehope * trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Passed cycle number right through to the integrate loops 2003-03-26 05:37 joehope * trunk/xmds-devel/examples/highdim.xmds, trunk/xmds-devel/source/xmdsmomentgroup.cc: Deterministic MPI nows works with all moment groups. Mixed space transforms still broken. 2003-03-25 04:26 joehope * trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc: Fixed cycles. Made all segments have access to the cycle number. Partial implementation of k-space output groups for deterministic MPI. 2003-03-24 23:38 joehope * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xsil2graphics.cc: Fixed xsil2graphics bug 708629. Added MPI changes to class definitions. 2003-03-24 09:13 joehope * trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvector.cc: Reversion to local-in-x tag with addition of the ability to use MPI on deterministic problems with >1 transverse dimensions. k-space moment groups and mixed space transforms currently broken. Simply compile with element as for stochastic problems. 2003-03-12 23:25 joehope * trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc: Memory reordering now complete. Cross-propagation should now be fully operational. 2003-03-11 06:23 joehope * trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsvector.cc: Reordered all the fields so that they are contiguous in memory when running through the FFTs rather than when going through x-space loops. This is in preparation for parallelisation. x-space heavy algorithms are slower and k-space heavy algorithms are faster. I have tested all the algorithms on gaugeatomlaser.xmds, and they all work identically to the stable branch. Cross-propagation is definitely broken - but fixable with effort. Mixed transforms should still work, but I haven't tested them on anything. Input files must now be reordered - components are now the slowest changing index rather than the fastest. 2003-03-10 03:55 joehope * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds: Updating the examples to make a tagged version. I want to have a "pre-reordering" version, as I'm about to rearrange the memory management of the main fields. 2003-03-04 02:35 joehope * trunk/xmds-devel/source/xmdsintegrateex.cc: Fixed missing segment name in xmdsintegrateex.cc (from previous speedup patch) 2003-03-03 03:58 joehope * trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc: Replaced various operations in the K_operater routines with index pointers. Provided detectable speedup. Modified Files: source/xmdsintegrateex.cc source/xmdsintegrateip.cc 2003-02-23 23:53 joehope * trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsvector.cc: Added partial support for threading. Placement of a 15 element in the simulation element will make the FFT use 15 threads. Further threading to follow. Default, and 1 is equivalent to the non-threaded code. Note that fftw must be compiled with the --enable-threads option. Modified Files: Configure examples/fullpos3D.xmds source/main.cc source/xmdsclasses.h source/xmdssequence.cc source/xmdssimulation.cc source/xmdsvector.cc 2003-02-03 04:42 joehope * trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc: Makefile has different options for different systems (different option order required) Stack no longer used for main fields (Simon) logical and rather than bitwise and (Simon) Details in changes.log 2003-02-03 01:23 joehope * trunk/xmds-devel, trunk/xmds-devel/examples, trunk/xmds-devel/examples/atomlaser.xmds, trunk/xmds-devel/examples/fibre.xmds, trunk/xmds-devel/examples/fullpos3D.xmds, trunk/xmds-devel/examples/gaugeatomlaser.xmds, trunk/xmds-devel/examples/kubo.xmds, trunk/xmds-devel/examples/ndparamp.xmds, trunk/xmds-devel/examples/nlse.xmds, trunk/xmds-devel/examples/sine.xmds, trunk/xmds-devel/examples/soliton.xmds, trunk/xmds-devel/examples/tla.xmds, trunk/xmds-devel/source, trunk/xmds-devel/source/dom3.h, trunk/xmds-devel/source/kissdom.cc, trunk/xmds-devel/source/kissdom.h, trunk/xmds-devel/source/main.cc, trunk/xmds-devel/source/xmdsclasses.h, trunk/xmds-devel/source/xmdscomplex.h, trunk/xmds-devel/source/xmdselement.cc, trunk/xmds-devel/source/xmdsfield.cc, trunk/xmds-devel/source/xmdsfilter.cc, trunk/xmds-devel/source/xmdsglobals.cc, trunk/xmds-devel/source/xmdsintegrate.cc, trunk/xmds-devel/source/xmdsintegrateex.cc, trunk/xmds-devel/source/xmdsintegrateip.cc, trunk/xmds-devel/source/xmdsintegraterk4.cc, trunk/xmds-devel/source/xmdsintegraterk4ex.cc, trunk/xmds-devel/source/xmdsintegraterk4ip.cc, trunk/xmds-devel/source/xmdsintegratesi.cc, trunk/xmds-devel/source/xmdsintegratesiex.cc, trunk/xmds-devel/source/xmdsintegratesiip.cc, trunk/xmds-devel/source/xmdsmomentgroup.cc, trunk/xmds-devel/source/xmdsoutput.cc, trunk/xmds-devel/source/xmdssegment.cc, trunk/xmds-devel/source/xmdssequence.cc, trunk/xmds-devel/source/xmdssimulation.cc, trunk/xmds-devel/source/xmdsutils.cc, trunk/xmds-devel/source/xmdsutils.h, trunk/xmds-devel/source/xmdsvector.cc, trunk/xmds-devel/source/xmdsvectorelement.cc, trunk/xmds-devel/source/xmlbasics.cc, trunk/xmds-devel/source/xmlbasics.h, trunk/xmds-devel/source/xmlparser.cc, trunk/xmds-devel/source/xmlparser.h, trunk/xmds-devel/source/xsil2graphics.cc, trunk/xmds-devel/source/xsilfield.cc, trunk/xmds-devel/source/xsilfield.h: Initial revision xmds-1.6.6/config.guess0000755000076500000240000011576311033276365011761 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-10-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # This shell variable is my proudest work .. or something. --bje set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; (old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; dummy=$tmpdir/dummy ; files="$dummy.c $dummy.o $dummy.rel $dummy" ; trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $files ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; unset files' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. eval $set_cc_for_build cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null if test "$?" = 0 ; then case `$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; 3-1307) UNAME_MACHINE="alphaev7" ;; esac fi rm -f $dummy.s $dummy && rmdir $tmpdir echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy && rmdir $tmpdir fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c && rmdir $tmpdir echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i386-pc-interix3 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c && rmdir $tmpdir test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c && rmdir $tmpdir test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xmds-1.6.6/config.sub0000755000076500000240000006703511033276365011422 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-08-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | s390 | s390x \ | sh | sh[34] | sh[34]eb | shbe | shle \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ | stormy16 | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 \ | we32k \ | x86 | xscale \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alphapca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ | mipsle-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | s390-* | s390x-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [cjt]90) basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xmds-1.6.6/configure0000755000076500000240000115232511033307502011330 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="source/main.cc" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA am__isrc CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S RANLIB CPP GREP EGREP ALLOCA build build_cpu build_vendor build_os host host_cpu host_vendor host_os PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS THREADLIBS MPICC MPILIBS LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CC CFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-mpi If you want to use mpi, then set this flag --enable-threads If you want to use threads, then set this flag --enable-fftw3 If you want to use fftw3, then set this flag --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-fftw-path Set the path to the prefix of your fftw distribution --with-fftw3-path Set the path to the prefix of your fftw3 distribution (defaults to the path to fftw2, if set) --with-user Install XMDS into user's bin directory --with-mpi-libs Extra libraries needed when checking for MPI --with-mpi-path Set the path to the prefix of your mpi distribution --with-mpi-compiler Set the mpi C compiler Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu XMDS_VERSION="1.6.6" am__api_version='1.10' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { echo "$as_me:$LINENO: result: $MKDIR_P" >&5 echo "${ECHO_T}$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=xmds VERSION="$XMDS_VERSION" cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers source/config.h" PACKAGE=xmds VERSION="$XMDS_VERSION" # Check whether --with-fftw-path was given. if test "${with_fftw_path+set}" = set; then withval=$with_fftw_path; FFTW_PATH="$withval" else FFTW_PATH="" fi # Check whether --with-fftw3-path was given. if test "${with_fftw3_path+set}" = set; then withval=$with_fftw3_path; FFTW3_PATH="$withval" else FFTW3_PATH="$FFTW_PATH" fi # Check whether --with-user was given. if test "${with_user+set}" = set; then withval=$with_user; bindir="$HOME"/bin includedir="$HOME"/bin libdir="$HOME"/bin mandir="$HOME"/man docdir="$HOME"/doc/xmds USER_LIB="$HOME"/bin USER_INCLUDE="$HOME"/bin echo "XMDS will be installed into $bindir" else USER_INCLUDE="." USER_LIB="." fi # Check whether --with-mpi-libs was given. if test "${with_mpi_libs+set}" = set; then withval=$with_mpi_libs; MPI_LIBS="$withval" else MPI_LIBS="$MPI_LIBS" fi # Check whether --with-mpi-path was given. if test "${with_mpi_path+set}" = set; then withval=$with_mpi_path; MPI_PATH="$withval" PATH="$PATH:$withval/bin" else MPI_PATH="$MPI_PATH" fi # Check whether --with-mpi-compiler was given. if test "${with_mpi_compiler+set}" = set; then withval=$with_mpi_compiler; fi # Check whether --enable-mpi was given. if test "${enable_mpi+set}" = set; then enableval=$enable_mpi; fi # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then enableval=$enable_threads; fi # Check whether --enable-fftw3 was given. if test "${enable_fftw3+set}" = set; then enableval=$enable_fftw3; fi AGGRESSIVE_GCC_CFLAGS=" -O3 -ffast-math -funroll-all-loops -fomit-frame-pointer" AGGRESSIVE_ICC_CFLAGS=" -O3 -tpp7 -ipo -ipo_obj" { echo "$as_me:$LINENO: checking for vendor's cc to be used instead of gcc" >&5 echo $ECHO_N "checking for vendor's cc to be used instead of gcc... $ECHO_C" >&6; } # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi { echo "$as_me:$LINENO: checking for vendor's cxx to be used instead of gcc" >&5 echo $ECHO_N "checking for vendor's cxx to be used instead of gcc... $ECHO_C" >&6; } # Extract the first word of "cxx", so it can be a program name with args. set dummy cxx; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="cxx" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C++ compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C++ compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { echo "$as_me:$LINENO: checking for library containing strerror" >&5 echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6; } if test "${ac_cv_search_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_strerror=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_strerror+set}" = set; then break fi done if test "${ac_cv_search_strerror+set}" = set; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 echo "${ECHO_T}$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6; } fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi XMDS_INCLUDES="-I$USER_INCLUDE" if test "x$FFTW_PATH" != "x" then FFTW_LIB_PATH="$FFTW_PATH/lib/" FFTW_INCLUDE_PATH="$FFTW_PATH/include/" XMDS_INCLUDES="$XMDS_INCLUDES -I$FFTW_INCLUDE_PATH" fi if test "x$FFTW3_PATH" != "x" then FFTW3_LIB_PATH="$FFTW3_PATH/lib/" FFTW3_INCLUDE_PATH="$FFTW3_PATH/include/" XMDS_INCLUDES="$XMDS_INCLUDES -I$FFTW3_INCLUDE_PATH" fi if test "x$MPI_PATH" != "x" then MPI_LIB_PATH="-L$MPI_PATH/lib/" MPI_INCLUDE_PATH="-I$MPI_PATH/include/" XMDS_INCLUDES="$XMDS_INCLUDES $MPI_INCLUDE_PATH" fi { echo "$as_me:$LINENO: checking for sqrt in -lm" >&5 echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6; } if test "${ac_cv_lib_m_sqrt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_m_sqrt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_sqrt=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5 echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6; } if test $ac_cv_lib_m_sqrt = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi { echo "$as_me:$LINENO: checking for cout in -lstdc++" >&5 echo $ECHO_N "checking for cout in -lstdc++... $ECHO_C" >&6; } if test "${ac_cv_lib_stdcpp_cout+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lstdc++ $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cout (); int main () { return cout (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_stdcpp_cout=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_stdcpp_cout=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_stdcpp_cout" >&5 echo "${ECHO_T}$ac_cv_lib_stdcpp_cout" >&6; } if test $ac_cv_lib_stdcpp_cout = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSTDC__ 1 _ACEOF LIBS="-lstdc++ $LIBS" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # Can't have this one when mpicc and cc are mixed non-gnu/gnu #if test "x$CC" = xgcc #then # CFLAGS="$CFLAGS -Wall -pedantic" # CXXFLAGS="$CXXFLAGS -Wall -pedantic -ansi" #fi # Add some warnings to the build if test "x$CC" = "xgcc" then WARN_FLAGS="-Wall " else WARN_FLAGS=" " # Sun's cc doesn't recognise -Wall fi CFLAGS="$CFLAGS $WARN_FLAGS" CXXFLAGS="$CXXFLAGS $WARN_FLAGS" # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { echo "$as_me:$LINENO: checking for working alloca.h" >&5 echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_working_alloca_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 _ACEOF fi { echo "$as_me:$LINENO: checking for alloca" >&5 echo $ECHO_N "checking for alloca... $ECHO_C" >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_alloca_works=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 _ACEOF else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext cat >>confdefs.h <<\_ACEOF #define C_ALLOCA 1 _ACEOF { echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; } if test "${ac_cv_os_cray+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 echo "${ECHO_T}$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi if test "x$enable_threads" = "xyes" then # POSIX threads, the default choice: if test -z "$THREADLIBS"; then # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then acx_pthread_ok=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 echo "${ECHO_T}$acx_pthread_ok" >&6; } if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) { echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5 echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6; } ;; -*) { echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5 echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6; } PTHREAD_CFLAGS="$flag" ;; *) { echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5 echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then acx_pthread_ok=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 echo "${ECHO_T}$acx_pthread_ok" >&6; } if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). { echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5 echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int attr=PTHREAD_CREATE_JOINABLE; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ok=PTHREAD_CREATE_JOINABLE else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ok=unknown fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test x"$ok" = xunknown; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int attr=PTHREAD_CREATE_UNDETACHED; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ok=PTHREAD_CREATE_UNDETACHED else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ok=unknown fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<\_ACEOF #define PTHREAD_CREATE_JOINABLE $ok _ACEOF fi { echo "$as_me:$LINENO: result: ${ok}" >&5 echo "${ECHO_T}${ok}" >&6; } if test x"$ok" = xunknown; then { echo "$as_me:$LINENO: WARNING: we do not know how to create joinable pthreads" >&5 echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;} fi { echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5 echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { echo "$as_me:$LINENO: result: ${flag}" >&5 echo "${ECHO_T}${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r # Extract the first word of "cc_r", so it can be a program name with args. set dummy cc_r; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PTHREAD_CC="cc_r" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}" fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5 echo "${ECHO_T}$PTHREAD_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then THREADLIBS="$PTHREAD_LIBS " CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" tempXMDS_CFLAGS="$PTHREAD_CFLAGS" tempMPICCFLAGS="$PTHREAD_CFLAGS" CC="$PTHREAD_CC" cat >>confdefs.h <<\_ACEOF #define XMDS_USING_POSIX_THREADS _ACEOF : else acx_pthread_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi # Solaris threads: if test -z "$THREADLIBS"; then { echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6; } if test "${ac_cv_lib_thread_thr_create+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char thr_create (); int main () { return thr_create (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_thread_thr_create=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_thread_thr_create=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 echo "${ECHO_T}$ac_cv_lib_thread_thr_create" >&6; } if test $ac_cv_lib_thread_thr_create = yes; then THREADLIBS="-lthread" cat >>confdefs.h <<\_ACEOF #define XMDS_USING_SOLARIS_THREADS _ACEOF fi fi # Mach C threads: if test -z "$THREADLIBS"; then { echo "$as_me:$LINENO: checking for cthread_fork" >&5 echo $ECHO_N "checking for cthread_fork... $ECHO_C" >&6; } if test "${ac_cv_func_cthread_fork+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define cthread_fork to an innocuous variant, in case declares cthread_fork. For example, HP-UX 11i declares gettimeofday. */ #define cthread_fork innocuous_cthread_fork /* System header to define __stub macros and hopefully few prototypes, which can conflict with char cthread_fork (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef cthread_fork /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cthread_fork (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_cthread_fork || defined __stub___cthread_fork choke me #endif int main () { return cthread_fork (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_cthread_fork=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_cthread_fork=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_cthread_fork" >&5 echo "${ECHO_T}$ac_cv_func_cthread_fork" >&6; } if test $ac_cv_func_cthread_fork = yes; then THREADLIBS=" " cat >>confdefs.h <<\_ACEOF #define XMDS_USING_MACH_THREADS _ACEOF fi for ac_header in mach/cthreads.h cthreads.h cthread.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi if test -z "$THREADLIBS"; then { echo "$as_me:$LINENO: checking for cthread_fork in -lcthread" >&5 echo $ECHO_N "checking for cthread_fork in -lcthread... $ECHO_C" >&6; } if test "${ac_cv_lib_cthread_cthread_fork+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcthread $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cthread_fork (); int main () { return cthread_fork (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_cthread_cthread_fork=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cthread_cthread_fork=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_cthread_cthread_fork" >&5 echo "${ECHO_T}$ac_cv_lib_cthread_cthread_fork" >&6; } if test $ac_cv_lib_cthread_cthread_fork = yes; then THREADLIBS="-lcthread" cat >>confdefs.h <<\_ACEOF #define XMDS_USING_MACH_THREADS _ACEOF fi for ac_header in mach/cthreads.h cthreads.h cthread.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi if test -z "$THREADLIBS"; then { echo "$as_me:$LINENO: checking for cthread_fork in -lcthreads" >&5 echo $ECHO_N "checking for cthread_fork in -lcthreads... $ECHO_C" >&6; } if test "${ac_cv_lib_cthreads_cthread_fork+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcthreads $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cthread_fork (); int main () { return cthread_fork (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_cthreads_cthread_fork=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cthreads_cthread_fork=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_cthreads_cthread_fork" >&5 echo "${ECHO_T}$ac_cv_lib_cthreads_cthread_fork" >&6; } if test $ac_cv_lib_cthreads_cthread_fork = yes; then THREADLIBS="-lcthreads" cat >>confdefs.h <<\_ACEOF #define XMDS_USING_MACH_THREADS _ACEOF fi for ac_header in mach/cthreads.h cthreads.h cthread.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi # BeOS threads: if test -z "$THREADLIBS"; then { echo "$as_me:$LINENO: checking for spawn_thread" >&5 echo $ECHO_N "checking for spawn_thread... $ECHO_C" >&6; } if test "${ac_cv_func_spawn_thread+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define spawn_thread to an innocuous variant, in case declares spawn_thread. For example, HP-UX 11i declares gettimeofday. */ #define spawn_thread innocuous_spawn_thread /* System header to define __stub macros and hopefully few prototypes, which can conflict with char spawn_thread (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef spawn_thread /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char spawn_thread (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_spawn_thread || defined __stub___spawn_thread choke me #endif int main () { return spawn_thread (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_spawn_thread=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_spawn_thread=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_spawn_thread" >&5 echo "${ECHO_T}$ac_cv_func_spawn_thread" >&6; } if test $ac_cv_func_spawn_thread = yes; then THREADLIBS=" " cat >>confdefs.h <<\_ACEOF #define XMDS_USING_BEOS_THREADS _ACEOF fi fi if test -z "$THREADLIBS"; then { { echo "$as_me:$LINENO: error: couldn't find threads library" >&5 echo "$as_me: error: couldn't find threads library" >&2;} { (exit 1); exit 1; }; } fi # end enable_threads test fi ### This code included from libsndfile configure.ac. # Determine endian-ness of target processor. { echo "$as_me:$LINENO: checking determining processor byte ordering" >&5 echo $ECHO_N "checking determining processor byte ordering... $ECHO_C" >&6; } if test "${ac_cv_c_byte_order+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Initialize to unknown ac_cv_c_byte_order=unknown if test x$ac_cv_header_endian_h = xyes ; then # First try which should set BYTE_ORDER. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if BYTE_ORDER != LITTLE_ENDIAN not big endian #endif int main () { return 0 ; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_c_byte_order=little else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if BYTE_ORDER != BIG_ENDIAN not big endian #endif int main () { return 0 ; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_c_byte_order=big else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi if test $ac_cv_c_byte_order = unknown ; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif int main () { return 0 ; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if BYTE_ORDER != LITTLE_ENDIAN not big endian #endif int main () { return 0 ; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_c_byte_order=little else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if BYTE_ORDER != LITTLE_ENDIAN not big endian #endif int main () { return 0 ; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_c_byte_order=little else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi if test $ac_cv_c_byte_order = unknown ; then if test $cross_compiling = yes ; then # This is the last resort. Try to guess the target processor endian-ness # by looking at the target CPU type. case "$target_cpu" in alpha* | i?86* | mipsel* | ia64*) ac_cv_c_big_endian=0 ac_cv_c_little_endian=1 ;; m68* | mips* | powerpc* | hppa* | sparc*) ac_cv_c_big_endian=1 ac_cv_c_little_endian=0 ;; esac else if test "$cross_compiling" = yes; then ac_cv_c_byte_order=unknown else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long l ; char c [sizeof (long)] ; } u ; u.l = 1 ; return (u.c [sizeof (long) - 1] == 1); } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_byte_order=big fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test "$cross_compiling" = yes; then ac_cv_c_byte_order=unknown else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main (void) { /* Are we little or big endian? From Harbison&Steele. */ union { long l ; char c [sizeof (long)] ; } u ; u.l = 1 ; return (u.c [0] == 1); } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_byte_order=little fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_c_byte_order" >&5 echo "${ECHO_T}$ac_cv_c_byte_order" >&6; } if test $ac_cv_c_byte_order = big ; then ac_cv_c_big_endian=1 ac_cv_c_little_endian=0 elif test $ac_cv_c_byte_order = little ; then ac_cv_c_big_endian=0 ac_cv_c_little_endian=1 else ac_cv_c_big_endian=0 ac_cv_c_little_endian=0 echo "$as_me: WARNING: *****************************************************************" >&2 echo "$as_me: WARNING: *** Not able to determine endian-ness of target processor. " >&2 echo "$as_me: WARNING: *** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in " >&2 echo "$as_me: WARNING: *** src/config.h may need to be hand editied. " >&2 echo "$as_me: WARNING: *****************************************************************" >&2 fi cat >>confdefs.h <<_ACEOF #define CPU_IS_BIG_ENDIAN ${ac_cv_c_big_endian} _ACEOF cat >>confdefs.h <<_ACEOF #define CPU_IS_LITTLE_ENDIAN ${ac_cv_c_little_endian} _ACEOF { echo "$as_me:$LINENO: checking for unsigned long" >&5 echo $ECHO_N "checking for unsigned long... $ECHO_C" >&6; } if test "${ac_cv_type_unsigned_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_unsigned_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_unsigned_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long" >&5 echo "${ECHO_T}$ac_cv_type_unsigned_long" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of unsigned long" >&5 echo $ECHO_N "checking size of unsigned long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_unsigned_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_unsigned_long=$ac_lo;; '') if test "$ac_cv_type_unsigned_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_unsigned_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef unsigned long ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_unsigned_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_unsigned_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (unsigned long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_unsigned_long=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_unsigned_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long _ACEOF # This defines SIZEOF_UNSIGNED_LONG, which is 4 for 32 bit and 8 for 64 bit FFTW_EXISTS="yes" HAVE_FFTW_TWO="yes" if test "x$FFTW_PATH" = "x" then for ac_header in "$FFTW_INCLUDE_PATH"fftw.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else echo "Eeek! I can't find fftw.h!"; echo "It doesn't look like you'll be able to use fftw"; echo "Are you sure that --with-fftw-path is set correctly?" fi done else as_ac_File=`echo "ac_cv_file_"$FFTW_INCLUDE_PATH"fftw.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for \"$FFTW_INCLUDE_PATH\"fftw.h" >&5 echo $ECHO_N "checking for \"$FFTW_INCLUDE_PATH\"fftw.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r ""$FFTW_INCLUDE_PATH"fftw.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then : else echo "Eeek! I can't find fftw.h!"; echo "It doesn't look like you'll be able to use fftw"; echo "Are you sure that --with-fftw-path is set correctly?" fi fi # only add FFTW_LIB_PATH to LDFLAGS when it is defined # TODO: how variables are set in configure.in need to be cleaned up, it's # getting hard to understand everything all in one go... if test "x$FFTW_LIB_PATH" != "x" then LDFLAGS="$LDFLAGS -L$FFTW_LIB_PATH" fi { echo "$as_me:$LINENO: checking for fftw_create_plan in -lfftw" >&5 echo $ECHO_N "checking for fftw_create_plan in -lfftw... $ECHO_C" >&6; } if test "${ac_cv_lib_fftw_fftw_create_plan+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw_create_plan (); int main () { return fftw_create_plan (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_fftw_fftw_create_plan=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fftw_fftw_create_plan=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_fftw_fftw_create_plan" >&5 echo "${ECHO_T}$ac_cv_lib_fftw_fftw_create_plan" >&6; } if test $ac_cv_lib_fftw_fftw_create_plan = yes; then FFTW_LIBS="-lfftw" else echo "Bummer! fftw (version 2) doesn't seem to work"; echo "You need fftw to use xmds properly."; echo "Maybe you meant to use fftw version 3?"; echo "If so, you need to pass --enable-fftw3 to configure"; FFTW_EXISTS="no"; HAVE_FFTW_TWO="no" fi # check for fftw3 if we enabled its use if test "x$enable_fftw3" = "xyes" then FFTW_EXISTS="yes" HAVE_FFTW_THREE="yes" if test "x$FFTW3_PATH" = "x" then for ac_header in "$FFTW3_INCLUDE_PATH"fftw3.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else echo "Eeek! I can't find fftw3.h!"; echo "It doesn't look like you'll be able to use fftw3"; echo "Are you sure that --with-fftw3-path is set correctly?" fi done else as_ac_File=`echo "ac_cv_file_"$FFTW3_INCLUDE_PATH"fftw3.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for \"$FFTW3_INCLUDE_PATH\"fftw3.h" >&5 echo $ECHO_N "checking for \"$FFTW3_INCLUDE_PATH\"fftw3.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r ""$FFTW3_INCLUDE_PATH"fftw3.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then : else echo "Eeek! I can't find fftw3.h!"; echo "It doesn't look like you'll be able to use fftw3"; echo "Are you sure that --with-fftw3-path is set correctly?" fi fi # only add FFTW3_LIB_PATH to LDFLAGS when it is defined if test -n "$FFTW3_LIB_PATH" then LDFLAGS="$LDFLAGS -L$FFTW3_LIB_PATH" fi { echo "$as_me:$LINENO: checking for fftw_execute in -lfftw3" >&5 echo $ECHO_N "checking for fftw_execute in -lfftw3... $ECHO_C" >&6; } if test "${ac_cv_lib_fftw3_fftw_execute+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw3 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw_execute (); int main () { return fftw_execute (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_fftw3_fftw_execute=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fftw3_fftw_execute=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_fftw3_fftw_execute" >&5 echo "${ECHO_T}$ac_cv_lib_fftw3_fftw_execute" >&6; } if test $ac_cv_lib_fftw3_fftw_execute = yes; then FFTW3_LIBS="-lfftw3" else echo "Bummer! fftw3 doesn't seem to work"; echo "You asked for fftw3, but you will need to install it to use it"; echo "If you have installed it, make sure you have passed the correct"; echo "path to fftw3 with the --with-fftw3-path option"; echo "fftw3 is available from http://www.fftw.org"; exit fi fi # if we couldn't find fftw2 and the test for fftw3 failed, then make sure we # report an error appropriately if test "x$FFTW_EXISTS" = "xno" then echo "" echo "Unable to find a working fftw version." echo "If you have installed it, make sure you have passed the correct" echo "path to fftw with the --with-fftw-path option" echo "fftw is available from http://www.fftw.org" exit fi FFTW3_THREADLIBS="$THREADLIBS" # if threads are enabled, check to see if fftw_threads is available if test "x$enable_threads" = "xyes" then if test "x$FFTW_PATH" = "x" then for ac_header in "$FFTW_INCLUDE_PATH"fftw_threads.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else echo "Eeek! I can't find fftw_threads.h!"; echo "It doesn't look like you'll be able to use fftw_threads"; echo "Continuing anyway" fi done else as_ac_File=`echo "ac_cv_file_"$FFTW_INCLUDE_PATH"fftw_threads.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for \"$FFTW_INCLUDE_PATH\"fftw_threads.h" >&5 echo $ECHO_N "checking for \"$FFTW_INCLUDE_PATH\"fftw_threads.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r ""$FFTW_INCLUDE_PATH"fftw_threads.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then : else echo "Eeek! I can't find fftw_threads.h!"; echo "It doesn't look like you'll be able to use fftw_threads"; echo "Continuing anyway" fi fi { echo "$as_me:$LINENO: checking for fftw_threads_init in -lfftw_threads" >&5 echo $ECHO_N "checking for fftw_threads_init in -lfftw_threads... $ECHO_C" >&6; } if test "${ac_cv_lib_fftw_threads_fftw_threads_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw_threads "$FFTW_LIBS" "$THREADLIBS" $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw_threads_init (); int main () { return fftw_threads_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_fftw_threads_fftw_threads_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fftw_threads_fftw_threads_init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_fftw_threads_fftw_threads_init" >&5 echo "${ECHO_T}$ac_cv_lib_fftw_threads_fftw_threads_init" >&6; } if test $ac_cv_lib_fftw_threads_fftw_threads_init = yes; then THREADLIBS="-L$FFTW_LIB_PATH -lfftw_threads $THREADLIBS"; FFTW_THREADS="-lfftw_threads" else echo "Eeek! fftw_threads doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw_threads"; echo "Perhaps you need to use --enable-threads in fftw??"; echo "Continuing anyway" fi if test x"$enable_fftw3" = "xyes" then { echo "$as_me:$LINENO: checking for fftw_init_threads in -lfftw3_threads" >&5 echo $ECHO_N "checking for fftw_init_threads in -lfftw3_threads... $ECHO_C" >&6; } if test "${ac_cv_lib_fftw3_threads_fftw_init_threads+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw3_threads "$FFTW3_LIBS" "$FFTW3_THREADLIBS" $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw_init_threads (); int main () { return fftw_init_threads (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_fftw3_threads_fftw_init_threads=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fftw3_threads_fftw_init_threads=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_fftw3_threads_fftw_init_threads" >&5 echo "${ECHO_T}$ac_cv_lib_fftw3_threads_fftw_init_threads" >&6; } if test $ac_cv_lib_fftw3_threads_fftw_init_threads = yes; then FFTW3_THREADLIBS="$FFTW3_THREADLIBS -lfftw3_threads" else echo "Eeek! fftw3_threads doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw3_threads"; echo "Perhaps you need to use --enable-threads in fftw3??"; echo "Continuing anyway" fi fi # end enable_threads check fi if test "x$enable_mpi" = "xyes" then if test -n "$with_mpi_compiler" then MPICC="$with_mpi_compiler" fi for ac_prog in mpicc hcc mpcc mpcc_r mpxlc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_MPICC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MPICC"; then ac_cv_prog_MPICC="$MPICC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MPICC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MPICC=$ac_cv_prog_MPICC if test -n "$MPICC"; then { echo "$as_me:$LINENO: result: $MPICC" >&5 echo "${ECHO_T}$MPICC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$MPICC" && break done test -n "$MPICC" || MPICC="$CC" acx_mpi_save_CC="$CC" CC="$MPICC" if test x = x"$MPILIBS"; then { echo "$as_me:$LINENO: checking for MPI_Init" >&5 echo $ECHO_N "checking for MPI_Init... $ECHO_C" >&6; } if test "${ac_cv_func_MPI_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define MPI_Init to an innocuous variant, in case declares MPI_Init. For example, HP-UX 11i declares gettimeofday. */ #define MPI_Init innocuous_MPI_Init /* System header to define __stub macros and hopefully few prototypes, which can conflict with char MPI_Init (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef MPI_Init /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char MPI_Init (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_MPI_Init || defined __stub___MPI_Init choke me #endif int main () { return MPI_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func_MPI_Init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_MPI_Init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_MPI_Init" >&5 echo "${ECHO_T}$ac_cv_func_MPI_Init" >&6; } if test $ac_cv_func_MPI_Init = yes; then MPILIBS=" " fi fi if test x = x"$MPILIBS"; then { echo "$as_me:$LINENO: checking for MPI_Init in -lmpi" >&5 echo $ECHO_N "checking for MPI_Init in -lmpi... $ECHO_C" >&6; } if test "${ac_cv_lib_mpi_MPI_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmpi $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char MPI_Init (); int main () { return MPI_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_mpi_MPI_Init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mpi_MPI_Init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_mpi_MPI_Init" >&5 echo "${ECHO_T}$ac_cv_lib_mpi_MPI_Init" >&6; } if test $ac_cv_lib_mpi_MPI_Init = yes; then MPILIBS="-lmpi" fi fi if test x = x"$MPILIBS"; then { echo "$as_me:$LINENO: checking for MPI_Init in -lmpich" >&5 echo $ECHO_N "checking for MPI_Init in -lmpich... $ECHO_C" >&6; } if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmpich $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char MPI_Init (); int main () { return MPI_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_mpich_MPI_Init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mpich_MPI_Init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_mpich_MPI_Init" >&5 echo "${ECHO_T}$ac_cv_lib_mpich_MPI_Init" >&6; } if test $ac_cv_lib_mpich_MPI_Init = yes; then MPILIBS="-lmpich" fi fi if test x != x"$MPILIBS"; then { echo "$as_me:$LINENO: checking for mpi.h" >&5 echo $ECHO_N "checking for mpi.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 MPILIBS="" { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi CC="$acx_mpi_save_CC" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x = x"$MPILIBS"; then { { echo "$as_me:$LINENO: error: couldn't find mpi library" >&5 echo "$as_me: error: couldn't find mpi library" >&2;} { (exit 1); exit 1; }; } : else cat >>confdefs.h <<\_ACEOF #define HAVE_MPI 1 _ACEOF : fi joempi_save_CC="$CC" joempi_save_CPP="$CPP" CC="$MPICC" CPP="$MPICC -E" save_LIBS="$LIBS" { echo "$as_me:$LINENO: checking for lamlog in -llam" >&5 echo $ECHO_N "checking for lamlog in -llam... $ECHO_C" >&6; } if test "${ac_cv_lib_lam_lamlog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llam -lmpi "$MPI_LIB_PATH" $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char lamlog (); int main () { return lamlog (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_lam_lamlog=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_lam_lamlog=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_lam_lamlog" >&5 echo "${ECHO_T}$ac_cv_lib_lam_lamlog" >&6; } if test $ac_cv_lib_lam_lamlog = yes; then MPILIBS="-lmpi -llam $MPILIBS" fi lamTest=`echo "$MPILIBS" | grep 'llam' | cut -f1 -d' '` if test x"$lamTest" = x then { echo "$as_me:$LINENO: checking for MPI_Init in -lmpich" >&5 echo $ECHO_N "checking for MPI_Init in -lmpich... $ECHO_C" >&6; } if test "${ac_cv_lib_mpich_MPI_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmpich "$MPI_LIB_PATH" $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char MPI_Init (); int main () { return MPI_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_mpich_MPI_Init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mpich_MPI_Init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_mpich_MPI_Init" >&5 echo "${ECHO_T}$ac_cv_lib_mpich_MPI_Init" >&6; } if test $ac_cv_lib_mpich_MPI_Init = yes; then MPILIBS="-lmpich $MPILIBS" fi else # test to see if lam has added in -llammpi++ lammpiTest=`mpicc -showme | grep 'lammpi++'` if test x"$lammpiTest" = x then # append -llammpi++ to $MPILIBS MPILIBS="$MPILIBS -llammpi++" fi fi # we don't want to add -lmpi -llam or -lmpich to the LIBS variable LIBS="$save_LIBS" if test "x$FFTW_PATH" = "x" then for ac_header in "$FFTW_INCLUDE_PATH"fftw_mpi.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else echo "Eeek! I can't find fftw_mpi.h!"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Continuing anyway" fi done else as_ac_File=`echo "ac_cv_file_"$FFTW_INCLUDE_PATH"fftw_mpi.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for \"$FFTW_INCLUDE_PATH\"fftw_mpi.h" >&5 echo $ECHO_N "checking for \"$FFTW_INCLUDE_PATH\"fftw_mpi.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r ""$FFTW_INCLUDE_PATH"fftw_mpi.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then : else echo "Eeek! I can't find fftw_mpi.h!"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Continuing anyway" fi fi { echo "$as_me:$LINENO: checking for fftw2d_mpi_create_plan in -lfftw_mpi" >&5 echo $ECHO_N "checking for fftw2d_mpi_create_plan in -lfftw_mpi... $ECHO_C" >&6; } if test "${ac_cv_lib_fftw_mpi_fftw2d_mpi_create_plan+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfftw_mpi "$THREADLIBS" "$FFTW_LIBS" "$MPILIBS" "$MPI_LIBS" "$MPI_LIB_PATH" "$MPI_INCLUDE_PATH" $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fftw2d_mpi_create_plan (); int main () { return fftw2d_mpi_create_plan (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_fftw_mpi_fftw2d_mpi_create_plan=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fftw_mpi_fftw2d_mpi_create_plan=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_fftw_mpi_fftw2d_mpi_create_plan" >&5 echo "${ECHO_T}$ac_cv_lib_fftw_mpi_fftw2d_mpi_create_plan" >&6; } if test $ac_cv_lib_fftw_mpi_fftw2d_mpi_create_plan = yes; then FFTW_MPI="-lfftw_mpi" else echo "Eeek! fftw_mpi doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Perhaps you need to use --enable-mpi in fftw??"; echo "Continuing anyway" fi CC="$joempi_save_CC" CPP="$joempi_save_CPP" fi if test -z "$FFTW_PATH" then FFTW_MPI_LIBS="$FFTW_THREADS $FFTW_MPI $FFTW_LIBS" FFTW_LIBS="$FFTW_THREADS $FFTW_LIBS" else FFTW_MPI_LIBS="-L$FFTW_LIB_PATH $FFTW_THREADS $FFTW_MPI $FFTW_LIBS" FFTW_LIBS="-L$FFTW_LIB_PATH $FFTW_THREADS $FFTW_LIBS" fi if test "x$FFTW3_PATH" != "x" then FFTW3_LIBS="-L$FFTW3_LIB_PATH $FFTW3_LIBS" fi XMDS_LIBS="$LIBS -L$USER_LIB -lxmds" LIBS="$LIBS -L. -lxmds" cat >>confdefs.h <<_ACEOF #define CC "$CC" _ACEOF cat >>confdefs.h <<_ACEOF #define CXX "$CXX" _ACEOF cat >>confdefs.h <<_ACEOF #define CFLAGS "$CFLAGS" _ACEOF cat >>confdefs.h <<_ACEOF #define CXXFLAGS "$CXXFLAGS" _ACEOF cat >>confdefs.h <<_ACEOF #define LIBS "$LIBS" _ACEOF cat >>confdefs.h <<_ACEOF #define INCLUDES "$INCLUDES" _ACEOF cat >>confdefs.h <<_ACEOF #define THREADLIBS "$THREADLIBS" _ACEOF cat >>confdefs.h <<_ACEOF #define FFTW_MPI_LIBS "$FFTW_MPI_LIBS" _ACEOF cat >>confdefs.h <<_ACEOF #define FFTW_LIBS "$FFTW_LIBS" _ACEOF cat >>confdefs.h <<_ACEOF #define FFTW3_LIBS "$FFTW3_LIBS" _ACEOF cat >>confdefs.h <<_ACEOF #define FFTW3_THREADLIBS "$FFTW3_THREADLIBS" _ACEOF # if we have detected fftw3, set the relevant flags FFTW_THREE_ONLY=0 if test "x$HAVE_FFTW_THREE" = "xyes" then # if we have *only* fftw3 then use the FFTW3 libs for FFTW if test "x$HAVE_FFTW_TWO" = "xno" then cat >>confdefs.h <<_ACEOF #define FFTW_LIBS "$FFTW3_LIBS" _ACEOF FFTW_THREE_ONLY=1 fi cat >>confdefs.h <<_ACEOF #define FFTW_THREE_ONLY $FFTW_THREE_ONLY _ACEOF fi if test "x$XMDS_CC" = "xicc" then XMDS_LIBS="$XMDS_LIBS" if test -z "$XMDS_CFLAGS" then XMDS_CFLAGS="$tempXMDS_CFLAGS $AGGRESSIVE_ICC_CFLAGS" fi else XMDS_CC="$CXX" fi if test x"$ac_compiler_gnu" = xyes -a "x$XMDS_CC" != "xicc" then XMDS_CFLAGS="$tempXMDS_CFLAGS $AGGRESSIVE_GCC_CFLAGS" fi if test -z "$XMDS_CFLAGS" then XMDS_CFLAGS="$CFLAGS" fi if test -n "$XMDS_CFLAGS" then xmdsflagsTest=`echo "$XMDS_CFLAGS" | grep 'pthread'` if test -z "$xmdsflagsTest" -a -n "$PTHREAD_CFLAGS" then { echo "$as_me:$LINENO: WARNING: $PTHREAD_CFLAGS required for xmds but not in XMDS_CFLAGS; appending" >&5 echo "$as_me: WARNING: $PTHREAD_CFLAGS required for xmds but not in XMDS_CFLAGS; appending" >&2;} XMDS_CFLAGS="$XMDS_CFLAGS $PTHREAD_CFLAGS" fi fi tru64Test=`cxx -V 2>/dev/null| grep 'Tru64'` if test -n "$tru64Test" then { echo "$as_me:$LINENO: WARNING: It looks like you are using the Tru64 compiler..." >&5 echo "$as_me: WARNING: It looks like you are using the Tru64 compiler..." >&2;} { echo "$as_me:$LINENO: WARNING: I will set __USE_STD_IOSTREAM appropriately" >&5 echo "$as_me: WARNING: I will set __USE_STD_IOSTREAM appropriately" >&2;} XMDS_CFLAGS="$XMDS_CFLAGS -D__USE_STD_IOSTREAM=1" fi cat >>confdefs.h <<_ACEOF #define XMDS_CC "$XMDS_CC" _ACEOF cat >>confdefs.h <<_ACEOF #define XMDS_CFLAGS "$XMDS_CFLAGS" _ACEOF cat >>confdefs.h <<_ACEOF #define XMDS_LIBS "$XMDS_LIBS" _ACEOF cat >>confdefs.h <<_ACEOF #define XMDS_INCLUDES "$XMDS_INCLUDES" _ACEOF if test x"$MPICC" = xmpicc then { echo "$as_me:$LINENO: checking how mpicc is run" >&5 echo $ECHO_N "checking how mpicc is run... $ECHO_C" >&6; } lamTest=`echo "$MPILIBS" | grep 'llam' | cut -f1 -d' '` mpichTest=`echo "$MPILIBS" | grep 'lmpich' | cut -f1 -d' '` if test x"$lamTest" != x then mpiccTest=`mpicc -showme | cut -f1 -d' '` elif test x"$mpichTest" != x then mpiccTest=`mpicc -show | cut -f1 -d' '` fi if test -z "$mpiccTest" then { echo "$as_me:$LINENO: WARNING: cannot work out how mpicc is run; assuming gcc" >&5 echo "$as_me: WARNING: cannot work out how mpicc is run; assuming gcc" >&2;} mpiccTest=gcc fi stdcTest=`echo "$LIBS" | grep 'stdc++'` case "$mpiccTest" in *gcc* ) if test -z "$stdcTest" then MPILIBS="$MPILIBS -lstdc++" fi { echo "$as_me:$LINENO: result: gcc" >&5 echo "${ECHO_T}gcc" >&6; } ;; *icc* ) { echo "$as_me:$LINENO: result: icc" >&5 echo "${ECHO_T}icc" >&6; } ;; * ) { echo "$as_me:$LINENO: result: \"$mpiccTest\"" >&5 echo "${ECHO_T}\"$mpiccTest\"" >&6; } ;; esac fi cat >>confdefs.h <<_ACEOF #define MPICC "$MPICC" _ACEOF case "$mpiccTest" in *gcc* ) # use the gcc aggressive flags by default MPICCFLAGS="$tempMPICCFLAGS $AGGRESSIVE_GCC_CFLAGS $MPILIBS $MPI_LIB_PATH -I$USER_INCLUDE -L$USER_LIB $XMDS_LIBS" ;; *icc* ) MPICCFLAGS="$tempMPICCFLAGS $AGGRESSIVE_ICC_CFLAGS $MPILIBS $MPI_LIB_PATH -I$USER_INCLUDE -L$USER_LIB $XMDS_LIBS" ;; * ) MPICCFLAGS="$XMDS_CFLAGS $MPILIBS $MPI_LIB_PATH $XMDS_LIBS" # MPICCFLAGS="$CFLAGS $INCLUDES $LIBS $THREADLIBS $MPI_LIBS $FFTW_MPI_LIBS" ;; esac cat >>confdefs.h <<_ACEOF #define MPICCFLAGS "$MPICCFLAGS" _ACEOF { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi { echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6; } if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_config_files="$ac_config_files Makefile source/Makefile examples/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "source/config.h") CONFIG_HEADERS="$CONFIG_HEADERS source/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "source/Makefile") CONFIG_FILES="$CONFIG_FILES source/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim CC!$CC$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim CFLAGS!$CFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim LN_S!$LN_S$ac_delim RANLIB!$RANLIB$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim ALLOCA!$ALLOCA$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim PTHREAD_CC!$PTHREAD_CC$ac_delim PTHREAD_LIBS!$PTHREAD_LIBS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF PTHREAD_CFLAGS!$PTHREAD_CFLAGS$ac_delim THREADLIBS!$THREADLIBS$ac_delim MPICC!$MPICC$ac_delim MPILIBS!$MPILIBS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| . 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi cp source/config.h source/xmds_config.h cd source ./version.sh cd .. echo "" echo "**************************************************" echo "" echo "XMDS will be built with these options:" echo " CFLAGS = $CFLAGS" echo " CXXFLAGS = $CXXFLAGS" echo " INCLUDES = $INCLUDES" echo " LIBS = $LIBS" echo " THREADLIBS = $THREADLIBS" echo "" echo "Simulations will be built with these options:" echo " compiler options:" echo " XMDS_CC = $XMDS_CC" echo " XMDS_CFLAGS = $XMDS_CFLAGS" echo " XMDS_LIBS = $XMDS_LIBS" echo " XMDS_INCLUDES = $XMDS_INCLUDES" echo "" echo " mpi options:" if test -z "$enable_mpi" then echo " MPI NOT ENABLED" else echo " MPICC = $MPICC" echo " MPICCFLAGS = $MPICCFLAGS" echo " MPILIBS = $MPILIBS" fi echo "" echo " fftw options:" echo " FFTW_LIBS = $FFTW_LIBS" echo " FFTW_MPI_LIBS = $FFTW_MPI_LIBS" if test x"$enable_fftw3" = "xyes" then echo " FFTW3_LIBS = $FFTW3_LIBS" echo " FFTW3_THREADLIBS = $FFTW3_THREADLIBS" else echo " FFTW3 NOT ENABLED" fi echo "" echo "The user defined options were:" echo " USER_LIB = -L$USER_LIB" echo " USER_INCLUDE = -I$USER_INCLUDE" echo "" echo "**************************************************" echo "" # # Local variables: # indent-tabs-mode: nil # End: # # vim: tabstop=4 expandtab shiftwidth=4: xmds-1.6.6/configure.in0000644000076500000240000005415711033277362011747 00000000000000dnl Process this file with autoconf to produce a configure script. dnl Copyright (C) 2000-2007 dnl dnl Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane dnl dnl This file is part of xmds. dnl dnl This program is free software; you can redistribute it and/or dnl modify it under the terms of the GNU General Public License dnl as published by the Free Software Foundation; either version 2 dnl of the License, or (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl dnl $Id: configure.in 1972 2008-04-09 10:44:00Z paultcochrane $ dnl AC_INIT(source/main.cc) XMDS_VERSION="1.6.6" AM_INIT_AUTOMAKE(xmds, "$XMDS_VERSION") AM_CONFIG_HEADER(source/config.h) AC_SUBST([PACKAGE],[xmds]) AC_SUBST([VERSION],["$XMDS_VERSION"]) dnl Pieces of this file have been copied from the fftw-2.1.5 configure.in file dnl Ok, now grab the arguments, if any dnl FFTW stuff AC_ARG_WITH([fftw-path], [ --with-fftw-path Set the path to the prefix of your fftw distribution], [FFTW_PATH="$withval"],[FFTW_PATH=""]) AC_ARG_WITH([fftw3-path], [ --with-fftw3-path Set the path to the prefix of your fftw3 distribution (defaults to the path to fftw2, if set)], [FFTW3_PATH="$withval"],[FFTW3_PATH="$FFTW_PATH"]) dnl Is this a user installation? AC_ARG_WITH([user], [ --with-user Install XMDS into user's bin directory], [bindir="$HOME"/bin includedir="$HOME"/bin libdir="$HOME"/bin mandir="$HOME"/man docdir="$HOME"/doc/xmds USER_LIB="$HOME"/bin USER_INCLUDE="$HOME"/bin echo "XMDS will be installed into $bindir"], [USER_INCLUDE="." USER_LIB="."]) dnl Do we need extral libs passed to check for mpi? (eg -llam) AC_ARG_WITH([mpi-libs], [ --with-mpi-libs Extra libraries needed when checking for MPI], [MPI_LIBS="$withval"],[MPI_LIBS="$MPI_LIBS"]) dnl Add a path to mpi if necessary AC_ARG_WITH([mpi-path], [ --with-mpi-path Set the path to the prefix of your mpi distribution], [MPI_PATH="$withval" PATH="$PATH:$withval/bin"],[MPI_PATH="$MPI_PATH"]) dnl Choose your mpi C compiler if necessary AC_ARG_WITH([mpi-compiler], [ --with-mpi-compiler Set the mpi C compiler]) dnl Enable mpi? AC_ARG_ENABLE([mpi], [ --enable-mpi If you want to use mpi, then set this flag]) dnl Enable threads? AC_ARG_ENABLE([threads], [ --enable-threads If you want to use threads, then set this flag]) dnl Enable fftw3? AC_ARG_ENABLE([fftw3], [ --enable-fftw3 If you want to use fftw3, then set this flag]) dnl These settings are from an Intel white paper comparing gcc and icc AGGRESSIVE_GCC_CFLAGS=" -O3 -ffast-math -funroll-all-loops -fomit-frame-pointer" AGGRESSIVE_ICC_CFLAGS=" -O3 -tpp7 -ipo -ipo_obj" dnl Use native cc if present AC_MSG_CHECKING([for vendor's cc to be used instead of gcc]) AC_CHECK_PROG([CC], [cc], [cc]) dnl Use native cxx if present AC_MSG_CHECKING([for vendor's cxx to be used instead of gcc]) AC_CHECK_PROG([CXX], [cxx], [cxx]) dnl Checks for programs. AC_PROG_CXX AC_PROG_CC AC_ISC_POSIX dnl Check for some handy programs AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB XMDS_INCLUDES="-I$USER_INCLUDE" dnl I need to process command line options just in case fftw is dnl in nonstandard location if test "x$FFTW_PATH" != "x" then FFTW_LIB_PATH="$FFTW_PATH/lib/" FFTW_INCLUDE_PATH="$FFTW_PATH/include/" XMDS_INCLUDES="$XMDS_INCLUDES -I$FFTW_INCLUDE_PATH" fi dnl In case fftw3 is in a non-standard location if test "x$FFTW3_PATH" != "x" then FFTW3_LIB_PATH="$FFTW3_PATH/lib/" FFTW3_INCLUDE_PATH="$FFTW3_PATH/include/" XMDS_INCLUDES="$XMDS_INCLUDES -I$FFTW3_INCLUDE_PATH" fi dnl I need to process command line options just in case mpi is dnl in a nonstandard location if test "x$MPI_PATH" != "x" then MPI_LIB_PATH="-L$MPI_PATH/lib/" MPI_INCLUDE_PATH="-I$MPI_PATH/include/" XMDS_INCLUDES="$XMDS_INCLUDES $MPI_INCLUDE_PATH" fi dnl Checks for libraries. AC_CHECK_LIB([m], [sqrt]) AC_CHECK_LIB([stdc++],[cout]) dnl Checks for header files. AC_HEADER_STDC # Can't have this one when mpicc and cc are mixed non-gnu/gnu #if test "x$CC" = xgcc #then # CFLAGS="$CFLAGS -Wall -pedantic" # CXXFLAGS="$CXXFLAGS -Wall -pedantic -ansi" #fi # Add some warnings to the build if test "x$CC" = "xgcc" then WARN_FLAGS="-Wall " else WARN_FLAGS=" " # Sun's cc doesn't recognise -Wall fi CFLAGS="$CFLAGS $WARN_FLAGS" CXXFLAGS="$CXXFLAGS $WARN_FLAGS" dnl Checks for library functions. AC_FUNC_ALLOCA dnl if --enable-threads is set, then check for threads libraries if test "x$enable_threads" = "xyes" then dnl Check for threads library... # POSIX threads, the default choice: if test -z "$THREADLIBS"; then sinclude(acx_pthread.m4) ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS " CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" tempXMDS_CFLAGS="$PTHREAD_CFLAGS" tempMPICCFLAGS="$PTHREAD_CFLAGS" CC="$PTHREAD_CC" AC_DEFINE([XMDS_USING_POSIX_THREADS],[],[Define for posix threads])]) fi # Solaris threads: if test -z "$THREADLIBS"; then AC_CHECK_LIB(thread, thr_create, [THREADLIBS="-lthread" AC_DEFINE([XMDS_USING_SOLARIS_THREADS],[],[Define for solaris threads])]) fi # Mach C threads: if test -z "$THREADLIBS"; then AC_CHECK_FUNC(cthread_fork, [THREADLIBS=" " AC_DEFINE([XMDS_USING_MACH_THREADS],[],[Define for mach threads])]) AC_CHECK_HEADERS(mach/cthreads.h cthreads.h cthread.h) fi if test -z "$THREADLIBS"; then AC_CHECK_LIB(cthread, cthread_fork, [THREADLIBS="-lcthread" AC_DEFINE([XMDS_USING_MACH_THREADS],[],[Define for mach threads])]) AC_CHECK_HEADERS(mach/cthreads.h cthreads.h cthread.h) fi if test -z "$THREADLIBS"; then AC_CHECK_LIB(cthreads, cthread_fork, [THREADLIBS="-lcthreads" AC_DEFINE([XMDS_USING_MACH_THREADS],[],[Define for mach threads])]) AC_CHECK_HEADERS(mach/cthreads.h cthreads.h cthread.h) fi # BeOS threads: if test -z "$THREADLIBS"; then AC_CHECK_FUNC(spawn_thread, [THREADLIBS=" " AC_DEFINE([XMDS_USING_BEOS_THREADS],[],[Define for beos threads])]) fi if test -z "$THREADLIBS"; then AC_MSG_ERROR(couldn't find threads library) fi AC_SUBST(THREADLIBS) # end enable_threads test fi ### This code included from libsndfile configure.ac. # Determine endian-ness of target processor. AC_C_FIND_ENDIAN AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian}, [Target processor is big endian.]) AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian}, [Target processor is little endian.]) dnl This code is made up by Joe, and you should blame him AC_CHECK_SIZEOF(unsigned long) # This defines SIZEOF_UNSIGNED_LONG, which is 4 for 32 bit and 8 for 64 bit dnl We need to make sure that fftw exists, and that it is the right version FFTW_EXISTS="yes" HAVE_FFTW_TWO="yes" if test "x$FFTW_PATH" = "x" then AC_CHECK_HEADERS(["$FFTW_INCLUDE_PATH"fftw.h],[], [echo "Eeek! I can't find fftw.h!"; echo "It doesn't look like you'll be able to use fftw"; echo "Are you sure that --with-fftw-path is set correctly?"]) else AC_CHECK_FILE(["$FFTW_INCLUDE_PATH"fftw.h],[], [echo "Eeek! I can't find fftw.h!"; echo "It doesn't look like you'll be able to use fftw"; echo "Are you sure that --with-fftw-path is set correctly?"]) fi # only add FFTW_LIB_PATH to LDFLAGS when it is defined # TODO: how variables are set in configure.in need to be cleaned up, it's # getting hard to understand everything all in one go... if test "x$FFTW_LIB_PATH" != "x" then LDFLAGS="$LDFLAGS -L$FFTW_LIB_PATH" fi AC_CHECK_LIB([fftw], [fftw_create_plan], [FFTW_LIBS="-lfftw"], [echo "Bummer! fftw (version 2) doesn't seem to work"; echo "You need fftw to use xmds properly."; echo "Maybe you meant to use fftw version 3?"; echo "If so, you need to pass --enable-fftw3 to configure"; FFTW_EXISTS="no"; HAVE_FFTW_TWO="no"]) # check for fftw3 if we enabled its use if test "x$enable_fftw3" = "xyes" then FFTW_EXISTS="yes" HAVE_FFTW_THREE="yes" if test "x$FFTW3_PATH" = "x" then AC_CHECK_HEADERS(["$FFTW3_INCLUDE_PATH"fftw3.h],[], [echo "Eeek! I can't find fftw3.h!"; echo "It doesn't look like you'll be able to use fftw3"; echo "Are you sure that --with-fftw3-path is set correctly?"]) else AC_CHECK_FILE(["$FFTW3_INCLUDE_PATH"fftw3.h],[], [echo "Eeek! I can't find fftw3.h!"; echo "It doesn't look like you'll be able to use fftw3"; echo "Are you sure that --with-fftw3-path is set correctly?"]) fi # only add FFTW3_LIB_PATH to LDFLAGS when it is defined if test -n "$FFTW3_LIB_PATH" then LDFLAGS="$LDFLAGS -L$FFTW3_LIB_PATH" fi AC_CHECK_LIB([fftw3], [fftw_execute], [FFTW3_LIBS="-lfftw3"], [echo "Bummer! fftw3 doesn't seem to work"; echo "You asked for fftw3, but you will need to install it to use it"; echo "If you have installed it, make sure you have passed the correct"; echo "path to fftw3 with the --with-fftw3-path option"; echo "fftw3 is available from http://www.fftw.org"; exit]) fi # if we couldn't find fftw2 and the test for fftw3 failed, then make sure we # report an error appropriately if test "x$FFTW_EXISTS" = "xno" then echo "" echo "Unable to find a working fftw version." echo "If you have installed it, make sure you have passed the correct" echo "path to fftw with the --with-fftw-path option" echo "fftw is available from http://www.fftw.org" exit fi FFTW3_THREADLIBS="$THREADLIBS" # if threads are enabled, check to see if fftw_threads is available if test "x$enable_threads" = "xyes" then if test "x$FFTW_PATH" = "x" then AC_CHECK_HEADERS(["$FFTW_INCLUDE_PATH"fftw_threads.h],[], [echo "Eeek! I can't find fftw_threads.h!"; echo "It doesn't look like you'll be able to use fftw_threads"; echo "Continuing anyway"]) else AC_CHECK_FILE(["$FFTW_INCLUDE_PATH"fftw_threads.h],[], [echo "Eeek! I can't find fftw_threads.h!"; echo "It doesn't look like you'll be able to use fftw_threads"; echo "Continuing anyway"]) fi AC_CHECK_LIB([fftw_threads], [fftw_threads_init], [THREADLIBS="-L$FFTW_LIB_PATH -lfftw_threads $THREADLIBS"; FFTW_THREADS="-lfftw_threads"], [echo "Eeek! fftw_threads doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw_threads"; echo "Perhaps you need to use --enable-threads in fftw??"; echo "Continuing anyway"], ["$FFTW_LIBS" "$THREADLIBS"]) if test x"$enable_fftw3" = "xyes" then AC_CHECK_LIB([fftw3_threads], [fftw_init_threads], [FFTW3_THREADLIBS="$FFTW3_THREADLIBS -lfftw3_threads"], [echo "Eeek! fftw3_threads doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw3_threads"; echo "Perhaps you need to use --enable-threads in fftw3??"; echo "Continuing anyway"], ["$FFTW3_LIBS" "$FFTW3_THREADLIBS"]) fi # end enable_threads check fi if test "x$enable_mpi" = "xyes" then dnl If --with-mpi-compiler is used, then change the MPICC setting if test -n "$with_mpi_compiler" then MPICC="$with_mpi_compiler" fi dnl Copied and hacked from fftw's configure.in dnl Check for mpi library... sinclude(acx_mpi.m4) ACX_MPI([], [AC_MSG_ERROR([couldn't find mpi library])]) dnl This is a hack to make the compilers point to $MPICC only dnl for the rest of the mpi tests. dnl This must be reversed at the end of this section. joempi_save_CC="$CC" joempi_save_CPP="$CPP" CC="$MPICC" CPP="$MPICC -E" dnl checking to see if lam is installed as mpi implementation save_LIBS="$LIBS" AC_CHECK_LIB([lam], [lamlog], [MPILIBS="-lmpi -llam $MPILIBS"], [], [-lmpi "$MPI_LIB_PATH"]) lamTest=`echo "$MPILIBS" | grep 'llam' | cut -f1 -d' '` if test x"$lamTest" = x then dnl if didn't find lam, then look for mpich AC_CHECK_LIB([mpich], [MPI_Init], [MPILIBS="-lmpich $MPILIBS"], [], ["$MPI_LIB_PATH"]) else # test to see if lam has added in -llammpi++ lammpiTest=`mpicc -showme | grep 'lammpi++'` if test x"$lammpiTest" = x then # append -llammpi++ to $MPILIBS MPILIBS="$MPILIBS -llammpi++" fi fi # we don't want to add -lmpi -llam or -lmpich to the LIBS variable LIBS="$save_LIBS" dnl check for fftw_mpi.h if test "x$FFTW_PATH" = "x" then AC_CHECK_HEADERS(["$FFTW_INCLUDE_PATH"fftw_mpi.h],[], [echo "Eeek! I can't find fftw_mpi.h!"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Continuing anyway"]) else AC_CHECK_FILE(["$FFTW_INCLUDE_PATH"fftw_mpi.h],[], [echo "Eeek! I can't find fftw_mpi.h!"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Continuing anyway"]) fi dnl check for the fftw_mpi library AC_CHECK_LIB([fftw_mpi], [fftw2d_mpi_create_plan], [FFTW_MPI="-lfftw_mpi"], [echo "Eeek! fftw_mpi doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Perhaps you need to use --enable-mpi in fftw??"; echo "Continuing anyway"], ["$THREADLIBS" "$FFTW_LIBS" "$MPILIBS" "$MPI_LIBS" "$MPI_LIB_PATH" "$MPI_INCLUDE_PATH"]) dnl Must replace the compilers with the original CC="$joempi_save_CC" CPP="$joempi_save_CPP" fi dnl If the FFTW_PATH is set, put -L$FFTW_PATH into the FFTW_* variables if test -z "$FFTW_PATH" then FFTW_MPI_LIBS="$FFTW_THREADS $FFTW_MPI $FFTW_LIBS" FFTW_LIBS="$FFTW_THREADS $FFTW_LIBS" else FFTW_MPI_LIBS="-L$FFTW_LIB_PATH $FFTW_THREADS $FFTW_MPI $FFTW_LIBS" FFTW_LIBS="-L$FFTW_LIB_PATH $FFTW_THREADS $FFTW_LIBS" fi if test "x$FFTW3_PATH" != "x" then FFTW3_LIBS="-L$FFTW3_LIB_PATH $FFTW3_LIBS" fi dnl We need to know where libxmds.a is XMDS_LIBS="$LIBS -L$USER_LIB -lxmds" AC_SUBST([CC]) AC_SUBST([CFLAGS]) AC_SUBST([CXX]) AC_SUBST([CXXFLAGS]) dnl We now need to add -lxmds to the libraries needed to build xmds LIBS="$LIBS -L. -lxmds" AC_SUBST([LIBS]) AC_DEFINE_UNQUOTED([CC],["$CC"],[C compiler]) AC_DEFINE_UNQUOTED([CXX],["$CXX"],[C++ compiler]) AC_DEFINE_UNQUOTED([CFLAGS],["$CFLAGS"],[C compiler flags]) AC_DEFINE_UNQUOTED([CXXFLAGS],["$CXXFLAGS"],[C++ compiler flags]) AC_DEFINE_UNQUOTED([LIBS],["$LIBS"],[Library flags]) AC_DEFINE_UNQUOTED([INCLUDES],["$INCLUDES"],[Include flags]) AC_DEFINE_UNQUOTED([THREADLIBS],["$THREADLIBS"],[Thread libraries]) AC_DEFINE_UNQUOTED([FFTW_MPI_LIBS],["$FFTW_MPI_LIBS"],[MPI libraries for FFTW]) AC_DEFINE_UNQUOTED([FFTW_LIBS],["$FFTW_LIBS"],[Libraries for FFTW]) AC_DEFINE_UNQUOTED([FFTW3_LIBS],["$FFTW3_LIBS"],[Libraries for FFTW3]) AC_DEFINE_UNQUOTED([FFTW3_THREADLIBS],["$FFTW3_THREADLIBS"],[Thread libraries for FFTW3]) # if we have detected fftw3, set the relevant flags FFTW_THREE_ONLY=0 if test "x$HAVE_FFTW_THREE" = "xyes" then # if we have *only* fftw3 then use the FFTW3 libs for FFTW if test "x$HAVE_FFTW_TWO" = "xno" then AC_DEFINE_UNQUOTED([FFTW_LIBS],["$FFTW3_LIBS"],[Libraries for FFTW]) FFTW_THREE_ONLY=1 fi AC_DEFINE_UNQUOTED([FFTW_THREE_ONLY],[$FFTW_THREE_ONLY],[Have we only got FFTW3?]) fi dnl set up the libraries and CFLAGS to be passed to icc if test "x$XMDS_CC" = "xicc" then dnl XMDS_LIBS="-limf $XMDS_LIBS" XMDS_LIBS="$XMDS_LIBS" if test -z "$XMDS_CFLAGS" then XMDS_CFLAGS="$tempXMDS_CFLAGS $AGGRESSIVE_ICC_CFLAGS" fi else XMDS_CC="$CXX" fi dnl if we're using gcc, then use the gcc aggressive flags by default dnl ac_compiler_gnu is the flag internal to configure that is set if using the gnu c/c++ compiler if test x"$ac_compiler_gnu" = xyes -a "x$XMDS_CC" != "xicc" then XMDS_CFLAGS="$tempXMDS_CFLAGS $AGGRESSIVE_GCC_CFLAGS" fi dnl if the XMDS_CFLAGS etc aren't set, then use the CFLAGS if test -z "$XMDS_CFLAGS" then XMDS_CFLAGS="$CFLAGS" fi dnl if the user has set XMDS_CFLAGS at the command line, but not dnl mentioned -pthread and PTHREAD_CFLAGS is non-null then append dnl PTHREAD_CFLAGS to XMDS_CFLAGS if test -n "$XMDS_CFLAGS" then xmdsflagsTest=`echo "$XMDS_CFLAGS" | grep 'pthread'` if test -z "$xmdsflagsTest" -a -n "$PTHREAD_CFLAGS" then AC_MSG_WARN([$PTHREAD_CFLAGS required for xmds but not in XMDS_CFLAGS; appending]) XMDS_CFLAGS="$XMDS_CFLAGS $PTHREAD_CFLAGS" fi fi dnl if the C or C++ compilers are the Tru64 ones then need dnl to add -D__USE_STD_IOSTREAM=1 to XMDS_CFLAGS tru64Test=`cxx -V 2>/dev/null| grep 'Tru64'` if test -n "$tru64Test" then AC_MSG_WARN([It looks like you are using the Tru64 compiler...]) AC_MSG_WARN([I will set __USE_STD_IOSTREAM appropriately]) XMDS_CFLAGS="$XMDS_CFLAGS -D__USE_STD_IOSTREAM=1" fi dnl now set the variables in stone AC_DEFINE_UNQUOTED([XMDS_CC],["$XMDS_CC"],[C compiler for xmds simulations]) AC_DEFINE_UNQUOTED([XMDS_CFLAGS],["$XMDS_CFLAGS"],[C compiler flags for xmds]) AC_DEFINE_UNQUOTED([XMDS_LIBS],["$XMDS_LIBS"],[C libraries for xmds]) AC_DEFINE_UNQUOTED([XMDS_INCLUDES],["$XMDS_INCLUDES"],[Include flags for xmds]) dnl we need to work out how mpicc is run, if it is used. if test x"$MPICC" = xmpicc then AC_MSG_CHECKING([how mpicc is run]) lamTest=`echo "$MPILIBS" | grep 'llam' | cut -f1 -d' '` mpichTest=`echo "$MPILIBS" | grep 'lmpich' | cut -f1 -d' '` if test x"$lamTest" != x then mpiccTest=`mpicc -showme | cut -f1 -d' '` elif test x"$mpichTest" != x then mpiccTest=`mpicc -show | cut -f1 -d' '` fi dnl if mpiccTest isn't set, then assume gcc if test -z "$mpiccTest" then AC_MSG_WARN([cannot work out how mpicc is run; assuming gcc]) mpiccTest=gcc fi stdcTest=`echo "$LIBS" | grep 'stdc++'` case "$mpiccTest" in *gcc* ) if test -z "$stdcTest" then MPILIBS="$MPILIBS -lstdc++" fi AC_MSG_RESULT([gcc]) ;; *icc* ) AC_MSG_RESULT([icc]) ;; * ) AC_MSG_RESULT(["$mpiccTest"]) ;; esac dnl This part seems to be a bad idea, we've already tested that it works above (acx_mpi.m4) dnl All this section does is beef up the default compiler options dnl else dnl if test -n "$enable_mpi" dnl then dnl AC_MSG_WARN([mpicc not set explicitly; using system C++ compiler]) dnl MPICC=$CXX dnl fi fi AC_DEFINE_UNQUOTED([MPICC],["$MPICC"],[MPI C compiler]) dnl this is a better way to test than with an if blah = moo then... case "$mpiccTest" in *gcc* ) # use the gcc aggressive flags by default MPICCFLAGS="$tempMPICCFLAGS $AGGRESSIVE_GCC_CFLAGS $MPILIBS $MPI_LIB_PATH -I$USER_INCLUDE -L$USER_LIB $XMDS_LIBS" ;; *icc* ) MPICCFLAGS="$tempMPICCFLAGS $AGGRESSIVE_ICC_CFLAGS $MPILIBS $MPI_LIB_PATH -I$USER_INCLUDE -L$USER_LIB $XMDS_LIBS" ;; * ) MPICCFLAGS="$XMDS_CFLAGS $MPILIBS $MPI_LIB_PATH $XMDS_LIBS" # MPICCFLAGS="$CFLAGS $INCLUDES $LIBS $THREADLIBS $MPI_LIBS $FFTW_MPI_LIBS" ;; esac AC_DEFINE_UNQUOTED([MPICCFLAGS],["$MPICCFLAGS"],[MPI C compiler flags]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE dnl These are the makefiles to produce AC_OUTPUT(Makefile source/Makefile examples/Makefile) dnl We really want xmds_config.h to be the same as config.h, so, just so that it dnl works, put a cp in here cp source/config.h source/xmds_config.h cd source ./version.sh cd .. dnl echo some stuff for debugging echo "" echo "**************************************************" echo "" echo "XMDS will be built with these options:" echo " CFLAGS = $CFLAGS" echo " CXXFLAGS = $CXXFLAGS" echo " INCLUDES = $INCLUDES" echo " LIBS = $LIBS" echo " THREADLIBS = $THREADLIBS" echo "" echo "Simulations will be built with these options:" echo " compiler options:" echo " XMDS_CC = $XMDS_CC" echo " XMDS_CFLAGS = $XMDS_CFLAGS" echo " XMDS_LIBS = $XMDS_LIBS" echo " XMDS_INCLUDES = $XMDS_INCLUDES" echo "" echo " mpi options:" if test -z "$enable_mpi" then echo " MPI NOT ENABLED" else echo " MPICC = $MPICC" echo " MPICCFLAGS = $MPICCFLAGS" echo " MPILIBS = $MPILIBS" fi echo "" echo " fftw options:" echo " FFTW_LIBS = $FFTW_LIBS" echo " FFTW_MPI_LIBS = $FFTW_MPI_LIBS" if test x"$enable_fftw3" = "xyes" then echo " FFTW3_LIBS = $FFTW3_LIBS" echo " FFTW3_THREADLIBS = $FFTW3_THREADLIBS" else echo " FFTW3 NOT ENABLED" fi echo "" echo "The user defined options were:" echo " USER_LIB = -L$USER_LIB" echo " USER_INCLUDE = -I$USER_INCLUDE" echo "" echo "**************************************************" echo "" # # Local variables: # indent-tabs-mode: nil # End: # # vim: tabstop=4 expandtab shiftwidth=4: xmds-1.6.6/COPYING0000644000076500000240000004311011033277571010456 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xmds-1.6.6/depcomp0000755000076500000240000003305211033276365011004 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 xmds-1.6.6/examples/0000777000076500000240000000000011033374735011326 500000000000000xmds-1.6.6/examples/atomlaser.xmds0000644000076500000240000001174511033277417014135 00000000000000 atomlaser Joseph Hope Stochastic atom laser simulation no t no yes yes yes yes yes kick double -1.0e6 kappamax double 1.0e2 tags // const double kick = -1.0e6; // now in tags const double hbar = 1.05500000000e-34; const double M = 1.409539200000000e-25; /* absorbing boundary constants */ const double dpow = 1; const double absorbleft = 4.0e4/pow(2.,dpow); const double absorbright = 4.0e4/pow(2.,dpow); const double xleft = -7.0e-5; const double widthl = 3.0e-5; const double xright = 5.0e-5; const double widthr = 3.0e-5; /* numerical shift constant */ const double ko=-2.5e7; ]]> main x 2048 (-1.0e-4,8.0e-5) 1 main complex phi no vc1 double V damping no xright ? -absorbright*pow(1-cos(M_PI*(x-xright)/widthr),dpow): 0); ]]> RK4IP 1.0e-7 1600 4 yes KE main vc1 no 2048 phir phii xmds-1.6.6/examples/branch.xmds0000644000076500000240000001122111033277417013370 00000000000000 branch Paul Cochrane Branching reaction example of reaction between hydrogen and oxygen 2H_2(g) + O_2(g) -> 2 H_2O(g) Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) Equations are: d[H]_dt = -k1[O_2][H] + k2[H_2][O] + k3[H_2][OH] d[OH]_dt = k1[O_2][h] + k2[H_2][O] - k3[H_2][OH] d[O]_dt = k1[O_2][H] - k2[H_2][O] d[H_2]_dt = -k2[H_2][O] - k3[H_2][OH] d[O_2]_dt = -k1[O_2][H] t yes yes yes yes main 1 main double H O2 OH O H2 RK4IP 150 100000 1000 main Hout Oout OHout O2out H2out xmds-1.6.6/examples/brusselator.xmds0000644000076500000240000001205611033277417014507 00000000000000 brusselator Paul Cochrane Example simulation of the Brusslator model oscillating chemical kinetics equations. Calculates concentrations of components participating in the autocatalytic Brusselator model. The reaction scheme is A ----> X (1) B + X ----> R + Y (2) Y + 2 X ----> 3 X (3) X ----> S. (4) Rate equations for the intermediates X and Y are d[X]/dt = k1[A] - k2 [B] [X] + k3 [X]^2 [Y] - k4 [X] d[Y]/dt = k2 [B] [X] - k3 [X]^2 [Y], which are transformed in the program to d[X]/d(tau) = (k1[A] - k2 [B] [X] + k3 [X]^2 [Y] - k4 [X])/k4 d[Y]/d(tau) = (k2 [B] [X] - k3[X]^2 [Y])/k4, with tau = k4 t a unitless time-related variable. Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) Equations are: d[X]_d(tau) = (k1[A] - k2[B][X] + k3[X]^2 [Y] - k4[X])/k4 d[Y]_d(tau) = (k2[B][X] - k3[X]^2 [Y])/k4 tau yes yes yes yes main 1 main double CX CY RK4IP 250 5000 500 main 500 X Y xmds-1.6.6/examples/catcycle.xmds0000644000076500000240000001044411033277417013730 00000000000000 catcycle Paul Cochrane An example of a catalytic cycle of reactions. Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) Reactions are: A + X -> R + Y B + Y -> S + X where the intermediates X and Y are catalysts, so the reaction catalysed is A + B -> R + S Equations are: d[A]_dt = -k1[A][X] d[B]_dt = k2[B][Y] d[X]_dt = -k1[A][X] + k2[B][Y] d[Y]_dt = k1[A][X] - k2[B][Y] t yes yes yes yes main 1 main double A B X Y RK4IP 1000 100000 1000 main Aout Bout Xout Yout xmds-1.6.6/examples/chain.xmds0000644000076500000240000001331411033277417013222 00000000000000 chain Paul Cochrane Example simulation of free-radical chain polymerisation. Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) Calculates [M], concentration of monomer, [P.], concentration of chain radicals, [I], concentration of initiator, [R.], concentration of initiator radicals, and [P], concentration of polymer, during the first 10 s of a free-radical chain polymerization process. The various rates involved are Rate of initiation: Ri = 2 f kd [I] Rate of propagation: Rp = kp [M] [P.] + kp [M] [R.] Rate of termination: Rt = 2 kt [P.]^2, where kp, kd and kt are rate constants and f is the initiation efficiency factor. Rate equations are: d[M]/dt = -kp [M] [P.] - kp [M] [R.] d[P.]/dt = 2 f kd [I] - 2 kt [P.]^2 d[I]/dt = -2 f kd [I] d[R.]/dt = 2 f kd [I] - kp [M] [R.] d[P]/dt = kt [P.]^2. The program also calculates the average degree of polmerization according to Eq. (10.47), as given in "Mathematica computer programs for physical chemistry" xave = -(d[M]/dt)/(d[P]/dt). t yes yes yes yes main 1 main double Monomer Chain Initiator Radical Polymer RK4IP 10 100000 1000 main MonomerOut ChainOut InitiatorOut RadicalOut PolymerOut xAveOut xmds-1.6.6/examples/chemkin.xmds0000644000076500000240000001041311033277417013553 00000000000000 chemkin Paul Cochrane Example simulation of the chemical kinetics of a reversible biomolecular reaction: (the exclamation mark is so that the file parses as xml) A + B R + S Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) Equations are: d[A]_dt = -k1[A][B] + k2[R][S] d[B]_dt = -k1[A][B] + k2[R][S] d[R]_dt = k1[A][B] - k2[R][S] d[S]_dt = k1[A][B] - k2[R][S] t yes yes yes yes main 1 main double A B R S RK4IP 25 10000 1000 main Aout Bout Rout Sout xmds-1.6.6/examples/diffusion.xmds0000644000076500000240000000756211033277417014136 00000000000000 diffusion Paul Cochrane Solves the one-dimensional diffusion equation for an initial Gaussian pulse. Part 1 of 2: This simulation propagates the solution for 1 time unit, and then saves the state of the field. The simulation can then be continued in part 2. t no 3 no yes yes main x 128 (-1,1) 1 main complex T no ARK89EX 50 10000 50 1e-5 yes L main diffusion_break.xsil no main diffusion.xsil no 64 temp xmds-1.6.6/examples/duffing.xmds0000644000076500000240000000725211033277417013566 00000000000000 duffing Paul Cochrane Example simulation of Duffing's equation which describes the motion of a mechanical system in a twin-well potential. t yes yes yes yes main 1 main double x y RK4EX 1000 100000 10000 main yOut xOut xmds-1.6.6/examples/fibre.xmds0000644000076500000240000000701411033277417013227 00000000000000 fibre Unknown Author Example fibre noise simulation t no yes no 1000 13 22 2 yes yes main x 128 (-5,5) 1 main complex phi no ARK89IP 2.5 200000 1.0e-4 50 main yes L 3 yes 64 pow_dens xmds-1.6.6/examples/fisher_reaction_diffusion.xmds0000644000076500000240000001206411033277417017353 00000000000000 fisher_reaction_diffusion Paul Cochrane Example simulation of the reaction-diffusion equation of Fisher (1937). This equation can be interpreted as describing the frequency of a focal allele as a function of one-dimensional space in a biallelic diploid population of constant size. This simulation is adapted from equation 1 of "The diffusive spread of alleles in heterogeneous populations", G T Skalski, Evolution, 58 (3), 470-478 (2004). Thanks to John Novembre at UC Berkeley for pointing out this example. t yes yes yes yes main x 1024 (-1,1) 1 main complex P no RK4IP 1 1000 100 main yes L no 1024 POut xmds-1.6.6/examples/fullpos3D.xmds0000644000076500000240000002011211033277417014005 00000000000000 fullpos3D Unknown Author Stochastic superchemistry simulation yes t yes 1 1 no 37 41 8 x y z 32 32 16 (-1.2e-4,1.2e-4) (-1.2e-4,1.2e-4) (-8.0e-3,8.0e-3) 1 1 vc1 double vcore V1r V3r gV1r gV3r no no no main complex phi1a phi1b phi3a phi3b gphi1a gphi3a no no no vc1 0. ? complex(sqrt(realfn),0) : complex(0,0); phi1b = realfn>0. ? complex(sqrt(realfn),0) : complex(0,0); phi3a = complex(0,0); phi3b = complex(0,0); gphi1a = realfn>0. ? complex(sqrt(realfn),0) : complex(0,0); gphi3a = complex(0,0); ]]> SIIP 1e-10 50 1 5 yes L2p L2n L4p L4n main vc1 no no no 16 4 4 atoms molecules gatoms gmolecules no no no 0 0 0 rn_1 rn_2 grn_1 grn_2 excitedn xmds-1.6.6/examples/gaugeatomlaser.xmds0000644000076500000240000003036111033277417015141 00000000000000 gaugeatomlaser Joseph Hope Gauge atom laser simulation yes t yes 1 no 1 7 11 yes x 8192 (-1.0e-4, 8.0e-5) 1 1 1 1 dconstants double Vt Vu damping ruo2 ruo4dx sqrtruo2 no xright ? absorbright*pow(1-cos(M_PI*(x-xright)/widthr),dpow): 0); Vt = (0.5*M*omegax*omegax*x*x-muo+offsetpotential)/hbar; Vu = M*g*x/hbar; ]]> cconstants complex kappa kappas no main complex phita phitb phiua phiub theta no dconstants cconstants SIIP 1.0e-10 10 5 5 5 2 yes Lta Ltb Lua Lub main dconstants cconstants gaugeatomlaser.xsil yes no 0 integral no weight no 32 trapped untrapped no 0 ntr nuntr yes 128 ktrapped kuntrapped 0) { ktrapped = _active_main_main[_main_lattice0*_main_main_ncomponents - _main_main_index_pointer + 1]*phita*weight; kuntrapped = _active_main_main[_main_lattice0*_main_main_ncomponents - _main_main_index_pointer + 3]*phiua*weight; } else { ktrapped = phitb*phita*weight; kuntrapped = phiub*phiua*weight; }; ]]> xmds-1.6.6/examples/groundstate.xmds0000644000076500000240000001411711033277422014475 00000000000000 groundstate Joseph Hope Evolves a Gross-Pitaevskii equation in imaginary time to find the ground state. The wavefunction must be renormalised regularly. t yes no yes yes main z 256 (-18,18) 1 1 main complex phi no dconstants double V no 100 100 RK4IP 0.0001 1 0 0 yes T main dconstants ncalc yes main no RK4IP 0.0001 1 1 0 yes T main dconstants RK4IP 1.0e-10 1 1 1 main groundstate.xsil no 0 totalnumber double no 256 phire phiim double xmds-1.6.6/examples/highdim.xmds0000644000076500000240000002306711033277417013557 00000000000000 highdim Joe Hope Non-stochastic superchemistry simulation t yes yes yes yes kjoek double -1.0e6 joekappamax double 1.0e2 x y z 16 16 16 (-1.2e-4,1.2e-4) (-1.2e-4,1.2e-4) (-8.0e-3,8.0e-3) 1 1 1 vc1 double vcore V1r V3r gV1r gV3r no no no main complex phi1a phi1b phi3a phi3b gphi1a gphi3a no no no vc1 0. ? complex(sqrt(realfn),0) : complex(0,0); phi1b = realfn>0. ? complex(sqrt(realfn),0) : complex(0,0); phi3a = complex(0,0); phi3b = complex(0,0); gphi1a = realfn>0. ? complex(sqrt(realfn),0) : complex(0,0); gphi3a = complex(0,0); ]]> ARK89IP 1e-7 1.0e-7 1000 10 10 1 yes L2p L2n L4p L4n chippy yes yes yes ippy ichippy no no no py ic yes yes no ppy ichi no yes yes main vc1 no no no 16 1 1 atoms molecules gatoms gmolecules no no no 0 16 0 rn_1 rn_2 grn_1 grn_2 excitedn no no no 4 8 16 atomsr moleculesr atomsi moleculesi xmds-1.6.6/examples/highdim_vector_version.xmds0000644000076500000240000002273011033277422016676 00000000000000 highdim Joe Hope Non-stochastic superchemistry simulation t yes yes yes yes kjoek double -1.0e6 joekappamax double 1.0e2 x y z 16 16 16 (-1.2e-4,1.2e-4) (-1.2e-4,1.2e-4) (-8.0e-3,8.0e-3) 1 1 1 vc1 double Vr(5) no no no main complex phi(6) no no no vc1 0. ? complex(sqrt(realfn),0) : complex(0,0); else phi(j) = complex(0,0); } ]]> ARK89EX 1e-7 1.0e-7 1000 10 10 1 yes L2p L2n L4p L4n chippy yes yes yes ippy ichippy no no no py ic yes yes no ppy ichi no yes yes main vc1 no no no 16 1 1 atoms molecules gatoms gmolecules no no no 0 16 0 rn_1 rn_2 grn_1 grn_2 excitedn no no no 4 8 16 atomsr moleculesr atomsi moleculesi xmds-1.6.6/examples/HighdimPlotExample.nb0000644000076500000240000024611211033277422015310 00000000000000(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 84880, 1468] NotebookOptionsPosition[ 84356, 1446] NotebookOutlinePosition[ 84691, 1461] CellTagsIndexPosition[ 84648, 1458] WindowFrame->Normal ContainsDynamic->True *) (* Beginning of Notebook Content *) Notebook[{ Cell["\<\ This file is a sample file used to plot the output of ' highdim.xmds' in the \ latest version of Mathematica. After running the program, use the command : > xsil2graphics - e highdim.xsil Then run the cell below after altering the directory path to your local \ directory.\ \>", "Text", CellChangeTimes->{{3.406765836414184*^9, 3.406765938748354*^9}, 3.40676597339749*^9}, FormatType->"TextForm", FontSize->18], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{ "SetDirectory", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"<<", "highdim.nb"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ListPlot3D", "[", RowBox[{"atoms1", ",", RowBox[{"PlotRange", "\[Rule]", "All"}], ",", RowBox[{"DataRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Min", "[", "x1", "]"}], ",", RowBox[{"Max", "[", "x1", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Min", "[", "t1", "]"}], ",", RowBox[{"Max", "[", "t1", "]"}]}], "}"}]}], "}"}]}]}], "]"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"ListPlot3D", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"atomsr3", "[", RowBox[{"[", RowBox[{"t", ",", "x", ",", "i", ",", "j"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "y3", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"Length", "[", "z3", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "1", ",", RowBox[{"Length", "[", "x3", "]"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "1", ",", RowBox[{"Length", "[", "t3", "]"}], ",", "1"}], "}"}]}], "]"}]}], "Input",\ CellChangeTimes->{{3.406765646091586*^9, 3.40676571725424*^9}, { 3.406765979399116*^9, 3.406765982285563*^9}, {3.407313044049749*^9, 3.407313047910437*^9}, 3.407313173983762*^9, {3.40731524453581*^9, 3.407315246107214*^9}, {3.4073163620522203`*^9, 3.407316379036456*^9}, { 3.407316414749365*^9, 3.407316423965391*^9}}], Cell[BoxData[ Graphics3DBox[GraphicsComplex3DBox[CompressedData[" 1:eJx1nHk4Vdv7wE2VpDIXITKUqAyRVKvsbUqRDNEhwjmhJGQslUqzBs0paZBG JY1uKRpFtzQjpIGUkJDI8Ot79n7f0zn3+fXPfe7neZ9t7c96z7vXsNfWDlji ypMQExNLkxITk/zz3xANDye56OG3xUT+3Yw/Q4etH/YfPvh178TH+4b8hweY ehiPPq2IfN74o5vLzH9QC/nXH4w8Ru6DUb25My3Hv04/5OFhW9K/H+XQofz4 3lvAc9/enPYpzJ9ewudNyA83axwmnwNp5v8KbwBv+FUX1O8fLh3IxBPR+AXM 9Yno9Qcy7Zkq2p4gpv3Iof3+zP0ih/sdxPhBDv9uMD7/w8G/41bjD9vibUnG 7ZNr1xo+swb/wL1UTm2ay31pDf6BT9ty40ug93Vr8A+8lZp0bPu3ZvQP3Cr1 dHTLisnoH7j+19T2sSZT0T/wZbftalcNIegfeEdt7tZDjZPRP3CnWFfJw6sm o3/gnWw8+Ae+g70++BdtD/gHrse2H/wDL2LvF/wDb9P6h+8H/APflMn4FPbv QQr31FzLHlIl4t+DpGzi7Pd7XSXi34NMvnPefGD1RRH/HmTSlqW7nyiL+vcg R3tMpt0RGyLi34Ps3JG+/LlOfxH/HsQ/TeF66XwxEf9/rmP1fbL4rQ5K2L8H yRj8aVPDrXZK2L8HecTGC/v3IAns9YX9e5BMtj3C/j3Iebb9wv49iDx7v8L+ PYjrxWy+H2H/HkTC3pvvE/z/CskwMBw2nyxWen9OsfI5+gd+WjFcQSXjEfoH br/G8lP6PQkK/ANf42Y61ntfE/oHXqzBkQyb00iBf+BTlz/Q6Hf1DQX+gfsf pm8M83lGgX/gN0qc3z3WqkL/wK8Oqk/uK/sO/QOXLmfiwT/wjkzm+uAfeP8V THvAP3AFTab94B/4CPZ+wT/w7grGD/gHrtM3gu9TOP95JOHEpWNmH66I5D+P HNDeZBh1fp9I/vPI4TfdfV11dCjh/OeRlRHlD1KivonkP490vdJOmzDzHiWc /zzyUi2x61JxMyWc/3+uP2x0RpiupEj+84jJBvHLzkM1ReoPj9wJv7bfUEpb pP7wyO8UJl44/3kk2Ii5vnD+88j+4Ux7hPOfR/qx7RfOfx6Zzt6vcP7zyAyp Hr4f4fznkd0GSXyf4P9Q9s3UH28WkkdP7sRZxxehf+BibZTj8i9l6B+4qs9T 0yBnC/QP/E5R1XWxMV/QP/CjdK7sYp3L6B94SfzWg9JHRmL9Af7FZnBF8WBr 9A+cDHsmdvmwF/oHPlt2z8fHTd7oH3iBFhMP/oH3d2WuD/6Biycy7QH/wP3M mPaDf+A+7P2Cf+A18Ywf8A+8t7813yf4b+f/LsLJwyL3DQtlWtA/cK+M7FkP J/Wif+ClQXWdHDcb9A/8bVRC9Fq9WvQPvGfbPIVyr9foH3hB7WTxdeLu6B/4 zdlL/deMFYx/gKtkHeLZX5uD/oHr3Wzx7Uh2R//Ak04y8eAf+CUX5vrgH7j7 F6Y94B+4ZwzTfvAPPJW9X/APPDmK8QP+gU/ec4HvE/wfWf61z7yiSFKws9bi 1RdFCvwDLzpRueFKzzAK/AMfrNZdtaPHBf0DX5/yyvDZpY/oH3joSXEP704x fP4Cz8kx7AgznY3+gWcrpGXL77BC/8Bzj22qstyhhv6xncvNawPtlNE/cJUD TDz4B96v+xD/+uAfuHg20x7wD9xgD9N+8A+8agdzv+Af+NHhjB/wD9x0EOMT /E/n16VoUjQrqsHbdxT6B574oiS/nWuM/oFrLpgTIR7OQf/A49eo3lA7/x79 A7+VJp48duQo9A/c+t3T47OGjUD/wC03z+t4908XPn+B69hmKWbJfcLnL/B7 v06vkleqxOcv8EOzmHjwDzwrnLk++Ac+6i3THvAPvHEd037wDzxwNXO/4B/4 pkDGD/gH3pDK+AT/Pw7H3MofFUd63L+rnntiif6By229OL8pYRr6B57xwe9g lBYX/QNPfHYoxSShGv0Db9w/fdl9WXv0D3zzZZ7uwriv+PwFbndsqMmD6Dvo H3i5gt6qG7oqmP/AJ/n53gk+J4f5D9xoPBMP/oFHtTLXB//AL2cx7QH/wI9t ZtoP/oFzSpj7Bf/AqXLGD/gHPi+E8Qn+0/jPhWXE7JjcpMwZ9ugfuGc27SJT 5Iz+gbd0L+4XGRmG/oGv/Tl3wTNxgX/gVm/ebTp/Zjr6B14lW7ZQfNV19A/8 xFjxoOXyn9E/8HWf1Y6nXXVD/8DvB4Qvluk7G/0DL+li4sE/3m+BBP/64B+4 tCTTHvAPfMF7pv3gH/iZNuZ+wT9wvSbGD/gHfm4N47Ndx5brdf+/6wzAYb72 Tc7B4LHxS+t1o82XH1Ee+p944BAvo+dlorvmtrWiid7OOp4Sxsu32a5eva+B Ao7z6Ix7HSFaDdTRCcqnja/KYfzNJ7eUKh7b0cAhPker8PWoTHPaN0EmsVlW BuMTxl4yutPPEznEG63u9TWaS+hlm75mrc6SwPjBPvnJng/9kEP88lkPkrVX E9pwzJ5rOod+4rpH/zhaed/zAOTYnnWxUonhU+iN/P56h/G20ZKSx124yCFe Z9x6B41rk+lD/H55i+shN/SObH86j4sc4g2uv/Mbkz2ZNk76n+g2jA/ZpHpD vTMAOcSbXm980jxvCt01/kpo1jgJXPdwPbJk3Wa9+cghvkr24sH1SwhdPfIV 0djeH+PrXtpUmuR7Iof4kXs1h8xPInTA1mUb7WLlMJ6kPywfftIBOcQrrUpc OcxnAv1y/eaIHn0ljL8xLDVnclUTBRzij9h45P2e10TZJaZyrr7+73oOcIj3 O7Vx4L3GG9bCeetB3K3czkQVVVkL56cHKRyr7z1psCA/ga+QT1APv1tPCeeb Bzl9LfRA42wFkbzyINt+qGuonR4skj8eZG9ckP/P05IieeJBLi70dDv8tIsS zgcPoqO3MDD21i9KuN89SFLAxFHrD/+ihPvXg5Sq6boE+nVRwv3oQWJOj73/ QENSpL88SNHZki7iPUikXzxIQn/NtcdXKNLC/j3IjGDHYoPaBkrYswfJiQ11 yIi9jp5xnju+Rj+WV4Segeu6vlZ0TxfD3zvw3idiBtJnv6Bn4BMN5ZxPZzZS 4Bl4TqDDi91H31PgGbjFxfFiL/NeUOAZePbXTX63N5eiZ+DXm9SvhuytQs/A z1z76aJxogo9A6/NLIqQ8SxDz8ArNsk6mnu9oMAz8Pk/xYyq4qsp8Axc6lTA 8tSdjZjnwJs6b4yOz6hHz8Cn5ffr6rgoTgnnM498iFvxTPXcQZF85pFJr+Zn BeRridRVHjFM2fC2SfOzSD7zSN8vc29Vvn5FCefzn3nxo5gXAwZ9pYTzmUe2 n/tU3HCghxLOZx6RU/jTfA1lkfrGI2PUfOINpLVE6hiPzNtgn3d6pJZIveKR fR8dmvosUBGpSzzys++x+fnveynhfOaROzN3Rs3+WU8J5zOPNJ4KorK+Phep JzwyzuT4S73aOpF85hHzxHGc8mZt9AzzU/0K7tEszTL0DHzQTjWZ7Slm6Bn4 XvMjoSrRn9Az8KEjnj/RnVeCnoGvnaA6+JCjFtYN4K2HpoTnF0zEugE84Of+ 0tzds9Ez8AeKZpHT7DnoGTjt4SfmmsBBz8Crd93P1d/rip6BvzL6mJmrPwnr BvATCcaGQ+9oY90AHuX+/I2uXDF6xvWBm35vc/vVomfgBxSiNX83jUfPMA+9 VTt67cW4HvQMPHHA2wDDOmv0DPzF++vXwnrfo2fg2bwkB96rt+gZeO6E3pBB O2agZ4zvsiu/3OmDnoF/kl5Mip56o2fgh8c7BGgd80DPwDWPV65evsoDPQM3 5+0PDlP2Rs/Aa/f5vw6tnoeegRclf2pcOtAZPQN/dbBzGRVTjp6Bz83LOBrt /xE9A1e//37sXQ0aPcN888D4J2uCVgyjwDPwcVyOT9wYZ/QMvHWx6bOLktXo GbjzmG5dycbf6Bn4Dw1bv8md9ugZ+Ie38ndKTW3RM86j9bXi06+ORc/A6e1+ Ac71Q9Az8FSHcoWLe4egZ+A78sRkhk80Qs/AW2wiwge8p9EzcN425Y/bBzui Z+BS+0nf7CXd6Bnn70+CmxaQ9+gZeP7oPeszZVzQM8wrHwSP0z2obYyegbcO NxU3OOGJnoGbXnYOr75dgZ6Bux9qcBvGHYHjDVwfWOg3s0+vDnoGrrDuee55 eQX0DPz7yaNnIi1+4HMQ5+laBV84Tu/xOYjXP7I243trNT4HgaubnVZ0HNCM z0HgM35NsTW2lkPPwN/YVsyzP6yDnoEHbPqhXf1SB8cbwGf/m/qwq6UKPQN/ PNVm4h6ZuegZ5o+ff0YX75k0DT0DvxrZscZJKwA9A/cbOve6z7Ny9Izz9KcO TnIca/QMXMI3NFinZQx6Bj668/hmjfQyfA4CP+Dvz9mysD/mM3DZ3AKtncGK mM/AA33aWmXlFTGfgYsNUZbKUpfFfAa+UetI7K2Pr/E5CPywc8/ShY6j0DPw mT837s97QKFn4GdsOt76VlWgZ+CzjhkN9tcKRM8wT4xa9X2QrqszegZ+xVtC NSp1EXoG/rRDycRvkMAz8HmTnlyXcqHRM/Aib72gpGHG6Bl43Iv7AXe036Fn 4CvWRzY99bBDz8D1T9hKu/u6omfgBn3rXzqauaJn4KbTumzePXBAz8A7fHs+ dZZUo2fgN/XFZBc/NUDPwE+dURhzodYGPQNfNj19cLGMwDNwZ01LuaV9F6Pn qKSBrW3aNqR598BmRc0X+BxM59cZirxWTQptn3UF5ymPIh8OuRdpTR7OPBL0 93y5hV//p5G46yE9TicF8+JJdyRidTdMIZk1OscLDGzQ8w5+e6zI5fOHlzye 74R14zM/HyzJPe6um3tc3dDzFP7v0ZzsnLbR1zTWEz3v4rfTlHgtXhDlv1ww 3vjCb48x6Ss3maYuCZ6Dy/l/dzSJKvROmh3Mwbqhy7++HlllJHnBrcADPRfz r6NF3PrW11/MdEDPb5L/F69MAs72U5pSJZgnuvN5H3LkxP/2l3fjPOWd9PBF d/51Jz98Br+5+LsSPTP+3Yl+22M3y9e56FlGrCvBIMaNXFadT/89HzzMv19X oms2/QzHTzAfHN9eum2HpitxXPxoTrWWPnpm+ms2sRkaq9Kn1QA9+zVeOdL+ wIX8U/ygt17HCD238u/XhUiO8lqwZeFY9KxUrMfLq3Im+a0bv3beMEbPhN+/ TuThYHPxc2Wm6Dkk993GLeNmEu473ZHbzpqj5118/45k16xr85peWqLnvJMH zs1NnE4aR3pO2jdXME+v4eeDAyn5EnT87/n44L1uJSOf2ZH5LuYptltuoed1 syZUbNrsR0bdty0selyMntX47fclOhUKC3ifBfPBC3ZKjd9NfckQs0eJnWcE 80Eb/n3NIz+98x7nzmjC8Ub5lOZez7c+5KHTeSnNhWLoeQn/fn3IxCmdJlRK G9YNKfMn8rfXehMVv9hwTorgOZjK98AhRquUw1fnf8fn4Dijszr6Rhxypq6r T1fmd3wO3uf7mUtCEzL8Aq8JnoMcnY3mW196EY7a4i0Bfr+wbjTxvXkRnnPD TZt8KfScpMazb03wJF8fT2k3CBPMu4fyfc4hKXpqtaZ/zbuz5Km53npzyJcH x3W3/7yEnpWKT2ae0uERseelji4bM9Azk+dckuM+8llusWA+eMZu77iKWC7x Ceq/7t5f80Em/7lEprxPJBX8Bj1PvZN0ffDjQKI6UrMxueM7zgeZ30UgkSG9 7an6nej51ZSl1rRWIPG64tfPJEge85mpYwGEfL7Ya9Imj/m8MNe/KCYqgFyq DXHTSJLFfDbn/44CiEeLZE+kXAt6FjN3cTtT6E/UPMb17VR5j56L+L8vfxI2 tGO6rOtLnA/uySYVler+JGuMxHWlrgYc1zG/u/nkqYrc4L1/zbsNjMbw5CPm k/zbyy7POCiYdy9oNPOTXbOQ2O424IYeK0XPJvw8WUgqH6vke64TzAe7QkbU TX0dQi6pGooVRQnmgw/4+RNCYtqeejSIPUfPKTVyEUtHh5A+56ONeZ6C+aAP P6+CyT8qPTLrbplj3Rjp39uRuTKYcHjBGzZZzkTPzfx8CyZXdF89mf3MCT3f rGhYU/48iMQUGh9b2mSPnjfw8zCION00NDmxygTrhqtXxYBBI4OIRVNmyBYv Zawb6vz8XEAGdegFnnYVzLs/vyjabb18AfFyNKh8feEZer7Iz9sFJKLx4EOv v+bdy2flakQ/5ZH9NmYZ8j2Cefd1+fwh4dVLyPnhJ+d1J3Sj57X8erKE7K+f 1xnyVDAfdN56/sjx8UtI8azqE2J/zQeH8utMGDmxw/yrztxK9PxROs3gzcYw YvpP3sLJ6wTzwfP8+hNGSh+q+R/fMwc9xydtyZGpXEwWxc0oSF7jgp5pfl1a TC4t+nDh9Z948DxIbNkkYrKYTJwfl6Bwci56LuPXq1DSZXxguoKdD3rOWB58 L2JdKDFNlXN4OskBPYfx61go+VX+ZNT1T4J598T2OU4nyhaR0bsdatYXFaJn SX59W0R4hamTJaUF8+5/I21fl45ZRL6a/Fh/U9ocPa9T068LSY8k+zRXlLVs VsNx3SL+7zGSTD682Sm3wgk9u3ilnVs7PZJoTn//duBf80HmdxpJrvc3DZs4 uQs9q+1VikhriSD6Oz5rulwSzAeZ328Eabqj6WDgbI+ea15sMb+WFkGSE8aN 3tg0Cz0X83/XEaRaSiwja4ADes6Wl+wssY8gSv90Zy7f6YCe9/J/7xEk/Iic w6BsF8F4Y9ayW1+bw0m3eUXLlV4f9DyfXwfCCZc7rsnYTjDvtt3avEbqUDiJ 6OuTnr6lDD2P5teHcFL3qrzpw1/zbrniYHtNu3ASenL61RF2gnn3WKPQewed o4l+ATFL9xmHnpm6HU0y3Ced75krmA92hHzceOVXFImizQyH3RLMB6v49TyK 7EjOHmMaKpgP3jvJcXp6LIoMU17/4GzyMPR8ml/no0iS2Srzlq9W6HlbzTP5 LzOjyJsNVjtO/BiJnpn6H0XcqaSf8f6y6HmuzvTXEu1LiZSWzmxJbZm/xhv/ ey4sJTZ3YjafmqGInnX981PVjy4lVsFSB12GCMYb/fnPi6Vk8ZHVvqrOM9Bz 4+EJfhYzlpKUn+fq9acK5t0v+M+RpcSiNaJvz1/z7tyK8zoubZFEfYdc9iRj wbz7zZScI/92x5Lfm69fNsuaip7z+HUvlhwyaK/tqPRHz8eWG/A+n4wlh5U+ Jd9/IpinMPUwlpjMjLSgvAXzwdDcIwbirrFEP/+oxWtfefTM1MlYMvP+MbOU 9wPQ84T2IY1qXTEkxHBvg5npYPSswa+fMeRNv5fclWMl0bOE+fac8ZkxZOhq K8eti/qg5zp+XY0hgbP/Xd2wuQKfg/9G9o11dokhR7W0Uhw/tuNzMIdfb2NI +LWdqUdcTNHzvuwVk4I7o4mzYswCx2eCeXcCvw5Hk+XLdn262iaYdwc0tvau zogmpzbavaqbKZh3r5n1K6H33DLyq32Q7LvjTug5iP98XEYOFq2zHjBKMB+c uXWJtarnMrIuSjYyUUbg2ZT/3FxGLFd2DF3113xwSHFtHzPxZSTny5NlJ5qN 0DPzPI0nFdV9G5W86nC88V7at2jm2XhictusKslcMB98yH/OxpMvlwL05gRT 6Pmc3attCzz+XGdqwMwviyj0zDx/48n8u3u/b30zEPM5JmmmW2JvHNkit3RZ SVI+emaey3Fk3onda93qRqNn6zt3h6SejiOjkoJL/P+ad+vzn9dxZJyDu3dL tWA+OEBsUsUltzhy8evXZXvmBorsd1uRxmEK35asELwfCHzrhRQuN+a+tfA+ uBWRCxv9aXLkeWvhfXArsnyF/9wB0j9E9sGtiO+DA7a7J9mI7INbEbEuab0X 151o4X1wK3I1Z6PRmwezaeF9cCvitPpG6LVI0X1wKzInbSmJ6XUT2QcXxAvv g1uRXPb6wvvggvYI74NbES+2/cL74FbEn71f4X1wK2J6ehTfj/A+uBUxLGE8 C/t3JPqX3Ae+FXuDPIadJ46elPRac2OlSL84kjHm10q2LRC8zwzxUm/nyRsu qxDpL0fS63V98rabV5FDvI+3sWzchRyRfnQkfT0e+b672ozvOUC86Rqjq5nG zSL960j2uFE31zyxoIFD/A/bxLJn47RF+t2RaBml/Cs+1hI5xM+0+ZhC71cT yQdHsj4jOidTaQJyiN+RdPaupoWKSJ44Er2xU5c0qFogh3iHRJPkqqFKIvnj SK6HnLDM+TPuBQ7xssNftO+MUBTJqz/9xV4fOMS7s9cXzjdHsp9tP3CIP8W2 XzgPHYk26wc4Xp/1I5yff/yw/oFDfCvrXzhvHUmFO9O/wCFemu1f4Xx2JLL3 r/HzBzjE270z4eePcJ47kpPOHvx8Bo7t+cHks3D+c8il6Y9czF++Eslzzp/5 V6BpwLJSkXzmkLm/apyOuLWI5C2HrOQ8UL4V/l0kPzmEQ6WJ7SiWEclDDun0 8/LbpdYl8h4Oh4yRXz7OJ/mHyHs4HBLc7m+ldvw7JZw/HOL6QnNM0+omSjhP OCTzFxMvnA8c4q3AXF+43znEfj7THuH+5ZBwtv3C/cghs9n7Fe4vDtkQUMv3 I9wvHCJTw3gG/wHs/PSGeYmW05MHIvWHS9Tz/Z/lUxexXyBedjvn5RrjZyL1 h0uouqVm844XYH9BfNE84/rL3f0p4frDJbkvJPttHzgc6wzEU5724hJmTSL1 h0t6Q7K1bKY0YP9C/N26N73iY+sp4frDJcNvH6gofih4/xbip+Y6WWqdqKSE 6w+XnGqPq3I+1YD5APEqxyWi1o5+TwnXHy6ZE9hyMehxN+YJxE8WLx/tfryN Eq4/XHJm/kqrWzJDsM5AfOvbzf3+fdJOCdcfLvF/ZbcqQkIN6wzEn5Fmri9c f7ikNpi5PuQbxJMLTPuF6w+XDF7BtB/yEOJN8xg/wvWHS6R7GT+QnxDfwfoX rj9c8vkW4x/yFuI/z2H6V7j+cMlttn8hnyE+8S6TP8L1h0sUR0jx8wfyHOL7 /mTyWbj+cEmpI5PPkOeb2XWJRY1Dt+Q53Md8Bm5nop096l4+5jPwCsNlZ6qz jTA/gbcrHPK/MVGQh8BDPuwbbx+Tj/kGfP9wzd3lq5TwuQb85vI8xcA9Rvj8 At6/5Zx+Q4kN5g/wusjkZYmH7DFPgEv8YuKh34EP3MlcH/oX+G9dpj3Qj8Dv VTHth/4CfoG9X+gX4Fq+jB/wD7xIbQjfM/g/zO7X67HnHYDnsOskN7PuaU1r acN+gfhf7LkJ4BD/bVrCzECHr9hfEK/FnpsADvHGI7wsHn+Yhv0I8QXs+QLg EC/nURDm6vAZ+xfib7DnLIBD/MoLnv2vXHmK/Q7xksuY8w7AIb4pUFvus+UM zAeI72LPZQCHeF1JRTPVLC/ME4ifwp7XAA7x3Dklw+XCPDF/IN6ZPccBHOJN rbKzpV09Ma8gPp893wEc4jvdmetDvkG8OnvuAzjEz5Ji2g95CPHj2fMgwCH+ RhDjB/IT4uPZcyLAIf7IVsY/5C3Ee7P9CxziC9yZ/oV8hvhv7LkS4BB/bRyT P5DnEK8rw5w3AQ7x1Ou7/HyGPA9k14WOyD1bff9Kf5yXLWbXx2xi/OTz4lTx vWWIX6Vstu35UHHkEF+8wOZTg5QC5jnE/yg/d/Zxnj1yiHfpLo5s1RGcp4B4 qZsKH1U21SCH+KbFMtH9JD5hnkO8cd6nYVnegvNHEJ/8zONEbXAP5j/E3zhg ueq2kxvmP8Sblo35Z3ay4FwGxF8qtsi6F+aNHOKr5vc0OFjYYJ5DvPOpC0uu LhXMHyG+OiJBx9jQBPMc4rtt08ecXjELOcS/1D6reP/tGMxziO88zlwfOMR3 hTLXhzyH+OJCpv3AsT1zmPZDnmN7Uhk/wCHe4A3jB/Ic4s8fZfwDh/hn2Yx/ yHOIP32D6V/gEO/O9i/kOcRTn5n8AQ7xvyUe8/MH8hziR/uV8PMZOMTrf/Hl 5zPkeSy7Hig1pXDECe5IzGfgxx8vtTluoI15C3x4vsGo6dc8MD+B92yKbWnL /oB5CPxWP8r/Pk8d8w34yvMnGkqjacwr4Pr1ptm3vQXPX+DGM3oTnRUGYp4A Nx1m3JMxpB/mA/BKiomHfgf+6QVzfehf4I5nmfZAPwL3rbfmtx/6Cz2w9wv9 AvxwAeMH/APfUvWQ7xn8r2bX5RaofzyyO9YU+RZ2fTJ5IxE/8XIy9gvEG761 jpm03hA5xD98NCLlcaY59hfEK+yUXKg52gc5xl/NOea5IAD7EeLnfvuyp3LD e+QQn9f9++3ZQsE5C4gPHPbihoe7Ma4/QPzxmbFS/R5T2O8Qn33+8NrXslrI Ib7o+7HNH+X7YT5AvO+knwreiztw/A/xjoEf9da9eI/jfIgX8xobd7qsBTnE cy07+ilMlsf8gfgdNy0XGvMacPwP8XerNl+YUt8f8wriyWLm+sAh/ups5vqQ bxDvpM+0HzjEf+Mx7Yc8hPiBZxk/wCF+YT3jB/IT4nkDGf/AIX7xNMY/5C3E W9cz/Qsc4g92Mf0L+Qzx17Yy+QMc4g2zmfyBPIf4X+8/8PMZOMSX2zD5DHm+ h12P5XA2Lisrs8V8Bh7maa3Z+tc5LOANRjXHzXqDMD+B+98OXO3kLMhP4E7f tau7+jlgvgH3yisIsrgomFcCL9+zP+Gr/BvMH+A2inT1y7XTMH+AO7ttkBDT FXyHAfgbPSYe+h14ZOUB/vWhf4Efus60B/oR+Nh6pv3QX8A9bzH3C/0CfMQI xg/4B/7VlPEcJ/T+lRU5xb4XNIlZJ8f13vfZOZlL98+m1fjXf4O83HPYST9/ N9qH356PuK5b+EBR6omcO/2Rv37egVx3bcoPtaNu9Iy3t3OeZ0jheuz8sikb yn/Mpk+MUH6gskYWee/Oxckl1TNpMfP/rc8rIP9R0dud5T2Bzir1i5mlqYJc btFEzSKXtxSHv7+g9p/13iR2/wLWwdTY939KmXV75M53J9T87xzE6I/vgnws 5ZDX7p8SPShbif69cuHNqF3SyL0OfS05QVTZ80piyGsOeMz8eUeF3lq9yrDs YjOuf27+FmvpkqXE7l/cRv7hdd8pCqcV6ev8/qrH9cmEwm47v/eK9I7iVQ63 V3Qj9xnKG5J1VJkewd8f6Yvre7LjJvYPHaBGfxJ6n82RbGDf/0mI+loUFD8I 438c6Mo9UqFNpzP7NRhfKJ7y/N9j5vS3yuFNHoaC9ck4Ref6W7/l6Zn8flQS rGc6zZUo/fCV2r+66Fe7qmB9cpqMddS+bwVUB9/bUIyvWvKCjt5aaG2nFy2R Ki1YnzS8kHYv7Nafh5vQ+34cMpJ9b8eX4biOp/fgWoGWfRM1gJ+f7cg36hYY Sis3UvP5+SmJ62+ai4sPHvBsof7hex6AXFl2Us9VHzF6M7+/5JErTv91IqtF hp7AJBDytW6XNFqV31OMZ1XkCy5kzBnkWGB9hN3/gnWPn2XM+za1TL8gL/Ms ztut00wl8/+uOHKdlGHBfU17KC6//S24flVt1hh99o0KHcH38BT5Qu6O/fd6 VGlZvofPuL70T9l47UWDhtDM/f5GPs14/L2c/T0Uc199cH3GNmNUpHzlNyqF n28DkdsfvmkzRqmYiuHXDQXky306X0k3fKNes/tfsP6Tx75vo8PPTxWMv35s 17/NqU8p9veI8cHHbia1R4hRJSVTC+5vVsP4xrYpaVddP1pPZPfvYB3Dh32P hWmPBK5vfHZq7xdyaQj9jH8dGeRVryyHOhp/ppSTHb9KjZdH7numoD5lYhl1 d1xbS+YIZeRr6jQf1T56T4W/SO92kFdFvmPA8tD0DUOpKLZ+4roB+z7JeLZ+ Atd6dK90DW823f6KqZ/AH9/O9E5XnEOHsvUTuPO/ZVHx57zor2z9BD4mRXNZ 5hVfehZbP4HHfpC//DxoFn2arZ/ANz3w71i5T4GWYOsn8IxG2WSLnZXUBbZ+ AndJVN6nVvec8mHrJ/BeV49fcYY61Bq2fsI8woN9b+QVWz+Bn7xqerRjyntq JFs/gc87pyYbN7SXamXrJ/CJcikLSzWc6YNs/QRe2LyrOzh9Gr2arZ/A60K1 nw/qsaBL1Zn6Cdy3/+it/SWN6ads/cT5VPtIrf4qxvQhtn4CTyg9u7dspjU9 iq2fwLUGBeYUeLrRX9j6CfMpS/a9kTVs/YT4OOtXvx2uj6SPsfUT4qe8z9ZJ PlRONbL1E+LHXk08+enYB2oWWz8hvt+EiQupw9XUIbZ+4nz2y8bwnvlXqd9s /YT451MX18VrTqMc2PoJ8Q7fP9Wph+hTFFs/Yd6hwb7vkcrWT+AH9M5ujC/s R2uw9RPnKcvCw+LeydFBbP0ETqKpgoonJnQBWz+BZ1SfLXKfYENvY+sn8JC2 h5IfeG3UJLZ+Av8yaZtR/4IXVB1bP4Hb2Zk8fTLEljrI1k8YN7qx72lUsPUT uMaFl5F3NAbSa9n6CXxjX43Gl78k6Nls/cTxZ2bzYasgBbpZnamfwGcEFrae pGXocWz9xOtv59RUDJani9n6CXyO5LSKxNYSahpbP4FPXtFd/G5YM5XK1k+c R+i1Kk9fRLHvOSgg3/bN+U0sGUC/ZesnjJ8nsu9pjGLrJ8SnHqkfmvC1gNrA 1k+IP5RlMbHEwIt6ydZPiE+fZmx9ec90yp6tnzAOHMm+/7CSrZ/AXadfHxGq nU+9Zusn8CM1Gp0+98zooWz9BC72e5BTV+9k+gFbP4Hf27upWDHnJbWUrZ/A J8bbXFza6EtpxDr2q+9V/8/7D2y9/c97Dmx9Rn5RsWjzpaBaSoVpD/IjDx9R vyeZ0s+Z9iP3GmdetVfRll7J//1qCvbBI19utNr70trkybskSkodx28exveU pbQrrZnniBrG13Tt76RDSqx1mX5BPsh+r94L5WdULNO/yMMsm7pUJkrQu5h8 QG5srG60Z6QFzTzX+iDfcC+q98vnCfRtJt8E++8lp5r3/bKglZj8RB7XHanV LG9BuzLjAdzv5qVGbDj/wJz2Y/JfsG8uIWvcZW7BjnPEcTxmIrsz8RZnAr2T 304N3J998nRbdWXUK+sa5neKfNkL+s2i9J/WlszvGvnETrOF8/a9o7YwdQC5 nJNc8Rqt71QeUzeQz1kwKGdEgjQdyNQZ5H5S0i0es35TCkxdwnFgXGyX2w/d VqqlcLjs5HZN3E/UkTo0/El2iXUm/zmojuOo80Uy0Y+crlnbM3US4/NUJSJs mtusO5m6ivEHjh+1oOvUqVSmDmN8epCnQ3rMTcqJqdsY75V7VzXRs4Zix8kY f2eIx7pndt+oVczzAvmD6kHU1p5GSo957iC/9nHYkvLmj9Re5jmF+5gW29oX OpX+oO4yzzXkQed3hHgdbKeMmXkE7jOajH9ZWPi6jdrAPDeR797zsGVHfi11 mHnO4rjrg/UwKlKllPrFPJeR5xa9u9Rf6jVlwDzHkcePKlpuqtZI9dO6smnX bw3cR1vjvTn1sW2RNTv/Qt4xPOSr2R0tip2vIW8+Pthp6sfnFDu/Q65o8d4y 6Z8PFNOPssj33ruxea2GAs34lxL83S8lZQd/j6aZ/OzAfbrk+L5uSy1o2pcZ XyGv+Hy75LaTPa3IzGdxPDl5TXxJ1nBbOlhkn0v9KbPPNYytVzAuitsYe3zA 3VbYX8D4/F/MPloYW8cg3rU25cfg7RNhno7x8oeZfY0Ctr5B/H6Pjed+Z7+F 9RmMz2P3TZTYugfx2YVyizJCq2HdAOND/Jl9mSdsPcR9kLU9Nef6TIf1JYwf y+6LLRDZ/2pl978CRfa5JrP7XFe7e3t73z2YBHwWu5+1RGTf6j67bxUqsj+l wO5PyYnsQ/1axbRnoch+0wF2vylAZF/JjfUzWGT/qJLdP1rO1n8YR8mln79K 6fShxrL1H8eH+9QNTYeost7UMP6bf66Fb7Qppc3Wf+B98+WzB9+9y84LFJDv W7X9Jyn+Tm1j6z/wHcUBG+KjTWhztv4DN1vZ/lb3jAt9ma3/wAdpn4yWMubQ Emz9x30ZzyfDtvvOpjPZ+g+8ttb/VfvJWez4rQX5IqepJ2NyXNlxmjiOJyVr Yl38FHzp7Wz9h/GYQ9zmQYv99KgPbP3H8d60l4++jZtJmbP1H9ftxTdJpl59 Rm1k6z/uL7TfOrwoQJW+ytZ/XLefLhdfO1eFXUeSRJ43Sj6ec8Kavd92HMdm JFip7jM2pJvY+g/jn/XJmlrSKWOoY2z9h/HPucrr20wfTqIotv5DvL7zgJwF k62pn2z9x3Hde3Vej4UftYet/xAfkXh6b25pNjWdrf8QL7bjIac2v5SqY+s/ xHcE5i8o+T2UjmHrP/A55kXbJnrq0eps/Qc+9l2FrvWd4XQSW/+Bu5h8qPiu JkEfZes/8KE9RaqJGs2UoyZT/4GXF67aVRDWTO1n6z/wKYvzj9mO+FNX2foP PEAj7pBMcSclvoqp/8C5J5aFOvga0mPZ+g/86rYMDWtaj5Zi6z+O9xLGZ86d SVOebP0H/rDzkVt1lzd1hq3/wB/4D5gywLyQ6h7P1H/g15qnvluy04w+wtZ/ 4L5y3Hj9ssm0HVv/gbtIzE8rMflCvWbrP/Al//DO9Z6aQk9n6z/wOX59vz/u +XMdtv4DH5+2NiRMZZrIuVQrclrkvCRw+pPS+CFps0XOpf4ZZ+4KO/iG6yZy LtWKJDfsVU4d4C5yLtWKHLwinZe8zU3kXKoVkbX7WFZaMZsWPpdqRcSeF11e FOAkci7Vijy17ON46oy1yLlUK/Ik96hhy+4mkXOpVkSy4sOelY9z8NwNjHvH ipyLxPdCQ0Ms/j4XCXxBW/nRDC/BuUjgyX3nrQ4zE5xTwPVVy4dJHm+HoE+M l4vrOjBR8F0R4HWdT5W7SgXnqYHfWxo8PP604Dw1vp8Z1yM3oUDpr/e6GZ65 eWLRnt1DRHz+GVez66LA8e8+W/68w0xDxLMjsZrTLXujwRw5xF/e+60tqUJT xL8jef+7zW/GKMH3jiB+4pybg8qHNYr0iyMJ3bJ0lp57njVwbP+JBs3B9rnW G/+fdVHhfOOQopO625c5N1HC+cYhN96IE7f3jZRwvnGI0owxuwIGtIicg+YQ 88mfs8QW9lDCHjikkZuuebBcRuR+OWSJj8qo1MZvIvfFIQMNkla4j222Piqy Liotcg4R+PMDUxoixgnOIQLfPvAo8T/2mxLOHy5RqUxR3NCjIJI/XPJyoHn8 HQlVkfzhkn0SQYWLpw8VyR8u6Ru9pf5r9iCR/OGS8YbWRY48wfkL4KmyAziW /Wop4XzgErcV4S7zkt9hv8P4+V92XVQ4H7jkhEH82NLzX/46l8HEG136OeH1 hD6UcD5wSZ1qUFb6GXXsXxjHJoqc7wOubr/1g5O9BuY58PWTCxe0bBDHfMb3 zR73vcv5pwTbCfySlEZSlJLgfB/wTdvvr5ZuNcD+gnFmjcg5O+Dbgg+crxru iv2F749VLlf/4iU4Zwd8tHbqi802XthfwM8qPB4x4bHgvDnwJ51b7VYbu+P9 Aq/STu5yoa3xfnHd9ZtDA/XrBd4v8MS0L6k2SZ/wfrH9YsdfBnME549g3EhE ztMB53l0rbH56zwd8DUH903XVBacpwMunTP8XWWl4Dwd8PejVGwO1wq+rwJc 807T56cTBN+jA96nISKpbbUx+gRuubH7dL3kOPQJPJFXHn7xuCX6xPeUNLTX z3jqiD5h3OjLrosCh/grFao8j7uC765A/NAV3i/TZwu+lwXxSZop4tUfO9A/ xC/uOJF5TvEjcogfcjbNMi1ZcF4M38vqruhsf2WLHOLHqxeOV5rvjOfBYTyp KXIODt8Duefd7pvTD/3g+qdN64hP0+XQD/AuuRdfVkQaowfgP++Pqtj7mkYP wO1/6GwdVSA4Dw6cG2Z4qCyhGtsPvDptyPeK2e6YPzD+FD2/Brxgrt0It2pV zB/g3yWqcs6dFHynDrhdduE0ueuymD/AR+cZuj3rFfgBrlh2XWn95UHoB7ic a54yZ4YE+gGuNHHxqx8n67B+Aj98fv5lnyAj9AN8rNdi254BU9APjD9j2XVR 4BBvlHYt3C22Er1B/FONtNntBhzkEG8Zt0rFZoE/1k8YBxY9ED4XBryv6Yjm 59r3sf3Ap+3IXLImV3AuDHjEZfe13TSN7Qf+qjzH9u5xwbkw4I6zL5wbv2uB yPdYBOuiwt9jEayLCn+PxYo4b3igWTOpQeR7LFbEvn8DR+bERJHvsVgR1QSv P88UO1r47zqSG1mt55z+fY3fH4BxSL65bkyKe6VIexxJ4Q/3JOePeSLtcSTc wurI/le+ibTHkaheLrAKbxgn0h5Hon+3bXyvxwSRcbgj2TC+zcth5QSRcbgj qXrcVVNy0EJkHO5ItmqXrTD5aS4yDnckc3q51ivfmouMwx2JZZrGwaHeFiLj cEdS7nwyYm7oBBE/HBLTWRDgWPhKxAOHjFgyxXiXfquIBw6RzNYePiv+q4gH Dgm5rHCpbrG4iAcO6UwxmJ2yU0rEA4fse6i7Zp9mh8h3cjgkbuQjl2uXWzB/ YPww2NPW/Pz2hyL9yCUFEjM719wXjP8h/tSYJ2ohpf0o4XkBl5y68VzzS6cG Ptcg/vZz5a7zdl8o4fkClyTUrBzW7CL47gTEG//c6jhlZT0+74DnSCTP1z7w CccPeO7AaPleP+8PeL/Arz+sKyqZ0or1HNdL3d88411sx/EwcCUxG/vge234 ewc+fpzd086RNTgeBi5ZtIvrbF+Gv3fg29Z0u3w6Vo7PL+CPzsY6W49tRP8w LvKMfzM1svA+egYeb1Dp0uw0Gr0BzzCdHqP6qQa94fpkk9LmmvoX6A24yo/Q wRecFTFPgHM3j9Ndl26IvxfggVKu7/ZdpPH3Atw27cqPVfPs8fcC/NDJlbf/ HWKL+Q/raTPY7yUCh3HR+pFbrybnt+H9Qrwy+x1F4BA/Z9lvOl96KnqA+D3s 9xWBQ/yn22tGBO/4IPg+DxuvyX53ETjEfz81S053nOA7gRB/lf0eI3CI57hJ NWwJnI4+IV4tTfg7jcD9Rb7TCPyuyHcagVMi32kE/lXkO43AG0W+0whc9DuN wJeIfKcRuOh3GoGninynEcZRr0y2HbRy748cxlHv+pLD7faq2I8Qn7oyXTHN 1Rb7C3jXqFl6EoGC73UA3zzq19Ufqt+wX/A96rSfvLWjHNE/8HrdffeiZAXz COBqUokOE5PnoH/gccN0U3+/cEH/wHelf9/ydZIL+geellznOnakO/rHddrp 89xPGs3D/IfxWFjSNK0enZHoAfjI0rmxUU/d0APw0senTLLEq9ADvle8Sixx 6Cc1zEN8r/iJ/pUwFVP0APyU2pGzqyQF36kGvn/ksDMql0ZhO2H8c+6itZTl eFPsRxj/vNRI4zqkTMb2Q3zdjHcdtn5zkUN8zq4jC+vFBN9VgPjmDU16C5ZW IIf4f84o5ki0Cb4DgO/xmu+cur9mNN4v7ndbjTVK/q6N9wvc+6JlohORx/sF Pn9ex/77/QTfVQYeF67gaK0kWA8B/mbPgWnFM35g/Qe+/Nlazubl9Vj/gRsZ X+uf4CCNvzvgl8sTp98bLhivAu/dnj4r4bkO+odxncm9mTWr9tuiT9w3z1u5 RbaXh96Aa7fW7tsdLfAG/J2+9iV7Dwq9Ad+uecwoe4Hgu4XAw4d7xSrc+IjP TeADBvWf+fgswd8L8BsGWhyZF4LvkwOvHN09yE97Gv1/iKqh6A== "], {{ {EdgeForm[None], GraphicsGroup3DBox[{Polygon3DBox[CompressedData[" 1:eJwt2HW8VUUXxvHZMwcLEBXp7gaD7u4GaUQR6ZSW7u4WMJAGERURUUTFQrAD ERARTERM8hXf3+KZP/Znfe++99xzzt571jwz+boPaj3QO+f+TpwL1LUp577H r/LDQvwlfhbPx5/jZ/ASfBQ/j+fhz/B2PBd/irfhRfgI3okX4C/wDnsD/DzO g0fgF/Ay3A0/hcfjLngVHoMX46/wc7gjXo5H4U54BR6Nh+Hn8BLcGa/Ej+Ku +DE8Fi/FX+MX8Gp8Gu/FY/HLeDV+FL+EV+EJ+HX8OB6Nd+OVeBR+Ea/A4/Be vAaPwXvwY3gk3oWX49n4Y7wFP4a/wy/jlfhb/BJehU/hPXgZPoF34eX4G/wi noM/wVvxCnwS78bj8X68Fj+I1+GJuB1egofj3ngjnoF74Q14Ou6Ht+DZ+Af7 7NyeWtSHOb+eOpXzffAmPBP/ZN+Vv6lD/S/omuemXuN4Fuey+0LNzN/s5TiL n6DWp/bl/2ymzuJvfrbPy/m61B/t2uPa1H/53Q5qTuovdu05X4/agdcuo47k fH+8Fc/BQ1J634W4LV6Ah+LWeB4egtvjpXgEboXn4sG4JZ6DB+H78GI8DLfB 8/EjeHh8VpfiQ9RxfJ7C9h6c30ldzPnBKX3mBfgh/DSejAfgbXguHoi343n4 A+oE/k9Re2/OP0Odz/mJ+A27Xng6/hBvwDPxR3gTroIH4E64Mu6PO+JKuJ9d J1wypeveBJfG7XEz3BBPxb1wfTzF7jM+bGOOz1PEXsP56XavOF8ND8JdcFU8 EHfGpXA73BTXxqPwg7hoSveyAW6Mp+E+uC5+FD+E6+DRuDsukdI9boyLp/RM NMLv2pjm8+SnHrQegAtS37dxjAtR37PxjQtQX+HojzNT37HegPNRy/I/e1Lb 8D/L4V64LS6Pe+P7cLGUnumGuAzugJvjirgvbo/vwh1xC3wvfhi3xhVwH9wO 353Sc98SV8fDcFdcE4/A3XAtPBI/gLOkdN3L45yxr1bBmVN6zsrhTCl957I4 R+yxlXG22Acq4uyx31bCWVN6tirgZnimXRc8Fb+Nn8aT8Jv4SZwr9uSqeAp+ C6/DLfBsPBA3x7PwADwZH8BP4Ywp3YN7cP7YV2vhfHFeqIl97IH5cBL7fF4c Yv/Mj2+MvbcwLpJSD6qPa+Dh+H58e0r39a6g+5CJ+7uHI03s1QU5n4r9uQDO HeesajhvnDtq4Btify6E88S5qTq+I6Vn7m7cFM/A/fCdKT1/9+JX7RrwnlkS Pft34OedxlZG6i6nvvsQNV2i3vkwvjVRr+2JMySaizrZFJhofuuIQ6Ke0QOn T3SvZuIyie7JDFw60dzYHaelfma9j/qnV29YwvlKiea9DthTP7HeRP3dayzW 5fx5p/s/jVoy0by0FFdO1G8W44rUs7x2IfWWoL7YmvP/43g3aEz9wP88HNRz zuJ3cA/8PX7b+iA+gw8FjaNf8MGgcfcTfj9o7PyM3wsamz/iNVzzMzamg+b2 9rxnkmjOb+fsB+fO8btF1HRBc8J9nP7Paa5rQ/3X7g3/a6rTXGm9vy2+xvFB UM/81etZns65UonGdH78kdOcvIHaOFEO2opbJPpcW3DzRHP1RtwkUY7YjJsl mqufxg2p55PrUed637C5ej1uZM8fJ4/b/eD8ueT6V7reS38FlsOsV1tG2GTn qb8lymXWlwrw2mP8XDsoI6zjfAO7xxxpnPqPzSH23UtQb06pPxYN6tPlOf+d 0zxQh/qb0zxQm3rOaU57hJo9UQ+7B3/D8QWvf4Sf//bKRFM4V5x6hPNDqRc4 n5732odLBuWRyfxNsUS9vyI+49T7K1BP23Oc0rgqHtQXy3HulFO/LGv3wakH 3Es9aeOHv3+Nn0vz9wc4HsTf8b4T7D35/dccE3Ep6jGO74P6WMquZ9C4Tqhn gnpaoJ4O6pOeOs4+C6/7iuPHoJxwA/WnoCxxI/WHoMyQhvpzUE64iXosvv4K n+db65X4PzzGrj3/70v7fJwfy8+XOX/SejG+hk8Fzbl2k48GveYS508Efbf/ eX3XdDb+OB7AaalvO92T3NTDTmM9J/U9G6uJepTNffa8zMflEz13C3CFRP0j F37f6R7moX7o9BmLUY9wdLHvTd3nNKZvpR5yGusZbDxxdMfpqQc5ulnPoB7g uN+eP+obHJ3tWlJf4ehq14y6356toHv2L9/xOB6Pr+JfgrLczdTHqc3428sc a3AT6kWOJ3Bz6hV7j6D3/pbXvhb0uU/gtdSm/P6SUz+rTj3r9D4lqEed7lUZ 6gmne1KaetyuRVDWOmfPfND3OYk/DspF5/FbQd//NH4z6N6csp4clJd+w/uD vvM3eF/QtTiOn6S24H2u2v0KyoE5qFeDsmJ26pWgDJmNejko92alXgrK7Vmo F4NydWbqhaCsnikoy9zJ/97N8U9Q/r+T+nfQe2eMfbQGv/+VYzVuTL3A8VfQ 9b2D+nvQdc9A/SPomt5GPR/0mlupf8b7dHtQDxjI/8hq9zmuj4pwvg3fuaHT mm4Evt8pM3f36s9TrMfgLk45ubdX/7d1R0+v/m/rl2G4q1Nmnuw1b9r6carX nGtrrvE2ZvAiG1te86+t18Z6zaG2TpzoNV9bth+FuzmtI/p6zaG2TrGFsc3X ttYYjDs75fn8uIhTps2DCzrluhu81j6WG2/BWZ3y+U04i1M+z4cLO2XgvLiQ U37OjQs4ZcX+XtnA1mUzcS+ntWdtXNVpbZIL53PKmTm95i/LSz285sRp9jx6 zYmTcAuvDGBrqFa4vtPa+RW80il/foWfccrD+73Wg5aj9uFVTlnxS7zNKaet x7OcstlGPMcpE27As50y1Ut4uVNGfRmvcMqxW7z6kmXdTXiuU9bajOc55d43 vNaGltNuxdmd1iAHvNahlusOeq0x6+BmuJbTOq41buC0D9DUa46ztXBLXM9p D6G51zxoa8O2uJHTXkEXr8wzwcY9boXH4UM2bnE9/K7X+tRybzavHvKP3Wev HvIXNZPXfPSH5SKvNa9l49twDqe1VTqczWlNVxdXc1rDrsMjnXL7U3iEUz5/ Eg93yuFrvOZr26N4Ag9zyvaHvbKc7Rt85JXxbJ9hLu7jtEdxKfZ/m0NDfIYt g12Oc4r1tKs4r1OuuxLnCMt1Czn6Oe17XIzzjvW9xzmGOq1hP/TKpbZHsdcr 09r+z3avbLAR7/TKEpvxbq88ZvtIu7wyqu0j7cCT8Hq8xysP2x7Uq/HZs72p 1+OzZ3tEb8ZnyfamXovPoe1BvRWfK9v/+QAvctpjWYuHOO2fvIiXOa2tkjge Lev+k+jZs/5/l1cm6c3flPTKSD1xaXw37oFn495O+0jeqw/bevMer2xj6+uq uJLT/kNNXMVpv6K8V06ztVtFr7xk66+yXhnJ1iaVvTKVrdGq48pOexrzcV+n vaw0sbdY3v4zUf+xeeeTOB5tDyq911xvefjG2Jcsk9/uNT/a/JXBKxfZPJjR K2vZ3JfWK9tY/r859kPL+RcSPds2F38ax7vts30W+4xl+89jP7E9xo/jNbe9 L9uDtLFgc+VfifqnzeNbvXKLrZev2TyDW+Ft9iw6rXmLxN5o+aFoHEeWnQrH a2vZbEocI7b3OCOOKVufTotjytanY/Bgp72sOV77CbaunBSfbdvvKuaVJSy3 FPeaQy3LFYr3wjJewXh/Lcs18MoqlmeqxT5jubSWV56xnFnFa360XDorjn1b I1eKfcwyaiOvzJAWV/Dq4ZZpm+CWOD0uF/ub5cl6XtnJMmodryxkOXae1x6L rZ1XeO3/lMCD4vNjuWJIHOOWN9p7zcuWAQbEHmJ5o198zi1v9PGapyxjWE4f hLNZrvVaI9veS8pr/W57Jh285nHLEkO99nAs53T0ygaWJTrjB5yyyjKv/bdi eJXXHlopvBpPxGXwAq99IVvjt/Oary2fLPHaO7IcMtrrs9keYyeved9yznCv Nb7lrpFeGcby2CKvPSjbo6jhlZEs/5fANZ1y/jGOnU57bkfxDqe9rBzWL/BF 6hGO7U77Y1/jZ532vv4PkpPYhw== "]], Polygon3DBox[CompressedData[" 1:eJw1mQfYVMUVhu/O/IJIBztIUxQQUJoNkGaviL0hgtgVEBVFRbrYFaWDGmOJ ibH3ii3W2GNX7EaxgLHFmvflTJ6H4Z935+7e3SnnfN+57UeOGXZiqqpqAP/V 8ffEXFVb8fcT2p68MAbemv6ntKHwMq5bn/6jtKWMvQ+3ov847RH4eNoW9D+i 7c71M+B96Ve1qjoSfo/r1/O9tIcZ+xf8V+/H+BLGT+C1LeGPaXvAPeDz6Pdg vAV8PnwQvBp8PNwLvgDuBa8J3w1fDveF58M94fPhnnBLuDd8IdwbXgv+J/wa 3InWkO+yBXwx/S0YX4fxF+A34C60pow/D79OvzOtMTwO7kv/37RhXP8Sr11H /wPevwBeyPgxcEv4DPgVxv/i/MCL4Jfh6+EP4YXwi/C18Pvl+/fh/RfBfeC1 4c3hc+HN4ebwSXA/+HPa3vB4uD/9L2j7wGPhbeh/RtsL3ofPP5D+At5/CLzC eYAP5O/m8L4p5nchfCi80vvCB/G3B/yN8wwfwN/N4Le4/kp4OdwV/tp5hvfn b3f4Au5/MFwPPgF+k+uv8PvBm8IXMn4IXB8+Ef7SdYb34283+FjGezuftF3h y+FRzj3jp8Cv83mLnX+4M/wGvMT5gLvAr8I3uJ/gxfBxvL+P803bDd4KnlP2 y3rwH/z9nbYXrw+jvcD7r2F8Ga/NY/ws+CT4Fng8/Bx8NfwuPAd+iPc8BK9D +5bXnmf8z/Tfoz+X8aMZ7+X60naGX2N8kevDeKe6OA8LPW/wJvA2XD8P7g+3 gp+EX4Q70H7jtfNyrGcd/eMY3wQ+E94IXh3uC8+Ht4Vbw0+l2N/vwB3hqxk/ FW4LT4OfgV+BO3rG/O7wBPrtGJ/O+F957Wz4n/C68Fz4RPhBuDHcP8f3Hwi3 gRfDx8FrwWfBG8NnwBvC9eG/8P6z4GfL/n6a8Zf9/rTM2O0pzvOL/lbGP4Bb w/8wBnHtVbST6W/A+JS6mPP68CG1WIvv+NsAHl6LeHUr778MfgGexfX/cZ7g Q2sRj66kjYdbw5MZ/xN8CtwGngrfwPsnwc+V+PCPFOfzbXjDcl7qwQfz90He u4h2LLwmfCbjl8Ej4UbwyfB83j8Gfghu6v6GT4AfgBvCR8FHwtfCR8Htyvfx 99bgDmV9XL/senL9Ocbjsp79GF9gfIc3cP3hl5x/Q7LrS5tF/4myvs8y/iq8 sWeSsS3hS+hvWda7fdkvzkeqiz3oXhzN317woSl+35/gwzwfxnh4E1oDxtqW 9XJ+TTgbwafTbQ+v5nxzzUz4sTLfh6c471fDh8PXp9jfz5T4PQo+Av4zPAqe DR8P3++6w6Ph0fA18Gh4a+43F+4Hrw9fk+L+T5b80pHxiZ4v17Eu5uc091uJ t9el2L9Pl3zTpuyXVvAf9DfMcb3npY7xa1N83lMl/9xb7t+/xPvOjHeHp8DL GOsCbwZPhd83d+aIt/eYk+piD5t7zaHu7aHwavTvrSI+758jXj9A2woenmN9 jBkD4MNyrL17YKDrBbf3PBgjnO8cZ98YMBg+iO+zJ/2ruNd3xt4ca+mabsf4 iBxn1TM7CB6ZY++4h4bAl8KH02/I+0+C98yhM+6uIt/sxOcPoH8p418x9i68 bhUx1PNrHG5O/zZaz5KfdqG/iOu/YWx/eDd4CbwSvqfE834l/+6XI7/d5x6G 986RX+6g9TYf5shXd9H6wHvA/KvurCK/zcmxv5rweafCu8PqpduryG/vpIj1 zrfn/QB4d/pXcP238H7wrvBieIWxGt4DvhL+j9fneL+/d2s+76Yc59H8fjF8 S9E/6pdL4btyxK9tSj66Dp4Kd4HPMZ7C0+BN4XPhm4teUD9dYvyGp8Nd4fPd //AUuDM8oy5iqrFVTfcDr/0NnkG/G/0LGL8xx/nsDl8I/z1HvNkMvgi+E57t byn57g74UvdiyY9qxMer0JDfq0Fy3Mt79mf8yhTf75ESfw/Ksdfd833hA3Ps j6XOAXxFit+7lOvPhpcwPs7PhyfBB+e4l/fsB0+D96H/B+0I+NaiD9WPs+Gr UvzeR0s+ub3oRfXX5fA5rqmxEz4avq3oT/XkZfDQFHp3DnwAPIXxveHfaSPh 0+Dt6a+kHQg/Dj9jPKf9VHKQv83faG46Wx1C/zfaCONTCi16FmNvm0tpOxkL qtBzG6bQsmcw/iZju9BuhvcpeusUeDD8NW0/9YxnjP6vtOFwtxTj07h+B/Mb 48/DbWk/89rfU6zv8/Rn1sWed+8bc8x9c3PE26b0J3jeuP4AeD58MHxuDs7w seoVxrvCZ8PvMtYJ7gZPht/z7NF6wO/Rtuf6I+Ge9JfRdoRPhYfQ/4a2P3wy PIj+V7R94VnGCPqJzzsGXgAfDbeAJ6pHuN+m8CT4HXMd7TB4DXgc4xfBh8Kr w2PMVym0/5nwW4w9QXsObkP7rzkhxVqOo/+KWoy2s3u9Cj3di/Ht6M9gfBf4 /hz6zPysPl2c4jw/XPZvhxR+6PRaxNN2KfTrhFrE2x3gbeFL4OV81m4p9svs Wvz++3LoR/WffmMivKN7q4r12CPF/rysFvthWIr5mgcfZLxOcV4ur8X87pVi /8+txf69mM8bDjeAx6oPUvi/02qRP+YzfhTcHD4dXjvFXJ0E/yvHftVvTqxF PmlR9N1Y+CXXPsX6Tod3YvyBomfUl/rFeTn0UTP4NLh1iv1xci3y2YQc872i ivO4boq9PJ7x1xlrk0KPn1KL/Ng2hd84tRb58TGueaqK7/SjvwHegf63VczP FTn8QKsSf16G36piT7dMcWaaGmtqcZY+yXFWPbN9Gf8wRywwJvSBP8rx2d5j yxSaYHkVa6xW8Izo9fR8np2Pc6yla7q1uSjFHDu3r9E+zbH33IP9U5wpvaEe 0bPm/G6ewpcck0NzfFlFTlaLqFnMPeYgtYwayNxkjlIbqYGMncZQtdF6KebY uX0jh6Yy95iD1FrGl64pzvFROc6UZ8s9dCqvf5BjrVwzz8pm6qMUcWB0jjPW hLFRtTh73uPdKjST914rxRn07L2aQyNYK9DTqh3UiyNT5IHpOfThESnqFDNz 6NdDUsTdyTn054gUcXxqjhyul9XTmts/h3+qQoMMgT+Df6hCo1hTOYw2PEWc nZRDo+h19bxqFzVAg/L71QbGbGsvngnPhjHJ2oI1BmOVv+ntKmKkv9U1fqcK DenamxP0+np+c8X3Oc6GZ0QvYcyylmNNx1impjPWGfPUemoW18OYp5ZpZIys hUebk6LpUfQmjjUxhtfCE81L4en0dmrei1NoaLW0GvvCFBpfra9GPt95pk1K oRNnu745vJKeaUwKTe3Z8ozpvX/MEbuN4cfBP+WorVhjOSGF5lZ764nOTeGJ 9EZ6lnMUbnXhPdTsU1LsQfeiucT44hnwLOjNjc8b14VP3s68Tfs5h5fV045L sSfdm+Ym86Vn3hhm7DIWWENQw6pd9Ud6Nr2bHmhaCg+ll9LTzYB/4dq1a+Fh xsO/q39q4RFPh39T/9TCc09I4UGtVelB9abWCPQWeoy7U3gctbCa+M4UHtBc Y865P4WHUruoYfRWrqGevnFZ28tSeCq91Bq0ZrROtagBLEjR9LBNy9gXrmEV Gnj7FDUHc4856N4U/vuWFDr1hhyf2bEWns57WbOwdqHHuhT+lWvWqYUnPiVF jUAtpiazdvBDjtxijjkGvpl2Uwpde20OvXJjCp18fQ4Pq5e1BmItw5qPtR9r DNYaXOOrjL+1WPsvXfMqNPuOKZo511zrmB5GL6MHs5amB9OLWQNYWXKgXkpP ZG5sDw+pRc3qMbiDe6sWNasnUniOO2Obrqq1taMzuBY1okcY3wjevhY1tCdT 1MhurcKTWDuzZjS0FjVVa0nWlPZSx1dRa1JD6M30cGoLc65erlOJN2pAtaAa wjjoPaxxWNvw3tbU9lYHVlFrU1OqLW+qorZnDXDfWmhOa4N6JL0SU7WqNmiN bhh/b6yidqemVduqQYyzzrlzb03xaXglbUWJ6cY7z5Bn6dda1B70AEur8AiN UozpFfV4XqNn1jvrAetSeEC9oHq1XgrPp/fTY6cUnlk9qydbPYUn05upx9dI 4Rn1jnpGJ11P8mgVHqOJ8ck96bnzLKbwHI9X4XGaGe+NsSlytPFaz6P3UV8Y N/zN1ug6ltijJtG7b1iFVlGT6N03qkKrqAH13np2teH3xvQUOdh8qAbS23eo QhtZQ3HOnWtzmzUa19y1XlW7qQuvouYzT6oh1dKDq9CWxjm1uBrLPG7M8zX7 5nZrtB9UoVF7p6ixfliFJtwixTOBj6rQtFuliLtqeTWYOsSYa+ztmSL/+wzg 4yry4TYpatrqF/WQ59Cat3pIPbNdipqj2lCN+CC8c4oag7WFr0v7pYqahmPe 6/0qNJ/39BmH+dH8uW2Kmr75V701OEUN3fxqPh4INzSG5biHn+czE/O3+bVf ipzib/S3qbUac20j2i7OVQrNrRdT46rF1eTqOfWh3knNrbdRD6nFrXG5Rq6N Wsaalj5WDaOW0WOo99Qfq2r5daEn1Ydqez2i+lM96LMANbF6S/2pd1XTq0fV n2r9f/Ndf6yihjEoxTOX1Yr+GZuiZl+/6IWTU3hivbEe4ugUnkvvpec7Fm4L D6pFjfjhFM8E6hU9dFKKGqfPiY5MoVf0iHpFa9zHpxjzWZIexGv87Xp5Pbdz YA28rug9H2xtmkObqGHUK7vlVW9fFTO7lZxmbuvE651z1PStU52ZQm+0KH5Q jaZWs6batugLa6214gecM7X88hSx1Jhq7fPLFH7RZ0w+azIQOtfOuVq3JW1E FRpMLda8+Ck1mFqsWY65dY7Vjmvl0D7mPHPf2jm0j5pIbbRuDm2ihlJLrZdD S6hZ1C7r5NBWaia10xcpcoE5wdpv0xxr4ZqodVOOveMe0ptYs7Z2PQqe7LlK UY/wmZjPxr5J4X3epL2YowbQtOjPme6nFLHKmGWtf2rRP+oza7/WoNsVfai/ MB+rvZ6h/yztoxT+0ZqJtZOPU/g5Pbh+wBpXj+JXHjJv5NAGamC1sB6xWdEL s1LUAFoU/XhBirW3Vjmyij3wdYr6gM8AfRb4eYpcbk73WclnKWKxMdnaujUD 19I1ncjYhynqAXpIvaQ1RGuJ1kimp3iG5bOsI+CpcJMcZ8szpnfZjNadtpCx RcZY+l1zaC61lzWDASXe+azLmuA2Rc/47GpJiYeeN/WANThrcdZwfHa1qOgz 9aDPJvVTercfSi4z/+o19LTqWf2G3vK7kmv0/A2KfzgtRU27f9F7L5f4aKxV Q6mXfI9eTc/iZ3mPzavwcN7bmqG1Q2ucPjubX/SZ+tVno9Z0+xV967NWP3N5 icHey/g6tIoY//94/1WJuY59miKXmlN9lmY+1jvpqfRWxgi9TZccsWP1HFpW j6fXq5cjFurx9Ho+021Z/MpFKWoArYq/sDZpDXGDou+tLdbP4RWNqcZWazzr F39j7ceaZ+viD6yF+p30smoGv+tqOWK7MV5vX5cjlhvTPykxzFimR9OruWZ6 kRVlLT2Tnk33dPMUz+TWKn5jdomX/nY9gF7AZ1ZrFr9zCZxz5CZzlLWHBjm0 sZpf7f8J17SromZovcOaT/Pi184zH+bQjsOKFrTmbO15ahU6/b8pcq85WK+q 59Z7m/PMfa1yeB89gd7AGnVDeEQtatd6dr27Gket81OKXGxO1lv/nCJ3m8P1 ynoCvYG181ml2dej6FWs+TTi2sNrcX71LHoXa+s+j9TT6+3VUGopPaxe1jhi Lmmdw7vp2fRuM8tv9rfqTTbgtbFVeDy93q60W6rQ0GppaxLWJsx75kbva21/ OtfcxvsH5fACegi9xM45tLgavUv5LT4bmFbFb/qDNrCKGo+1noE5vIeeRG8y IIc3GVy8xw45vMPQ4i12zKHd9RR6C58h+CzBmvkdKWoq1lbMy2oTnxn47MBn BnelmDN/g99dv6VH06s5J87Ntjm8jhpBreAzBZ8tWG+6L4XH1Gt2L7HReKgX tQahX7WG36v42Ue5fkgOL6Fn0r94Pqxl6DnN/b+l0JJqSmtjPtPw2YbPNO5J 8Zl64a7lXr+m0JpqTmtxPpOxPmb9ayljv6TQimpGazfeU+80OMd3WT+Hl9Xj 6/V9BrIGfFgtno34zMf6mvWyB1I8c+hT/L0+zGcMvYv/fRz+PUWtzhrhsnIP 76WH0Ev4TKExYyNrkS+ds8lVeHjn8n+ecR9g "]], Polygon3DBox[CompressedData[" 1:eJwt13f8iFUbx/Gf330bZbaXQlPSJlEeoT20rYZQD5VIj8gokZJCkrY90yZk tLSU2XpaQqJBRa+eMlPP+3qd+4/v61zfzzn3POdc55xaHbpd1rW0pKTkAypL O5m7ypSUfCWuS0fx52YlJT9hzWkM9iX2PV3PL+OrxXXiH7FOyvp5SUmpOKMy rh2MXYidwjegHXQn9qXrjqEj+b21m4p11q4zfyOdg/2INaPR2n2BbaSb+FO1 qyDejfbRbhp2I3YTfzPtiz2D3YR14W+Jj8Tuwy7A6vH1aUM8C2uAlROXp+3U D/vCJXXoCP4fGoit4k+I9+bPdr8fsKb0NPY59hN15k9xv1xcln6Od8IaYruL K9JCeotmuMeX6mqq+4H/t7ieuCT+Ha2ma7A3od3oD/EC16xXtqBnsE+1mYut jW+jKdhH2KvYt/z5NBlbgc3GVvPn0kRsKfYttePf4SvSFvFa7Drle3wl2iqe 5dpVynNoArZMm++oPb+Ir0zbxGuwa5UL+d3pT/Ec165RnkeTsOXazMfW8RfR NOwT7DXse/5imo59hr1Jb9DL6r7Aa/g/7/Hv0ivY19ih2Df8VfF/XFeefhfv wu5WruSPo6P5VXQ19jpfgf4nnuc+38U4panYx9ocgD3H3+Let/H/oXXUAftQ myq0XfwbdmuZNIcOpr35d+htmukeX6mr5R5b4h7i5drUpAP5X2NsYqepryKu Sr9QF6wRVklcmfZ3n2exLtitfPdoi43GtrrXhdQKOxB7HuuqXQ/+dtoPm47d jMVk70abo8QaY3uK96L11BFb4l5VaYe4mmvHKLfxF1FrbbZRX+zz+J90OL+n duOwHfzF1DbuiY3HdvKX0FXYHthYbDvfgtpgm6grdrp3qRZtqIp2T2NbtLmA WmJ/0G3YUr4G7c//Hv8CW8wfQvvyf9MA7Bv++JjD/FHuNx+70zNG8o/QedgG 7Ewaq91XWJNiPo7MU/9FPzbCPsWGYXP5eTQWewurQwNdOxo7DfuMH67dfH4B /asYsw/nab7HvG+GrYwcQQ9F7sXOxL6JPEQjsMVY02Jsj3Lt+/wiOgF7P8YT 9dZucvE+8V4vFM+vrv2r/Bx6vnj3g7AzirH4SJ7mTsyh2TSLnlP3iboD1Y0T LxQfQ/d4xtiYZzGW6Vl1H+MHaHe6+L/xDeLX1L1Ok7D3sONpsGsnYifTSZG3 i/y7VlmLZol7ufY+dYOpJvYK1hMbxN9bmtaLWDe6qLtf3TplQ/7UmDfiIdh6 5Q10j/hXz2wa/R55HbsX28w3pxOxTtggbBPfjI7FxmNvY3VpEDYOm4i9yx9H 92ETsAnYO/yxdC82vjStU7Fe3V+sQVuUnSKPxzcVa9qfysb0efRtnnJZ5LR6 2GLsiBiX7vdMfCu2lD+K+mPPYlOw5bHmxTjCXsKGxDPpCXVz8DxP8ybmz9VZ mtsfKR/kH6Anxa9iZbV7mB9Bo4s5UQG7k+8X8wKbgf2jfIgfTk+L52HltRvG D6WnsLlYOWxA5Fgahc3ESrDq4hfFt4rvUNebDsJewLphPfledA8NpEeLvi+T p36P/n+sGCOleRofMU4ex2ZjWZ7W9FjbHyjy27Ys5bbIcQ8W+XJ7lnJl5Myh RT7fkaU9QuwVhhT7hK3Kk+gD8WHU12dMVT8NW8E3jJyAvYBNxz6K/BxzCZsR Yxz7kD+c+mHTsPrYEv5Iugubjp2ILYr1ivpgU7DDij7snae+ij5rgC3DatPd 2j1XmtafWIeGFTl+p/LUYj4+mKd5HPN5JPZyzGXq7tr+xb+Of/5Q0S+7stQn 0TcjxC9hf8fcKvLA0Dzlj8gjsYbEWjK86L+/lH/x/cVfxxyi2vyhRd/ckaex GWP04OLe3bE+fF86K/JdfE+MMXUblU0iV0Y/iYdiP8b70eMxJqilZ1wa74s9 FmOMrox1Jb4LGxXvz18e60rkTjqDuqsbpu4nZfPIvfEPxcOxDcratEC8L93i 2lEx9rDJfBW6HuuIHVnMgX55mjsxhwZik7DK1FG79jGHsKdiPlIb7AqsD/ZE jGNqhV0W/YE9GvMs2sSaGeMbm4JVpRuwG+LfY49Ef8V1sc6XpnUl1pcXi/x7 sHfarfiXV4jPVncOVcIexn5x3Rl0Plah+PbL89QH0RcXYD9jZ9N47VZi52Mb +bNoHPY1tjs2gv+Zb0LnYqVFXr4oTzk5cnP54p9flqf/3bxYG2KNeKnIg4eo Kxv5SXxJnvo+xkCOPYBdHOsL35iyIs+3wBrxp1G5Ypxcmqd+jv7ugY2M8Rlj JfYrWB3sNWw/6oo9htXFXuf3j1yEPRHjEnsy8gq1jnGEXYP14FfH2hF7O+yQ Ij/2yFPOi9y3K54Z/zRL+/dFWdrjx16/TZb2csuU7ain+Fv3Ojn2K+pbYK2x OfxetCn+B9ZWOZ/fh36L/4G1Uc6N/SVtjv8b655yBV+L/hHXKHLw7XnKq5Ff r8Vux9ZocxJVxy7EWmIz+T3o1+hDrJVyFr8n/VImna/inNU6S2eYpVnao8Ze 9aos7dtWZGmPGnvVtlnazy5XHl6sOX3ytGYMK/ou+rBr0c/fZ6mPo6+7FePh B+Vx9Ib4gFhDvMtT6u/CJvAVqT3WLtYdbCJfiTpg15Smc2ecP6/M0lnswyyd 9eLMd3OWzqPfZelsFme0llk6Ay5Wdoi8I17nXqfEf1V/RLHW9c3TehjrYkes D7ZemwZ0KHYd1gtby9eLPWppOsPFWe6KLJ2NP8jSGTPOmq2ydJZdomxPd8R7 aV4/zgfqx2BvYkfTAGwM9n9sKu+B "]]}]}, {}, {}, {}}, { {GrayLevel[0], Line3DBox[{177, 1, 493, 17, 510, 511, 33, 541, 49, 558, 559, 65, 589, 81, 606, 607, 97, 638, 639, 113, 669, 129, 686, 687, 145, 717, 161, 327, 162, 328, 163, 329, 164, 330, 165, 331, 166, 332, 167, 333, 168, 334, 169, 335, 170, 336, 171, 337, 172, 338, 173, 339, 174, 340, 175, 341, 176, 731, 160, 715, 714, 144, 683, 128, 667, 666, 112, 635, 634, 96, 603, 80, 587, 586, 64, 555, 48, 539, 538, 32, 507, 16, 205, 15, 203, 14, 201, 13, 199, 12, 197, 11, 195, 10, 193, 9, 191, 8, 189, 7, 187, 6, 185, 5, 183, 4, 181, 3, 179, 2, 177}]}, { Line3DBox[{493, 844, 1069, 492, 845, 1070, 494, 846, 1071, 495, 847, 1072, 496, 848, 1073, 497, 957, 732, 498, 958, 733, 499, 959, 734, 500, 960, 735, 501, 961, 736, 502, 962, 737, 503, 963, 738, 504, 964, 739, 505, 965, 740, 506, 966, 741, 507}], Line3DBox[{511, 850, 1075, 509, 967, 742, 513, 968, 743, 515, 969, 744, 517, 970, 745, 519, 971, 746, 521, 972, 747, 523, 973, 748, 525, 974, 749, 527, 975, 750, 529, 976, 751, 531, 978, 753, 533, 980, 755, 535, 982, 757, 537, 984, 759, 539}], Line3DBox[{538, 758, 983, 536, 756, 981, 534, 754, 979, 532, 752, 977, 530, 1085, 860, 528, 1084, 859, 526, 1083, 858, 524, 1082, 857, 522, 1081, 856, 520, 1080, 855, 518, 1079, 854, 516, 1078, 853, 514, 1077, 852, 512, 1076, 851, 508, 1074, 849, 510}], Line3DBox[{541, 861, 1086, 540, 862, 1087, 542, 863, 1088, 543, 864, 1089, 544, 865, 1090, 545, 866, 1091, 546, 867, 1092, 547, 985, 760, 548, 986, 761, 549, 987, 762, 550, 988, 763, 551, 989, 764, 552, 990, 765, 553, 991, 766, 554, 992, 767, 555}], Line3DBox[{559, 869, 1094, 557, 871, 1096, 561, 873, 1098, 563, 993, 768, 565, 994, 769, 567, 995, 770, 569, 996, 771, 571, 997, 772, 573, 998, 773, 575, 999, 774, 577, 1000, 775, 579, 1001, 776, 581, 1002, 777, 583, 1004, 779, 585, 1006, 781, 587}], Line3DBox[{586, 780, 1005, 584, 778, 1003, 582, 1108, 883, 580, 1107, 882, 578, 1106, 881, 576, 1105, 880, 574, 1104, 879, 572, 1103, 878, 570, 1102, 877, 568, 1101, 876, 566, 1100, 875, 564, 1099, 874, 562, 1097, 872, 560, 1095, 870, 556, 1093, 868, 558}], Line3DBox[{589, 884, 1109, 588, 885, 1110, 590, 886, 1111, 591, 887, 1112, 592, 888, 1113, 593, 889, 1114, 594, 890, 1115, 595, 891, 1116, 596, 892, 1117, 597, 1007, 782, 598, 1008, 783, 599, 1009, 784, 600, 1010, 785, 601, 1011, 786, 602, 1012, 787, 603}], Line3DBox[{607, 894, 1119, 605, 896, 1121, 609, 898, 1123, 611, 900, 1125, 613, 902, 1127, 615, 1013, 788, 617, 1014, 789, 619, 1015, 790, 621, 1016, 791, 623, 1017, 792, 625, 1018, 793, 627, 1019, 794, 629, 1020, 795, 631, 1021, 796, 633, 1022, 797, 635}], Line3DBox[{634, 1137, 912, 632, 1136, 911, 630, 1135, 910, 628, 1134, 909, 626, 1133, 908, 624, 1132, 907, 622, 1131, 906, 620, 1130, 905, 618, 1129, 904, 616, 1128, 903, 614, 1126, 901, 612, 1124, 899, 610, 1122, 897, 608, 1120, 895, 604, 1118, 893, 606}], Line3DBox[{639, 914, 1139, 637, 1023, 798, 641, 1024, 799, 643, 1025, 800, 645, 1026, 801, 647, 1027, 802, 649, 1028, 803, 651, 1029, 804, 653, 1030, 805, 655, 1031, 806, 657, 1032, 807, 659, 1034, 809, 661, 1036, 811, 663, 1038, 813, 665, 1040, 815, 667}], Line3DBox[{666, 814, 1039, 664, 812, 1037, 662, 810, 1035, 660, 808, 1033, 658, 1149, 924, 656, 1148, 923, 654, 1147, 922, 652, 1146, 921, 650, 1145, 920, 648, 1144, 919, 646, 1143, 918, 644, 1142, 917, 642, 1141, 916, 640, 1140, 915, 636, 1138, 913, 638}], Line3DBox[{669, 925, 1150, 668, 926, 1151, 670, 927, 1152, 671, 928, 1153, 672, 929, 1154, 673, 930, 1155, 674, 931, 1156, 675, 1041, 816, 676, 1042, 817, 677, 1043, 818, 678, 1044, 819, 679, 1045, 820, 680, 1046, 821, 681, 1047, 822, 682, 1048, 823, 683}], Line3DBox[{687, 933, 1158, 685, 935, 1160, 689, 937, 1162, 691, 1049, 824, 693, 1050, 825, 695, 1051, 826, 697, 1052, 827, 699, 1053, 828, 701, 1054, 829, 703, 1055, 830, 705, 1056, 831, 707, 1057, 832, 709, 1058, 833, 711, 1060, 835, 713, 1062, 837, 715}], Line3DBox[{714, 836, 1061, 712, 834, 1059, 710, 1172, 947, 708, 1171, 946, 706, 1170, 945, 704, 1169, 944, 702, 1168, 943, 700, 1167, 942, 698, 1166, 941, 696, 1165, 940, 694, 1164, 939, 692, 1163, 938, 690, 1161, 936, 688, 1159, 934, 684, 1157, 932, 686}], Line3DBox[{717, 948, 1173, 716, 949, 1174, 718, 950, 1175, 719, 951, 1176, 720, 952, 1177, 721, 953, 1178, 722, 954, 1179, 723, 955, 1180, 724, 956, 1181, 725, 1063, 838, 726, 1064, 839, 727, 1065, 840, 728, 1066, 841, 729, 1067, 842, 730, 1068, 843, 731}]}, { Line3DBox[{177, 1069, 342, 178, 1074, 1075, 357, 207, 1086, 372, 222, 1093, 1094, 387, 237, 1109, 402, 252, 1118, 1119, 417, 267, 1138, 1139, 432, 282, 1150, 447, 297, 1157, 1158, 462, 312, 1173, 477, 327}], Line3DBox[{179, 1070, 343, 180, 1076, 358, 967, 208, 1087, 373, 223, 1095, 1096, 388, 238, 1110, 403, 253, 1120, 1121, 418, 268, 1140, 433, 1023, 283, 1151, 448, 298, 1159, 1160, 463, 313, 1174, 478, 328}], Line3DBox[{181, 1071, 344, 182, 1077, 359, 968, 209, 1088, 374, 224, 1097, 1098, 389, 239, 1111, 404, 254, 1122, 1123, 419, 269, 1141, 434, 1024, 284, 1152, 449, 299, 1161, 1162, 464, 314, 1175, 479, 329}], Line3DBox[{183, 1072, 345, 184, 1078, 360, 969, 210, 1089, 375, 225, 1099, 390, 993, 240, 1112, 405, 255, 1124, 1125, 420, 270, 1142, 435, 1025, 285, 1153, 450, 300, 1163, 465, 1049, 315, 1176, 480, 330}], Line3DBox[{185, 1073, 346, 186, 1079, 361, 970, 211, 1090, 376, 226, 1100, 391, 994, 241, 1113, 406, 256, 1126, 1127, 421, 271, 1143, 436, 1026, 286, 1154, 451, 301, 1164, 466, 1050, 316, 1177, 481, 331}], Line3DBox[{187, 347, 957, 188, 1080, 362, 971, 212, 1091, 377, 227, 1101, 392, 995, 242, 1114, 407, 257, 1128, 422, 1013, 272, 1144, 437, 1027, 287, 1155, 452, 302, 1165, 467, 1051, 317, 1178, 482, 332}], Line3DBox[{189, 348, 958, 190, 1081, 363, 972, 213, 1092, 378, 228, 1102, 393, 996, 243, 1115, 408, 258, 1129, 423, 1014, 273, 1145, 438, 1028, 288, 1156, 453, 303, 1166, 468, 1052, 318, 1179, 483, 333}], Line3DBox[{191, 349, 959, 192, 1082, 364, 973, 214, 379, 985, 229, 1103, 394, 997, 244, 1116, 409, 259, 1130, 424, 1015, 274, 1146, 439, 1029, 289, 454, 1041, 304, 1167, 469, 1053, 319, 1180, 484, 334}], Line3DBox[{193, 350, 960, 194, 1083, 365, 974, 215, 380, 986, 230, 1104, 395, 998, 245, 1117, 410, 260, 1131, 425, 1016, 275, 1147, 440, 1030, 290, 455, 1042, 305, 1168, 470, 1054, 320, 1181, 485, 335}], Line3DBox[{195, 351, 961, 196, 1084, 366, 975, 216, 381, 987, 231, 1105, 396, 999, 246, 411, 1007, 261, 1132, 426, 1017, 276, 1148, 441, 1031, 291, 456, 1043, 306, 1169, 471, 1055, 321, 486, 1063, 336}], Line3DBox[{197, 352, 962, 198, 1085, 367, 976, 217, 382, 988, 232, 1106, 397, 1000, 247, 412, 1008, 262, 1133, 427, 1018, 277, 1149, 442, 1032, 292, 457, 1044, 307, 1170, 472, 1056, 322, 487, 1064, 337}], Line3DBox[{199, 353, 963, 200, 368, 977, 978, 218, 383, 989, 233, 1107, 398, 1001, 248, 413, 1009, 263, 1134, 428, 1019, 278, 443, 1033, 1034, 293, 458, 1045, 308, 1171, 473, 1057, 323, 488, 1065, 338}], Line3DBox[{201, 354, 964, 202, 369, 979, 980, 219, 384, 990, 234, 1108, 399, 1002, 249, 414, 1010, 264, 1135, 429, 1020, 279, 444, 1035, 1036, 294, 459, 1046, 309, 1172, 474, 1058, 324, 489, 1066, 339}], Line3DBox[{203, 355, 965, 204, 370, 981, 982, 220, 385, 991, 235, 400, 1003, 1004, 250, 415, 1011, 265, 1136, 430, 1021, 280, 445, 1037, 1038, 295, 460, 1047, 310, 475, 1059, 1060, 325, 490, 1067, 340}], Line3DBox[{205, 356, 966, 206, 371, 983, 984, 221, 386, 992, 236, 401, 1005, 1006, 251, 416, 1012, 266, 1137, 431, 1022, 281, 446, 1039, 1040, 296, 461, 1048, 311, 476, 1061, 1062, 326, 491, 1068, 341}]}, {}, {}}}, VertexNormals->CompressedData[" 1:eJxcvHk81c/7Pi6htMiWrc2+70vlzJMhQqQosq9lLWVfy15SSqgIkZJQkuzC WLNLtkJk351jKfvyPee8+v0ej8/bP+dxLmOe87xn5r7v6565cFnfumRDSUFB 8ZKKgmI38fNEvytHhQ09ijixtL2zQ0AOn3mP4G5aYzWT1BkLTryQNcJ3jYTX XJV4X73vJnbuRansKvF7tYh/40N9W/TOe/QTywk/7PgBdPiF1nfEWixWKfMN D9+9SFF2K3sOrnJXFGbHnkGjRk8ziP3A9StzZveuLuBoAz57HRQVRiUs5/+S cJ59B+KrjAZxNRonfxhVsaNJT/stEn5/Kv24W8MPnCtL/NDh3zTIU/7ODgmv Coydyi/txM3fbAySPxxUXrizQ8atJ2X3vLfsxAUpqAeenKCFr5UNybjsIusy u0s3jjVFVXI6lwu2uXBskHBGGgylT//CJbRfVfWbAfBIgfo3Eu5lK1WUFDyN C7eP8YpK7YaSVv4zwvg5mE2bk7d10Bu811PIYF+cgk/P7/PBlwzDqqc/jyZf /gkqPitfMnnyC6Yu0Er9eD2LvgXyyP+2dcYo/s/PPMIr6PwJ7LHEBIcIsUe4 OBGzFYE0HiRec0ThaYAjdkRbdpvvsQVEKSpHN4n4zpuU8HtFodilVmlbUrv3 7GNy6S0aSPnRSn3a1yis9fPyVRalH6hU8Y2cdtsc9NfQV/waWA9C1c8e3D+F UGz1m+kjFQRoKr/V0mTuCqgz/exMrzIjisuWpHmH4XYOI2hwEUf7NoqB6duf 8h7CKNluK2vlvt8XCbhzrFHCDrZD5X9VN8j4XIogtVkfHud4COkKG/4sN87e IuPhe4XTGm7hcVT9lnWCsm3lLmvbZNzyaaPM/eN4nNCZijcOiR2KDgH/4RKF zJ14VzxOs1fHtFt8H1xL1CPjR9MZiww0F3C72s9yxF//AO1bBdLMlwjwQ4cq hdA1S5B6hdm3qasf7muj+2Z3cRaCOV3dCw31oGGrL3mb+PfzirsbF6ovoZSp mX0vn0VjDL5LbEeYtNBgXpkGyX6OGlR0KzkuGMXjYkYoKQM//dycJD336cxZ 1Rj6EOxL6q8kZSYz9Cwk5TPJ/mc+dpUyJAZixwM+PpTbIqA/K1s/jpbEI5oN 9SlxwmOsV0nLMIy9CQ2WvR3WUiNAljzjMTGmemDNL/Yt/m4oMuH+mf+c2L9Z zumfwW1WQD7R2axznyAcGVhZJj1366v6d/t9vGBv/9Te5dSjcCigaZOEv/t1 zNQViIOqmuqpRzr0cLrzL3m+KsoW42jvyQILqHOsULVLMR38Z09dkcui4Q5y 4HzeW5qHZmvlDxt+kPHjzITsDRspcCnhj50LNyvaapwk7y/Oc1alA538IOOo 0MARKR5Um6O4TsLvXZqxn/p4DOxxHvdqVveFiyIaXZ1EfLj548FJAQMQIpr/ bNPjO3z5rWr1dAMeOlvr33AXqAd0/CdP1k+Ow+IY/nsPDcbhnxwRguZ4KLbc eClc4/ADZF1+ZEqf2M8x3oq5moBXWNn5/N188zKwMEZggvRcP99Oo5GeG9ib iELBXV9CkYg5e+RTIi6qdl3A+Ywz5v8lm8KxjoAo+p42PKMtR2Y+HsxhRlew x+W2DmdiGlDMacfCb8YE+IA277TjRgNgNB+QDDDiRMrV7eT9/uLw3oL+67bg aeA11mni9/PuYGOzyBVGuIg9TY6QxW5E8O0Q1w8K/aq2t51GB/pzpBk0lf8F 7qdHC0l/L73O/Kh0Qwn12hWOwAQFzGb8P7+z0R/3JFohr1xru3PFsFYI67XY v0LCU1YDi9rmBeBGwVb6yxg6zDJaaZGEt3jUUUVniMFddtcKGI15ME9x1tlH w8xI77sWeX6PG5V4i4maAs7Q/sungmXRoG7BGAl/ENhMmyhhCEw27v4WHmuE O3dPLx8/R1xXuxMS6KQbwXX5q/Zp3wlwoP2hY4LUFzQopWuhmWuJZb3LD3md GgAXqSWuVxL7SZUrlWbu98HaHcKulMecQ0eH3UxJ+2Kaw10ybSsUY783FkWy Q/j50etnuC/D72L8dDJK9djr4cS/VSN4tDnQX2pT0IYKY+a9HWQsME/8oX6b 0AbktLbfJcqEAHs61DIkZFrAS0Xc0TyD58jzYz06sE2A3vEcXsev+YCOZ8FO dAPqKFbquQvpuZn62k8nXdXAQgHfllG6Gop0Sw8g4b9rTaZL5iSBffCTZUFL WZRicHCchIveYjzSfpcFfFLNwzTGphQz7/4lzQPyT8BWznLvBTyL9E5+OCHI yUFH2l+orDH+cr3zPnCCVn178KEU3FyvnCXhWzkVFxVquABHp+/AV6NrEH/M JmyNiEdJRGqcPm8DegylLWzENRAL73cnkv3R14OOE4s+YJfGgU7NqAbIR/HQ eoq43oSLTmxtdzSD4J1697z+EbjnOoyQYJlCrw9prDPFq2CL2A0LNhAP7YsC Oy8S/Qf1upR0+0NP7EqBuuWWxxlU59+cSRoPnpcy8VGxFdZk/t421iIEyWVf F35NxI8pnyh7cd8YM2Zwv+V3dgh5fMjQ05ufRqyHGd2GcpWxMn+6wF3WXajF n/kVFMLDAI/Hd6/o9gGzKlbe7L8EJEmXRlmVnQFb65YzByyKQXeJ38lhvxco Xvi4tydxPEF0GcBp2xKoyt4J5RmxRNqt6g83iM8duT1uxmi9D0jnZPmtk+LT 6UIqo0ZrlPE8xzT6VQpwyeL4QPK3dRcflH68dQkhyYs2XJktgLW1kzGs9CLq YJOhIr2XVHIA676jHOD23YTEVYeT8Fr3i0ESbrRW7hCDJnFjPNl2P895QI+n Xz+MEPHJCjfRJXkMtPRc5zlN7N9tceMhm1oETLk8zr3fewE0Pr9csKlbD7Ny qd7UOhLj/kSvTcCTb0Dr5k/jtwVD0K6A4rNb2jSKZ1d4JqLHh12UvNN6Lz4Y cvHd9skg9v/ASAVuE9SxQw6/xFeV5FD6jZoR0nimxj4f1hSTw4oOYXf0d7mi 5yfWSmeI+K6qBJ2WFBlsoPbxx5Ejv9AvO/f0ODSL3qqHvr8zyY3FPf9B0Nfr QoN+Xyjfi+ChTMBqKUF3AHwlpL8IoiklroPUK9WtBLTkfuNC9BcfwMLDKvKz l4C6WWYpK4yLICf7k/mQkw/Ak+hpkh9EnxPr72ulyMC61ZEw89Aa0B5e8/vG oA4yfyU2QrL3l+MD/eUP9wHfnLWeB09p4J37gWQ/JDrjHBrKtYG78VHgz+lq FWQnbJpEjhdCafqmvZRg2eOVsKqbCBrCy/8h4XdrqoQauVmAXeZ7I5WWGEgz v7fXa5uATkkFM2jXSAKG8bfxn/oiYJvak0YJ4riME3Zut+1xAi8q1IvvuHXA 1cGSsdu38XBsuYR7xOcX2JvX8V07qh+O1WssGFrNIufbncMvvOmxwssXTmbX e8D9EroGw8R+Xj5QVL5RJoQ52kdK6NvLoEuPPEjxF02e4CiNFzyGHa6svaa0 YIPUXE/4kvLNsL4JcakqdmzcumziulYXMlX6uKIghkdBv58IGoMD2BULYe/T 2t3IQuxQ7sPtORiaUOjGHki0v5JARk17DKqz6t3xJL7XYbqS91yWbuCI6jPp QFc/5KIpP91GWr8ljTKNIVzg1WdTmTOjFyA1zomBZB8b9x22WjUqEDqH8+mu gpC+dKmChJdHsN5uNqQHu7rTH8R/mVPsllgk299JpYrVJIkB5PdxJNvM8yMB mTpyHLj9S7tI3nMPSIq9aG2XI4vutGJkf745eSdjVnwOt+eh4xW997bwqYnj 6gopv3Lab7wStR90cfyOp/VIhCnxRnu7NwlozZmSaZPLCzC9vPblFN13mCPo E1LxAw+7mDiHSxT7AONueWGx392wufV4H9XIHHpdkGHtMrAbk1A6IinW7QQF NFhZF4n2DMHl380KZ8LKvCjzH6XIIRRROUyyv7PMW8qp34cwX6s/wZ7HrNGM qcVv0r5PsI47GMV8AJsTWaVO+NyKnq5ZZc/SE5DuWUeWhV4K7PVbkcCp5SG0 G+fBft5vGrLe6nn2+VsfaH7gYHDB+yOqSheg9VsgIIIFj66arwdIZqfuDf6k BmMWtUh+nmhvi2fL7HygaHXnEXueMrzh8zaHhP+m2ZewgkmCR5MPT5C+Fy6l Rmcua6MN9Qtcq/ltQIR7dYE07ovHVip1V8SgBytfoLqCKLaRfmCx0JUC2ZmV kuelHceXkfVOCVif8OIp2D6F7Pp3/yLHZ3V76lcv+UGVmr6Na4QeWtlTaUTa X7ebXhwfqTgIPuqEHqsXLIFgr/ml410E1PXaf2wqJAjYGDrexFW3wybRP+F0 cXj4CsnLGzZ0g6m62N3cN9ugaytrtOscHlHQ3JEWDlwDf4/V/bDDO8AB+rP+ f4njvT6qf5aOiwb7fTJvOCL+FKLuFusnvQd0K2L+oU+JxWvlLaYkm6MBTekr pPzzN+e2ojovBbaP8UNhmXUt0uH5GtYbQcxTesOjiob+gFSxTXh2dRoxPAUG jPJDEEXpBklZdINGW7kTxWZtKC68Vz+ZgEeZHdQjYXq+QHtAHTfV+QxOUzRd 4iHG5aa5b8xKbkbgOteJqRsrxH2428Dc4/o7qNNg0Lsl/xow1bqbnNjEEO6g fxNpnD7mr990feAHKW2pJy10VssvHOwjx98hbSvB5nAWMP/EqGyflB4UHDlv T8ojPFJdj1a6SQHFd4ljxPeHcoZ3cClODrCDVnSxrXwUXBHs1fjo+wgJpkV8 4Sf+Xrgk/pW/sipQtj+j/Je7Cw72a9cZyeLR3VDl5+bNd4D0DcPUT5zj8MWf TKP6YxNQsVNb5Ch9BxhhPHbt70otdOW+H+pyj4Dc3/IFqZjPg89JDS5nxWxh 4kWkQ/Inxm/B5fKVNcC72XpL7ZAiYsm4V0caf+sVvXM9D3cAxWJFmGyBMUq6 53dyi4g7OdxfMLi/DvS29q/f1ipAHiXrg78HCcjkTf2555wzwCvY7EX2QTwy 9BUyYN/ogtY6/OdVif4wY2I/Rtn6G33dprnQWzODfvKeZh1cCwHl3ixrpvzp MPBmaffQMjG+ed29RH/VAvgorK2brxUgfFP+2sIAATHZUX7dnHEA9VFRTXmF SQj3+eYpHaIfuFh2lzuWRx780omdzB+8Wr7+H/9Fp0vE9KafjuIMXAePSMUJ wcLsahK/RmHJXVuTGSO4a2FL2kcJ1+A5jF6AlOdYOTbz3p/VACvWWE5J5zvE quB45MQKMc9VEOfcWbcDgsaV8Rbe71BwtaLzVeK6WKo9cXSs+BJ4KSrw7cbo LLTPG9uHC+mDh8QYPx9NygYZzKkXTvC3Q07+zZmCbDx6l3pPcGxhHqQ6mi0q KlrD8ymomeRPBO2HLmSJzoMvPxgej77hhmUi0STegY7nDjBu6DhhGUYzb3Z5 mEH7VfVE0vq/ZzwXv9kdgnFyW+HDMwmo0m6tucu5Cu3K/WTpsXwby5Fau1f1 gYD4B99J28lUoUPw4XIzfQwmqecRNfW4H32PDrRctZqFvzO/Prc4bIA181DQ /5QdQo3+FnMr69Mwe9Y4vKbYCasc3Btdcy8H2cgYOtTNEqCPBq+l+5InmNR9 BA6U1CHfu1xFe1wJcElS2I3HMhOoZu72WXwpi6L33SL7862ZnYapI+O4cQ/9 P9iuVCTcb/KyfI0A08Or8SayBqDIIpBTuZ8LBXnvJvMRQ1o4Ic/VhythhCqg iRqVKoeT/dUWTcV1IfoFnA5VoUdtLgMKT/lK5gV3FxY+aTB2417SXP7RtD1T Tle5RG5f+zJxNVmfgPMTkzkiMr9c7nHsNxk/wOLn/elxJ06lyPmyf3R/+e1n m2Tc/laGfsxbPK4tMeMba+yy4izHIBmv7+yI7FPvwq2OyL11qO8sZ9L5j1cK 6nNSKZzH4z69i/sgaXEYJiueIo9HUGcoKHvgJ87BJHXtsURa+cXV//jQozsT 2eKKeJxOmCv9QJIYvHpbk8x71CeZkvzkh3EBYJpLsHRJ8Xb6BLn934kVKr8y As68buy49K5CiLu/adM3QICM+R2nuIINQez+MivDoAgor3GxV5bYPuNvVzdv ixLINe2gder/BacV35X6R85C48AjYeLrucB/sFfcTKYS7jxffPI5nwD/rIkU n//8BvTJMFf9Mp6F6gJJ8fyZ/ZCvrLJSVUIFO2fE3F7BNwxT9HlyNUym4XL7 8kxN81Ws5oT96T8LvdDYW64lmmYOdcb/GIqgcMZidn5J4uYIMPhBSLzkpRyk bUtjeaE7Grtp8btY+ps5spCu1ySt2zjF5EhbwRCMPy3kQ8AjAuJkWf9753It 8sGJR7LceILJct4pVgjrRcJyXd5HTszBSDFjscSvjhjbXr4HxgzZiOB+LHFi ngATw05hxbsywKLNxM3EJHskJBkYtkyqp90yvR5YcA7o7ae+l7jCBfsK/pD5 O232lXo6B2FQ1HbHyy//MGQtFiTPV5C2qqOtoDRgKCs06UndBaHoZ7L9i8vq rBtWZMFi5Qu+eycHyyNH/6vzHFObP7vxTgb0usJAenVaVH3GkozfI7RwX7go Dlyu37G2GD+CouP+kusVJrZ74rP0ecHcmxv6p/0M4dC+zPQt0npenXf8UoSB yOPnlM2os+Be59NOnYvEfjjecJe2vgY9nc+hjW4XzKQ7SSEpioe5YaPnYpT0 Mc/VJ1fje8cg80e1qcOWE3BBcnH9hdB9bCeeg97MJgRx7/dZTCHV6y76JR3h c8Y0H53hvEDkM00KFsfsVOLhhOROUH+LBca1+rs1Qq0XyYnYWVSKzcEXTxWd tOZlsIg0rm83izJQWx+VcPpfAnxaafatgvs9eBRGzV/NPAd7HHXG/fJ6obk9 zVHrLGnskW+J+lvivOpoqmjFHgiBiXdQ5/GjyljeiHoFKW+QShmYcR/ShXcf BLwMh1ZY5sOROZJdbvVMWvRRS6E9X0rAsqIcpvRChzwfz58cZxetZYZM6txa Aj+4sOHd5uR6aOoNWTl2FmEo8SFHO5uBDbsVQqm4j2sO7s/xfoD8e+H4wC9u niQuzK1w9yg9CzcafTxCnvf7Fy6doBUzAYb7rr7mOZoK/enulmUR/c+ntI6O +3qpoPCURFHeVhc8xFUTLncQD0deOfndapfG3usH94YR28kGPt7eY5iKagyj Rt9j1zBs75Vrt/FEXj2ZRcn95RM6xNd9bEmjHkueT3ca5CPy2PR1CXmDFvRj UZbpBV08JvnbyjT0cy8yTlQtOXl4Dsoa69RNZmPYWVPlmI87n5BlQ2DUDHHf 7Hgoqw58yAYvv50VurMeg5LdXrQ7E/Pz6Vuzw/xaviDCxvDdnaPqaOWxly+Z P4p8Va52BOBAdcR3m3MQ3VNtryLh6/M7mWl8fGDl4Z+i7Sc8SPUVFTmOiCVw R/pqMQBmZe3DWmOskGenhlTvQup/9HYl89ICNX3pEY85UdhQN0vyS+jsLfHn N54fBo1ZvFQXvS/CFXqHvSScUVhwZleWNjgsJxjdF3gdvj+qLP6HNP+FjBUJ i7dBXNz9q1fnXsPaOcEHtusEmOxFP/hXLx0Mm9pkm0p0Qu9JWv0xMzzcE6zT yOHHjrmeZDx5dHwYOkgk0BW2TyEeGoHJw7suYDlg+zMLFoyeMyr//kDs/9KD T4tnWU0whUpr5ZPtA6g0i5Lz9v5ZJPrj7+fOQDXs9U8aZd7iQWTkde2srsYM PPJbvcY9lgfTy8vWDbDDI18vVofTfzvg2efz7IqujeD6dI+ep8gvNB2a31f/ ZRapxs7QzoqlgbtMqyrlFXfR9YP0ueGk9x14UzB8VxMkjX5bZ4NTiG1/oEpi xghyKItUPtqSAPRkI7io+VTgiVXzVHK9yKEKe+15Gfsh9ndil8IUnBT229H8 MIICZXiXtq7XgWvvrGlmVSD68WGCPF/SPRmuQb4M4H77d80HnubwhD+FJclP 2ggfvOGZxw1W74dk70rohLpFmlPNWnik+EXB+ph4N3gmedplnwQBHizy7+so boZPVriHZgQXwI6+J374YAcMiC9QDYnAQ06JV7upr+wAUbMx06n6QejZ0GX9 SnEGxXG1CO8BwtjwWsu7oGVnlN/ERYUnPjeH8KHsbokMxnFVxl174ifCURW7 WfjOoc0zEaerPvFhhf4rHyLVB9HZmjfHP0bMwHSaDbuc/r3YFHbx2UZFB5po CnehdsajFIaT3HoOLYBOLT969zk8Ct6RyDV734mqKZQsq/Y8AocdONiL1gko kvNGe7TVa1geMNyrNVECHgcxbn1PH0HdIYcDCuAU5HYmOFZIFAPrAcpP9SJK aKM3uZy0r4ek/SqU6KgAo2QOrLCXQOd7n82T8LVXbc4zlTs4OX4NytQeBdR2 +2I9CSewB5pFWR8AitrfxZ9xPIF292+nbRLzfIHUjafeR0+DKl26guse0XBP +CR8T9x3+68lfyxO1wUNp9Ksb/t9gRWBgv7pbQQ00uvlbaJXCUCFSH2GYC+8 R/3wtJfsHBR5/hcQVBZB8bErN0Rn+2BQBtv5k02zaLE9J4q6nhE7T5d+Zqvo GmK7oKlJyjMZe8Tp41bZMfThmMWB2nbEMMXBUheLR2EpyOGn/iHs56vcXHWi nV3q19/+JNoZrzP+3Tl/FdhesTI/UlWPBAXaV7RsCGizkfcR90gLmLO0uBZ7 +CXyEZHE52wSIIPTXpqDvC5Aju5yhU+oBXIsfnucuK4gVhS2seXNBFCp5qUM VzWYPUQdTLLPjWyjS7/O7AeDl80/GhlKwqpr2gQS7jbW+j1mgx50VjTRCW4w IPWPpWQ/ffbzs7Lfh+nAMe4rdNp9YijvEiM5n1HGV6po2u4CYffrtSXkz8Ld Ztciyecg2pG1ZiobuHmhjIJN72jonidamkm0f5Fs9DW1WjtAfcBXYftUGeRW E/fzaiQg4WzDLJ+dCqAkHUM/3tcN9YSNDN6OzMGqaeUj9ayzYOkhG/10eBcc fjV+nY8bjzyzWvfp8VNjD89Q6w3zW6E/rdCOVK87mCRSrqZ7AKu56stIvdGI NEQlRxfUCegOrYBMvw4l9oZBWZ3m9ziiFMbdu281DscjhT6kMy6AP/55LoSs TkS7Rqkbo4FHb473LJ0RaQDKdIf0xbLSEVY1OOBL5ClXcl5986dzA/SbNvsr o1WgfsvpV6T3Tdtk21iQEwU+h1/0nVGbgpjKrRO2r0ZgNiGC+pddI/hq3/kE lpxB+iO66SQ/wOBcMmTn24kNBH6+Wqg8hT4caKWAaSNQ6dBbz5Fz/FiV4ZLp 3ye86NLxa6TzRzgSvsIucEge8N8MlL/CehaVOjU+IeGj/cF9t35zgZv5snMp 7BnQdYf3Oj9xnHPHOpoqm1zANYFJ3I5TE3xccuxKjjIBOUvjWdW0y8C8cNVl UcIP+IvR6/uzrDmYlcjc8UFsDFS59g7wj7bC+uq04t6DBPQrP37TvngdWBKS BBiZzVAEryv5PGi5OOqCpToFhu5/LNSorULDwrlDt94REAtH7VFxg2XQ3PiF nkocjxBbkP9e9S6owzLPYKExDhxWBBd7qYdREs++n9wu08hCz4NOILQCPNB/ 2vbGshYtE/R1FiII8NQUv+JDzkCAP32Sbbh2GnHtMnDeuTcEu2u9UwJLk0Ee W8NTzsOjSOPsteKJqUmUfqTn28qeWMDkcMSYL0gcmU96kOsiob1Cw/2rnMD1 hN5CgIIyjHuck0/Cd17EZO5L5APNp9M/DgYPQsoLxk6aDjOo4Zog4wGrLrAl z8KXQD8H/zBSSkR+7YV+AVZNz9eGwWuGlcL23Eo4NLWLTT2HuC8SJm1bdrsC OlHTvr+HhmCYATc0ZpxBQDtAJlA8H0Qb+9jZdk9Ch1lRCSA2Cs+/Fh9ubBkA FTsSTB6va+BYx4Rq71NivK4+JXJ3Yx5QcgFHuhAjlLrF40Hi3foJ3OxPfq6D P486qhyictGRLylBeycJaOLiUfcCKzx4UYz2StcR0GzOXKUFWzlkey7UwXF6 DOzvyrvdcnMCZQxeHfjeOIZ8/2TkcWpWAeb6Dpd7fO2I6fHHuy3ZeJif4pOm lxIKLMKuGeHiqlFrz+cwl2QCKrgr9KGP8h5AL/MajlZ+QJ1sXjyMSwTE+9NA zR1nDGy0JlpfFD1GeyIv7mMmjtM3duj5Zr0Q2LpqJlZ7lQXicveRz9N/bW0h dvFRXNro7Xb5XF3I2573lVQPcUjy8ylikgFGxuZx6rdSkFub1Fe4QUCXn7js tTS9BZq3FGfUMwuRVdgZntlfRP9GF/Jt8ow74Hl9sje44ivMz4vWiLhDQN9/ n/F4rhAFHrDFiCdF4mG443D63Fo7FO+MKAIJTQBQS05Z0n+HbA8QlfsPPFpI icrtIcyD4CPPWQdCzeC9B6/iSOv5y0SNRGFBCNY0dpi+hcij6+M+NCtLVyG6 vuUyX85oLE6dRc785BCiszGk21mbhrUbt9xPFFzBiox9fHnSa5A3LdfPpKcE GEa39mpVKxgs2el5VkNxdGotd4HMF0TfLbx0WMRdoVs7bDPEgsRu/yGfP67l 8E5eZ5/GbdQV2Hps7kVnZq+S+UXThc0gj8hxHBoYEzkyvVa+b083GcdFPtBm tBvF6S7T2tc+Liu3bfiPb/59m/3p4eQwTrdmevePI7tgQnsBGWdvC/rgcnMY x3xAOCj35lHYH/eDzFNo0w52caJR3Geft28UDj+CycXd90WJ+LnCR88m85RA +FmLAzNUP6HVWryQVMYc3HTOvZVK9xbcwF28YKk2A1cH2F9cKB2Evhl7WHxo rmJf2wcISkSeuPNb3r6UyBNTrlMKjT5zxvYZdw1etDZBFCrHGEnr+WFoN13S agCmkPlbx4rIBx9Ufrl+/kotkrt60e560RPsxLM4j7u2vSiyM+JuOP8c/CBG Jf/65U1sIfHAFY3bxUjwDuuq9g9i3PH5e7c0LQMIKRnYf556g/LRoYstxPyd 8RLvZdoSQ2DfNq/4MYQKqjQ+J9tBbDLW51MdD+Da/345LX5D8aRlGxnvSK68 d3NZABh6pd06Sf+lXL79P3uOP/NnvmbJDzSmOyLe7psrN2z/r7596FmTjrAW J2CsaFGYfEmJbhtnkPHqF/E5tL5MgPXbw6oFbRr08VUIGY8R20VgbNgDglV8 JGdHjWGGZK4oiQ8+FWPhdlw5BSb6nxRmfCmCzxyueGX1EPNn2neuhVRvQHAs /w93ikG4M9jjcqpgBsaP2JX3HNTHbv9V3HLBEyC1Fu8Ma8UnOJ/z0mqs8imG 1IYoyoh8MC28G0/ig7IbF+QtXrlgIrIMZ9P/4BHz78cfvU61IZ/mHX0+zmvY /c6OlwGDPSij2cjgruocXGKumC/74YghA+HTt1Xeo8E/+e8t/xDtvDKMLwQZ wC1aPHeZbg5+6px6kd3SCzdvcgtKImkM/9aFzdBpBiXQvDjGe3sQBohdbONO XQShGn3nZVWnoIZH+sz+NyMwS1E7aMbiFGZ418q55dU4tBUEpreIn0ryMQcp 5LkxfFfzvvXUETh3x1wg78wUhE8aVeprKbE6yivMsp6DcOJNSuek8wzUczlw wXeKCXMQVdL1vcmCtDv2kvMT75muXOn7Z0HT11dR828F0aX+IPK9AuGGmla7 CgXQ9mhi6e9UGgym4a9qXCHAwzV2fnnnU0HQjT3R/Nk9MEyQ6bzVxTlomcV9 nvmtNGbOuzyhNjgGKdlwqV+NJ6Csb+bt6epQbLZc3vDUHAHJq+bqBF7OgfkF bqdq5esx5921rGbVBFQ89N3uICtCTY9O5z9uuIadKk9cZVXqRYvUQFlOYg7W f9SrXVqWwdL03WZl9uQgFrnO8D4iH+SSf8NQ6voBZOF6FweeGqBFzakO0n5J rEKvT63dAPNlGbPv/AahX8vMl9dEe5/P+pb4S4oPOxOT/oSWyE/stYpOPyTy lVsKT7m5CqbBjTKO0wLJ4/DF7bjbh1+Po9XzNpuzc7JYTJQndSnRvsHHh2cJ qSMo9Qafu6ABLyYonGDo6kLc15u4tgseg0iI7+4JqtP7sOelC2vNPHPQIVNJ Ls61F512Gi8ti+fCVB2+XsnaJYm43m6S80Zs3aCd6oEdKC55qlDC8QbyhjA/ 1SLyQd+LzmLftdPAgQDq/IqhTnhvrNngI8TD45cPHKczYccKwvolDcIIULGA ieHSSC36/m2FXc3/Kuap+fWSrEowije6nETig9HST0Xcs62whjS1SFrBUXTg 0kzSy95JFOhK0Fs7HI/FdmcyeDMPoVN2TCrBh2Ygy8kxxZe7MUx1fPrNbhE8 Ype9H7nXsAu2fvGKmPhRDXwvCLvWXPiEvvdRvzIlEJDloWTukCvBQHwxzC3y mRHaDHR1Idlf+uFzzp9j0uDzbuNn/tgUGi+ZdFsi8rt73XiC4lICSEnfK+yR OA67rsv9/po6joZHPX0z12qAE3VGyk0dgASWzb+T4uAYxyaYlGMEOoR7Lbs1 JeFWiiPJbqiqdJvG7SclqMzpVzR/ZQabKNSiSfFIbjdOUaBPDLDRCQns9uiE 9PVPj2GX8OhDU2dKnF43cOfv12zaSIHGH4RXFoh2fqz+juWvVSbQUE2eMyrq gIcfBiZdd8FDjZRfdi4z2yD9cVOd++AwvElHf6OnewoJrVgHmZ5QxV4GHkoQ pXFBR/J6hueIz/XKuEHnrQqwtXhDCfn5n6jxu3/Rbe85hC+81llbK4cF7FXJ hZ8HkSX72sfw8zOQ4G4hMJTLg9lu6t5k+dqBcvhdNaVu4ZG02jjt0/hGcHMu u2X3GAFNqee67a7Og6sMi0ZO5sR9pycSbvFoBsHkIKuraoPIq/2FhM2DSpCc GJQcqnof8Z0YrL5Bqg99Ne6g8MGBl3u9FLnfjSO7sdostvhx6P7qAZ5yPQ7U /HJ4V0n0M3r4Tuorr0fgYgduUsq5DpgwvNtKsrdFR/JtBUjnHed8y2YeJZ0G 43GeslcLfaCP8YvMbiJOp7TzjoGFFSTSdVmes/GHTx56KX8lnY+wq3l9a70M /OCuMnsVApz0I3ClXGiCDPpOtuxuC2C0J1CJ0aQdtryy0uh+h4faZV51x/Fz QK1G+7Z/3SDcJac3FgBn0GkTrR+VbXxYV51e2MfSa+jl0pg6iQ/qMSQsWLoc w3YHGcmcq29Hat1KU+pEPhiqPdb2VpsF+yBbb+7ZMIjmPWuCzinOwOyPIQVC LXuxmt7VP+5zdUh6d7BJ3C0C2jOTuGXc1QLelF1l+o4rQTw/Tv4d7iT6ty0i tz3tCV5VPZsTcP2NbFgEt/4MzMCVQCsq5QO+4K7w4cnC1yMoPzMs1oNoP56Q MG5WuWKQbIna/qYqodPlZSWkfS0if6UFN0oHSs6GlvO47EfHS1XIca017k0Y /9gu0KSbuaUGlJCJETeZp88IPP6GaLdwv836xEyS1CGLwwN38r2mndjekntM 4LVsYaTiyjN48Uyp6zEi724cK6XvVjMGr1XpbStri2Cqx0PWxz0ENErJlp+V VQGE45itq116YMenkMUK0znY1JiQ8ihjlphXL4bVTvfBFby/1iMi747b5X+y uZYeC9DfO3qL2wrR5qY4kPjgkKrmA5PVg5iY+Lep3s1GlGBzKfInkQ8OGnv+ 5VamxrTaXkZLcE8gIYNsHpajxLg0kfNr7fUyYON7uJel+htSaV8517CDR1ov Y0IK37eAlJ2Itzo3H6Ozdsd92Yjvde05RQQycgHNoFOv+rsVsr4ySEt8LvQR WuT/0C8MIpneLFGrT0HPbKoex+QRuP/NVJy+dSN4tT7i/ihpHE2Jtwtkvx6H NJekMyNWebCSNo0lj+M/y9VL/rtPeCzWsXrzgBTYPCdOnyosiU6rZZL97aS4 zSFhLTYQyN8iWP1HBQEl50QS/vl8h2/2q02cwgGZt/tFPsCtJM7vsUsEuMN/ s7qz2gVknHwhyc6N4C+ZsDYpYrz6mtY2+j61FPQmbHrH03VDl5rd7Uf34aHZ rtTxppoJEOCWmu1L5N02GnmX5Im8O7UW/0CGhQrLSxcXFT9ghsQasTySv4IZ grd2ce7CNij73NO/ViFn46Uf1kQ+KKCwSWmmtwaCa2SePpTFI+/cc5E/ubog 9/WJpz5HZoEU2F+RqzqEXpvSGXTOT6MyOLFyJ64OKBMeBcv530UHIm8FR5D8 QBVrTlLYHXDsjX7B7MA0Gh1yZwmxHIINHZ8eL5UmgWRPyVr7PRwowN+YXOc8 GuCf82TZGORocxyYeDkOe557OOm/GUecv46bnUmpA1C1a7NCaYrITw3T/d6N oIJSW++YC/zYzC+BuFbnQXi450svr/sMFGHY8/uuYRdgmk/NL3Z3Q36pjgaT xPGklw574G7JApX+gpUlxhr46fdEZEo8AQq5I70RLSeg2aO2dUGzAxofTRqm CcGjhoDtbz71BUD8o978eewH/Lw+x7fv+xy8F2e16WQ2DPAimesqI63w9ed3 nZNE3s14EDxTfLoG1p2W7wEHI3SRSt2XFI/sN6McHwlvALeO820mMbloLOnp l91EPtg/vktk7DsB1DIfaaEi8sEJ/zj+C7zlkCpF9VIqnARXCYO478sT6NKW Vuqo7Bj6qzMxO3McgUCWNq8FM4QKJ15oqFURoBGVvb1tTBBYqNFUpnSoR0Ls VEvvHAhoe/JXjXNjKPBUGwx0fDCKKvWnJh+FT6IYepu7d/ufA6/Xe5zKN0WR 0tIAuZ78jLP4Eu8yKxBsi3nev8YIlydjyXxQL2ZcJCFoPzi89+ylTV1TyG6z 3E9aP+IGUAa9UADm9++XXt2ehWXvV9KOHO6Dt/2s9SgUR4CFfnuBalUa8lxp PTpBzN8+c71eDbtrCFpCE02vyw7Buq56RYWNaYSPMJv4TPEcaFArbVdvTULN 7NuC1zZH4PJtTXfV9wPAvLLyUUBKDQy9Zaw1SuTd4ZPt1oXm84Duh1T0TpYe fFZlpEfip3GuNklZ9wMwPbs99x9c5ED8SIu8robMHjgz+thhu7sy35Hmo3Ik gudmoCH6PhMbwXfhIRZyJbbRb18XklVPP5p8Gg+fyC/rcthWgIbgQ5Jje/NQ nPPc4O9xAszW1OjF6OyAXOrnuSgJTvSRaZJ8Hvonebw7rmQO58x/0sCnnRZ9 1zYi+4GwN1XB950mcQ1skWq6scvlmv/OK4tMmOFt0QncCAMO5nW2lpsz/sdf aiJl2bd/jOM4nPiDzozNK6YJ4sm4586b7XN7J3A157gfsLIcgAqNODKed1N+ qtNtEtfskLU6t0cIsrXIkfNnT755malHBNyj199V19NroZAJZ01fOHGd6BYd 1nxxA7RaBGaohI/AKYcHC4KGU3BcqFSmQus7iPb+6zfnPgfF/9QNU+/qQZ9m Tk8GRz7G+FIu0CzMKKFrHI5FJHvWjV24TO18A6sD3N4tNjqwue3YEsn+QY0J 2445Idh45jmpwwH6qMd6QoqED1t9O5lyIggL22JVzqCmQqZ1CeRzf/2/d+W4 vEMw4W3bcC7TU3DXwTHSfRJY4PHTrOJzBKbClqjQRLrveJVH68fBO0S/lfWD XyYK21KodPm5RUCSurTn2/1iUXZTiYxCSCSW88BZquN3J/Kofh2wWwkPeTeU LrG714NbKsH71qNaUEFsxxk7bgL8FHj9l61QPYiQKWyqjC9C9e/q7Jl6if7h iW2cAo0zSPmiyemzEoeSOK9EP9kiQGt48Vyw9DXgIrW49lNwurzgAvneJvyu 793w6fh+MHef74BqNQ/s/jJGrvttxcYWJnVyAagp6H2RaVpR0/K/9ht2+9pv H2UEZbvuZw84sEGv9ffkekLSrdHcqVxhYDpfuXT+6YhiAuU6uf2s+0vdeEdW cIKx71DtrgNQfgL8x39fTFfxMEuDP59XZkaGGsrDDP9bPwSVSSYqVTaQyNw/ IMf9TTHr4H84remttrpeabDrPEerXtVwuXXgf/3r3Gpx/3maGRztPTjrm7tc HtX43/n7W8vzofkfxUHqydAXxzyWyoOuTJJxN/v7odcfHACU7q120yzM6LLD DTKPe5OfVCV4ihdo6iR+lQ/6oHhh6b/nmqK6eP3L1KB5u81i99IJFKC4m1zH oI7TXzcP4QD5AsfFcLxpcO1tFNuVVQJUuDowvGZlDsoLWPg/FYRDOVeez8bE 9gKiz3q6TQ2BwnPfEz09vbDCL2JJ4ADpnC7o7euSejB91+synq4Deps6RhlF 4OGB1odPn2jWA54qHmsvd+L7yAtkCt6rg7xZP/diIVFYfUGhGeXsJCy/kcoc yjgKWezplWfawrAowp2vOoIByGdE4HI1Kc9sP72LnTsWexXwje4ujEZd2lXr n7cJsJki/O2zkHeYXozNF1L+7V2bUPeBzQV1KdunzirOY9wtp/dLP5GBsR7M 5Pv5OcOlHAfUfTH8A7fQX9PEeLCV2Llu+Rl1sYxF5g8FYud2jLtDrzQS41R6 c64OAeKuTzs57mkAonwHvRjq3FG5TCLVGLEfR0Kro9Lxa8DzHPOHsZhxaBI8 u3UxaxzO6453M22LYhyKgkNeL4nxMj7er+bNOJSafvX+UTke3PR9XXuemK/E rFtMEJLG4Y9X7dJJ87LYMcWtg2+IfN5BlQK9IH5yvwt04SHyerRGvYea+J2e cqryVMo4DPbDb0wkUWOFvUP8+UR+upBYlBhGxH+VdodXmR3BJOP8Oq1fH0MJ rVHk+Q0beXLo6J4LYNUtSuPzjj18IA8w0rl/7dSTjsb3BsAM/1A+b7YVsnaW hF06SICDdcuOJyQbwAeRO102CnhI157QuYzvhLl6tw/n5fthcTo/lmTvXUN2 zVTXiXk4fKelx/3+SwzGfLmGkGRcjV7cueTTlkLM69T99+EckrFrU1ZBB9bm EF2JQHKeYzc8LsqWYtv6FYutuMYe7C0GxSacyOcg2x9s09I6vLD9CZa48r5L 6OAL00SSv8o/pk+T5vkM80g/u+6XR0D+Y1qtFAaVSOaqePt3PwNstDpjrUmU 6O+0RZg/DzYj12dZNC77zbCpm8O/bKMaEI14/Z8JYwJco1iesSbmjefvVew9 dr8BhZnJHrQyIcDwl8+vKNo0A/d9tqoVmB0y2HPkCen+ZLmq7/VnKw7gmfBY zrHGJ+gWXz/rOHG93T/F7dPy0wOUjPC8qfpM3IcDRXb84ZUo7HzmdKqJLFZx fY5OzLsbjn9iGri3PIf+lF240TZ9FFvVktpu+EjMq+adhCPWK5FXQZTOqbC/ oCnHuUE0qBs1fzvzvPvPHBJysz7i9nAAmKYKtTBkESDX/KXSWuEqNNd8b/+v CwrY1+C79fedif0/uW74d2UOnStWVL1Qx4udOOynkUlsf0bfgYWTowo5uqrw 7A0RwpwWYq5ueXTDGFeaWgJxPFexizSxLIyYw4R75SCx/V1J2C/EXIXa+I7X LKrSYa+COc9WE8dv7m2T50hsn07xsQx6/gUK1DsDc8T2YlPn2EoYq4j867in iiAPtmsumbvbpxtW68YInSK2lzj/9UOg8H6sXTfj0p99cvDoqcujpPntPETX 3bJxFfT8hk3TXS6QpRd3fJY4vwWf83sr7b3BwjnB2vCtUwhY7yHfqww4ksL1 mMEK2AcarTDmqqKq+aGnJPxdy119gTV3cDaL+1VxSSOU/iby65oW0Z8LVukZ 3GsETIP7W/XGG+DHcS+biCvE+blIx/tcpBnQlYSEJJgTeX6syRcjjQb0YpqC ainAAmMOn51rNZmEKRsDZc8qRpFtDadGQJcOZt6qHr8h/RDepT2yX5343Mtt N1q/LQdiafSRfaXmmTA8zCuF8y/RLxlxcsQyPsZKfjs2l/vPoLSykcyDFoNo 0Tcj6lJHDUZ5+eLms0k1dKi4+TYpzo6oRp7vjbyD6b38Gr0dNINqW677xxoN ovd/zHs/GxpiB2Kcix/saUOZB6DU2DoeqqInEeMOHSAb/4TR/94gaqBmyTlq NwM9R62kwd/3wJpGgG1+fygyz+8PSyD2/+m0mwxT9WVAm3Rl/0r5ZWT7g82X tI/01JbzTF4LgKvVhJzD7oPoq8oXVnHXGaRI2VJhKhUN4vnapYvcibzbnD2z 2WUGyXmGmi2HlgNciluzQrcEmk8TIp0Xo66r9dFVBxnB7qBfPUIWMjDq60Py vWuOvPEIdXNivtqyfiow+wZ8vvKQd4l0z4HZu7VA1Qz0Zi9NchgNQh2P7Zca wTNwS7fg15v9w4DOsjryFXsDvKW6Xb1kSYBy2uO1tb0twGvzdtNuphFIU8Of /jJnCokd4qE9fw/D3gpznmEcjoH4G0deuRP5b+fkE+97Tjexuv/ROxz+p3fo fyt/KKLeB1WkmrmR6hVPNz/G7qXVxC7/j25i8p9u4vX2Q0F2LoD8aSjaSfh5 cZVGhXid/1834fVPN8H0TzfhS/WwriJqAF30t+pkPzaLGtzoNBVOyWDl//QU rf/0FEH/9BTv2VptPY260E1fmdkqYTwUqRbwKJDqB+b/dBZuB//TWXz7p7OY XInhqP4zjJLNBR6s1E2h3NlwzQKeD+BS6f/VX2T8019E1d+fTns1i+4+2rHj fPEL2Ur4ntTxCgeSSv/pMi7802VIrPynyxiuq8d9c5tBszexJ2YugygtwtHx 9LNKIPVPr6Es+p9eI/2fXqPUy8VOL3AQZXtkC3c4zsAMT9tblsT18//pOOZP /V8dh7m39nF6n0H44aKFn9StGUhtwjrp97AciPyPvgP+03fYz2MjH5XsEQMv 7hspTvm0s1d5mUmAwP/Rfbz9p/t4eeE9pOUdL+c1WCXnOe589z1ct8TAxv/o QUb/6UFqctWm4soj4Of0x05SRNwkuCH/Ib0caP2nE/Eh/KcTef1PJ0KRcvVx w89BmEbBx9MuO4N8OjxDdzEOg7Z/+pGP//QjN/7pRyaVf/AElbfBcypNfzKG 8dAHPzvFVfkDaP7Tldj/05U8+6cryTgQsR7b+hu+2k3nlF0zg04LlO1yvsyB af/Tm3D/05uE/tOblF2+8lI/yg+WZsoEtpH0SuPRhjI78lilxrCHIHRGUaE5 gQQiLu8oYHJHXxKrSnbYdsq1Q+uf6OWJcQ292pZicBDjxDpbDt361iiLkvHr o2Qe4XkQC8qTwswqb0c6vJFB5yzHyDqSWy6lp1gOcmPXRClOYs69SJeHYkef dw69aQsytMSfwJgpomR7hLpRCa3rBhs1Ho10X6RgYmPA2tRuieVEd6FbjgYh MZx4SLEhMZRpNgAKrgohSfFu9D3/zhctKjzkLEgrcfYdAH3Yzh8HtQL0U8SQ AT9IQHxUIhIuQt4gjjetkdcqGe1VoWYX2CQggZA66R0xd+B4iG9OwW4O+cWZ JnEr98DKt6rp+fL3AUFIlqFP6SuSqirRhiHE+MYr9eniJ2ug3dSQ9d4Yj6jO 24yUnOmEem4pz6S9q8H1299qqi2+InwAI9tQEAF+CWeMaRxKBNJn7rVoGJ5F 0Jb9MfmexmBDg9zhA8A886XCWWMZKJ8US84nW740/O2fPQSseUSbuZooYWju O/I6xPqiFNAGJXi6S+zyyXeLiktK0//pW3Xnfyao0IPIjfLDLspKyFZjvox8 XqnLnHd5FxVY2d594++SGHqjvkE+99x88fFQ+TANiF748J2fII4WtQ+QcYWS OarIEAaQuDNYdLNdBl11cCHrH29/d0ye7VrBWclYfOA9lgwzKGPyThHtZsp2 7rrOAA78rmoZP/bmHhTrLRkOIOkhjALNW/bzg9mTMbrFhChYKvL8TDnRr/6N 8L0Z+N4Z/Pz6q1gmLx66ar6oO0n0M8u6PbbqdJ7Atotl7ldvO1zdXWd14yke bihEsHKJ/gIU11vzlU2+w5v6LEcoWvBQR8J4tsC2D2zs1oh8MdcHP26nV/c3 zqIzIP/iRP5BbGYl1W5fyQ/o9/qqpWLRHOL9wuoseZca64m6YXeOwR2KTb/v HCfVk0UrlNURH1aE08uOeXQLsi8nuMwT8Ym2TMmOMFbsqPDeOyZ7riFxU5sv pPow3fLfEWycCXNK0nddCJVFxZezSfer0aHzNUnqESzYnPbp6GGDdsT2euqK TjoeVbrsU1+IosHYg2IeRl/uR3nDY5UGLrPwoK4KK415P1CnPBE0IpWKGp3N 9r5aI6BYC5zGmZvu4JBk7i/fRHuk84snnOSvMrT37Ju6wAM29QiTYuc1IF7U /ga5LuH/QLWtlhswikybv08dh7O5OnlPEsehYl+JTH5qHWiWpDObTh5H+FUD x0vEfP5HB5Wa0QoPppPRkMh08AiSVuAl89OEdtezDCekgfa3XdV0hidRwWIT yR/CSx5cbY+d2cAyo9IT+UYNyGRqRtJ5w6Wdq3tdMg6APUrBERtvP8GtxeOJ 6XgCoq8Dboc57oB1FT1D4anvUEC5tzmjCA8ZqNmq31H1AHNfY9e8rA64Osbh y+uGR4enHeWO6VNgxl4gSnP4OuRKx/eQ4vt9vuUC2Xg6bKEwo6Oy2gr9Hs5g IMWXBrtX3WHP92G1dyrNcbstUbmt9TYJPyVsU2DEuRsLNCiLzxqUQ6fHDpN1 Q6l78DVp4nSYIrcOq/bRU0jBOWmAhDsxYU9Miqgx36RguskHLejmQba0dm5i HIfJF2bpKLB9oZoiG8V1iMmH695eVwIqCmNR4+ZYBY7Z6OxJlRH0VmuXR+Sj KdhEW+tsbNkHJt43FIawTqGazJGvNL9GIM+Oie760Z8gXSE2yCkyH5X8va84 NkzMo25vS7VyeYL1wQS/nw8akVJUZMO8NgF9EDh+xVXOBwj1KRZ9bHKECT9X 6v6Q8tLYTftjf+VAZbWfl9yjJ9BI8ycNnsgXjq39lnBCl8EvwwMHv41XIu4P Q223s4m8Uq552eOOB3jrcPTUodA5FBZ/Tlmx+CdkDmjjvzz4CijRUeq+/ECA DGbN/a6nqtAlrTgRtodt4FoF0P3h1A3/hOVYeK7OoQ8sSV9S/AvBX/8YNmJ+ jmKv03R9I+bnJ7faTLv+iGBeQdcuF3p2o4p829lmYn7eAhQ+ZLQzYVYDvs1z J/jhs02jVdI6oWHAguKHVYH9OanZe8gKStdRMpPm61LA3Ohdr/PgYnPt9xsH qiDHdp2xwEdinDS13nctqBB0X8mW1SPMwUwzv7QbSd2w/97bCA2HEeCwT3Tw R4kdeiEQLUPiU+I7GZobrzlBQE2qm1/FPZS0ceeZPxE3mg6WstaBwEy69YlT XQXkrl5Kv1hMQFKjtbE2CkGg8WZvxXDUdxjr3tujVItHwcX2HmxnA0Ba0Tmf XLlumO45eXaSEg+N63ekaJ53gydThqevXxiBVw4mTrDdnYJZP00+xzl2gqcT d8KYQr5BGj5ZpYHdBDTGYGYaar4KpIY4f5bn18O5HYe6CRsCkm6QsdPJXASK iYRIFU8HmMWEBkh6q2ls2sZ+kwrLpT/I9PiYHQzhy00jxdPjdd9m9B9sA5X4 /jk2QTMkMz6SRarHXj2Vc8CXcxu8NzvmfYkGh8xd3neR1vP+v3tEflvswn7Q 0ulrRVaiwT+EkxGfCciqScixhH8RePPX3/bVmEX6IjLue+b7YbkS5zXp5p9g Jmzj1xP9brRQY6K0vTmHej22Z7lzAoC+ROw736pk+EjjBvOhTQKsN5c0K80y AR/7Lx/9aDCL9lt/5b9Q0I+EnK7r1fG/Arzp9smXEsLQcaX9We7E8bAXdZxp DJEE3K6PNGau48uPP1gg1wPtaW2F5TjoQJp8hXL0Gy3omEatTMIdRJP2Zqnx A1F903fUd2agytIPuUWrQTTjmTOl1ToEPnUeKC9mSUBUu+YYuLcIcP1ksqC3 riE4sTBwnSe1Hsr2MArX2hLQuwdJAi1f3IG4KO128YEpqKu1/fDV1Aj8Gs36 6cjJJlD87YvELesmyKarFXH5DDEvTpCuOZU4D4aeXd3/Jvca/C1RqU3y8y81 8zditZbBuX/3gsT/3Qva+XcvqHvVra2algb5P71Hjr+d7vrFv8sncB6m+2lY //4pT4z47/9UHCrJ51GaGsclz6tc+vyuptzw2X91M/0PRVJyb8dxSHbKqufO suJB6//qxiaEWu59ChM4lwK7lGiPw3AxQIZcf3ude05zbu8M7qDy2PObPSkw 0crsFPUGASrydrGGROuBd7R2yxck+qC6yclu5dVZOL/89kRALAIvzjZzmnAS oMTPkUTrvBbo5VE/RCV6H5NtuOy0e6sWSi5nc8nfIyDdZ4Kn09JcMMV/939u /bv/I/Pv/s++pYYLGrhu1Jj8SuIQcV8cmnzRr3L3GmZQ837/SeYPaEbRbPr9 EgEOZL7CZTbGA99GdUn21EgUG238mZo4/hcPRrfTG9XAQ4ULX2ZCWGDQIWry e9ll9dKHIWGwgucQ3KO0HyabqJHt4PvI5hQ4LA3CmagG9t9tVkyX/c9uDA9a r8r0SQMeN8vV+D/L5V/o/6tnlj+V3GOYLQ625pIiHpozIw1WK3L/nJQGfwNO 8oKRe1RrJoWcKEf1NbmePyv+ZOWHKwfI/Z/7P+jf/Z8SDttzVtReUM3IY3CA iC8cfRQdraUHxCjb+iFWCk2lvshRtxLgd55ni8eoMsCJqorpAqIfKJDdNdix mwAr5URZGP9fXdcdTnX4tyNkZmclZEQKCcXz5aFIkUpmhYyUjKJskREhlZGV UhmRSFaKeOxR9t7Z+5yjZIf30Hnf6/r1vu+/n4vr+D7f83zGfd+fm1wlWIu0 /snLPASjZa1jXzHPQIsJtb1rjJbYYH43kyDlOOwaVsBTH5+At1YUy08b+2KS B2f3NHjjIYWTM6uhYSt8ykL2Wa8uDjvbkxayU6ISRjBfC2Z9SsxvFou0EP8G MyPpdoxJuh11km7nRIZ5CMPAGHzR+bS012gCXqZSFPIdo8BAnNM6QWMMKhyp 5lUcIcYh3RHFUi7sYhVV2n3yPYgmnGf73I55q1+opToPymOCVCu5JVBvb8d2 fyhe+uhNMK0GKO56yZXeVgjZeV5fvtNIgJ/8Dzi2exSAicH7EuG9U3DBCdz7 0z0MUzpDDkngdbGdhPj9GRrd8GPuj00pSxx0zsnpXTHyxaJIehsOkt7mz/G/ ehslxrup3sp6SC/6Mra9p3mL6/k+LSuQOfx76Hp2BzTUUT0eMoNDG3t+CtvL 8GJfzSTaXb52ogCDx9pl+Tik/OCbQPK+QXAjNcKO6V4XXDvTdqkuFIfA4vwx lhQRbN++/F+yS11QQJSbkdwFhzRVdZYbONkwXx7PI8/YuqEH7yeJSnscyuTE PU2aXwJseVxxFvgu6Bd1nW7QldhPus4ubG4wYEy+Aj6DtSeQ1TmUsnU+wQdv 3J077gRASIX7S/lyyJ5e7sGSSICan2Z5dL9WgsMkvY0PSW/ziKS3eXcp8Mnb A7Ow1pAjrtl6AM2tmTt52Z/GbiQ+x16zEqAHLlH4a0ADEmx4PtZmeB1beLb8 vi6hA05FFAZ743HoLZ2WxlVWF0yfpGPZIOlYPpN0LHev3PtyUd8Mep3K1Nqq vzqJzoeYBaVA42755JzOAbj4VKllhWYWCVgd9B9pHwQ1putKahLZUJdq7sOF GQLUCic73VrxGVCm21Ecbx6FO1tDT8VqTULZ2QopGad9mKm+YC6XZw/MnKkS sRbAIbk77/MpDU9hoSQ9iSBJT+JD0pMgxVELGW5/FBFm+z6UeG45h3RPqxw8 Bq7J9wVGkg8jhRURXeO70zDS4UiVfX8EsBFLTzL1GYaB6rW+ajzT0EFPP0j/ UCm4eeGFyvw7H/TYvWsji/hcNROcfnxAD6ivH4qiogiCHKLiIRZbe518KIEu WBi0XmHIkN4VACXe/cgMIMZte4ZkEl0sgGhIYeDZzHHI96Q3fzxsHH79yOhu aDsDSm/y0HQyEPOFNeUx89EGVHmrLmHwNQ+25Dpot3yiDk4LjZi0yhIQQequ 5k4mMYyFpBtRJelGdEi6ERd96vzGn/0ogU+rkOz0LIw76aaUNUSGfVmpfzV9 vwBRsLNRbLQS0D2lY0yiIcUgV+5LlhFzClJz67f5sESAL7RXlqvvmoNDBb2s O/wqUW4NLs7jEQGWEeY3cNzmYDivMF7QrhpFJgjxJTgRoCdt576LEvHgJ1nE ET3vfSj7vfE2bp/Z1JCtycoMAiRWn+UaC6LIVsHt/axMVZtvwfJUgKxtbx41 /THUY1w/sF3XCk++2efxUyGHarlg5ysL+EmA9s8WPm8q8ZLSNpUBZJB0IxdI uhGJ8b+6kc32DnsO0zgopJDtyEKc797cUTc9c9URLEgG1wKfEqj9pLf4RSEB mboquapvVoGzD0K8RNo6oF5mxDn+MRy8PluEl941DNTdgnITnAfhhyfazm/t Z+BvdxN1lcglEHH67HBc0CCU/h2pAyxnkBybvS/1AjV27X1az0RRBzyttGOP 8RQOue22lKCKY8a4CHW7cWwf4fIzo/lmAgH9Xh/XD7JgxcpJeo8Kkt5DiKT3 IBNvjU/YNVycO0Pi6Uql6N2IdWdhvcrdsfAIUma7NLut68iydZLw2AtmvpVd r/t8BmW/i7m8FXcb6FA5H0AO/GOnujgffIMGUdEaZ88R636W8KzU8TAwxYUv +xQyAj8NvO2+rzeFrp4/lXjwzhjQCQ9WWS7AQbZXggrG6Z3wkh451+8mWuyI 5ZvjDferYc2UunG5IwFlFPZOJxlSYjtIOo0ykk4DI+k05rPSUkpn7VG0bg0n fotXqozyWhlzBbK1YjQENxxyvXv7pdkUMZ8FB3n97ngNzBQfdy8JSiE7lL+d NxqnLvVqvroAwvDNxmLuXdBuQeDQkTAc0s///Yk36gs4d8Zh02ayCx3UlsTt d8ehlviSiUK6PVh9qfx1FWscjIjeIcR+tBvKNu6RfMg6AoYvvStnOxuALHn9 cv229NXBc200ccrgvOtxMbzvGHTyLNLr/ziBTo35jnIFPgHcLnk0tznwsKps 4cv9ynYoMFt3sDC2C9wm6TSSSDoNHEmnMabynuaGVT90SHtUt2gzixLVvr7R YloHM2emug0n6uCUzJLhzUNbe/c2L7PfroBzFfEGflxZMKhT3zIXR0Aq0tam 8+SrQPYf/YMJSf8wFa8i4JMxA0N1u9t9GAdhg+84JZnbMKh/tq40tD8LPa/B nXtNrF/HldQifyaZAeUTLzNfrU3AuYSbvxwlx9Awxx/BJ+sJwDDWjAM/hod1 rzuV9d42QSoRT11TKQJgZCI8qKwqhMLVI/MJjQSUqm+sPHxpDmQyfhty0teB QaoMwVt1sOG1FbnuFU+MNriau4xpFuVuKPz6UzyAGGiWLN9fC8P8cXPCBWHj KPx9yKArMZ85ObwIeKlyA5M71vGmcLMKTc/I62e4E6A+VSt9V1cAuJ2tqqIh cATh/qRu74OKf6S6/E37l0L6s1Ddjqcq6NHhseztOdrPu2ZQ8Q52Shuxm2Rd QjNvBm22dBYNd1RjOL94YT09f4SecXWgG7a7PDmp8SjDzra0f/Mx9pPbUcDq NB69TNtvMfuhDVL3tf0giDzFZNp3O++pbEbFSwdlx4vwUEVfV/TY6zLgTZdA H/0rH+l48FKx9RHn3Jn52ZvjNuBU7Nuopyd2IKmJou37uPr17MH+FBaQGGIa M5/yVmlt6W9/eJ65F6t/wAGqLAOWb9e0FbOQ9sQv5DWPcp3jBHMyG2btjWPF K6F/cd1N6ofRzspswBB+ZZA/tFpcL9m+Hf+w4HMqxp0efNaLWXK4TIYU8nO3 46WfmT3JHlOAhYkokQgBR7SehN6Pb9WvqbA7w0c8sLMR7Dbd8uMouSjuYwzl BCp9Ry4rw+aG4W90a4TyTKJAJl9tdroxqF8utzrG5IeN2O9aNwCF6HSSAZd/ MwHq3Da0G3n4GTylExZLpp+Ek+oXb/LvHYPIy/L4YTFJ7AidyfzywASay53Q +Hx+DEbzyFKVyM8B+3UlLWOTCUh9fz3AoW8Mlr/TGjWOl8Vu/16l6JIsRwrn tK85EPsQ8Xtv+cUvv8bsItwDnsni0RzlfOssTztMnDV0v0xXjcVVOJ39GFGF 5nvcTEPvE2D0tdjP0ax3MH9ezJNmmpg3o1jMPhdmQ8eYDE5TSRtsWOZqSegS AXl12HLrK6RAR19WUFqmh8U857jMyfcDee1X4VRYnIGqUrtLN3QBdunNgcHE sir0Kmog7a4nAUrtiY58218FChyEKVYLTiBtZs2tPSwoKrCe5Pf4DuDtojE9 5EyAz1Vp6ALMqhHf67yZPhkZLPheG13iLQKqzq9oDiWrQT11UxWlVxbAgULf 33K3CBA/WfnsBm0N0r9UUXSZTRHDuQhtLDgS+1TujHthHtUofOOEirCeGDbZ IUGX4EWAJvzZb2+lViF/C1/jDxy7sSo9s3arYAJsT2wd5ntRieqUaje4mQWx 9v4drRcUhFGr/8I2vvF0n20NQ5M5YJM/+iHZJBY+U7qifo84n2rrtleehfHg vHGnoPpDe+RktTC7tdepe/pMPO7LPYzxeE9FbDkOhVU8D2717kQ+FZY5cv0l WIzpXaNaWzxq8ZfQGGxrhR8HQt3u9RliBzKcQ69vjqLWL8sTRcKTkHVoD177 cB1oO3P6rpRbH/oxZADjUmeRZCCHbF5iDpCWMnRBfLroJg+VzTbfXaE/Ds4q AqVXMbaq94ZR4CkNttF906j1shrnu6fPgKlzuOjt5SHIl+CWc9J9Gqk1F71a Si8BSZJdHDOax1CzDts2buYWd7lGXo8Z+P8/PJeVe2ZgEWaFpoflWha3cDkF /t93jS5gnKb/N48mZkF7cFm1Be3SFOcQfI9HrrhA+5dn1bHrJF7sNokX4yXx YkavWSwKaSdRvGCB5Ll9Y/CUuNeuwPtyWCOJF/tG4sXCSLxYWJ/MrtMafSha oX+HXO4ssr0wEN7J0vE//mPyJP+xKhIvZu6RW9YzTkBMvlmpeNpcOOqi0fxR IAX0/sOLcTH/5cVCZf6T//Lx/Mt//TfPpXXgP3mu/+azNCX+8lklJD5L+x/e yo3EW519+J/8FOfqX35q/h8eSqb0P33JXi/8J980R+KV0km8kvXkX15JjcQf 2ZD4o5ck/siN882b+CktdELmPP/W5/6y1pPh8TqCKToGRe0NtEDzG/S0W8+X Kf7j+ulQfkxLQnD0issnRFD5lX5tkIBYyK35mX0lMb8ochz9hSnk7lBoVhEx gmwtKR/V3hPDHotWRu9bHUNGA8ktzicm4Jmkx6V61/HAt4yMvoR4H5TCGOJf Eu+HZ2hT+t3NZ+CBSMzJm/dn0Vqo4EDR3n440st/RtjzIWh3NDlg4IxDNqfe BBqtdkHHSYYfr8bKgP3pkI4J6TMoSUjFbOue7rGgHP+TTw+kOrkWFnZOFlOv L27n89gXdAL8tDtA8GRQcrSVCipXx3K34qyuXlxWuE2FNVafps/+KlB3XDFn W0cdcD7OgJ4N9LZxt/kE66LyQqbLW/drIQhTuRPLjtmL2igdPYcQXfIn6wdl BHQbcFNcl2HGfDbHdmUT67oKNkbmWFYI1xyTVCXwuzFcIQqlfjuK6H02hnXv TCJV4Xo7ybVxMFookjLPk4BwhsnNP1YJkNzRyibugx9Iv6ToSIndRKvjQ/Tb PKb4GN3khihIrU0LfWU2AbNrvsotdI1BXib20rHrNaCN9XZK1D4VdJS98NPW e2wZPkrjNMmAyTeQv2vRNkSrJ5983KrjkjYP/0iyUmCzRw5enLSLRh2c6Rs9 xO/5L8XgNp0pGoxfk61+TqQE8XulrfsVExDcXFWbrVoHhWP7z4tc6kGyG2Fv n4rhkEoLzaNKIXIsZr93IZ6TgK47+grUSjbAJ9Vux145/AQjEWI/PtaNI1Vq VztZx3H4ZpTfZ373INBVofTU0s9Ft0NvzfMQ719PFP+t6+S+IFHM1axeqhot CumesHMlQIobG4+HJT0A+9GPPRUe6lAnS8B5673Qd1gPLbpcADEFq0ZpdgSo 8XMhY4idWBd0LKfabzYB67am3N1OBFSYYptz360aHY28/VinQhyL4c3k2pNc BUUkax/VEOvA3Z4vHYFeRUBXOEFZ09gMtWVMnNnSjRslZ3lXTR8G2gKuor9X cqD0vPcVygkCDPC8vbTQYwwUijIiZY43wOADhGEb4nPfCM+woP2TCTTOU3+f t9JEo6aHVLfOf2ejM++x2zuwPZd1tdz036Ab++1OaK0REGjJvBB+egUkOzuT /RGZRKsVL94tr4+ib0bt9UYSS8DCMWhq9wQByaZoyAou5qCLt9YNyodbgBNn XHvKwgyK5L8yKSzwAzqqtppIPUsA3xzKfgyo/UAZwmcUbszMoHkdf+bg/Fcg mv7S8nzDNAq/oobf6zaE3qSFpJwSiwdDn4RUGnmlEe+nezNbfydhFy8L1Xle cDIazIp/3w33zbFs47eV1wbpD1PsBlr/4KI7sv/ioj5ndCsSrKnQxFXf7fsV 1p++w6BpQoGWT+TU19MLxdWZI3/3FMQin2YvjitsGB0Yl86rLr5392//ppNy 0MUhd1yhJ0EeNCn/VvppNL4d9/6U7z53YEJBoFL36PkSZkg5VrGNU1FsNnCZ FU8pUL68v0vzewhckJn+JEWMp39Z/0xVqgx+S+4Rbs9ohOnmFgrCZATYvBD8 9bNHEvjyUcG9MWgcyn2WsdXPH4clP+RvUI1aYJl7wzCNi7NwLYBOvONbP2LW 0/3BNfX4/92LfBdn4nbLoQc9K00OYBLCwb76R2GLenbYGIfmTXe/XFTl+U0x dYwA7603hTjrvQMVlz68flIdhpoor/eXbxDvtfEDdec4bfBhQN+K05QH1kSx bJ/niTH/D6pHRcGg4izvNXdmeORBw/bzjipw70m4JgV86YclKelWlURf/O1X cyY+hIz4SwMn72BMl2mkWOPi37nV4DXttDzXEXCiY/EO9a9dyDrF/m+f/E5W nV76ILgqZWne1cOJLmFR25/bvk/59VK+APD5BxeNJuGi3WYKyeLDhvDhZOOz rXhDl3hwFw4Ag/zNnNxf+bC/9nc6K7Fvv7i/0rBzRyKouVNiXMz+EU6qFGo1 EYjz8sUquUedCeD674S+C8EDsEtglYmPbxY+pbRkP8uvhzm5ixbsHOuAoRfe l4wPEec7EY+MOFU9bKj7ZrmTFvH3Kc9aTUZ8g+8tsygtJyIw3Uv4D/U0k9Bu cB0Z8Y3BAhcZmzsuj/4XLqpNwkWvMZ9g5B4Yg77H0+iajCbg5xC6gdgXNJi3 Oc/hRY0xeF5V9PmxkQnYlfmq+k/YHsytQ+hitkALvFAtecXkIx5ighiH2k9K 7NSrPoM1JxGUS7Nvuw9k0SNcaqU+C0rvTcmPtSdDXTKf5UfLBEiWTL7v6/kk EH6iWnp4bxdccq3T0E3CwZc5zL21BdJYcIP07DF5HJS2rhqyZO2BOiXCenWB nljKP7joAdIeInZbIJQ7xxH5exsfH9vC8dqyhxS67cH+JcXretkdkCObMejp DA5JF+M6fWR4sWqmfLvAok7ErRw69Cgfh5LaRI837hsE4hoqyp3Eub7E8rME A3Gu98yovaCWIoL98tt/y2CxC9ZWZ0kdccEhA8eduXhONuyb0q4qAbZuWFHf ENJvj0M9/GsHwueXQEQ9T2zUQBfcGOFXlLuHQ59nYlm+bzJgVoPBE5ne7jDh UBxX2xZv9TDc2s86DHRnmBXrryXAE1IaaibEutbYZHVVPi8FMJBw0YckXJSP hIvSygzkXjdvg7tbXgmZ6OHhq9Qde2jucGGnFvuqr2MEqMLq5VpT/x2taRQG n9xlgdltXvSzTZmAfZGuqucfjyGhlZBd9FX6mMg/uGgzCRdtmeB82ZFjDFl7 yx5vzftvv7I1JHQeAuGvCXWGHm2w8F2c1UFtPHJ/lWksea4DhHGyqmvUtECG Y/hi9Wg8fK6sTN9u1Q4kHMpl8x62QgWGIn8VNzxcGdB1XqfZBObPOqdEjgzD dkXabhudaZT40WlKTB5i4SRcVICEizqScNGj3KC2Ov8LQv5Jz590EOCNUVMD 3hNPwO8d45pmO4eRIYdweMudaRh1Wax8tD8C5NDE3eT2HYZvRGObSrmnocb7 DEu8eCnonu3inX3vi67jTTpTt/Dzhms7ZzBdIBt0uxY8LYINMp96ZWoJ6GSq vaHyCQuwb+Upc8fuYLiv9oCiPvHnD7Ff72gvvAgiaj1qik9NQg12l0TZ7lE0 c7Oh8/v9GSDO3Tbzsa8DOso7PfYawUGBDSy1cXgOUGT1HHovNwCflLF9S5ed RRNJC1hQ6d7/tU9nRMJFh2l1xEH8IOKp+dBSZDgDhTJiSo+lUGAP2C4NNhnU oDYaFytPawLa/yDJ6UxfPYhzm2UNLchAIuy+zYd/EWD+pDOlhuRdoOVebptS WoniE/78+R5IgH+093KlnjUHx6RE0iytqhFLQnVMjxMBHs9ZwHkfige9a28I J7wYoRkd9XY+dHHcVJOLZQI8vpe+11MzI5O2/u18m3GlDZqZ0oGEzmXbW7el kRMsm97WyVeZxja07ACvi+WS36eqQcdDX4K34h7VK+emlcnBj39wUXkSLtp7 Fa9yMuIFpNbu12z8Q4Bfxjk2srzsgTnTnhIz3i/wASdPuEcXca4NuaxLkVsC DvtQTFMGfYXMSJN3vo6Apn6dFl/9VQL0Dy49XmDthllRzkvj9jiYdSS6/Vnk LMiyWRY9ADqhvuBJ05PNOFgXYDdy5/AsMFvTFYtM64G6mSIh1Bw4FG9Le8ec kxFj/epskX6jA+IU1WJfruDQA7sWqrxmqv/BRStJuKhOydFtXPSYR5DtXqN8 9Dp3urelnwBrz8fy7or/DdRL6g81rx5Grr2/t3kiSdEypoIiQcBZcS+YXFUV vTDTid3mMW9xIaNJBnDTjr9XVfg9dGaTtHT/TYBnz0VVeFY5AJ86TR0fkQqY ePSqa08sASXkPJhRxX0FXAl+vGr9HfBQop6c+ciWL0pUhta7cdBWGsiQmt8C Qf19gbZYPLJrmJGQXN6ByZFw0TckXPQZCRfdn5cTa+WQjMiFStYaifnZu5D/ mMl+L/Bk6d1qbMc0quv6I3XFbgh68j/8KMbyCriYWFnNgxbUOBIS6p6ORwyG DNOXfgUA/bzSixGuXVDgLY+0PzF/qhfD+z+jvwDDFKkYD3wXavdPW+5xxSFU phCXR7sHazbQ9f50FQ+LL+kIWwu1IaoFq49PMkeA2MMn8UWxYxA5PlxmeTEB A+Y7xtY0+wDFWyFLc68yuPmIw5sujQDZcz7oZI7agwIDC/LYin5IYa5Ph9eZ Ra+z3B8mtOYB239wUX8SLrrxlbzsfPIY3FzmyHQJm4Acf6Yc5XMGAZ1vDzYi 2wBPx76aeUrsV0+MUCf2ka+Aby5mUnbm1dDyuWmigDNxfifjDMk+Mw/+7PpP XJSdhIsa733j6MiPh8O3WlNMItrhJN3PrD3so6BnJdShtDcN3f5h4veZ+H4f zbwyOrdCnJezI7y67/XDXTTyd9OuzyKR6omGMslIwPZAIWV9cRrODjGKs4Ih eFLi0Lfvx3sAn3LNYoxYLaTM+MZ9wJSABGKXWGKezQGa06kbRY668Bv1Y+Ot +SstpNe8Vvw+dqL+tbloOgGJPyy3FFQtQ9+v7f7sQv0EM6j+fib43SBq4M3S 6tWegVONQ9e4m/Sxi41TKlGZZSjvuJKqYiqxH9v5R+y5uA9Yu+RofRNKIlqd 4m0/K/rEvl2mxT8VZOCKm3bsWSj6LODoVh35qbnQPtjoi9VfKPgoH2OAKmk1 t/0BPkscKtmj5I1JvfVz1Uoizn3W95p4uMqRbco07VPLcEyop/+aIPkguqV6 u0wpbwZqc3w9+4DpFsZhYRhAy16BTs5J6Yc8J96jYJSLP5AGBEP77mUsJ6KV YJWl8hUC3JcbfpmxzABYnxCyd/EYKS5n/tvvNdu5bxwyZwF1dA5P2paalUSK /uKfzVewj8NuHKDLMWNJTbyleCTvbzzhafeZIg1OEP2AUtGJfqy4mXXlr87w d9fup0psQAtYuucyrBQLVHb9xT9VH3oAT3pgdUH5m3vRZjEZTenf/8dh9eR+ 4EsKIKBCU+yR+Qn9PBiQXvmDADtuOnTS3PuCfck9Lj2kSMzjIVpMYjnfkcBE VFT+kjcWL9sWWsDfg3SlMr8qyuFg/BGldeVma+zXUtzBA4HpiMx2/KjaPDFP ZnNL2Im+AzNM9sVGbJPwq/cPj4usY9AsN+1OLY8kRvnCQZf8xwTSeHOrNuM8 MU7htrdcfg408X87d9lkAnpYny1w7BuDV7ssrMziZbHUl1r01WYVyLfcWtI9 mgDVBbpl8UGvMXG1/OaO43iUI7s/B9C0w96lhvCTZNWYspWUzdQWnuObyr2T /C4MD+g/Bl+ZYkVJdsc8OwgoRPZ8p2jRFyQfm735iPcadvHs8KMnaj1IurI2 bvUwDmbqw7faP49iKWO5fNHKPShL68Q7Tkkc5BNhz7BfPIrdVugSkN/7HpnQ c7L6Eu/LGjX5/qHL70ElV0aOxxninP8ezdgMfINJp17ScHPLYPICyQvEpgal BYY2s2nXI44qhim6WFVsfYP3cMwgHjLuZfMrrm9CfLuFgnOOX8NS7ZfsAm4R YCo7lJncWYPSnYbvnroth7GUzufTE+ti3yeknUaci/P22qTcsBLEXGGz2Fvi PJwnWUvFmlqFwvR7N1Q52bGBt3u0OQYI8JYjoS1fNR/uPJxyD3dSEGvlMq3N oxdDjozS2/uJZ9gdslRDzcHo3pbIQPtEWOfh2s9B7Pf6+zj0ryUng13q7xd3 9U6hlL5G+oKeYeSxum7Mn12OXbweXC48MYNEjMJj6PV+IJbqDp0ivzjMuO1y jbjsAGKjI9xilZuFasd2xGvbYxhV4Kpnmu4IWqMnazH2noJK1tx1JvElQKjz /Qqj/ltUErZmd3SZgGID9ROHF++D4/i0aeoVHcRjtsdhK29k8daekzsnB5be cf3o8BhGX/pDnh/hm0aizOZR0QHPAA8mlJC+PATrFWdWuNynkcEhGvKs9BLw M5d5mOapHCJ/e2Qbl7vbnNWXcYMZZPzjl6hB8kt0m05iDPBxQRnWd136ifGu 7nM8V0Q0MQWSj2IRyUfxAMlHkbK6bqAyuQehpODn+zlxyHFRjQJHfN7/119x dnCzI2cQZYlz+oVqzsB1fz2uixmCmCHJd/EKyXdRm+S76HXBtuYa8XyPfkBk DMTzTpFQYS/SaARBJD/GUZIfoybJj/GKLcfAJ+Lf7ftF/qYTtw8SC22Mr85J BrEc/+nT6DX516cxleTTSEvyaXQk+TT2zT3a9mnkJ/k0LpJ8GidIPo2tJJ/G pySfxqV/fBp9ST6NA//4NBqRfBp7ST6N+iSfxn0kn8Yokk8jHcmnMZzk07j+ j08jQeL/9mn0Ivk0Erza51KtbqFrMkcf/9zSG9jXvZC9JYVVXNy4WvnSEtHk zWVv+Vo8m8mq6TLhx+Zj+t71Hu5E4FPEne5WHHrDl2C+lr0fS6Z7oJR5exCR XTg00eQ4A8ui93R2dFFj/l9LyRckm9FQKb87cyseVYzV0SU/rwcf8qYyd+8h oDKZPjKqqw2w/CCVmzVXGMhJvdAsTYlDu1smWQeXeuBJUVVJaoEc8KWH8wfP 2xGUJxL0uUVlClLY3N3FL/0FMC2aK1+1Uka65tlft/dAQ2eqFN1ogNS0e/Jr MwFU+Fh9Wx8ViHnQ4XaRgXoeVp3IaIhoyV6VbsWr1VgZeYR2Ajr1ezqPPG9B 9SYdN+I5QD8Cb+RTRwFAEzGrwdloju4WjLhu4cNJCfPvE/eyYQp93zXyghoR ZUvetTs7CejTNbh7LYYG4/1kb6D5YRSd8fupamgzCc/z5sk1Jy2ByHHvJUb7 emTIRXbzphAB9QyKRPaU1IPqIaWWR5vhqKxAgyZ6gwCnMpz5JDUdgK9QFd0J KzN08Muvk1t4ndz5HP5E+wNA2IPZxtdsAsLeXVZs3WPwU9ymI/uNGjDVXZlw uN4UXeDsjNrC7ddf7PVTbKXFVk8fOXOWywRV2DI6b32v6qLjzjEa78QCJJ8F ZDbVoiIKdcE0A+L3/HebopEfGcZe8xjj/l2O+MTq+HriCIjs8PegyPlV8Mea K7Xp7CR6a7R8ZH/LKFTM3TTcaJoDreQ9Mdc7cOgWWLXK4++Eyw6wtqFyFoyu m934ydaJ6nvCYzO6cIhlzmd4kKwWlC7gifU6GTlrP/q8QexX1w4oXA5edAQK dy9Z3DxajfS6bt8750qca/bvp91l5gEOHngc3/oEB6W/Jok88++CZquMdI3z DeCb9iDj7FQ1HL5if638NgHtttnbfk29CfP/UPr8/hU80n+Cl65QbIP+dP6M fHUHsSmp924GCVXQOapw7ySxDry/eCN8ybUITB3/GulZYI5yXVceEN8vvCnd rnaCRRycfKAdecaiAILnGqLGbQSYfblAZlHJHoR/+HMl4k4zxCpKv+bW4pFG +PH7/qufgV6RAW/Qiyto7ngc5Va/5DYZIZx+fQPYYMmdwn1F6InZ4in2GgJS Iyu1zI+ZBwXNqhUUPATU3XZ0SZuhAepOvhto1Z0A8sMm+34fGEMrfiYmSuST yCb7R3OsWAnYV8nr9vlUGWp+2BzClE6AHByWItMz3mD2QeBJ+ZxJ5DCTQYkZ jiIWBQqMUe01uCq13P7AYhQ5HoC+U+8mEXx7YXZ0JgpkiZ0T7TI+jLysA7b9 E8iPCkjSOnGDlfF58HNNANKf/rXt61ssVr3fepEZ/BcYfLZM "]], Axes->True, BoxRatios->{1, 1, 0.4}, ImageSize->{360., 262.27713832694536`}, Method->{"RotationControl" -> "Globe"}, PlotRange->{All, All, All}, PlotRangePadding->{Automatic, Automatic, Automatic}, ViewPoint->{2.1491248020917535`, -2.117032254415456, 1.5327873364556128`}, ViewVertical->{0., 0., 1.}]], "Output", CellChangeTimes->{{3.406765675863799*^9, 3.406765686746913*^9}, 3.406765720280673*^9, 3.407312947506917*^9, 3.4073130489365788`*^9, 3.407313175541992*^9, 3.407313380393078*^9, 3.407315084108781*^9, 3.407315142183584*^9, 3.4073163157572927`*^9, 3.407316380529451*^9, 3.4073164440393763`*^9, 3.407316490406719*^9, 3.408743219472472*^9, 3.408744633940255*^9}], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`t$$ = 2, $CellContext`x$$ = 4, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`x$$], 1, 4, 1}, { Hold[$CellContext`t$$], 1, 2, 1}}, Typeset`size$$ = { 360., {132., 137.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`x$1676$$ = 0, $CellContext`t$1677$$ = 0}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`t$$ = 1, $CellContext`x$$ = 1}, "ControllerVariables" :> { Hold[$CellContext`x$$, $CellContext`x$1676$$, 0], Hold[$CellContext`t$$, $CellContext`t$1677$$, 0]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ListPlot3D[ Table[ Part[$CellContext`atomsr3, $CellContext`t$$, $CellContext`x$$, \ $CellContext`i, $CellContext`j], {$CellContext`i, 1, Length[$CellContext`y3]}, {$CellContext`j, 1, Length[$CellContext`z3]}], PlotRange -> All], "Specifications" :> {{$CellContext`x$$, 1, 4, 1}, {$CellContext`t$$, 1, 2, 1}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{402., {189.375, 194.625}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{{3.406765675863799*^9, 3.406765686746913*^9}, 3.406765720280673*^9, 3.407312947506917*^9, 3.4073130489365788`*^9, 3.407313175541992*^9, 3.407313380393078*^9, 3.407315084108781*^9, 3.407315142183584*^9, 3.4073163157572927`*^9, 3.407316380529451*^9, 3.4073164440393763`*^9, 3.407316490406719*^9, 3.408743219472472*^9, 3.408744634105131*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"ListPlot3D", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"moleculesr3", "[", RowBox[{"[", RowBox[{"t", ",", "x", ",", "i", ",", "j"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "y3", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"Length", "[", "z3", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "1", ",", RowBox[{"Length", "[", "x3", "]"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "1", ",", RowBox[{"Length", "[", "t3", "]"}], ",", "1"}], "}"}]}], "]"}]], "Input",\ CellChangeTimes->{{3.4067657617113113`*^9, 3.4067657659534473`*^9}, { 3.407312993921043*^9, 3.407313014398695*^9}, {3.407313194375691*^9, 3.407313231564951*^9}, {3.407316328991769*^9, 3.407316331456567*^9}}], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`t$$ = 2, $CellContext`x$$ = 4, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`x$$], 1, 4, 1}, { Hold[$CellContext`t$$], 1, 2, 1}}, Typeset`size$$ = { 360., {132., 137.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`x$1765$$ = 0, $CellContext`t$1766$$ = 0}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`t$$ = 1, $CellContext`x$$ = 1}, "ControllerVariables" :> { Hold[$CellContext`x$$, $CellContext`x$1765$$, 0], Hold[$CellContext`t$$, $CellContext`t$1766$$, 0]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ListPlot3D[ Table[ Part[$CellContext`moleculesr3, $CellContext`t$$, $CellContext`x$$, \ $CellContext`i, $CellContext`j], {$CellContext`i, 1, Length[$CellContext`y3]}, {$CellContext`j, 1, Length[$CellContext`z3]}], PlotRange -> All], "Specifications" :> {{$CellContext`x$$, 1, 4, 1}, {$CellContext`t$$, 1, 2, 1}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{402., {189.375, 194.625}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{3.40676576688666*^9, 3.4073130157133293`*^9, 3.40731323290305*^9, 3.407315095681476*^9, 3.407316332751369*^9, 3.408744698917877*^9}] }, Open ]] }, WindowSize->{811, 1074}, WindowMargins->{{4, Automatic}, {Automatic, 4}}, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 431, 11, 116, "Text"], Cell[CellGroupData[{ Cell[1024, 36, 1980, 53, 133, "Input"], Cell[3007, 91, 75893, 1230, 277, "Output"], Cell[78903, 1323, 2287, 45, 402, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[81227, 1373, 1039, 26, 43, "Input"], Cell[82269, 1401, 2071, 42, 402, "Output"] }, Open ]] } ] *) (* End of internal cache information *) xmds-1.6.6/examples/hires.xmds0000644000076500000240000001120211033277417013244 00000000000000 hires Paul Cochrane This is a stiff system of 8 non-linear ODEs. It refers to "High Irradiance RESponse" of photomorphogenesis on the basis of phytochrome, by means of a chemical reaction involving eight reactants. The problem originates from plant physiology and is given as part of the "Test set for initial value problem solvers" http://www.dm.uniba.it/~testset t yes yes yes yes main 1 main complex y1 y2 y3 y4 y5 y6 y7 y8 RK4IP 321.8122 1000000 10000 main no 10000 y1Out y2Out y3Out y4Out y5Out y6Out y7Out y8Out xmds-1.6.6/examples/krebs.xmds0000644000076500000240000001131611033277417013246 00000000000000 krebs Paul Cochrane Simulation of a simplification of the Krebs cycle of biochemical reactions. Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) This is a cyclic reaction scheme with the following reactions: A + R -> B + S B -> C R + C -> S + D D -> A with this reaction included which produces R at a constant rate from a reactant P whose concentration is large enough to be nearly constant. P -> R The overall reaction is R -> S With equations: d[A]_dt = k4[D] - k1[A][R] d[B]_dt = k1[A][R] - k2[B] d[C]_dt = k2[B] - k3[C][R] d[D]_dt = k3[C][R] - k4[D] d[R]_dt = k5 - k1[A][R] - k3[C][R] t yes yes yes yes main 1 main double A B C D R RK4IP 250 100000 1000 main Aout Bout Cout Dout Rout xmds-1.6.6/examples/kubo.xmds0000644000076500000240000000560011033277417013077 00000000000000 kubo Unknown Author Example Kubo oscillator simulation t yes yes 1000 no Scheduling yes 111 123 1 1 main complex z SIEX 10 10000 10 3 main realz xmds-1.6.6/examples/lane_emden.xmds0000644000076500000240000001013511033277417014225 00000000000000 lane_emden Paul Cochrane Example simulation of the Lane-Emden equation. This equation models stellar polytropes. Taken from the UQ Physics Astrophysics course notes. xi yes yes yes yes n double 0.0 main 1 main complex theta DthetaDxi no RK4EX 10 1000 100 main no 100 thetaOut xmds-1.6.6/examples/lorenz.xmds0000644000076500000240000000747611033277417013465 00000000000000 lorenz Paul Cochrane Lorenz attractor example simulation. Adapted from the example in "Numerical methods for physics" by Alejandro L. Garcia, page 78. t no xo double 1.0 yo double 1.0 zo double 1.0 1 main double x y z RK4EX 15.0 5000 50 main xOut yOut zOut xOut = x; yOut = y; zOut = z; xmds-1.6.6/examples/lorenzInput.dat0000644000076500000240000000001311033276365014257 000000000000003.0 2.5 1.6xmds-1.6.6/examples/lotka_volterra.xmds0000644000076500000240000001003011033277417015160 00000000000000 lotka_volterra Paul Cochrane Example simulation: The Lotka-Volterra system, used to model undamped oscillations in autocatalytic chemical reactions. Adapted from the journal article: "A new transformation for the Lotka-Volterra problem", C.M. Evans and G.L. Findley, J. Math. Chem. 25, 1, Jan (1999) t yes yes yes 1 main double x1 x2 RK4EX 30.0 3000 100 main x1Out x2Out xmds-1.6.6/examples/Makefile.am0000644000076500000240000000153711033277422013277 00000000000000## Process this file with automake to produce Makefile.in # $Id: Makefile.am 1667 2008-01-21 22:12:20Z paultcochrane $ SUFFIXES = .xmds check_SCRIPTS = \ atomlaser\ branch\ brusselator\ catcycle\ chain\ chemkin\ diffusion2\ diffusion\ duffing\ fibre\ fisher_reaction_diffusion\ fullpos3D\ gaugeatomlaser\ groundstate\ highdim_vector_version\ highdim\ hires\ krebs\ kubo\ lane_emden\ lorenz\ lotka_volterra\ nan\ ndparamp\ nlse\ oregonator\ paraxial_wave\ pendulum\ ring_modulator\ sech_soliton_tdepk\ sech_soliton\ sine\ soliton\ thermkin\ tla\ van_der_pol\ vibstring CLEANFILES = $(check_SCRIPTS) *.cc *.exe *.o *.xsil *.m *.sci *.gnu *.R .xmds: -../source/xmds $*.xmds xmds-1.6.6/examples/Makefile.in0000644000076500000240000002237311033307502013302 00000000000000# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # $Id: Makefile.am 1667 2008-01-21 22:12:20Z paultcochrane $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 $(top_srcdir)/acx_mpi.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MPICC = @MPICC@ MPILIBS = @MPILIBS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ THREADLIBS = @THREADLIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUFFIXES = .xmds check_SCRIPTS = \ atomlaser\ branch\ brusselator\ catcycle\ chain\ chemkin\ diffusion2\ diffusion\ duffing\ fibre\ fisher_reaction_diffusion\ fullpos3D\ gaugeatomlaser\ groundstate\ highdim_vector_version\ highdim\ hires\ krebs\ kubo\ lane_emden\ lorenz\ lotka_volterra\ nan\ ndparamp\ nlse\ oregonator\ paraxial_wave\ pendulum\ ring_modulator\ sech_soliton_tdepk\ sech_soliton\ sine\ soliton\ thermkin\ tla\ van_der_pol\ vibstring CLEANFILES = $(check_SCRIPTS) *.cc *.exe *.o *.xsil *.m *.sci *.gnu *.R all: all-am .SUFFIXES: .SUFFIXES: .xmds $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu examples/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am .xmds: -../source/xmds $*.xmds # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmds-1.6.6/examples/nan.xmds0000644000076500000240000000551311033277422012712 00000000000000 nan Gabriel McManus An ODE with NaN derivatives. Used to test the halt_non_finite feature. t main 1 main double x no ARK45EX yes 2 10000 200 1e-5 main xOut xmds-1.6.6/examples/ndparamp.xmds0000644000076500000240000001106711033277422013741 00000000000000 ndparamp Unknown Author Non-degenerate parametric amplifier. Simulton formation for logical switching. z yes yes main y t 50 50 (-10,10) (-10,10) 1 1 main complex ff1 ff2 sh no no vc1 double damping no no RK4IP 10 500 50 50 yes Lap1 Lap2 main vc1 no no 50 0 pow_dens no no 0 0 etot xmds-1.6.6/examples/nlse.xmds0000644000076500000240000001035211033277422013074 00000000000000 nlse Unknown Author Example simulation of the nonlinear Schroedinger equation yes z yes 3 no no energy double 4.0 main t 100 (-5,5) 1 main complex phi no vc1 double damping no ARK89IP 2000 1.0e-6 1000 50 yes L main vc1 nlse_break.xsil no main vc1 nlse.xsil no 50 pow_dens xmds-1.6.6/examples/oregonator.xmds0000644000076500000240000001235011033277417014316 00000000000000 oregonator Paul Cochrane Example simulation of the Oregonator model of oscillating chemical kinetics equations. Calculates concentrations of components participating in the Oregonator model. The reaction scheme is A + Y ----> X + R (1) X + Y ----> 2 R (2) A + X ----> 2 X + 2 Z (3) 2 X ----> A + R (4) B + Z ----> 1/2 Y (5) Rate laws are d[X]/dt = k1 [A] [Y] - k2 [X] [Y] + k3 [A] [X] - 2 k4 [X]^2 d[Y]/dt = -k1 [A] [Y] - k2 [X] [Y] + (1/2) k5 [B] [Z] d[Z]/dt = 2 k3 [A] [X] - k5 [B] [Z] which are transformed to d[X]_d(tau) = (k1 [A] [Y] - k2 [X] [Y] + k3 [A] [X] - 2 k4 [X]^2)/(k5 [B]) d[Y]_d(tau) = (-k1 [A] [Y] - k2 [X] [Y] + (1/2) k5 [B] [Z])/(k5 [B]) d[Z]_d(tau) = (2 k3 [A] [X] - k5 [B] [Z])/(k5 [B]) where tau = k5*[B]*t is a unitless time variable. The program integrates these equations, assuming that concentrations of A and B are constant. Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) tau yes yes yes yes main 1 main double CX CY CZ RK4IP 50 5000 500 main 500 X X10 Y Z xmds-1.6.6/examples/paraxial_wave.xmds0000644000076500000240000001136111033277417014763 00000000000000 paraxial_wave Paul Cochrane Solves the paraxial wave equation for various input fields using one transverse dimension. This is an example of double slit interference. Script adapted from equation in "Fundamentals of Photonics", B.E.A. Saleh and M.C. Teich (1991) z no yes yes yes main x 10000 (-5e-2,5e-2) 1 main complex A no d ? ((fabs(x)-d) > w ? 0.0 : 1.0) : 0.0; // double slit //A = fabs(x) < w ? 1.0 : 0.0; // single slit ]]> RK4IP 1.0 1 1 yes L main paraxial_wave.xsil no 10000 A2 xmds-1.6.6/examples/pendulum.xmds0000644000076500000240000000743111033277417013774 00000000000000 pendulum Paul Cochrane Example simulation of a finite amplitude pendulum. Adapted from the exercise in "A first course in computational physics" by Paul L. DeVries, page 234. t no E double 0.25 1 main double theta thetaDot RK4EX 10.0 5000 50 main t_out tDot_out KE PE xmds-1.6.6/examples/ring_modulator.xmds0000644000076500000240000001432511033277417015170 00000000000000 ring_modulator Paul Cochrane Simulation of a ring modulator circuit in electrical analysis. The simulation describes the behaviour of the ring modulator, which, given a low-frequency signal, and a high frequency signal produces a mixed signal output. This script is adapted from the Intial Value Test Set http://www.dm.uniba.it/~testset t no yes yes yes yes main 1 main double y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 RK4IP 1e-3 100000000 1000 main maxDeltaU) || (delta*UD2 > maxDeltaU) || (delta*UD3 > maxDeltaU) || (delta*UD4 > maxDeltaU) ) { printf("delta*U is greater than maxDeltaU, exiting\n"); printf("delta*UD1 = %g\tdelta*UD2 = %g\tdelta*UD3 = %g\tdelta*UD4 = %g\n", delta*UD1, delta*UD2, delta*UD3, delta*UD4); exit(255); } double qUD1 = gam*exp(delta*UD1 - 1.0); double qUD2 = gam*exp(delta*UD2 - 1.0); double qUD3 = gam*exp(delta*UD3 - 1.0); double qUD4 = gam*exp(delta*UD4 - 1.0); dy1_dt = (y8 - 0.5*y10 + 0.5*y11 + y14 - y1/R)/C; dy2_dt = (y9 - 0.5*y12 + 0.5*y13 + y15 - y2/R)/C; dy3_dt = (y10 - qUD1 + qUD4)/Cs; dy4_dt = (-y11 + qUD2 - qUD3)/Cs; dy5_dt = (y12 + qUD1 - qUD3)/Cs; dy6_dt = (-y13 - qUD2 + qUD4)/Cs; dy7_dt = (-y7/Rp + qUD1 + qUD2 - qUD3 - qUD4)/Cp; dy8_dt = -y1/Lh; dy9_dt = -y2/Lh; dy10_dt = (0.5*y1 - y3 - Rg2*y10)/Ls2; dy11_dt = (-0.5*y1 + y4 - Rg3*y11)/Ls3; dy12_dt = (0.5*y2 - y5 - Rg2*y12)/Ls2; dy13_dt = (-0.5*y2 + y6 - Rg3*y13)/Ls3; dy14_dt = (-y1 + Uin1 - (Ri + Rg1)*y14)/Ls1; dy15_dt = (-y2 - (Rc + Rg1)*y15)/Ls1; ]]> y1Out y2Out y3Out y4Out y5Out y6Out y7Out y8Out y9Out y10Out y11Out y12Out y13Out y14Out y15Out xmds-1.6.6/examples/sech_soliton.xmds0000644000076500000240000001413211033277417014630 00000000000000 sech_soliton Sebastian Wuester Evolves soliton N*sech by NLSE using the adaptive timestep algorithm. t no no no yes yes main x 4096 (-20.000,20.000) 1 0 1 0 main complex psi no ARK45EX 1.570796327 10000 1e-8 200000 1e-3 no 50 10 100 1 no L main sech_soliton_rk4ip.xsil no 512 density yes 4096 mom_dens no 0 number no 4096 real imag xmds-1.6.6/examples/sech_soliton_tdepk.xmds0000644000076500000240000001146511033277417016025 00000000000000 sech_soliton_tdepk Sebastian Wuester Similar to "sech_soliton.xmds" but the time coordinate is rescaled by a gaussian. Sole purpose is the check of algorithms allowing time dependent k-operators. t yes no no yes yes > T0. double T0=2*M_PI; double sigmasq=M_PI/2.0; double A=Tfin/sqrt(2*M_PI*sigmasq); ]]> main x 4096 (-20.000,20.000) 1 0 1 0 main complex psi no ARK45EX 12.56637061 210000 1e-8 50 10 50 1 no L main sech_soliton_tdepk.xsil no 512 density yes 4096 mom_dens no 0 number no 4096 real imag xmds-1.6.6/examples/sine.xmds0000644000076500000240000000522211033277417013075 00000000000000 sine Unknown Author Example simulation: coupled two component ODE t 1 main double a ap SIIP 6.28318 50 50 main s c xmds-1.6.6/examples/soliton.xmds0000644000076500000240000000722511033277417013633 00000000000000 soliton Unknown Author Example of an exactly solvable coupled nonlinear Schroedinger equation. Describes solition formation. z yes no main t 50 (-5,5) 1 main complex u v no RK4IP 10 2400 30 yes L main 3 no 25 ure uim vre vim xmds-1.6.6/examples/thermkin.xmds0000644000076500000240000001420611033277417013762 00000000000000 thermkin Paul Cochrane Example simulation of a thermokinetic oscillator The reaction scheme is A ----> X (1) X ----> R (2) Reaction 1 is neither exothermic nor endothermic and its activation energy is equal to zero. Reaction 2 is exothermic with a reaction enthalpy deltarH, and it has a substantial activation energy Ea. Assume that the concentration of component A is constant. The rate equation for X is d[X]/dt = k1 [A] - k2(T) [X]. Express the Arrhenius equation for Reaction 2 in terms of the rate constant at T0, the temperature of the surroundings and deltaT = T - T0, k2(T) = k2(T0) Exp[alpha deltaT/(1 + deltaT/T0)], where alpha = Ea/(R T0^2). Then the rate equation for X is d[X]/dt = k1 [A] - k2(T0)[X] Exp[alpha deltaT/(1 + deltaT/T0)]. The rate equation for deltaT at time t is d[deltaT]/dt = gamma [X] Exp[alpha deltaT/(1 + deltaT/T0)] - beta deltaT, in which beta = A h/(V rho cp) gamma = |deltarH| k2(T0)/(rho cp), with rho and cp the density and specific heat of the reaction mixture, A the area for heat transfer from the system to the surroundings, h the heat transfer coefficient, and V the volume of the system. For more on this system see P. Gray and S.K. Scott, "Chemical Oscillations and Instabilities," Oxford Univ. Press, 1990, Chap. 4. Adapted for xmds from "Mathematica computer programs for physical chemistry", William H. Cropper, Springer Verlag (1998) t yes yes yes yes main 1 main double CX deltaT RK4IP 20 1000000 1000 main 1000 X delT xmds-1.6.6/examples/tla.xmds0000644000076500000240000000701211033277417012716 00000000000000 tla Unknown Author Two level atom example simulation. Illustrates a cross-propagating field. z t 10000 (-10,15) 1 0 main double E cross double P N RK4IP 4 200 50 50 main cross cross t 50 pow_dens main cross 50 P_out N_out xmds-1.6.6/examples/van_der_pol.xmds0000644000076500000240000000735211033277417014435 00000000000000 van_der_pol Paul Cochrane Van der Pol oscillator example, adapted from de Vries t yes yes yes yes epsilon double 0.0 main 1 main complex x xdot RK4EX 8*M_PI 1000 100 main 100 xOut xmds-1.6.6/examples/vibstring.xmds0000644000076500000240000000761111033277417014152 00000000000000 vibstring Paul Cochrane Example simulation of waves on a vibrating string. Adapted from the example in "A first course in computational physics" by Paul L. Devries, page 348. t yes no main x 100 (0,1) 1 main complex u uDot no RK4EX 0.002 1000 20 yes L main vibstring.xsil no 50 amp xmds-1.6.6/INSTALL0000644000076500000240000001731711033276365010466 00000000000000$Id: INSTALL 1194 2006-12-18 12:59:46Z paultcochrane $ Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. xmds-1.6.6/install-sh0000755000076500000240000003160011033373416011423 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) mode=$2 shift shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac done if test $# -ne 0 && test -z "$dir_arg$dstarg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix=/ ;; -*) prefix=./ ;; *) prefix= ;; esac case $posix_glob in '') if (set -f) 2>/dev/null; then posix_glob=true else posix_glob=false fi ;; esac oIFS=$IFS IFS=/ $posix_glob && set -f set fnord $dstdir shift $posix_glob && set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dst"; then $doit $rmcmd -f "$dst" 2>/dev/null \ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } } || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xmds-1.6.6/ltmain.sh0000644000076500000240000043506511033276365011261 00000000000000# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case $nonopt in *cc | *++ | gcc* | *-gcc* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= prev= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do case $prev in "") ;; xcompiler) # Aesthetically quote the previous argument. prev= lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac # Accept any command-line options. case $arg in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; -Xcompiler) prev=xcompiler continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi continue ;; esac case $user_target in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $lastarg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case $user_target in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $libobj" else removelist="$libobj" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" else # Don't build PIC code command="$base_compile $srcfile" fi if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$libobj"; then dir="$objdir" else dir="$dir/$objdir" fi libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` if test -d "$dir"; then $show "$rm $libobj" $run $rm $libobj else $show "$mkdir $dir" $run $mkdir $dir status=$? if test $status -ne 0 && test ! -d $dir; then exit $status fi fi fi if test "$compiler_o_lo" = yes; then output_obj="$libobj" command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then output_obj="$obj" command="$command -o $output_obj" fi $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi # If we have no pic_flag, then copy the object into place and finish. if (test -z "$pic_flag" || test "$pic_mode" != default) && test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj $run $rm $obj fi $show "$mv $libobj $obj" if $run $mv $libobj $obj; then : else error=$? $run $rm $removelist exit $error fi xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi exit 0 else error=$? $run $rm $removelist exit $error fi fi # Allow error messages only from the first compilation. suppress_output=' >/dev/null 2>&1' fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $srcfile" else # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $srcfile $pic_flag -DPIC" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Create an invalid libtool object if no PIC, so that we do not # accidentally link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" $run eval "echo timestamp > \$libobj" || exit $? else # Move the .lo from within objdir $show "$mv $libobj $lo_libobj" if $run $mv $libobj $lo_libobj; then : else error=$? $run $rm $removelist exit $error fi fi fi # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi exit 0 ;; # libtool link mode link | relink) modename="$modename: link" case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args="$nonopt" compile_command="$nonopt" finalize_command="$nonopt" compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= # We need to know -static, to get the right output filenames. for arg do case $arg in -all-static | -static) if test "X$arg" = "X-all-static"; then if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n $prev prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit 1 fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread ) compiler_flags="$compiler_flags $arg" continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.lo | *.$objext) # A library or standard object. if test "$prev" = dlfiles; then # This file was specified with -dlopen. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $arg" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= else case $arg in *.lo) libobjs="$libobjs $arg" ;; *) objs="$objs $arg" ;; esac fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit 1 ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode" = prog; then # Determine which files to process case $pass in dlopen) libs="$dlfiles" save_deplibs="$deplibs" # Collect dlpreopened libraries deplibs= ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi for deplib in $libs; do lib= found=no case $deplib in -l*) if test "$linkmode" = oldlib && test "$linkmode" = obj; then $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do # Search the libtool library lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then echo echo "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not used here." else echo echo "*** Warning: Linking the shared library $output against the" echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # Link against this shared library if test "$linkmode,$pass" = "prog,link" || { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac if test "$linkmode" = prog; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n $old_archive_from_expsyms_cmds if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then # Try looking first in the location we're being installed to. add_dir= if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="-L$inst_prefix_dir$libdir" ;; esac fi add_dir="$add_dir -L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" else # We cannot seem to hardcode it, guess we'll fake it. # Try looking first in the location we're being installed to. add_dir= if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="-L$inst_prefix_dir$libdir" ;; esac fi add_dir="$add_dir -L$libdir" add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo echo "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="-L$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="-L$absdir" fi ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then test "$pass" != scan && dependency_libs="$newdependency_libs" if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do case $deplib in -L*) new_libs="$deplib $new_libs" ;; *) case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi if test "$pass" = "conv" && { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then libs="$deplibs" # reset libs deplibs= fi done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else echo echo "*** Warning: Linking the shared library $output against the non-libtool" echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case $current in [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $revision in [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case $age in [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring="" ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done # It is ok to link against an archive when # building a shared library. if $AR -t $potlib > /dev/null 2>&1; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then echo "*** with $libname but no candidates were found. (...for file magic test)" else echo "*** with $libname and none of the candidates passed a file format test" echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check below in file_magic test if eval echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | egrep "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then echo "*** with $libname but no candidates were found. (...for regex pattern test)" else echo "*** with $libname and none of the candidates passed a file format test" echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Ensure that we have .o objects for linkers which dislike .lo # (e.g. aix) in case we are running --disable-static for obj in $libobjs; do xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` if test ! -f $xdir/$oldobj; then $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else save_deplibs="$deplibs" for conv in $convenience; do tmp_deplibs= for test_deplib in $deplibs; do if test "$test_deplib" != "$conv"; then tmp_deplibs="$tmp_deplibs $test_deplib" fi done deplibs="$tmp_deplibs" done eval cmds=\"$archive_cmds\" deplibs="$save_deplibs" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit 0 fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" else # Just create a symlink. $show $rm $libobj $run $rm $libobj xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$libobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` $show "(cd $xdir && $LN_S $oldobj $baseobj)" $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; prog) case $host in *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" ;; esac ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit 0 fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case $0 in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe ;; *) exeext= ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # win32 systems need to use the prog path for dll # lookup to work *-*-cygwin* | *-*-pw32*) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case $xlib in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # Ensure that we have .o objects in place in case we decided # not to build a shared library, and have fallen back to building # static libs even though --disable-static was passed! for oldobj in $oldobjs; do if test ! -f $oldobj; then xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$oldobj"; then xdir="." else xdir="$xdir" fi baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` $show "(cd $xdir && ${LN_S} $obj $baseobj)" $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi done eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 fi # We do not want portage's install root ($D) present. Check only for # this if the .la is being installed. if test "$installed" = yes && test "$D"; then eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`" else mynewdependency_lib="$libdir/$name" fi # Do not add duplicates if test "$mynewdependency_lib"; then if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then newdependency_libs="$newdependency_libs $mynewdependency_lib" fi fi ;; *) if test "$installed" = yes; then # Rather use S=WORKDIR if our version of portage supports it. # This is because some ebuild (gcc) do not use $S as buildroot. if test "$PWORKDIR"; then S="$PWORKDIR" fi # We do not want portage's build root ($S) present. if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then mynewdependency_lib="" # We do not want portage's install root ($D) present. elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`" else mynewdependency_lib="$deplib" fi else mynewdependency_lib="$deplib" fi # Do not add duplicates if test "$mynewdependency_lib"; then if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then newdependency_libs="$newdependency_libs $mynewdependency_lib" fi fi ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac # Do not add duplicates if test "$installed" = yes && test "$D"; then install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`" fi $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit 1 fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit 1 fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $wrapper ;; *) . ./$wrapper ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit 1 fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $wrapper ;; *) . ./$wrapper ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` if test $? = 0 ; then : else tmpdir="$tmpdir/libtool-$$" fi if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $0 --finish$current_libdirs' else exit 0 fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = ":" && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi rmdirs= for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$objdir" else objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) if test "$build_old_libs" = yes; then oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi ;; *) # Do a test to see if this is a libtool program. if test "$mode" = clean && (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$file rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit 1 fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: xmds-1.6.6/Makefile.am0000644000076500000240000000345211033277571011464 00000000000000## Process this file with automake to produce Makefile.in # $Id: Makefile.am 1696 2008-01-26 23:07:17Z paultcochrane $ .PHONY: api examples examples-clean test test-clean SUBDIRS = source examples example_files = \ examples/HighdimPlotExample.nb \ examples/atomlaser.xmds\ examples/branch.xmds\ examples/brusselator.xmds\ examples/catcycle.xmds\ examples/chain.xmds\ examples/chemkin.xmds\ examples/diffusion.xmds\ examples/duffing.xmds\ examples/fibre.xmds\ examples/fisher_reaction_diffusion.xmds\ examples/fullpos3D.xmds\ examples/gaugeatomlaser.xmds\ examples/groundstate.xmds\ examples/highdim.xmds\ examples/highdim_vector_version.xmds\ examples/hires.xmds\ examples/krebs.xmds\ examples/kubo.xmds\ examples/lane_emden.xmds\ examples/lorenz.xmds\ examples/lorenzInput.dat\ examples/lotka_volterra.xmds\ examples/nan.xmds\ examples/ndparamp.xmds\ examples/nlse.xmds\ examples/oregonator.xmds\ examples/paraxial_wave.xmds\ examples/pendulum.xmds\ examples/ring_modulator.xmds\ examples/sech_soliton.xmds\ examples/sech_soliton_tdepk.xmds\ examples/sine.xmds\ examples/soliton.xmds\ examples/thermkin.xmds\ examples/tla.xmds\ examples/van_der_pol.xmds\ examples/vibstring.xmds manfiles = man/loadxsil.1\ man/xmds.1\ man/xsil2graphics.1 man1_MANS = $(manfiles) m4files = acx_mpi.m4 acx_pthread.m4 EXTRA_DIST = $(example_files) $(m4files) $(manfiles) MANIFEST README.Windows source/loadxsil.m dist_doc_data = AUTHORS NEWS COPYING README README.Windows source/loadxsil.m doc_examplesdir = ${docdir}/examples dist_doc_examples_DATA = $(example_files) api: $(MAKE) --directory=source $@ examples: check examples-clean: (cd examples; $(MAKE) clean) test: all $(MAKE) --directory=$@ test-fftw2: all $(MAKE) --directory=test test-fftw2 test-clean: $(MAKE) --directory=test clean xmds-1.6.6/Makefile.in0000644000076500000240000005573111033307502011470 00000000000000# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # $Id: Makefile.am 1696 2008-01-26 23:07:17Z paultcochrane $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_doc_examples_DATA) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO config.guess config.sub depcomp install-sh ltmain.sh \ missing mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 $(top_srcdir)/acx_mpi.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(doc_examplesdir)" NROFF = nroff MANS = $(man1_MANS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; dist_doc_examplesDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_doc_examples_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MPICC = @MPICC@ MPILIBS = @MPILIBS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ THREADLIBS = @THREADLIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = source examples example_files = \ examples/HighdimPlotExample.nb \ examples/atomlaser.xmds\ examples/branch.xmds\ examples/brusselator.xmds\ examples/catcycle.xmds\ examples/chain.xmds\ examples/chemkin.xmds\ examples/diffusion.xmds\ examples/duffing.xmds\ examples/fibre.xmds\ examples/fisher_reaction_diffusion.xmds\ examples/fullpos3D.xmds\ examples/gaugeatomlaser.xmds\ examples/groundstate.xmds\ examples/highdim.xmds\ examples/highdim_vector_version.xmds\ examples/hires.xmds\ examples/krebs.xmds\ examples/kubo.xmds\ examples/lane_emden.xmds\ examples/lorenz.xmds\ examples/lorenzInput.dat\ examples/lotka_volterra.xmds\ examples/nan.xmds\ examples/ndparamp.xmds\ examples/nlse.xmds\ examples/oregonator.xmds\ examples/paraxial_wave.xmds\ examples/pendulum.xmds\ examples/ring_modulator.xmds\ examples/sech_soliton.xmds\ examples/sech_soliton_tdepk.xmds\ examples/sine.xmds\ examples/soliton.xmds\ examples/thermkin.xmds\ examples/tla.xmds\ examples/van_der_pol.xmds\ examples/vibstring.xmds manfiles = man/loadxsil.1\ man/xmds.1\ man/xsil2graphics.1 man1_MANS = $(manfiles) m4files = acx_mpi.m4 acx_pthread.m4 EXTRA_DIST = $(example_files) $(m4files) $(manfiles) MANIFEST README.Windows source/loadxsil.m dist_doc_data = AUTHORS NEWS COPYING README README.Windows source/loadxsil.m doc_examplesdir = ${docdir}/examples dist_doc_examples_DATA = $(example_files) all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done install-dist_doc_examplesDATA: $(dist_doc_examples_DATA) @$(NORMAL_INSTALL) test -z "$(doc_examplesdir)" || $(MKDIR_P) "$(DESTDIR)$(doc_examplesdir)" @list='$(dist_doc_examples_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_doc_examplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(doc_examplesdir)/$$f'"; \ $(dist_doc_examplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(doc_examplesdir)/$$f"; \ done uninstall-dist_doc_examplesDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_examples_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(doc_examplesdir)/$$f'"; \ rm -f "$(DESTDIR)$(doc_examplesdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d $(distdir) || mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(MANS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(doc_examplesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dist_doc_examplesDATA install-man install-dvi: install-dvi-recursive install-exec-am: install-html: install-html-recursive install-info: install-info-recursive install-man: install-man1 install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_doc_examplesDATA uninstall-man uninstall-man: uninstall-man1 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_doc_examplesDATA install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am \ uninstall-dist_doc_examplesDATA uninstall-man uninstall-man1 .PHONY: api examples examples-clean test test-clean api: $(MAKE) --directory=source $@ examples: check examples-clean: (cd examples; $(MAKE) clean) test: all $(MAKE) --directory=$@ test-fftw2: all $(MAKE) --directory=test test-fftw2 test-clean: $(MAKE) --directory=test clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmds-1.6.6/man/0000777000076500000240000000000011033374735010263 500000000000000xmds-1.6.6/man/loadxsil.10000644000076500000240000001310511033276362012075 00000000000000.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "LOADXSIL 1" .TH LOADXSIL 1 "2004-03-11" "perl v5.8.2" "User Contributed Perl Documentation" .SH "NAME" loadxsil \- load simulation data into matlab .SH "SYNOPSIS" .IX Header "SYNOPSIS" loadxsil('') .SH "DESCRIPTION" .IX Header "DESCRIPTION" Utility script bundled with \fBxmds\fR, used to load simulation output data (from the xsil data file) into matlab, where the results can be presented graphically. .PP To load data from the xsil file data_file.xsil, enter at the matlab command prompt: .PP >> loadxsil('data_file.xsil') .SH "EXAMPLES" .IX Header "EXAMPLES" At the matlab command prompt: .PP >> loadxsil('nlse.xsil') .PP loads the data contained in \fInlse.xsil\fR into matlab .SH "AUTHORS" .IX Header "AUTHORS" Written by Paul Cochrane .SH "BUGS" .IX Header "BUGS" No known bugs. However, the loadxsil script does not work in Matlab version 4.0 or below; it can only be used with Matlab version 5.0 and above. Users with Matlab 4.0 can use the \fBxsil2graphics\fR utility as a means to import data into Matlab. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIxmds\fR\|(1), \fIxsil2graphics\fR\|(1) .PP http://www.xmds.org .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2003\-2004 .PP Code contributed by Paul Cochrane .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place \- Suite 330, Boston, \&\s-1MA\s0 02111\-1307, \s-1USA\s0. xmds-1.6.6/man/xmds.10000644000076500000240000001457111033276362011241 00000000000000.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "XMDS 1" .TH XMDS 1 "2004-06-21" "perl v5.8.2" "User Contributed Perl Documentation" .SH "NAME" xmds \- the eXtensible Multi\-Dimensional Simulator .SH "SYNOPSIS" .IX Header "SYNOPSIS" xmds [options] .SH "DESCRIPTION" .IX Header "DESCRIPTION" The program \fBxmds\fR is a code generator that integrates equations. You write them down in human readable form in an \s-1XML\s0 file, and it goes away and writes and compiles a \*(C+ program that integrates those equations as fast as it can possibly be done in your architecture. .PP For information as to how to write a script for xmds, and how to solve problems in physics, mathematics and even finance and economics, read the associated pdf documentation available from the xmds web site: http://www.xmds.org. .SH "OPTIONS" .IX Header "OPTIONS" \&\fB\-t\fR, \fB\-\-template\fR Output a template either to the terminal or to an optionally specified file .PP \&\fB\-h\fR, \fB\-\-help\fR Display help and usage information .PP \&\fB\-v\fR, \fB\-\-verbose\fR Turn on verbose information output .PP \&\fB\-n\fR, \fB\-\-nocompile\fR Turn \fIoff\fR automatic compilation of output code .PP \&\fB\-d\fR, \fB\-\-debug\fR Turn on debugging information in processing of xmds script .PP \&\fB\-x\fR, \fB\-\-xmldebug\fR Turn on debugging information in parsing of xml code .SH "FILES" .IX Header "FILES" Directory for storing fftw wisdom files: .PP ${\s-1HOME\s0}/.xmds/wisdom/ .PP Preferences file: .PP ${\s-1HOME\s0}/.xmds/xmds.prefs \fIor\fR /xmds.prefs .SH "EXAMPLES" .IX Header "EXAMPLES" xmds nlse.xmds xmds \-t new_xmds_file.xmds xmds \-\-template > new_xmds_file.xmds .SH "AUTHORS" .IX Header "AUTHORS" Originally written by Greg Collecutt .PP Maintained by Paul Cochrane with code contributed by Joe Hope .SH "BUGS" .IX Header "BUGS" No known bugs. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIxsil2graphics\fR\|(1), \fIloadxsil\fR\|(1) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2000\-2004 .PP Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place \- Suite 330, Boston, \&\s-1MA\s0 02111\-1307, \s-1USA\s0. xmds-1.6.6/man/xsil2graphics.10000644000076500000240000001560311033276362013045 00000000000000.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.13 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "XSIL2GRAPHICS 1" .TH XSIL2GRAPHICS 1 "2004-06-21" "perl v5.8.2" "User Contributed Perl Documentation" .SH "NAME" xsil2graphics \- generate scripts to load xsil output data files .SH "SYNOPSIS" .IX Header "SYNOPSIS" xsil2graphics [options] .SH "DESCRIPTION" .IX Header "DESCRIPTION" Utility program bundled with \fBxmds\fR, used to generate scripts that load simulation output data into either matlab (http://www.mathworks.com) or scilab (http://www.scilab.org), which are then used to manipulate the results further if necessary and then to present the results graphically. .Sh "Matlab" .IX Subsection "Matlab" To generate a matlab m\-file, from the xsil file data_file.xsil use the command: .PP \&\fBbash$\fR xsil2graphics data_file.xsil .PP or .PP \&\fBbash$\fR xsil2graphics \-\-matlab data_file.xsil .PP Then at the matlab command prompt: .PP >> data_file .Sh "Scilab" .IX Subsection "Scilab" To generate a scilab script file, from the xsil file data_file.xsil use the command: .PP \&\fBbash$\fR xsil2graphics \-\-scilab data_file.xsil .PP Then at the scilab command prompt: .PP \&\-\-> exec('data_file.sci') .SH "OPTIONS" .IX Header "OPTIONS" \&\fB\-m\fR, \fB\-\-matlab\fR generate matlab m\-file script to load data from the xsil data file (the default option) .PP \&\fB\-s\fR, \fB\-scilab\fR generate scilab script file to load data from the xsil data file .PP \&\fB\-o\fR, \fB\-\-outfile specify an alternative output script filename to the default which is the input xsil filename with the .xsil extension changed to either \&.m for the matlab m\-file or .sci for the scilab script file .SH "EXAMPLES" .IX Header "EXAMPLES" \&\fBbash$\fR xsil2graphics nlse.xsil .PP Generates the output \fBnlse.m\fR to load the data into matlab .PP \&\fBbash$\fR xsil2graphics \-m nlse.xsil .PP Also generates the output \fBnlse.m\fR but explicitly sets matlab to be the output format .PP \&\fBbash$\fR xsil2graphics \-\-scilab nlse.xsil .PP Generates the output \fBnlse.sci\fR to load the data into scilab .PP \&\fBbash$\fR xsil2graphics \-\-outfile nlse_new.m nlse.xsil .PP Generates the output \fBnlse_new.m\fR to load the data into matlab .SH "AUTHORS" .IX Header "AUTHORS" Originally written by Greg Collecutt .PP Maintained by Paul Cochrane with code contributed by Joe Hope .SH "BUGS" .IX Header "BUGS" No known bugs. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIxmds\fR\|(1), \fIloadxsil\fR\|(1) .PP http://www.xmds.org .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2000\-2004 .PP Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place \- Suite 330, Boston, \&\s-1MA\s0 02111\-1307, \s-1USA\s0. xmds-1.6.6/MANIFEST0000644000076500000240000001226711033374620010556 00000000000000xmds-1.6.6/ xmds-1.6.6/AUTHORS xmds-1.6.6/COPYING xmds-1.6.6/ChangeLog xmds-1.6.6/INSTALL xmds-1.6.6/MANIFEST xmds-1.6.6/Makefile.am xmds-1.6.6/Makefile.in xmds-1.6.6/NEWS xmds-1.6.6/README xmds-1.6.6/README.Windows xmds-1.6.6/TODO xmds-1.6.6/acinclude.m4 xmds-1.6.6/aclocal.m4 xmds-1.6.6/acx_mpi.m4 xmds-1.6.6/acx_pthread.m4 xmds-1.6.6/config.guess xmds-1.6.6/config.sub xmds-1.6.6/configure xmds-1.6.6/configure.in xmds-1.6.6/depcomp xmds-1.6.6/examples/ xmds-1.6.6/examples/HighdimPlotExample.nb xmds-1.6.6/examples/Makefile.am xmds-1.6.6/examples/Makefile.in xmds-1.6.6/examples/atomlaser.xmds xmds-1.6.6/examples/branch.xmds xmds-1.6.6/examples/brusselator.xmds xmds-1.6.6/examples/catcycle.xmds xmds-1.6.6/examples/chain.xmds xmds-1.6.6/examples/chemkin.xmds xmds-1.6.6/examples/diffusion.xmds xmds-1.6.6/examples/duffing.xmds xmds-1.6.6/examples/fibre.xmds xmds-1.6.6/examples/fisher_reaction_diffusion.xmds xmds-1.6.6/examples/fullpos3D.xmds xmds-1.6.6/examples/gaugeatomlaser.xmds xmds-1.6.6/examples/groundstate.xmds xmds-1.6.6/examples/highdim.xmds xmds-1.6.6/examples/highdim_vector_version.xmds xmds-1.6.6/examples/hires.xmds xmds-1.6.6/examples/krebs.xmds xmds-1.6.6/examples/kubo.xmds xmds-1.6.6/examples/lane_emden.xmds xmds-1.6.6/examples/lorenz.xmds xmds-1.6.6/examples/lorenzInput.dat xmds-1.6.6/examples/lotka_volterra.xmds xmds-1.6.6/examples/nan.xmds xmds-1.6.6/examples/ndparamp.xmds xmds-1.6.6/examples/nlse.xmds xmds-1.6.6/examples/oregonator.xmds xmds-1.6.6/examples/paraxial_wave.xmds xmds-1.6.6/examples/pendulum.xmds xmds-1.6.6/examples/ring_modulator.xmds xmds-1.6.6/examples/sech_soliton.xmds xmds-1.6.6/examples/sech_soliton_tdepk.xmds xmds-1.6.6/examples/sine.xmds xmds-1.6.6/examples/soliton.xmds xmds-1.6.6/examples/thermkin.xmds xmds-1.6.6/examples/tla.xmds xmds-1.6.6/examples/van_der_pol.xmds xmds-1.6.6/examples/vibstring.xmds xmds-1.6.6/install-sh xmds-1.6.6/ltmain.sh xmds-1.6.6/man/ xmds-1.6.6/man/loadxsil.1 xmds-1.6.6/man/xmds.1 xmds-1.6.6/man/xsil2graphics.1 xmds-1.6.6/missing xmds-1.6.6/mkinstalldirs xmds-1.6.6/source/ xmds-1.6.6/source/Makefile.am xmds-1.6.6/source/Makefile.in xmds-1.6.6/source/config.h.in xmds-1.6.6/source/dom3.h xmds-1.6.6/source/getopt_xmds.c xmds-1.6.6/source/getopt_xmds.h xmds-1.6.6/source/getopt_xmds1.c xmds-1.6.6/source/getopt_xmds_init.c xmds-1.6.6/source/kissdom.cc xmds-1.6.6/source/kissdom.h xmds-1.6.6/source/loadxsil.m xmds-1.6.6/source/main.cc xmds-1.6.6/source/version.h xmds-1.6.6/source/xmds_arg.cc xmds-1.6.6/source/xmds_arg.h xmds-1.6.6/source/xmds_arg_element.cc xmds-1.6.6/source/xmds_arg_element.h xmds-1.6.6/source/xmds_argv.cc xmds-1.6.6/source/xmds_argv.h xmds-1.6.6/source/xmds_breakpoint.cc xmds-1.6.6/source/xmds_breakpoint.h xmds-1.6.6/source/xmds_common.h xmds-1.6.6/source/xmds_complex.h xmds-1.6.6/source/xmds_element.cc xmds-1.6.6/source/xmds_element.h xmds-1.6.6/source/xmds_field.cc xmds-1.6.6/source/xmds_field.h xmds-1.6.6/source/xmds_filter.cc xmds-1.6.6/source/xmds_filter.h xmds-1.6.6/source/xmds_globals.cc xmds-1.6.6/source/xmds_globals.h xmds-1.6.6/source/xmds_integrate.cc xmds-1.6.6/source/xmds_integrate.h xmds-1.6.6/source/xmds_integrate_ark45.cc xmds-1.6.6/source/xmds_integrate_ark45.h xmds-1.6.6/source/xmds_integrate_ark45ex.cc xmds-1.6.6/source/xmds_integrate_ark45ex.h xmds-1.6.6/source/xmds_integrate_ark45ip.cc xmds-1.6.6/source/xmds_integrate_ark45ip.h xmds-1.6.6/source/xmds_integrate_ark89.cc xmds-1.6.6/source/xmds_integrate_ark89.h xmds-1.6.6/source/xmds_integrate_ark89ex.cc xmds-1.6.6/source/xmds_integrate_ark89ex.h xmds-1.6.6/source/xmds_integrate_ark89ip.cc xmds-1.6.6/source/xmds_integrate_ark89ip.h xmds-1.6.6/source/xmds_integrate_ex.cc xmds-1.6.6/source/xmds_integrate_ex.h xmds-1.6.6/source/xmds_integrate_ip.cc xmds-1.6.6/source/xmds_integrate_ip.h xmds-1.6.6/source/xmds_integrate_rk4.cc xmds-1.6.6/source/xmds_integrate_rk4.h xmds-1.6.6/source/xmds_integrate_rk4ex.cc xmds-1.6.6/source/xmds_integrate_rk4ex.h xmds-1.6.6/source/xmds_integrate_rk4ip.cc xmds-1.6.6/source/xmds_integrate_rk4ip.h xmds-1.6.6/source/xmds_integrate_rk9.cc xmds-1.6.6/source/xmds_integrate_rk9.h xmds-1.6.6/source/xmds_integrate_rk9ex.cc xmds-1.6.6/source/xmds_integrate_rk9ex.h xmds-1.6.6/source/xmds_integrate_rk9ip.cc xmds-1.6.6/source/xmds_integrate_rk9ip.h xmds-1.6.6/source/xmds_integrate_si.cc xmds-1.6.6/source/xmds_integrate_si.h xmds-1.6.6/source/xmds_integrate_siex.cc xmds-1.6.6/source/xmds_integrate_siex.h xmds-1.6.6/source/xmds_integrate_siip.cc xmds-1.6.6/source/xmds_integrate_siip.h xmds-1.6.6/source/xmds_moment_group.cc xmds-1.6.6/source/xmds_moment_group.h xmds-1.6.6/source/xmds_output.cc xmds-1.6.6/source/xmds_output.h xmds-1.6.6/source/xmds_segment.cc xmds-1.6.6/source/xmds_segment.h xmds-1.6.6/source/xmds_sequence.cc xmds-1.6.6/source/xmds_sequence.h xmds-1.6.6/source/xmds_simulation.cc xmds-1.6.6/source/xmds_simulation.h xmds-1.6.6/source/xmds_utils.cc xmds-1.6.6/source/xmds_utils.h xmds-1.6.6/source/xmds_vector.cc xmds-1.6.6/source/xmds_vector.h xmds-1.6.6/source/xmds_vector_element.cc xmds-1.6.6/source/xmds_vector_element.h xmds-1.6.6/source/xml_basics.cc xmds-1.6.6/source/xml_basics.h xmds-1.6.6/source/xml_parser.cc xmds-1.6.6/source/xml_parser.h xmds-1.6.6/source/xsil2graphics.cc xmds-1.6.6/source/xsil_field.cc xmds-1.6.6/source/xsil_field.h xmds-1.6.6/missing0000755000076500000240000002403611033276365011030 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 xmds-1.6.6/mkinstalldirs0000755000076500000240000000341111033276365012231 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) # -h for help echo "${usage}" 1>&2; exit 0 ;; -m ) # -m PERM arg shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } dirmode="${1}" shift ;; -- ) shift; break ;; # stop option processing -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option * ) break ;; # first non-opt arg esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 3 # End: # mkinstalldirs ends here xmds-1.6.6/NEWS0000644000076500000240000001770011033277571010130 00000000000000$Id: NEWS 1889 2008-03-18 15:48:09Z paultcochrane $ Version xmds-1.6.5 (2008-02-26) * Various bug fixes - new no known bug status * Superior treatment of extreme cases in adaptive algorithms * Simulation can halt if the solution goes non-finite. Put this in the appropriate integration element: yes * Cross-propagation is now 4th order for RK4 algorithms * Patches to fix compiler warnings (and potential issues, and the removal of superfluous files courtesy of Rafael Laboissiere. * ChangeLog format altered to give a better summary of changes * Reconfigured the location of where some files are installed, specifically loadxsil.m, ancillary files like README and the example files are all installed under the equivalent of /usr/share/doc/xmds. * Automatic plotting of simulation output is now possible with the -p (a.k.a. --plot) command line argument to xsil2graphics. This is only possible with Matlab/Octave at present. * One can now specify the desired XSIL output filename at the command line when one calls the simulation program. Just use the -o (--outfilename) argument and supply the desired filename. Version xmds-1.6.4 (2008-01-10) A new release for a new year. * Arrays: ... phi(100) ... for (long j=1;j<101;j++) { dphi_dt(j) = L[phi](j) + V*phi(j); } ... * Bug fixes! * Internal code cleanups * New example scripts * Rudimentary visualisation capability with R (http://www.r-project.org) Version xmds-1.6.3 (2007-06-27) This is another bugfix release of xmds-1.6. It is unlikely that anyone else has ever encountered these bugs, and now they never will. We are back to "no known bugs". Version xmds-1.6.2 (2007-06-15) This is a critical bugfix update of xmds-1.6. Recommended for all users. Version xmds-1.6.1 (2007-05-10) This is a bugfix and minor tweak release of xmds, to correspond with the new documentation release. Version xmds-1.6 (2007-03-22) Welcome to a brave new world of XMDS. A brave new algorithm list, anyway. Say hello to Michael Hush and the new algorithms he coded. We now have adaptive 9(8)th order deterministic integration, where the adaptive step is stochastic safe. In our testing this means 4th order adaptive strong convergence for stochastic equations. The new algorithms are: RK9IP, RK9EX, ARK89IP and ARK89EX. The syntax and workings are identical to the RK4 and ARK45 algorithms, except that for stochastic problems the adaptive algorithm changes automatically to a stochastic-safe version. Also, less bugs. We are back to zero known bugs, as usual for release. Version 1.5-3 (19/09/2006) * FFTW version 3! This version is faster, and vectorises on many architectures. This can be installed concurrently with FFTW version 2.1.5, which is still required for MPI implementations. * Vector initialisation from XSIL moment groups! Also, this initialisation has a "loose" mode, where partial data can be input. This allows easy shifting of grids between simulations. * Better IO behaviour on supercomputers with queues. * OpenMP support! For OpenMP compatible compilers, threaded parallel processing is as easy as a tag away. Use FFTW version 3, and compile it using OpenMP rather than pthreads for best results. * Breakpoints! You can choose to have the fields sent to file at any time in the sequence, including in the middle of a run. This can be used to check long calculations in the middle, as an efficient method of reloading the output to start again, or just as a memory- efficient output method for large MPI simulations. * Almost a year's worth of bug fixes. We are back at "No Known Bugs" status, just as we are for each release. * New documentation! Please read all the details in the parallel "xmds-doc" release. Version 1.5-2 (27/10/2005) * The major feature of this release is the ability to use adaptive scheduling when using parallel processors on stochastic problems. The new scheduler is much more efficient in heterogeneous environments, such as clusters of unequal machines, or homogeneous clusters with variable load. * To use adaptive scheduling simply add the tag Scheduling in the element. To use the old, symmetric method, simply add the tag Uniform. Version 1.5-1 (05/07/2005) * Two new algorithms: ARK45IP and ARK45EX * These new algorithms are adaptive timestep algorithms and using them is as easy as choosing their name as the integrate algorithm. * Set the element to set the relative error per timestep. * New examples; sech_soliton.xmds and sech_soliton_tdepk.xmds have been added. * Binary output further improved and problems have been fixed such that moving binary files between 32 and 64 bit machines now works as hoped. * Recent changes to the compile option order may be able to break MPI enabled computations on some systems. Compiling by hand will be an effective temporary fix, but please contact us immediately if you have any problems. Version 1.4-1 (03/11/2004) * Certain kinds of non-local terms can now be included. * Functionality for those who wish to tweak things with pasted code. * One can put elements as well as elements in blocks. * elements let you define moments that are integrated through any number of transverse dimensions. * elements allow to place arbitrary chunks of c-code in the integrate step. They are very useful for calculating functions that do not have to be recalculated for every point in the transverse dimensions. * You can put both of them in elements as well. * You can put as many as you like, of any dimension, in any order. * Non-local terms are MPI aware. * The binary output option is now at the "no known bugs" stage. Using instead of the old tag will do the output using binary data. This should be transparent to all current activities, as xsil2graphics works normally with either. Note that Scilab does not support binary input. Version 1.3-5 (19/07/2004) * Bugfix release. * Problem with production of a malformed XML tag when producing binary output has been fixed. * The number of samples can safely be zero without causing problems with Fourier transforms. * Configuration has been improved slightly. * Removed as many system() calls as possible to make xmds more portable. * Fixed problems associated with the -ansi and -pedantic gcc flags. Version 1.3-4 (18/06/2004) * Fix of a parsing bug when using the tag. * Man pages for xmds, xsil2graphics and loadxsil.m are installed at 'make install' time. * Command line option parsing of xmds and xsil2graphics improved. * More example simulations have been added. * Documentation has been updated. Version 1.3-2 (12/05/2004) * Updated api * Added output of a template xmds script by passing the -t flag to xmds. * Added more examples. * At startup xmds prints information about what it is, what version, who wrote it etc. * A warning is now issued if the and/or tags are left out of a script. Adding these is good xmds coding style. Version 1.3-1 (23/12/2003) * Fixed xsil2graphics filename referencing bug. * Added tag, and ability to use preferences * Added format="ascii|binary" attribute to tag of element. * Xmds works in Cygwin environment, and added a readme file explaining how to install the environment and xmds within. Version 1.1.x (01/07/2003) * Now have a configure script! xmds-1.6.6/README0000644000076500000240000001123111033277571010302 00000000000000# $Id: README 1888 2008-03-18 15:41:15Z paultcochrane $ This is XMDS: eXtensible Multi Dimensional Simulator; an open source numerical simulation package that integrates equations. You write them down in human readable form in an XML file, and it goes away and writes and compiles a C++ program that integrates those equations as fast as it can possibly be done in your architecture. INSTALLATION ------------ See the file `INSTALL' in the current directory. Supplementary to that information (which is the generic GNU stuff at this stage) one can use the following switches to customise the installation at the configuration step (i.e. when you run ./configure): --with-user This option installs xmds, xsil2graphics and xmdscomplex.h into $HOME/bin (by default the configure script installs into /usr/local (or /usr depending upon your system) --with-fftw-path= This option tells the configure script to look elsewhere than /usr/include and /usr/lib or for the relevant fftw files. e.g. --with-fftw-path=/usr/local --enable-fftw3 This option has no arguments and is used to install XMDS with the option of using the fftw3 libraries. fftw2.1.5 must still be installed. --with-fftw3-path This option tells the configure script to look elsewhere than /usr/include and /usr/lib or for the relevant fftw3 files. e.g. --with-fftw3-path=/usr/local --enable-mpi This option has no arguments and must be set if you wish to use mpi. --with-mpi-path= This option tells configure to look elsewhere other than /usr/include and /usr/lib for the relevant mpi files. --with-mpi-libs= This option tells the configure script the extra libraries that may be needed to properly check for MPI on your system. e.g. --with-mpi-libs=-llam (if you have the LAM implementation of MPI) --with-mpi-compiler= This option sets the mpi compiler to whatever you have on your system. For example, on some systems the mpi compiler isn't mpicc it is cxx, so in this case you would use --with-mpi-compiler=cxx to tell configure the correct compiler to use. This information (and more) is also supplied when one asks the configure script for help; i.e. when you run the command: bash$ ./configure --help Other ways to alter the configuration (place these options on the command line BEFORE ./configure, e.g. CC=gcc ./configure): CC= Defines the C compiler to use for compilation of xmds itself. Examples: CC=gcc or CC=icc (Intel C/C++ compiler) CXX= Defines the C++ compiler to use for compilation of xmds. Examples: CXX=g++ or CXX=icc (Intel C/C++ compiler) XMDS_CC= Defines the C/C++ compiler to use for compilation of xmds simulations. It is better to use a C++ compiler here than a C compiler with C++ extensions. Examples: XMDS_CC=g++ or XMDS_CC=cxx XMDS_CFLAGS= Defines the C/C++ compiler flags to use for the compilation of xmds simulations. Examples: XMDS_CFLAGS="-O2" or XMDS_CFLAGS="-O3 -funroll-all-loops" MAN PAGES --------- The manual (man pages) for xmds, xsil2graphics and loadxsil.m are installed with xmds during the 'make install' process. If you have installed xmds in a non-standard location, or in your home directory, and you want to view the man pages with the 'man' command, you will need to append the relevant path to your MANPATH environment variable. For example, if you have installed xmds in your home directory, the man pages will be located in $HOME/man/. You therefore need to run the following command (assuming your shell is bash): bash$ export MANPATH=${MANPATH}:${HOME}/man You will now be able to use the command: bash$ man xmds to view the xmds manual page. TRY IT OUT! ----------- Try out the nlse.xmds example in the examples/ directory. Type: .../xmds-1.6.6> cd examples .../xmds-1.6.6/examples> xmds nlse.xmds This makes an executable file called nlse, which includes all the high-level simulation data in nlse.xmds, in the form of an executable, compiled C++ program. All you have to do is run the code to get the results of your simulation: .../xmds-1.6.6/examples> nlse The output is in the file nlse.xsil, in scientific interchange xml format. There is a utilitly installed to convert this into other formats for plotting: .../xmds-1.6.6/examples> xsil2graphics nlse.xsil once in matlab or octave, type: >>nlse >>mesh(t_1,z_1,pow_dens_1') OR .../xmds-1.6.6/examples> xsil2graphics --scilab nlse.xsil and once in scilab, type: >>exec('nlse.sci') >>plot3d(t_1,z_1,pow_dens_1) xmds-1.6.6/README.Windows0000644000076500000240000001762611033277362011747 00000000000000# $Id: README.Windows 1642 2008-01-10 04:13:14Z joehope $ This document is the Readme file for installing Octave (http://www.octave.org) on Windows using the Cygwin (http://www.cygwin.com) environment, altered to be specific for installation of xmds. Orinally written by: John W. Eaton jwe@bevo.che.wisc.edu University of Wisconsin-Madison Department of Chemical Engineering Wed Apr 30 17:15:32 2003 Modified by: Paul T. Cochrane cochrane@physics.uq.edu.au Department of Physics University of Queensland Australia Mon Jul 19 13:44:42 EST 2004 ---------------------------------------------------------------------- The following is my current best set of directions for building xmds from sources on a Windows system using the Cygwin tools. If you already have Cygwin installed, you may need to update your installation of tools to include those mentioned below. Following these steps should give you a properly working xmds installation. 1. Use your favorite browser to view the page http://www.cygwin.com 2. Click on the "Install or update now" link. 3. A dialog should appear with the option to run the setup program from its current location or save it to disk. Either will work, but I usually choose to save the setup program to disk so that it is possible to run it later to update the installation without having to go back to the web page using a browser. 4. Run the setup program. 5. Choose "Install from Internet". 6. Select a root install directory. You may choose any directory, but it needs to have about 600MB available to install all the necessary Cygwin tools plus build and install xmds from sources. That may seem like a large disk space requirement, but remember that you are getting more than just xmds, you are installing a Unix-like development environment including C, C++, and Fortran compilers as well. You may choose to install for just you or all users (if you have permission to do so). I would select "Unix" as the default text file type (this option should be the default). 7. Select a local package directory. This is a directory that the setup program will use to temporarily store package files before installing them. It should have plenty of space (probably 70MB or more). You may delete this directory once the installation is complete. 8. Select your Internet Connection. Probably "Direct Connection" is OK unless you are behind a firewall of some kind that limits your access to the Internet. 9. Choose a download site. One that is "near" you on the net is probably best. 10. Select packages. The defaults are not enough to build all of Octave from sources. In addition to the default set of packages, you should select the following packages from the following categories: Archive: unzip Devel: autoconf, binutils, bison, cvs, dejagnu, flex, gcc, gperf, make Text: less, tetex, tetex-base Utils: diff, patch Once you have made these selections, click the Next button to download and install all the selected packages. The download and install may take a while depending on the speed of your computer and your connection to the net. 11. Once the download and file installation is done, click Finish. I usually choose to create an icon on the desktop and put an icon in the start menu. After you click finish, a series of scripts will run, displaying some output in a terminal window. It will take a few minutes. 12. Now grab and install fftw; this is necessary for the installation of xmds. Make sure you get fftw version 2.1.5 (and NOT version 3 or above) from http://www.fftw.org. a. Put the tar.gz file into somewhere like /var/tmp (within Cygwin) b. Unpack the source files using the command (assuming that you downloaded fftw version 2.1.5): tar -xvzf fftw-2.1.5.tar.gz c. Change into the fftw directory and run the configure script cd fftw-2.1.5 ./configure d. Then run make and install the package by going: make make install This should have put the fftw libraries and header files under the /usr/local are within your Cygwin environment. Have a check by using the command: ls /usr/local/lib/libfftw* /usr/local/include/fftw* 13. Get the xmds sources, either from a current distribution or from SVN: Distribution: a. Download a copy of the current version of xmds from http://www.xmds.org. You are looking for the most recent version under the Downloads link from the main page. At the time of this writing, it was xmds-1.3-5.tar.gz. Save this file to your Cygwin home directory. This directory will usually be called something like c:\cygwin\home\cochrane from Windows (the precise location depends on where you chose to install Cygwin). b. Unpack the source files using the command: tar zxf xmds-1.6.4.tar.gz in the Cygwin shell. This command will create a subdirectory called xmds-1.6.4 in your home directory. c. Change your current working directory to the top-level xmds source directory: cd xmds-1.6.4 then continue with step 14 below. CVS: a. Check out a copy of the current sources from the public CVS archive by running the following commands svn co https://xmds.svn.sourceforge.net/svnroot/xmds/trunk/xmds-devel xmds-devel in the Cygwin shell. The first command will prompt you for a password, just hit return/enter. The checkout command will create a subdirectory called xmds-devel containing the current CVS version of the xmds development sources. b. Change your current working directory to the top-level xmds source directory: cd xmds-devel c. Build the configure scripts by running the command autoreconf then continue with step 14 below. 14. Configure xmds by running the command ./configure --with-fftw-path=/usr/local This command will take several minutes to run as the configure script determines what features are available on your system. You will possibly need to add the flag --with-fftw-path=/usr/local to the configure command (if your fftw libraries and headers are based from /usr/local that is) as the configure script doesn't always check in /usr/local (it does on some systems, but not on all) and consequently it won't find fftw.h, libfftw.a and friends. Have a look at the README file for xmds and/or go ./configure --help for a more complete list of options. 15. Build the xmds binary by running the command make 16. Complete the installation by running the command make install 17. Try running xmds by changing into the examples directory cd examples And then running the nlse.xmds script: xmds nlse.xmds This will run xmds and hopefully compile the output simulation. Run the simulation by merely going: nlse This will produce an output file called nlse.xsil which can be converted to something usable by either scilab or matlab using the xsil2graphics command (also built and installed along with xmds). This command is used as follows: xsil2graphics nlse.xsil This will produce an output file called nlse.m and a data file called nlse1.dat. Start matlab and execute the command nlse at the matlab prompt to load the variables into matlab, and then you can use your favourite set of plotting commands to view the output. If you have scilab you need to type instead: xsil2graphics --scilab nlse.xsil This will produce a file called nlse.sci, which can be used inside scilab with the command exec('nlse.sci') 18. If that's all worked, then congratulations! You've got a working xmds installation. xmds-1.6.6/source/0000777000076500000240000000000011033374735011010 500000000000000xmds-1.6.6/source/config.h.in0000644000076500000240000001043611033307511012737 00000000000000/* source/config.h.in. Generated from configure.in by autoheader. */ /* C compiler */ #undef CC /* C compiler flags */ #undef CFLAGS /* Target processor is big endian. */ #undef CPU_IS_BIG_ENDIAN /* Target processor is little endian. */ #undef CPU_IS_LITTLE_ENDIAN /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* C++ compiler */ #undef CXX /* C++ compiler flags */ #undef CXXFLAGS /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Libraries for FFTW3 */ #undef FFTW3_LIBS /* Thread libraries for FFTW3 */ #undef FFTW3_THREADLIBS /* Libraries for FFTW */ #undef FFTW_LIBS /* MPI libraries for FFTW */ #undef FFTW_MPI_LIBS /* Have we only got FFTW3? */ #undef FFTW_THREE_ONLY /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_CTHREADS_H /* Define to 1 if you have the header file. */ #undef HAVE_CTHREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `stdc++' library (-lstdc++). */ #undef HAVE_LIBSTDC__ /* Define to 1 if you have the header file. */ #undef HAVE_MACH_CTHREADS_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define if you have the MPI library. */ #undef HAVE_MPI /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Include flags */ #undef INCLUDES /* Library flags */ #undef LIBS /* MPI C compiler */ #undef MPICC /* MPI C compiler flags */ #undef MPICCFLAGS /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Thread libraries */ #undef THREADLIBS /* Version number of package */ #undef VERSION /* C compiler for xmds simulations */ #undef XMDS_CC /* C compiler flags for xmds */ #undef XMDS_CFLAGS /* Include flags for xmds */ #undef XMDS_INCLUDES /* C libraries for xmds */ #undef XMDS_LIBS /* Define for beos threads */ #undef XMDS_USING_BEOS_THREADS /* Define for mach threads */ #undef XMDS_USING_MACH_THREADS /* Define for posix threads */ #undef XMDS_USING_POSIX_THREADS /* Define for solaris threads */ #undef XMDS_USING_SOLARIS_THREADS /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif xmds-1.6.6/source/dom3.h0000644000076500000240000023127511033277417011750 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: dom3.h 1586 2007-11-11 21:55:49Z paultcochrane $ */ /*! @file dom3.h @brief Provides the abstracted Document Object Model (DOM) level 3 interface as specified in the W3C Working Draft as of 05 June 2001. Most of the documentation of this file is taken directly from the W3C Working Draft of 05 June 2001. */ /* This header file provides the abstracted DOM level 3 interface as specified in the W3C Working Draft as of 05 June 2001. (http://www.w3.org/TR/2001/WD-DOM-level-3-core-20010605) My (GC) implementation of this is in the files "kissdom.h" and "kissdom.cc".*/ using namespace std; typedef XMLString DOMString; //!< Defines a DOMString const DOMString EMPTY_STRING = ""; //!< The empty string const DOMString XML_PREFIX = "xml"; //!< The xml prefix string const DOMString XML_NAMESPACEURI = "http://www.w3.org/XML/1998/namespace"; //!< The xml namespace URI const DOMString XMLNS_PREFIX = "xmlns"; //!< The xmlns prefix, and quite possibly the xml namespace prefix const DOMString XMLNS_NAMESPACEURI = "http://www.w3.org/2000/xmlns"; //!< The xmlns namespace uri, or the uri of the xml namespace typedef long DOMTimeStamp; //!< Defines the DOM time stamp typedef long DOMKey; //!< Defines the DOM key // ************************************************************************** // ************************************************************************** // DOMException // ************************************************************************** // ************************************************************************** //! Structure containing the DOM defined exceptions struct DOMException { //! Enumerator containing the DOM defined exception numbers /*! The exception code is an integer indicating the type of error generated */ enum { INDEX_SIZE_ERR = 1, //!< If index or size is negative, or greater than the allowed value DOMSTRING_SIZE_ERR = 2, //!< If the specified range of text does not fit into a DOMString HIERARCHY_REQUEST_ERR = 3, //!< If any node is inserted somewhere it doesn't belong //! If a node is used in a different document than the one that created it (that doesn't support it) WRONG_DOCUMENT_ERR = 4, INVALID_CHARACTER_ERR = 5, //!< If an invalid or illegal character is specified, such as in a name NO_DATA_ALLOWED_ERR = 6, //!< If data is specified for a node which does not support data NO_MODIFICATION_ALLOWED_ERR = 7, //!< If an attempt is made to modify an object where modifications are not allowed NOT_FOUND_ERR = 8, //!< If an attempt is made to reference a node in a context where is does not exist NOT_SUPPORTED_ERR = 9, //!< If the implementation doesn't support the requested type of object or operation INUSE_ATTRIBUTE_ERR = 10, //!< If an attempt is made to add an attribute that is already in use elsewhere // Introduced in DOM Level 2: INVALID_STATE_ERR = 11, //!< If an attempt is made to use an object that is not, or is not longer, usable SYNTAX_ERR = 12, //!< If an invalid or illegal string is specified INVALID_MODIFICATION_ERR = 13, //!< If an attempt is made to modify the type of the underlying object //! If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces NAMESPACE_ERR = 14, INVALID_ACCESS_ERR = 15 //!< If a parameter or an operation is not supported by the underlying object }; //! The exception code for a DOMException unsigned long code; //! Constructor of DOMException object DOMException(); //! Constructor of DOMException object where error is specified /*! @param err Error code of exception */ DOMException( unsigned long err); //! Destructor ~DOMException(); //! Gets an error /*! Returns the string specifying the type of error that occurred */ const char* getError() const; }; // ************************************************************************** // ************************************************************************** // ************************************************************************** // The Core Interfaces // ************************************************************************** // ************************************************************************** // ************************************************************************** // Document class class Document; // DocumentType class class DocumentType; // ************************************************************************** // ************************************************************************** // DOMImplementation // ************************************************************************** // ************************************************************************** //! DOMImplementation class /*! The @c DOMImplementation interface provides a number of methods for performing operations that are independent of any particular instance of the document object model. */ class DOMImplementation { public : //! Destructor virtual ~DOMImplementation() {}; //! Tests if the DOM implementation implements a specific feautre /*! @param feature The name of the feature to test (case-insensitive). The name must be an XML name @param version This is the version number of the feature to test. In DOM Level 2, the string can be either "2.0" or "1.0" */ virtual bool hasFeature( DOMString& feature, DOMString& version) const = 0; // Introduced in DOM Level 2: //! Creates an empty DocumentType node /*! Creates an empty @c DocumentType node. Entity declarations and notations are not made available Entity reference expansions and default atribute additions do not occur. @param qualifiedName The qualified name of the document type to be created @param publicId The external subset public identifier @param systemId The external subset system identifier */ virtual DocumentType* createDocumentType( const DOMString& qualifiedName, const DOMString& publicId, const DOMString& systemId) = 0; //! Creates a DOM document object of the specified type with its document element /*! @param namespaceURI The namespace URI of the document to create @param qualifiedName The qualified name of the document element to be created @param doctype The type of document to be created or @c null. When doctype is not @c null, its @c Node.ownerDocument attribute is set to the document being created */ virtual Document* createDocument( const DOMString& namespaceURI, const DOMString& qualifiedName, DocumentType* doctype) = 0; // Introduced in DOM Level 3: //! Makes available a @c DOMImplementation's specialised interface. /*! @param feature The name of the feature requested (case-insensitive) */ virtual DOMImplementation* getAs( DOMString& feature) = 0; }; // Node class class Node; // ************************************************************************** // ************************************************************************** // NodeList // ************************************************************************** // ************************************************************************** //! NodeList class /*! The @c NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. The items in the @c NodeList are accessible via an integral index, starting from 0. */ class NodeList { public : //! Destructor virtual ~NodeList() {}; //! Gets an item from the node list at index /*! Returns the @c index th item in the collection. If @c index is greater than or eaual to the number of nodes in the list, this returns @c null. @param index Index into the collection */ virtual Node* item(unsigned long index) const = 0; //! Returns the length of the node list /* Returns the number of nodes in the list. The range of valid child node indices is 0 to @c length-1 inclusive. */ virtual unsigned long length() const = 0; }; // ************************************************************************** // ************************************************************************** // NamedNodeMap // ************************************************************************** // ************************************************************************** //! NamedNodeMap class /*! Objects implementing the @c NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that @c NamedNodeMap does not inherit from @c NodeList; @c NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing @c NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a @c NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes. */ class NamedNodeMap { public : //! Destructor virtual ~NamedNodeMap() {}; //! Gets a named item /*! Retrieves a node specified by name @param name The @c nodeName of a node to retrieve */ virtual Node* getNamedItem( const DOMString& name) const = 0; //! Sets a named item /*! Adds a node using its @c nodeName attribute. If a node with that name is already present in this map, it is replaced by the new one. As the @c nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased. @param arg A node to store in this map. The node will later be accessible using the value of its @c nodeName attribute. */ virtual Node* setNamedItem(Node& arg) = 0; //! Removes a named item /*! Removes a node specified by a name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. @param name The @c nodeName of the node to remove. */ virtual Node* removeNamedItem( const DOMString& name) = 0; //! Gets the length of the object /*! Returns the number of nodes in this map. The range of valid child node indices is @c 0 to @c length-1 inclusive. */ virtual unsigned long length() const = 0; //! Returns the node item at index /*! Returns the @c index th item in the map. If @c index is greater than or equal to the number of nodes in this map, this returns @c null. @param index Index into this map. */ virtual Node* item( const unsigned long index) const = 0; // Introduced in DOM Level 2: //! Gets the named item namespace /*! Retrieves a node spcified by local name and namespace URI. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the node to retrieve @param localname The local name of the node to retrieve */ virtual Node* getNamedItemNS( const DOMString& namespaceURI, const DOMString& localname) const = 0; //! Sets the named item namespace /*! Adds a node using its @c namespaceURI and @c localname. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. @param arg A node to store in this map. The node will later be accessible using the value of its @c namespaceURI and @c localname attributes. */ virtual Node* setNamedItemNS(Node& arg) = 0; //! Removes the named item namespace /*! Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes atribute of the @c Node interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. Documents which do not support the "XML" feature will permit only the DOM level 1 calls for creating/setting elements and attributes. Hence, if you specify an non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the node to remove @param localname The local name of the node to remove */ virtual Node* removeNamedItemNS( const DOMString& namespaceURI, const DOMString& localname) = 0; }; // ************************************************************************** // ************************************************************************** // Node // ************************************************************************** // ************************************************************************** //! Node class /*! This @c Node interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the @c Node interface expose methods for dealing with children, not all objects implementing the @c Node interface may have children. For example, @c Text nodes may not have children, and adding children to such nodes results in a @c DOMException being raised. The attributes @c nodeName, @c nodeValue and @c attributes are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific @c nodeType (e.g. @c nodeValue for an @c Element or @c attributes for a @c Comment), this returns @c null. Note that the specialised interfaces may contain additional and more convenient mechanisms to get and set the relevant information. */ class Node { public : //! Destructor virtual ~Node() {}; //! Enumerator containing the document node numbers /*! These are the @c nodeTypes; an integer indicating which type of node this is. The values of @c nodeName, @c nodeValue, and @c attributes vary according to the node type as follows:
Interface nodeName nodeValue attributes
Attr name of attribute value of attribute null
CDATASection "#cdata-section" content of the CDATA section null
Comment "#comment" content of the comment null
Document "#document" null null
DocumentFragment "#document-fragment" null null
DocumentType document type name null null
Element tag name null NamedNodeMap
Entity entity name null null
EntityReference name of entity referenced null null
Notation notation name null null
ProcessingInstruction target entire content excluding the target null
Text "#text" content of the text node null
*/ enum { ELEMENT_NODE = 1, //!< The node is an @c Element ATTRIBUTE_NODE = 2, //!< The node is an @c Attr TEXT_NODE = 3, //!< The node is a @c Text node CDATA_SECTION_NODE = 4, //!< The node is a @c CDATASection ENTITY_REFERENCE_NODE = 5, //!< The node is an @c EntityReference ENTITY_NODE = 6, //!< The node is an @c Entity PROCESSING_INSTRUCTION_NODE = 7, //!< The node is a @c ProcessingInstruction COMMENT_NODE = 8, //!< The node is a @c Comment DOCUMENT_NODE = 9, //!< The node is a @c Document DOCUMENT_TYPE_NODE = 10, //!< The node is a @c DocumentType DOCUMENT_FRAGMENT_NODE = 11, //!< The node is a @c DocumentFragment NOTATION_NODE = 12 //!< The node is a @c Notation }; //! Returns the node name as a DOMString /*! Returns the name of this node, depending on its type. */ virtual const DOMString* nodeName() const = 0; //! Returns the node value as a DOMString /*! Returns the value of this node, depending on its type. When it is defined to be @c null, setting it has no effect. */ virtual const DOMString* nodeValue() const = 0; //! Sets the node value /*! Sets the node value to the value specified. @param newNodeValue The new node value */ virtual void setNodeValue( const DOMString& newNodeValue) = 0; //! Returns the node type /*! Returns a code representing the type of the underlying object. */ virtual unsigned long nodeType() const = 0; //! Returns the parent node /*! Returns the parent of this node. All nodes, except @c Attr, @c Document, @c DocumentFragment @c Entity and @c Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is @c null. */ virtual Node* parentNode() const = 0; //! Sets the parent node /*! Sets the parent node of the current node to the @c Node specified. @param newParentNode The new parent node of the current node */ virtual void setParentNode( Node* newParentNode) = 0; //! Returns the child nodes as a node list /*! Returns a @c NodeList that contains all children of this node. If there are no children, this is a @c NodeList containing no nodes. */ virtual const NodeList* childNodes() const = 0; //! Returns the first child node /*! Returns the first child of this node. If there is no such node, this returns @c null. */ virtual Node* firstChild() const = 0; //! Returns the last child node /*! Returns the last child of this node. If there is no such node, this returns @c null. */ virtual Node* lastChild() const = 0; //! Returns the previous sibling node /*! Returns the node immediately preceding this node. If there is no such node, this returns @c null. */ virtual Node* previousSibling() const = 0; //! Returns the next sibling node /*! Returns the node immediately following this node. If there is no such node, this returns @c null. */ virtual Node* nextSibling() const = 0; //! Returns the attributes of the node /*! Returns a @c NamedNodeMap containing the attributes of this node (if it is an @c Element or @c null otherwise). */ virtual const NamedNodeMap* attributes() const = 0; //! Returns the owner document /*! Returns the @c Document object associated with this node. This is also the @c Document object used to create new nodes. When this node is a @c Document or a @c DocumentType which is not used with any @c Document yet, this is @c null. */ virtual const Document* ownerDocument() const = 0; //! Sets the owner document /*! Sets the owner document to the @c Document object specified. @param newOwnerDocument The new @c Document object to own the node */ virtual void setOwnerDocument( const Document *const newOwnerDocument) = 0; //! Inserts child node before reference child node /*! Inserts the node @c newChild before the existing child node @c refChild. If @c refChild is @c null, insert @c newChild at the end of the list of children. If @c newChild is a @c DocumentFragement object, all of its children are inserted, in the same order, before @c refChild. If the @c newChild is already in the tree, it is first removed. @param newChild The node to insert @param refChild The reference node, i.e., the node before which the new node must be inserted */ virtual Node* insertBefore( Node* newChild, Node* refChild) = 0; //! Replaces a child node /*! Replaces the child node @c oldChild with @c newChild in the list of children, and returns the @c oldChild node. If @c newChild is a @c DocumentFragment object, @c oldChild is replaced by all of the @c DocumentFragment children, which are inserted in the same order. If the @c newChild is already in the tree, it is first removed. @param newChild The new node to put in the child list @param oldChild The node being replaced in the list */ virtual Node* replaceChild( Node* newChild, Node* oldChild) = 0; //! Removes a child node /*! Removes the child node indicated by @c oldChild from the list of children, and returns it. @param oldChild The node being removed */ virtual Node* removeChild(Node* oldChild) = 0; //! Appends a child node /*! Adds the node @c newChild to the end of the list of children of this node. If the @c newChild is already in the tree, it is first removed. @param newChild The node to add. If it is a @c DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node */ virtual Node* appendChild(Node* newChild) = 0; //! Determines if object has child nodes /*! Returns whether this node has any children. */ virtual bool hasChildNodes() const = 0; //! Clones a node /*! Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate has ho parent; (@c parentNode is @c null). Cloning an @c Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child @c Text node. Cloning an @c Attribute directly, as opposed to be cloned as part of an @c Element cloning operation, returns a specified attribute (@c specified is @c true). Cloning any other type of node simply returns a copy of this node. @param deep If @c true, recursively clone the subtree under the specified node; if @c false, clone only the node itself (and its attributes, if it is an @c Element). */ virtual Node* cloneNode(const bool& deep) const = 0; //! Puts all Text nodes into a ``normal'' form /*! Puts all @c Text nodes in the full depth of the sub-tree underneath this @c Node, including attriubte nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections and entity references) separates @c Text nodes, i.e., there are neither adjacent @c Text nodes nor empty @c Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and reloaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used. */ virtual void normalize() = 0; // Modified in DOM Level 2: // Introduced in DOM Level 2: //! Determines if feature is supported /*! Tests whether the DOM implementation implements a specific feature and that fearture is supported by this node. @param feature The name of the feature to test. This is the same name which can be passed to the method @c hasFeature on @c DOMImplementation @param version This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supoorting any version of the feature will cause the method to return @c true */ virtual bool isSupported(DOMString& feature, DOMString& version) const = 0; //! Returns the namespace URI as a DOMString /*! Returns the namespace URI of this node, or @c null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time. For nodes of any type other than @c ELEMENT_NODE and @c ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as @c createElement from the @c Document interface, this is always @c null. */ virtual const DOMString* namespaceURI() const = 0; //! Returns the prefix as a DOMString /*! Returns the namespace prefix of this node, of @c null if it is unspecified. Note that setting this attribute, when permitted, changes the @c nodeName attribute, which holds the qualified name, as well as the @c tagName and @c name attributes of the @c Element and @c Attr interfaces when applicable. Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the @c namespaceURI and @c localName do not change. For nodes of any type other than @c ELEMENT_NODE and @c ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as @c createElement from the @c Document interface, this is always @c null. */ virtual const DOMString* prefix() const = 0; //! Sets the prefix /*! Sets the namespace prefix to the specified @c DOMString. @param newPrefix The prefix to set */ virtual void setPrefix( const DOMString& newPrefix) = 0; //! Returns the local name as a DOMString /*! Returns the local part of the qualified name of this node. For nodes of any type other than @c ELEMENT_NODE and @c ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as @c createElement from the @c Document interface, this is always @c null. */ virtual const DOMString* localName() const = 0; // Introduced in DOM Level 3: //! Determines if object has attributes /*! Returns whether this node (if it is an element) has any attributes. */ virtual bool hasAttributes() const = 0; //! Returns the base URI as a DOMString /*! Returns the absolute base URI of this node. This value is computed according to XML Base. */ virtual const DOMString* baseURI() const = 0; //! An enumeration of the different orders the node can be in /*! The @c DocumentOrder is a type to hold the document order of a node relative to another node. */ enum DocumentOrder { DOCUMENT_ORDER_PRECEDING, //!< The node precedes the reference node in document order DOCUMENT_ORDER_FOLLOWING, //!< The node follows the reference node in document order DOCUMENT_ORDER_SAME, //!< The two nodes have the same document order DOCUMENT_ORDER_UNORDERED //!< The two nodes are unordered, they do not have any common ancestor }; //! Compares the document order with another node /*! Compares a node with this node with regard to document order. @param other The node to compare against this node */ virtual DocumentOrder compareDocumentOrder( const Node* other) const = 0; //! An enumeration of the different orders the node can be in /*! The @c TreePosition is a type to hold the relative tree position of a node with respect to another node. */ enum TreePosition { TREE_POSITION_PRECEDING, //!< The node precedes the reference node TREE_POSITION_FOLLOWING, //!< The node follows the reference node TREE_POSITION_ANCESTOR, //!< The node is an ancestor of the reference node TREE_POSITION_DESCENDANT, //!< The node is a descendant of the reference node TREE_POSITION_SAME, //!< The two nodes have the same position TREE_POSITION_UNORDERED //!< The two nodes are unordered, they do not have any common ancestor }; //! Compares the tree position with another node /*! Compares a node with this node with regard to their position in the tree. @param other The node to compare against this node */ virtual TreePosition compareTreePosition( const Node* other) const = 0; //! Returns the text content /*! Returns the text content of this node and its descendants. When set, any possible children this node may have are removed and replaced by a single @c Text node containing the string this attribute is set to. On getting, no serialisation is performed, the returned string does not contain any markup. Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content. The string returned is made of the text content of this node depending on its type, as defined below
Node type Content
ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE concatenation of the @c textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes
ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE @c nodeValue
DOCUMENT_TYPE_NODE, NOTATION_NODE empty string
*/ virtual const DOMString* textContent( const bool& deep) const = 0; //! Sets the text content /*! Sets the text content to the @c DOMString specified. @param newTextContent The text content to be set for the node */ virtual void setTextContent( const DOMString& newTextContent) = 0; //! Determines if the current node is the same as other node /*! Returns whether this node is the same node as the given one. @param other The node to test against */ virtual bool isSameNode( const Node* other) const = 0; //! Looks up the namespace prefix /*! Look up the prefix associated to the given namespace URI, starting from this node. @param namespaceURI The namespace URI to look for */ virtual const DOMString* lookupNamespacePrefix( const DOMString& namespaceURI) const = 0; //! Looks up the namespace URI /*! Look up the namespace URI associcated to the given prefix, starting from this node. @param prefix The prefix to look for */ virtual const DOMString* lookupNamespaceURI( const DOMString& prefix) const = 0; //! Adds namespace declarations so that every namespace is properly declared /*! This method walks down the tree, starting from this node, and adds namespace declarations where needed so that every namespace being used is properly declared. It also changes or assigns prefixes when needed. This effectively makes this node subtree is "namespace wellformed". */ virtual void normalizeNS() = 0; //! Returns the key /*! Ths returns a key identifying this node. This key is unique within the document this node was creted from and is valid for the lifetime of that document. */ virtual DOMKey key() const = 0; //! Determines if node equals argument node /*! Tests whether two nodes are equal. This method tests for equality of nodes, not sameness (i.e., whether the two nodes are exactly the same object) which can be tested with @c Node.isSameNode. All objects that are the same will also be equal, though the reverse may not be true. @param arg The node to compare equality with @param deep If @c true, recursively compare the subtrees; if @c false, compare only the nodes themselves, (and its attributes, if it is an @c Element) */ virtual bool equalsNode( const Node* arg, bool deep) const = 0; //! Makes available a Node's specialised interface. /*! This method makes available a @c Node's specialised interface. @param feature The name of the feature requested (case-insensitive) */ virtual Node* getAs( DOMString& feature) = 0; //! Determines if node is read only /*! Returns @c true if the node is read only. Not specified in the DOM Level 3. */ virtual bool readOnly() const = 0; //! Sets node read only /*! Sets the node read only attribute. Not specified in the DOM Level 3. @param newReadOnly Boolean specifying @c true for read only, @c false otherwise @param deep If @c true, then sets the attribute recursively for the subtrees, if @c false, then only sets the attribute for the current node */ virtual void setReadOnly( const bool& newReadOnly, const bool& deep) = 0; }; class Element; class Attr; class DocumentFragment; class Text; class Comment; class CDATASection; class ProcessingInstruction; class EntityReference; // ************************************************************************** // ************************************************************************** // Document // ************************************************************************** // ************************************************************************** //! Document class /*! The Document interface represents the entire XML document. Conceptually it is the root of the document tree, and provides the primary access to the document's data. */ class Document : public virtual Node { public : //! Returns the @c DOMKey /*! A method which returns the @c DOMKey. This is a utility method defined by Greg Collecutt, and is not part of the W3C DOM specification. */ virtual DOMKey getDOMKey() const = 0; // Mine! //! Returns the document type /*! Returns the Document Type Declaration (DTD) associated with this document. Returns @c null if the document is without a document type. */ virtual const DocumentType* doctype() const = 0; //! Returns the DOM implementation /*! Returns the @c DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations. */ virtual const DOMImplementation* implementation() const = 0; //! Returns the document element /*! This is a convenience attribute that allows direct access to the child node that is the root element of the document. */ virtual Element* documentElement() const = 0; //! Creates an element of tagName /*! Creates an element of the type specified. Note that the instance returned implements the @c Element interface, so attributes can be specified directly on the returned object. In addition, if there are known attributes with default values, @c Attr nodes representing them are automatically created and attached to the element. To create an element with a qualified name and namespace URI, use the @c createElementNS method. @param tagName The name of the element to instantiate. For XML this is case-sensitive. */ virtual Element* createElement( const DOMString& tagName) = 0; //! Creates a document fragment /*! Creates an empty document fragment object */ virtual DocumentFragment* createDocumentFragment() = 0; //! Creates a text node /*! Creates a @c Text node given the specified string @param data The data for the node. */ virtual Text* createTextNode( const DOMString& data) = 0; //! Creates a comment /*! Creates a @c Comment node given the specified string. @param data The data for the node. */ virtual Comment* createComment( const DOMString& data) = 0; //! Creates a CDATA section /*! Creates a @c CDATASection node whose value is the specified string. @param data The data for the @c CDATASection */ virtual CDATASection* createCDATASection( const DOMString& data) = 0; //! Creates a processing instruction /*! Creates a @c ProcessingInstruction node given the specified name and data strings. @param target The target part of the processing instruction @param data The data for the node */ virtual ProcessingInstruction* createProcessingInstruction( const DOMString& target, const DOMString& data) = 0; //! Creates an attribute /*! Creates an @c Attr of the given name. Note that the @c Attr instance can then be set on an @c Element using the @c setAttributeNode method. To create an attribute with a qualified name and namespace URI, use the @c createAttributeNS method. @param name The name of the attribute */ virtual Attr* createAttribute( const DOMString& name) = 0; //! Creates an entity reference /*! Creates an @c EntityReference object. In addition, if the referenced entity is known, the child list of the @c EntityReference node is made the same as that of the corresponding @c Entity node. @param name The name of the entity to reference */ virtual EntityReference* createEntityReference( const DOMString& name) = 0; //! Gets the elements by tag name /*! Returns a @c NodeList of all the @c Elements with a given tag name in the order in which they are encountered in a preorder traversal of the @c Document tree. @param tagName The name of the tag to match on. The special value "*" matches all tags. */ virtual NodeList* getElementsByTagName( const DOMString& tagName) = 0; // Introduced in DOM Level 2: //! Imports a node /*! Imports a node from another document to this document. The returned node has no parent; (@c parentNode is @c null). The source node is not altered or removed from the original document; this method creates a new copy of the source code. For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's @c nodeName and @c nodeType, plus the attributes related to namespaces (@c prefix, @c localName, and @c namespaceURI). As in the @c cloneNode operation on a @c Node, the source node is not altered. @see Node */ virtual Node* importNode(const Node* importNode, const bool& deep) = 0; //! Creates an element's namespace /*! Creates an element of the given qualified name and namespace URI @param namespaceURI The namespace URI of the element to create @param qualifiedName The qualified name of the element type to instatiate */ virtual Element* createElementNS( const DOMString& namespaceURI, const DOMString& qualifiedName) = 0; //! Creates an attribute's namespace /*! Creates an attribute of the given qualified name and namespace URI @param namespaceURI The namespace URI of the attribute to create @param qualifiedName The qualified name of the attribute to instatiate */ virtual Attr* createAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName) = 0; //! Gets the elements by tag name namespace /*! Returns a @c NodeList of all the @c Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the @c Document tree @param namespaceURI The namespace URI of the elements to match on. The special value "*" matches all namespaces @param localname of the elements to match on. The special value "*" matches all local names */ virtual NodeList* getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Gets element by id /*! Returns the @c Element whose @c ID is given by @c elementId. If no such element exists, returns @c null. Behaviour is not defined if more than one element has @c ID. @param elementId The unique @c id value for an element */ virtual Element* getElementById( const DOMString& elementId) = 0; // Introduced in DOM Level 3: //! Returns the actual encoding /*! Returns a @c DOMString specifying the actual encoding of this document. This is @c null otherwise. */ virtual const DOMString* actualEncoding() const = 0; //! Sets the actual encoding /*! Sets the actual encoding to the specified value. This is not part of the W3C DOM Level 3. @param newActualEncoding The new actual encoding to set the actual encoding to. */ virtual void setActualEncoding( const DOMString& newActualEncoding) = 0; //! Returns the encoding /*! Returns a @c DOMString specifying, as part of the XML declaration, the encoding of this document. This is @c null when unspecified. */ virtual const DOMString* encoding() const = 0; //! Sets the encoding /*! Sets the encoding of the document to the specified @c DOMString. This is not defined in the W3C DOM level 3. @param newEncoding The new encoding to set for the document */ virtual void setEncoding( const DOMString& newEncoding) = 0; //! Determines if document is standalone /*! Returns a boolean specifying, as part of the XML declaration, whether this document is standalone. */ virtual bool standalone() const = 0; //! Sets the document to be standalone /*! Sets the boolean specifying that the document is standalone. This is not defined in the W3C DOM level 3. @param newStandalone A boolean specifying if the document is standalone or not */ virtual void setStandalone(const bool& newStandalone) = 0; //! Determines if strict error checking is on /*! Returns a boolean specifying whether error checking is enforced or not. When set to @c false, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any @c DOMException. In case of error, the behaviour is undefined. This is set to @c true by default. */ virtual bool strictErrorChecking() const = 0; //! Sets strict error checking /*! Turns strict error checking on by setting the appropriate flag. @param newStrictErrorChecking Boolean value defining whether or not strict error checking is on */ virtual void setStrictErrorChecking( const bool& newStrictErrorChecking) = 0; //! Returns version as DOMString /*! Returns a @c DOMString specifying, as part of the XML declaration, the version number of this document. This is @c null when unspecified. */ virtual const DOMString* version() const = 0; //! Sets the version /*! Sets the version number of the document to the @c DOMString specified. @param newVersion The new version number */ virtual void setVersion( const DOMString& newVersion) = 0; //! Adopts a node /*! Changes the @c ownerDocument of a node, its children, as well as the attached attribute nodes if there are any. If the node has a parent it is first removed from its parent child list. This effectively allows moving a subtree from one document to another. @param source The node to move into this document */ virtual Node* adoptNode( Node* source) = 0; //! Sets the base URI /*! Set the @c baseURI attribute from the @c Node interface. @param baseURI The new absolute URI for this document */ virtual void setBaseURI( const DOMString *const baseURI) = 0; }; // ************************************************************************** // ************************************************************************** // Element // ************************************************************************** // ************************************************************************** //! Element class /*! The @c Element interface represents an element in an XML document. Elements may have attributes associated with them; since the @c Element interface inherits from @c Node, the generic @c Node interface attribute @c attributes may be used to retrieve the set of all attributes by name or an attribute value by name. In XML, where an attribute value may contain entity references, an @c Attr object should be retrieved to examine the possibly failry complex sub-tree representing the attribute value. */ class Element : public virtual Node { public : //! Returns the tag name as a DOMString /*! Returns the name of the element, for example \verbatim ... \endverbatim @c tagName is the value @c elementExample */ virtual const DOMString* tagName() const = 0; //! Gets the attribute as a DOMString /*! Retrieves an attribute value by name. @param name The name of the attribute to retrieve */ virtual const DOMString* getAttribute( const DOMString& name) const = 0; //! Sets an attribute /*! Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the @c value parameter. This value is a simple string; it is not parsed as it is being set. In order to assign an attribute value that contains entity references, the user must create an @c Attr node plus any @c Text and @c EntityReference nodes, build the appropriate subtree, and use @c setAttributeNode to assign it as the value of an attribute. To set an attribute with a qualified name and namespace URI, use the @c setAttributeNS method. @param name The name of the attribute to create or alter @param value Value to set in string form */ virtual void setAttribute( const DOMString& name, const DOMString& value) = 0; //! Removes an attribute /*! Removes an attribute by name. If the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name and prefix when applicable. To remove an attribute by local name and namespace URI, use the @c removeAttributeNS method. @param name The name of the attribute to remove */ virtual void removeAttribute( const DOMString& name) = 0; //! Gets an attribute node /*! Retrieves an attribute node by name. To retrieve an attribute node by qualified name and namespace URI, use the @c getAttributeNodeNS method. @param name The name (@c nodeName) of the attribute to retrieve */ virtual Attr* getAttributeNode( const DOMString& name) = 0; //! Sets an attribute node /*! Adds a new attribute node. If an attribute with that name (@c nodeName) is already present in the element, it is replaced by the new one. To add a new attribute node with a qualified name and namespace URI, use the @c setAttributeNodeNS method. @param newAttr The @c Attr node to add to the attribute list */ virtual Attr* setAttributeNode( Attr& newAttr) = 0; //! Removes an attribute node /*! Removes the specified attribute node. If the removed @c Attr has a default value it is immediately replaced. The replacing attribute has the same namespaceURI and local name, as well as the original prefix, when applicable. @param oldAttr The @c Attr node to remove from the attribute list */ virtual Attr* removeAttributeNode( Attr& oldAttr) = 0; //! Gets elements by tag name virtual const NodeList* getElementsByTagName( const DOMString& name, const bool& deep) const = 0; // Introduced in DOM Level 2: //! Gets the attribute's namespace /*! Retrieves an attribute value by local name and namespace URI. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the attribute to retrieve @param localname The local name of the attribute to retrieve */ virtual const DOMString* getAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const = 0; //! Sets the attribute's namespace /*! Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to the prefix part of the @c qualifiedName, and its value is changed to be the @c value parameter. This value is a simple string; it is not parsed as it is being set. In order to assign an attribute value that contains entity references, the user must create an @c Attr node plus any @c Text and @c EntityReference nodes, build the appropriate subtree, and use @c setAttributeNodeNS or @c setAttributeNode to assign it as the value of an attribute. @param namespaceURI The namespace URI of the attribute to create or alter @param qualifiedName The qualified name of the attribute to create or alter @param value The value to set in string form */ virtual void setAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName, const DOMString& value) = 0; //! Removes the attribute's namespace /*! Removes an attribute by local name and namespace URI. If the removed attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the attribute to remove @param localname The local name of the attribute to remove */ virtual void removeAttributeNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Gets the attribute node's namespace /*! Retrieves an @c Attr node by local name and namespace URI. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The namespace URI of the attribute to retrieve @param localname The local name of the attribute to retrieve */ virtual Attr* getAttributeNodeNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Sets the attribute node's namespace /*! Adds a new attribute. If an atribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. @param newAttr The @c Attr node to add to the attribute list */ virtual Attr* setAttributeNodeNS( Attr& newAttr) = 0; //! Gets the elements by tag name namespace /*! Returns a @c NodeList of all the descendant @c Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this @c Element tree. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence if you specify a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The name space URI of the elements to match on. The special value "*" matches all namespaces. @param localname The local name of the elements to match on. The special value "*" matches all local names. */ virtual NodeList* getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname) = 0; //! Determines if node has attribute name /*! Returns @c true when an attribute with a given name is specified on this element or has a default value, @c false otherwise @param name The name of the attribute to look for */ virtual bool hasAttribute( const DOMString& name) const = 0; //! Determines if node has attribute namespace of localname /*! Returns @c true when an attribute with a given local name and namespace URI is specified on this element or has a default value, @c false otherwise. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence if you specify a non-null namespace URI, these DOMs will never find a matching node. @param namespaceURI The name space URI of the elements to match on. @param localname The local name of the elements to match on. */ virtual bool hasAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const = 0; }; // ************************************************************************** // ************************************************************************** // Attr // ************************************************************************** // ************************************************************************** //! Attribute class /*! The @c Attr interface represents an attribute in an @c Element object. Typically the allowable values for the attribute are defined in a document type definition. @c Attr objects inherit the @c Node interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the @c Node attributes @c parentNode, @c previousSibling, and @c nextSibling have a @c null valuue for @c Attr objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make is more efficient to implement such feautures as default attributes associated with all elements of a given type. Furthermore, @c Attr nodes may not be immediate children of a @c DocumentFragment. However, they can be associated with @c Element nodes contained within a @c DocumentFragment. */ class Attr : public virtual Node { public : //! Returns the attribute name as a DOMString /*! Returns the name of this attribute */ virtual const DOMString* name() const = 0; //! Determines if the attribute was given explicitly in the original //document /*! If this attribute was explicitly given a value in the original document, this is @c true; otherwise, it is @c false. */ virtual bool specified() const = 0; //! Sets the specified boolean /*! Convenience function to set the @c specified boolean. This is not explicitly defined in the W3C DOM Level 3. @param newSpecified Boolean value to set for the attribute */ virtual void setSpecified( const bool& newSpecified) = 0; //! Returns the attribute value /*! On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. @see @c getAttribute on the @c Element interface On setting, this creates a @c Text node with the unparsed contents of the string. I.e. any characters that an XML processor would recognise as markup are instead treated as literal text. @see @c setAttribute on the @c Element interface */ virtual const DOMString* value() const = 0; //! Sets the attribute value /*! Convenience function to set the attribute value. Not explicitly defined in the W3C DOM Level 3, however, it is certainly implied that such a function should exist. @param newValue The new value of the attribute */ virtual void setValue( const DOMString& newValue) = 0; // Introduced in DOM Level 2: //! Returns the owner element of the attribute /*! Returns the @c Element node this attribute is attached to or @c null if this attribute is not in use. */ virtual const Element* ownerElement() const = 0; //! Sets the owner element of the attribute /*! Convenience function to explicitly set the @c ownerElement of the attribute. Not defined in the W3C DOM Level 3 @param newOwnerElement The new owner element of the attribute */ virtual void setOwnerElement( const Element* newOwnerElement) = 0; }; // ************************************************************************** // ************************************************************************** // CharacterData // ************************************************************************** // ************************************************************************** //! CharacterData class /*! The @c CharacterData interface extends @c Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to @c CharacterData, though @c Text and othersdo inherit the interface from it. All @c offsets in this interface start from 0. As explained in the @c DOMString interface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term 16-bit units is used whenever necessary to indicate that indexing on @c CharacterData is done in 16-bit units. Note: I believe that Greg Collecutt only implemented strings in UTF-8, so one must be damn careful when using this implementation of the DOM and that documented both here, and in the 05 June 2001 Working Draft. PTC. */ class CharacterData : public virtual Node { public : //! Returns the data as a DOMString /*! Returns the character data of the node that implements this interface. */ virtual const DOMString* data() const = 0; //! Returns the length of the data /*! Returns the number of 16-bit units that are available through @c data and the @c substringData method. This may have the value zero, i.e., @c CharacterData nodes may be empty. */ virtual unsigned long length() const = 0; //! Returns a substring of the character data of length count characters starting at offset /*! Extracts a range of data from the node. @param offset Start offset of substring to extract @param count The number of 16-bit units to extract */ const virtual DOMString* substringData( unsigned long offset, unsigned long count) const = 0; //! Appends data /*! Append the string to the end of the character data of the node. Upon success, @c data provides access to the concatenation of @c data and the @c DOMString specified. @param arg The @c DOMString to append */ virtual void appendData( const DOMString& arg) = 0; //! Inserts data at offset /*! Insert a string at the specified 16-bit unit offset. @param offset The character offset at which to insert @param arg The @c DOMString to insert */ virtual void insertData( unsigned long offset, const DOMString& arg) = 0; //! Deletes count characters starting at offset /*! Remove a range of 16-bit units from the node. Upon success, @c data and @c length reflect the change. @param offset The offset from which to start removing @param count The number of 16-bit units to delete. If the sum of @c offset and @c count exceeds @c length then all 16-bit units from @c offset to the end of the data are deleted */ virtual void deleteData( unsigned long offset, unsigned long count) = 0; //! Replaces count characters starting at offset /*! Replace the characters starting at the specified 16-bit unit offset with the specified string. @param offset The offset from which to start replacing @param count The number of 16-bit units to replace. If the sum of @c offset and @c count exceeds @c length, then all 16-bit units to the end of the data are replaced; (i.e. the effect is the same as a @c remove method call with the same range, followed by an @c append method invocation). @param arg The @c DOMString with which the range must be replaced */ virtual void replaceData( unsigned long offset, unsigned long count, const DOMString& arg) = 0; //! Sets the data /*! Convenience function to set data in a @c CharacterData object. This is not specified in the W3C DOM Level 3. @param newData The new data that the @c CharacterData object should hold */ virtual void setData( const DOMString& newData) = 0; }; // ************************************************************************** // ************************************************************************** // Text // ************************************************************************** // ************************************************************************** //! Text class /*! The @c Text interface inherits from @c CharacterData and represents the textual content (termed @em character @em data in XML) of an @c Element or @c Attr. If there is no markup inside an element's content, the text is contained in a single object implementing the @c Text interface that is the only child of the element. If there is markup, it is parsed into the information items (elements, comments, etc) and @c Text nodes that form the list of children of the element. When a document is first made available via the DOM, there is only one @c Text node for each block of text. Users may create adjacent @c Text nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML, so they will not (in general) persist between DOM editing sessions. The @c normalize() method on @c Node merges any such adjacent @c Text objects into a single node for each block of text. */ class Text : public virtual CharacterData { public : //! Splits text at offset /*! Breaks this node into two nodes at the specified @c offset, keeping both in the tree as siblings. After being split, this node will contain all the content up to the @c offset pint. A new node of the same type, which contains all the content at and after the @c offset point, is returned. If the original node had a parent node, the new node is inserted as the next sibling of the oriinal node. When the @c offset is equal to the length of this node, the new node has no data. @param offset The 16-bit unit offset at which to split, starting from 0 */ virtual Text* splitText( unsigned long offset) = 0; // Introduced in DOM Level 3: //! Determines if whitespace exists in element content /*! Returns whether this text node contains whitespace in element content, often abusively called "ignorable whitespace". */ virtual bool isWhiteSpaceInElementContent() const = 0; //! Returns entire text (I think) /*! Returns all text of @c Text nodes logically-adjacent to this node. */ virtual const DOMString* wholeText() const = 0; //! Replaces entire text /*! Replace all @c Text nodes logcally-adjacent to this node. @param content The content of the replacing @c Text node */ virtual Text* replaceWholeText( const DOMString& content) = 0; }; // ************************************************************************** // ************************************************************************** // DocumentFragment // ************************************************************************** // ************************************************************************** //! DocumentFragment class /*! A DocumentFragment is a "lightweight" or "minimal" Document object. It is very common to want to be able to extract a portion of a document's tree or to create a new fragement of a document. This object fulfils that purpose. */ class DocumentFragment : public virtual Node { }; // ************************************************************************** // ************************************************************************** // Comment // ************************************************************************** // ************************************************************************** //! Comment class /*! This interface inherits from @c CharacterData and represents the content of a comment, i.e., all the characters between the starting "". */ class Comment : public virtual CharacterData { }; // ************************************************************************** // ************************************************************************** // ************************************************************************** // The Extended Interfaces // ************************************************************************** // ************************************************************************** // ************************************************************************** // ************************************************************************** // ************************************************************************** // Entity // ************************************************************************** // ************************************************************************** //! Entity class /*! This interface represents an entiy, either parsed or unparsed, in an XML document. Not that this models the entity itself not the entity declaration. @c Entity declaration modeling has been left for a later Level of the DOM specification. The @c nodeName attribute that is inherited from @c Node contains the name of the entity. An @c Entity node does not have a parent. */ class Entity : public virtual Node { public : //! Returns the public id as DOMString /*! Returns the public identifier associated with the entity, if specified. If the public identifier was not specified, this is @c null. */ virtual const DOMString* publicId() const = 0; //! Returns the system id as DOMString /*! Returns the system identifier associated with the entity, if specified. If the system identifier was not specified, this is @c null. */ virtual const DOMString* systemId() const = 0; //! Returns the notation name as DOMString /*! For unparsed entities, this returns the name of the notation for the entity. For parsed entities, this is @c null. */ virtual const DOMString* notationName() const = 0; // Introduced in DOM Level 3: //! Returns the actual encoding as DOMString /*! Returns an attribute specifying the actual encoding of this entity, when it is an external parsed entity. This is @c null otherwise. */ virtual const DOMString* actualEncoding() const = 0; //! Sets the actual encoding /*! Sets the actual encoding of the entity to the string specified. @param newActualEncoding The new actual encoding of the entity */ virtual void setActualEncoding( const DOMString& newActualEncoding) = 0; //! Returns the encoding as DOMString /*! Returns an attribute specifying, as part of the text declaration, the encoding of this entity, when it is an external parsed entity. This is @c null otherwise. */ virtual const DOMString* encoding() const = 0; //! Sets the encoding /*! Sets the encoding attribute of the entity to the specified string. @param newEncoding The new encoding attribute of the entity */ virtual void setEncoding( const DOMString& newEncoding) = 0; //! Returns the version as DOMString /*! Returns an attribute specifying, as part of the text declaration, the version number of his entity, when it is an external parsed entity. This is @c null otherwise. */ virtual const DOMString* version() const = 0; //! Sets the version /*! Sets the version attribute of the entity to the specified string. @param newVersion The new version of the entity */ virtual void setVersion( const DOMString& newVersion) = 0; }; // ************************************************************************** // ************************************************************************** // DocumentType // ************************************************************************** // ************************************************************************** //! DocumentType class /*! Each @c Document has a @c doctype attribute whose value is either @c null or a @c DocumentType object. */ class DocumentType : public virtual Node { public : //! Returns the name of the document type as a DOMString /*! Returns the name of DTD; i.e., the name immediately following the DOCTYPE keyword. */ virtual const DOMString* name() const = 0; //! Returns the entities of the document type as a NamedNodeMap /*! Returns a @c NamedNodeMap containing the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. */ virtual const NamedNodeMap* entities() const = 0; //! Returns the notations of the document type as a NamedNodeMap /*! Returns a @c NamedNodeMap containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the @c Notation interface. */ virtual const NamedNodeMap* notations() const = 0; // Introduced in DOM Level 2: //! Returns the public id as a DOMString /*! Returns the public identifier of the external subset. */ virtual const DOMString* publicId() const = 0; //! Returns the system id as a DOMString /*! Returns the system identifier of the external subset. */ virtual const DOMString* systemId() const = 0; //! Returns the internal subset as a DOMString /*! Returns the internal subset as a string, or @c null if there is none. */ virtual const DOMString* internalSubset() const = 0; }; // ************************************************************************** // ************************************************************************** // ProcessingInstruction // ************************************************************************** // ************************************************************************** //! ProcessingInstruction class /*! The @c ProcessingInstruction interface represents a "processing instruction", used in XML as a way to keep prcoessor-specific information in the text of the document. */ class ProcessingInstruction : public virtual Node { public : //! Returns the target as a DOMString /*! Returns the target of this processing instruction. XML defines this as the first token following the markup that begins the processing instruction. */ virtual const DOMString* target() const = 0; //! Returns the data as a DOMString /*! Returns the content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the \?>. */ virtual const DOMString* data() const = 0; //! Sets the data /*! Sets the data in a processing instruction to the specified string. @param newData The string to set the processing instruction to */ virtual void setData( const DOMString& newData) = 0; }; // ************************************************************************** // ************************************************************************** // Notation // ************************************************************************** // ************************************************************************** //! Notation class /*! This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity, or is used for formal declaration of processing instruction targets. The @c nodeName attribute inherited from @c Node is set to the declared name of the notation. A @c Notation node does not have any parent. */ class Notation : public virtual Node { public : //! Returns the public id as a DOMString /*! Returns the public identifier of this notation. If the public identifier was not specified, this is @c null. */ virtual const DOMString* publicId() const = 0; //! Returns the system id as a DOMString /*! Returns the system identifier of this notation. If the system identifier was not specified, this is @c null. */ virtual const DOMString* systemId() const = 0; }; // ************************************************************************** // ************************************************************************** // EntityReference // ************************************************************************** // ************************************************************************** //! EntityReference class /*! @c EntityReference objects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. */ class EntityReference : public virtual Node { }; // ************************************************************************** // ************************************************************************** // CDATASection // ************************************************************************** // ************************************************************************** //! CDATASection class /*! CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognised in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. The @c DOMString attribute of the @c Text node holds the text that is contained by the CDATA section. The @c CDATASection interface inherits from the @c CharacterData interface through the @c Text interface. */ class CDATASection : public virtual Text { }; #define DOM3 //!< Set the DOM level 3 flag xmds-1.6.6/source/getopt_xmds.c0000644000076500000240000010633711033276361013433 00000000000000/* Getopt for GNU. NOTE: getopt_xmds is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* $Id: getopt_xmds.c 1194 2006-12-18 12:59:46Z paultcochrane $ */ /*! @file getopt_xmds.c @brief The GNU getopt_xmds() routines More detailed explanation... */ /* This tells Alpha OSF/1 not to define a getopt_xmds prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ /*! Defines the getopt interface version */ #define GETOPT_XMDS_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_XMDS_INTERFACE_VERSION == GETOPT_XMDS_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt_xmds. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. */ # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include # ifndef _ # define _(msgid) gettext (msgid) # endif # else /*! Definition of message id */ # define _(msgid) (msgid) # endif # if defined _LIBC && defined USE_IN_LIBIO # include # endif #endif /* This version of `getopt_xmds' appears to the caller like standard Unix `getopt_xmds' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt_xmds' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt_xmds.h" /* For communication from `getopt_xmds' to the caller. When `getopt_xmds' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt_xmds'. On entry to `getopt_xmds', zero means this is the first call; initialize. When `getopt_xmds' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind_xmds' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind_xmds = 1; /* Formerly, initialization of getopt_xmds depended on optind_xmds==0, which causes problems with re-calling getopt_xmds as programs generally don't know that. */ /*! Tells if getopt_xmds is initialised */ int __getopt_xmds_initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ /*! The next character to be scanned in the option element in which the last option character we returned was found */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr_xmds = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt_xmds implementation. */ int optopt_xmds = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt_xmds' to return -1 with `optind_xmds' != ARGC. */ /*! Enum which defines some ordering macros */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /*! Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv /*! Gets the environment variables */ extern char *getenv (); #endif /*! Determines the index */ static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ /*! Index of first non-option argument */ static int first_nonopt; /*! Index of last non-option argument */ static int last_nonopt; #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_xmds_init.c */ extern char *__getopt_xmds_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; # endif # ifdef USE_NONOPTION_FLAGS /*! Macro definition for swapping flags when using nonoption flags */ # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_xmds_nonoption_flags[ch1]; \ __getopt_xmds_nonoption_flags[ch1] = __getopt_xmds_nonoption_flags[ch2]; \ __getopt_xmds_nonoption_flags[ch2] = __tmp; \ } # else /*! Macro definition for swapping flags when not using nonoption flags */ # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ /*! Macro definition for swapping flags (fallback macro definition) */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind_xmds), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif /*! Exchange the shorter segment with the far end of the longer segment */ static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind_xmds; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_xmds_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_xmds_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_xmds_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind_xmds - last_nonopt); last_nonopt = optind_xmds; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_xmds_initialize (int, char *const *, const char *); /*! Intialises getopt_xmds */ #endif /*! Intialises getopt_xmds */ static const char * _getopt_xmds_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind_xmds; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (posixly_correct == NULL && argc == __libc_argc && argv == __libc_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_xmds_nonoption_flags == NULL || __getopt_xmds_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_xmds_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_xmds_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_xmds_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_xmds_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt_xmds' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt_xmds' finds another option character, it returns that character, updating `optind_xmds' and `nextchar' so that the next call to `getopt_xmds' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt_xmds' returns -1. Then `optind_xmds' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr_xmds' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt_xmds' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ /*! Main function impelmenting getopt argument parsing */ int _getopt_xmds_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { int print_errors = opterr_xmds; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind_xmds == 0 || !__getopt_xmds_initialized) { if (optind_xmds == 0) optind_xmds = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_xmds_initialize (argc, argv, optstring); __getopt_xmds_initialized = 1; } /* Test whether ARGV[optind_xmds] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /*! Defines if ARGV[optind_xmds] points to a non-option argument (libc version) */ # define NONOPTION_P (argv[optind_xmds][0] != '-' || argv[optind_xmds][1] == '\0' \ || (optind_xmds < nonoption_flags_len \ && __getopt_xmds_nonoption_flags[optind_xmds] == '1')) #else /*! Defines if ARGV[optind_xmds] points to a non-option argument (fallback version) */ # define NONOPTION_P (argv[optind_xmds][0] != '-' || argv[optind_xmds][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind_xmds) last_nonopt = optind_xmds; if (first_nonopt > optind_xmds) first_nonopt = optind_xmds; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind_xmds) exchange ((char **) argv); else if (last_nonopt != optind_xmds) first_nonopt = optind_xmds; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind_xmds < argc && NONOPTION_P) optind_xmds++; last_nonopt = optind_xmds; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind_xmds != argc && !strcmp (argv[optind_xmds], "--")) { optind_xmds++; if (first_nonopt != last_nonopt && last_nonopt != optind_xmds) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind_xmds; last_nonopt = argc; optind_xmds = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind_xmds == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind_xmds = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind_xmds++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind_xmds] + 1 + (longopts != NULL && argv[optind_xmds][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind_xmds][1] == '-' || (long_only && (argv[optind_xmds][2] || !my_index (optstring, argv[optind_xmds][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind_xmds]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind_xmds]); #endif } nextchar += strlen (nextchar); optind_xmds++; optopt_xmds = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind_xmds++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (argv[optind_xmds - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind_xmds - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind_xmds - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } nextchar += strlen (nextchar); optopt_xmds = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind_xmds < argc) optarg = argv[optind_xmds++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind_xmds - 1]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind_xmds - 1]); #endif } nextchar += strlen (nextchar); optopt_xmds = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_xmds_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind_xmds][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (argv[optind_xmds][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind_xmds][0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind_xmds][0], nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } nextchar = (char *) ""; optind_xmds++; optopt_xmds = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind_xmds' when we start to process its last character. */ if (*nextchar == '\0') ++optind_xmds; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } optopt_xmds = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind_xmds++; } else if (optind_xmds == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt_xmds = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind_xmds' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind_xmds++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind_xmds]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind_xmds]); #endif } nextchar += strlen (nextchar); optind_xmds++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind_xmds < argc) optarg = argv[optind_xmds++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[optind_xmds - 1]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind_xmds - 1]); #endif } nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind_xmds++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind_xmds++; } else if (optind_xmds == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt_xmds = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind_xmds' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind_xmds++]; nextchar = NULL; } } return c; } } /*! Simple interface to the getopt parsing functions */ int getopt_xmds (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_xmds_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt_xmds'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind_xmds = 0; while (1) { int this_option_optind_xmds = optind_xmds ? optind_xmds : 1; c = getopt_xmds (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind_xmds != 0 && digit_optind_xmds != this_option_optind_xmds) printf ("digits occur in two different argv-elements.\n"); digit_optind_xmds = this_option_optind_xmds; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt_xmds returned character code 0%o ??\n", c); } } if (optind_xmds < argc) { printf ("non-option ARGV-elements: "); while (optind_xmds < argc) printf ("%s ", argv[optind_xmds++]); printf ("\n"); } exit (0); } #endif /* TEST */ xmds-1.6.6/source/getopt_xmds.h0000644000076500000240000001755611033277417013447 00000000000000/*! @file getopt_xmds.h @brief Declarations for GNU getopt_xmds. */ /* Declarations for getopt_xmds. Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* $Id: getopt_xmds.h 1489 2007-08-14 13:41:02Z paultcochrane $ */ #ifndef _GETOPT_XMDS_H #ifndef __need_getopt_xmds /*! Do we have the getopt_xmds header file? */ # define _GETOPT_XMDS_H 1 #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt_xmds' to the caller. When `getopt_xmds' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ /*! When getopt_xmds finds an option that takes an argument, the argument value is returned here */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt_xmds'. On entry to `getopt_xmds', zero means this is the first call; initialize. When `getopt_xmds' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind_xmds' communicates from one call to the next how much of ARGV has been scanned so far. */ /*! Index in ARGV of the next element to be scanned */ extern int optind_xmds; /* Callers store zero here to inhibit the error message `getopt_xmds' prints for unrecognized options. */ /*! Callers store zero here to inhibit the error message getopt_xmds prints for unrecognized options */ extern int opterr_xmds; /* Set to an option character which was unrecognized. */ /*! Set to an option character which was unrecognized */ extern int optopt_xmds; #ifndef __need_getopt_xmds /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_xmds_long or getopt_xmds_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt_xmds' returns the contents of the `val' field. */ /*! Option structure for getopt_xmds */ struct option { # if (defined __STDC__ && __STDC__) || defined __cplusplus /*! Option name */ const char *name; # else /*! Option name */ char *name; # endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ /*! Determines if option has an argument */ int has_arg; /*! Variable to use if option sets a flag */ int *flag; /*! Value that option is given as argument */ int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ /*! Value to use if option has no argument */ # define no_argument 0 /*! Value to use if option has a required argument */ # define required_argument 1 /*! Value to use if option has an optional argument */ # define optional_argument 2 #endif /* need getopt_xmds */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt_xmds' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt_xmds'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt_xmds' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt_xmds'. */ #if (defined __STDC__ && __STDC__) || defined __cplusplus # ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt_xmds, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt_xmds for the GNU C library. */ extern int getopt_xmds (int ___argc, char *const *___argv, const char *__shortopts); # else /* not __GNU_LIBRARY__ */ extern int getopt_xmds (); # endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt_xmds extern int getopt_xmds_long (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_xmds_long_only (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_xmds_internal (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # endif #else /* not __STDC__ */ /*! The function to get short options (like unistd.h) */ extern int getopt_xmds (); # ifndef __need_getopt_xmds /*! The function to get both long and short options */ extern int getopt_xmds_long (); /*! The function to get only long options */ extern int getopt_xmds_long_only (); /*! A function used internally by getopt_xmds */ extern int _getopt_xmds_internal (); # endif #endif /* __STDC__ */ #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt_xmds #endif /* getopt_xmds.h */ xmds-1.6.6/source/getopt_xmds1.c0000644000076500000240000001170011033276361013501 00000000000000/* getopt_xmds_long and getopt_xmds_long_only entry points for GNU getopt_xmds. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* $Id: getopt_xmds1.c 1194 2006-12-18 12:59:46Z paultcochrane $ */ /*! @file getopt_xmds1.c @brief The GNU getopt_xmds_long() and getopt_xmds_long_only() routines More detailed explanation... */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt_xmds.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ /*! Defines the interface version for getopt_xmds */ #define GETOPT_XMDS_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_XMDS_INTERFACE_VERSION == GETOPT_XMDS_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL /*! Defines NULL */ #define NULL 0 #endif /*! Wrapper function for long and short option argument parsing */ int getopt_xmds_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_xmds_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_xmds_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ /*! Wrapper function for long option only argument parsing */ int getopt_xmds_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_xmds_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind_xmds = 0; while (1) { int this_option_optind_xmds = optind_xmds ? optind_xmds : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_xmds_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind_xmds != 0 && digit_optind_xmds != this_option_optind_xmds) printf ("digits occur in two different argv-elements.\n"); digit_optind_xmds = this_option_optind_xmds; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt_xmds returned character code 0%o ??\n", c); } } if (optind_xmds < argc) { printf ("non-option ARGV-elements: "); while (optind_xmds < argc) printf ("%s ", argv[optind_xmds++]); printf ("\n"); } exit (0); } #endif /* TEST */ xmds-1.6.6/source/getopt_xmds_init.c0000644000076500000240000000656111033276361014454 00000000000000/* Perform additional initialization for getopt_xmds functions in GNU libc. Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* $Id: getopt_xmds_init.c 1194 2006-12-18 12:59:46Z paultcochrane $ */ /*! @file getopt_xmds_init.c @brief Initialisation file for GNU getopt_xmds() routines More detailed explanation... */ /* some compilers throw a warning here, as the ifdef below doesn't get executed causing no executable statements to be in the file. I'm adding a single assignment here to stop this */ /*! Dummy value to get around problems with some compilers producing an error when they don't generate any code from the following ifdef */ int dummyIntegerValue = 0; #ifdef USE_NONOPTION_FLAGS /* Attention: this file is *not* necessary when the GNU getopt_xmds functions are used outside the GNU libc. Some additional functionality of the getopt_xmds functions in GNU libc require this additional work. */ #include #include #include #include #include /* Variable to synchronize work. */ char *__getopt_xmds_nonoption_flags; /* Remove the environment variable "__GNU_nonoption_argv_flags_" if it is still available. If the getopt_xmds functions are also used in the application it does not exist anymore since it was saved for the use in getopt_xmds. */ void __getopt_xmds_clean_environment (char **env) { /* Bash 2.0 puts a special variable in the environment for each command it runs, specifying which ARGV elements are the results of file name wildcard expansion and therefore should not be considered as options. */ static const char envvar_tail[] = "_GNU_nonoption_argv_flags_="; char var[50]; char *cp, **ep; size_t len; /* Construct the "__GNU_nonoption_argv_flags_=" string. We must not use `sprintf'. */ cp = memcpy (&var[sizeof (var) - sizeof (envvar_tail)], envvar_tail, sizeof (envvar_tail)); cp = _itoa_word (__getpid (), cp, 10, 0); /* Note: we omit adding the leading '_' since we explicitly test for it before calling strncmp. */ len = (var + sizeof (var) - 1) - cp; for (ep = env; *ep != NULL; ++ep) if ((*ep)[0] == '_' && __builtin_expect (strncmp (*ep + 1, cp, len) == 0, 0)) { /* Found it. Store this pointer and move later ones back. */ char **dp = ep; __getopt_xmds_nonoption_flags = &(*ep)[len]; do dp[0] = dp[1]; while (*dp++); /* Continue the loop in case the name appears again. */ } } #endif /* USE_NONOPTION_FLAGS */ xmds-1.6.6/source/kissdom.cc0000644000076500000240000040571111033277417012713 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: kissdom.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file kissdom.cc @brief Greg Collecutt's implementation of DOM3 More detailed explanation... */ // My implementation of DOM3 #include #include #include #define DEBUGKISSDOM 0 //!< Whether or not to debug the KISS DOM // ************************************************************************** // ************************************************************************** // DOMException // ************************************************************************** // ************************************************************************** long nDOMExceptions = 0; //!< The number of DOM exception objects DOMException::DOMException() { if (DEBUGKISSDOM) { nDOMExceptions++; printf("DOMException::DOMException();\n"); printf("nDOMExceptions=%li\n", nDOMExceptions); } code = 0; } DOMException::DOMException( unsigned long err) { if (DEBUGKISSDOM) { nDOMExceptions++; printf("DOMException::DOMException(unsigned long err);\n"); printf("nDOMExceptions=%li\n", nDOMExceptions); } code = err; } DOMException::~DOMException() { if (DEBUGKISSDOM) { nDOMExceptions--; printf("DOMException::~DOMException();\n"); printf("nDOMExceptions=%li\n", nDOMExceptions); } code = 0; } const char* DOMException::getError() const { switch (code) { case INDEX_SIZE_ERR : return "INDEX_SIZE_ERR\n"; break; case DOMSTRING_SIZE_ERR : return "DOMSTRING_SIZE_ERR\n"; break; case HIERARCHY_REQUEST_ERR : return "HIERARCHY_REQUEST_ERR\n"; break; case WRONG_DOCUMENT_ERR : return "WRONG_DOCUMENT_ERR\n"; break; case INVALID_CHARACTER_ERR : return "INVALID_CHARACTER_ERR\n"; break; case NO_DATA_ALLOWED_ERR : return "NO_DATA_ALLOWED_ERR\n"; break; case NO_MODIFICATION_ALLOWED_ERR : return "NO_MODIFICATION_ALLOWED_ERR\n"; break; case NOT_FOUND_ERR : return "NOT_FOUND_ERR\n"; break; case NOT_SUPPORTED_ERR : return "NOT_SUPPORTED_ERR\n"; break; case INUSE_ATTRIBUTE_ERR : return "INUSE_ATTRIBUTE_ERR\n"; break; case INVALID_STATE_ERR : return "INVALID_STATE_ERR\n"; break; case SYNTAX_ERR : return "SYNTAX_ERR\n"; break; case INVALID_MODIFICATION_ERR : return "INVALID_MODIFICATION_ERR\n"; break; case NAMESPACE_ERR : return "NAMESPACE_ERR\n"; break; case INVALID_ACCESS_ERR : return "INVALID_ACCESS_ERR\n"; break; default : return "UNKOWN_ERR\n"; break; } } // ************************************************************************** // ************************************************************************** // KissDOMImplementation // ************************************************************************** // ************************************************************************** long nKissDOMImplementations = 0; //!< Number of KISS DOM implementation objects // ************************************************************************** KissDOMImplementation::KissDOMImplementation() { if (DEBUGKISSDOM) { nKissDOMImplementations++; printf("KissDOMImplementation::KissDOMImplementation();\n"); printf("nKissDOMImplementations=%li\n", nKissDOMImplementations); } } // ************************************************************************** KissDOMImplementation::~KissDOMImplementation() { if (DEBUGKISSDOM) { printf("KissDOMImplementation::~KissDOMImplementation();\n"); } for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { if (DEBUGKISSDOM) { printf("deleting *ppNode=%li\n", (long)*ppNode); } delete(*ppNode); } if (DEBUGKISSDOM) { nKissDOMImplementations--; printf(" ... KissDOMImplementation deleted\n"); printf("nKissDOMImplementations=%li\n", nKissDOMImplementations); } } // ************************************************************************** bool KissDOMImplementation::hasFeature( DOMString& feature, DOMString& version) const { return 0; } // ************************************************************************** DocumentType* KissDOMImplementation::createDocumentType( const DOMString& qualifiedName, const DOMString& publicId, const DOMString& systemId) { if (qualifiedName.hasIllegalCharacters()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if (!qualifiedName.isNSWellFormed()) { throw DOMException(DOMException::NAMESPACE_ERR); } DOMString namePrefix; DOMString nameLocalPart; if (qualifiedName.splitNSName(namePrefix, nameLocalPart)) { // was a namespace name if (namePrefix.beginsWithxml()|nameLocalPart.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } else { // was not a namespace name, in which case the name may be // anything not begining with xml, if (qualifiedName.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } DocumentType* newDocumentType = new KissDocumentType(qualifiedName, publicId, systemId); myNodeList.push_back(newDocumentType); return newDocumentType; } // ************************************************************************** Document* KissDOMImplementation::createDocument( const DOMString& namespaceURI, const DOMString& qualifiedName, DocumentType* doctype) { if (qualifiedName.hasIllegalCharacters()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if (!qualifiedName.isNSWellFormed()) { throw DOMException(DOMException::NAMESPACE_ERR); } DOMString namePrefix; DOMString nameLocalPart; if (namespaceURI.length() > 0) { // We are making a document with a namespace root element. if (qualifiedName.splitNSName(namePrefix, nameLocalPart)) { // was a namespace name if (namePrefix.eqxml()) { // if the prefix is xml // the namespaceURI must be exactly XML_NAMESPACEURI if (namespaceURI != XML_NAMESPACEURI) { throw DOMException(DOMException::NAMESPACE_ERR); } } else if (namePrefix.beginsWithxml() |nameLocalPart.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } else { // was not a namespace name, in which case the name may be // anything not begining with xml, if (qualifiedName.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } } if (doctype != 0) { if ((doctype->ownerDocument() != 0) | doctype->readOnly()) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } // No further exceptions will occur beyond this point, // therefore we may begin creating the document and element nodes. Document* newDocument = new KissDocument((DOMImplementation*)this); myNodeList.push_back(newDocument); if (doctype != 0) { doctype->setOwnerDocument(newDocument); newDocument->appendChild(doctype); // must look for doctype amongst nodes and remove it if there // since it now belongs to the document list::iterator ppNode; ppNode = myNodeList.begin(); while (((*ppNode) != doctype) && (ppNode != myNodeList.end())) { ppNode++; } if ((*ppNode) == doctype) { myNodeList.erase(ppNode); } } Element* documentElement = new KissElement(newDocument, 0, namespaceURI, qualifiedName); newDocument->appendChild(documentElement); return newDocument; } // ************************************************************************** DOMImplementation* KissDOMImplementation::getAs( DOMString& feature) { return this; } // ************************************************************************** void KissDOMImplementation::printAll() { if (DEBUGKISSDOM) { printf("KissDOMImplementation::printAll()\n"); } for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { printNode(0, *ppNode); } } // ************************************************************************** void KissDOMImplementation::printNode( const unsigned long& indent, const Node* node2Print) { if (DEBUGKISSDOM) { printf("KissDOMImplementation::printNode()\n"); } unsigned long i; for (i = 0; i < indent; i++) { printf(" "); } printf("[%li] %s", node2Print->key(), node2Print->nodeName()->c_str()); const DOMString* s = node2Print->nodeValue(); if (s != 0) { printf("='%s'", s->c_str()); } printf("\n"); if (node2Print->namespaceURI() != 0) { for (i = 0; i < indent; i++) { printf(" "); } printf(" (URI='%s')\n", node2Print->namespaceURI()->c_str()); } if (node2Print->attributes() != 0) { if (node2Print->attributes()->length() != 0) { for (i = 0; i < indent; i++) { printf(" "); } printf("Has Attributes (%li):\n", node2Print->attributes()->length()); for (i = 0; i < node2Print->attributes()->length(); i++) { printNode(indent+1, node2Print->attributes()->item(i)); } } } if (node2Print->childNodes()->length() != 0) { for (i = 0; i < indent; i++) { printf(" "); } printf("Has Children (%li):\n", node2Print->childNodes()->length()); for (i = 0; i < node2Print->childNodes()->length(); i++) { printNode(indent+1, node2Print->childNodes()->item(i)); } } } // ************************************************************************** // ************************************************************************** // KissNodeList // ************************************************************************** // ************************************************************************** long nKissNodeLists = 0; //!< Number of KISS node list objects // ************************************************************************** KissNodeList::KissNodeList( const list* yourPNodeList) : myPNodeList(yourPNodeList) { if (DEBUGKISSDOM) { nKissNodeLists++; printf("KissNodeList::KissNodeList();\n"); printf("nKissNodeLists=%li\n", nKissNodeLists); } } // ************************************************************************** KissNodeList::~KissNodeList() { if (DEBUGKISSDOM) { nKissNodeLists--; printf("KissNodeList::~KissNodeList();\n"); printf("nKissNodeLists=%li\n", nKissNodeLists); } } // ************************************************************************** Node* KissNodeList::item( unsigned long index) const { if (index >= myPNodeList->size()) { return 0; } list::const_iterator ppNode = myPNodeList->begin(); for (unsigned long i = 0; i < index; i++) { ppNode++; } return (*ppNode); } // ************************************************************************** unsigned long KissNodeList::length() const { return myPNodeList->size(); } // ************************************************************************** // ************************************************************************** // KissNamedNodeMap // ************************************************************************** // ************************************************************************** long nKissNamedNodeMaps = 0; //!< Number of KISS named node map objects // ************************************************************************** KissNamedNodeMap::KissNamedNodeMap( const unsigned long& yourNodeType) : myNodeType(yourNodeType) { if (DEBUGKISSDOM) { nKissNamedNodeMaps++; printf("KissNamedNodeMap::KissNamedNodeMap();\n"); printf("nKissNamedNodeMaps=%li\n", nKissNamedNodeMaps); } readOnly = 0; } // ************************************************************************** KissNamedNodeMap::~KissNamedNodeMap() { if (DEBUGKISSDOM) { nKissNamedNodeMaps--; printf("KissNamedNodeMap::~KissNamedNodeMap();\n"); printf("nKissNamedNodeMaps=%li\n", nKissNamedNodeMaps); } for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { delete(*ppNode); } } // ************************************************************************** Node* KissNamedNodeMap::getNamedItem( const DOMString& name) const { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::getNamedItem()\n"); } if (DEBUGKISSDOM) { printf("KissNamedNodeMap::getNamedItem() myNodeList.size() = %zd\n", myNodeList.size()); } if (myNodeList.size() == 0) { return 0; } list::const_iterator ppNode = myNodeList.begin(); list::const_iterator ppName = myNameList.begin(); bool found = 0; while ((ppNode != myNodeList.end())&!found) { found = (**ppName == name); if (!found) { ppNode++; ppName++; } } if (ppNode != myNodeList.end()) { return *ppNode; } return 0; } // ************************************************************************** Node* KissNamedNodeMap::setNamedItem( Node& arg) { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::setNamedItem()\n"); } canAddThisNode(arg); if (DEBUGKISSDOM) { printf("arg.nodeName = %s\n", arg.nodeName()->c_str()); } Node* oldNode; try { oldNode = removeNamedItem(*(arg.nodeName())); } catch(DOMException DOMExc) { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::setNamedItem DOMException %s\n", DOMExc.getError()); } oldNode = 0; } myNodeList.push_back(&arg); myNameList.push_back(arg.nodeName()); myNamespaceURIList.push_back(&EMPTY_STRING); return oldNode; } // ************************************************************************** Node* KissNamedNodeMap::removeNamedItem( const DOMString& name) { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::removeNamedItem()\n"); } if (DEBUGKISSDOM) { printf("name is %s\n", name.c_str()); } if (readOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (myNodeList.size() == 0) { throw DOMException(DOMException::NOT_FOUND_ERR); } list::iterator ppNode = myNodeList.begin(); list::iterator ppName = myNameList.begin(); list::iterator ppNamespaceURI = myNamespaceURIList.begin(); bool found = 0; while ((ppNode != myNodeList.end())&!found) { found = (**ppName == name); if (!found) { ppNode++; ppName++; ppNamespaceURI++; } } if (ppNode != myNodeList.end()) { Node* removedNode = *ppNode; myNodeList.erase(ppNode); myNameList.erase(ppName); myNamespaceURIList.erase(ppNamespaceURI); return removedNode; } // if not found by now throw DOMException(DOMException::NOT_FOUND_ERR); } // ************************************************************************** unsigned long KissNamedNodeMap::length() const { return myNodeList.size(); } // ************************************************************************** Node* KissNamedNodeMap::item( const unsigned long index) const { if (index >= myNodeList.size()) { return 0; } list::const_iterator ppNode = myNodeList.begin(); for (unsigned long i = 0; i < index; i++) { ppNode++; } return *ppNode; } // ************************************************************************** Node* KissNamedNodeMap::getNamedItemNS( const DOMString& namespaceURI, const DOMString& localname) const { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::getNamedItemNS()\n"); } if (myNodeList.size() == 0) { return 0; } list::const_iterator ppNode = myNodeList.begin(); list::const_iterator ppName = myNameList.begin(); list::const_iterator ppNamespaceURI = myNamespaceURIList.begin(); bool found = 0; while ((ppNode != myNodeList.end())&!found) { found = (**ppName == localname)&(**ppNamespaceURI == namespaceURI); if (!found) { ppNode++; ppName++; ppNamespaceURI++; } } if (ppNode != myNodeList.end()) { return *ppNode; } return 0; } // ************************************************************************** Node* KissNamedNodeMap::setNamedItemNS( Node& arg) { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::setNamedItemNS()\n"); } canAddThisNode(arg); Node* oldNode; try { oldNode = removeNamedItemNS(*(arg.namespaceURI()), *(arg.localName())); } catch(DOMException DOMExc) { oldNode = 0; } myNodeList.push_back(&arg); myNameList.push_back(arg.localName()); myNamespaceURIList.push_back(arg.namespaceURI()); return oldNode; } // ************************************************************************** Node* KissNamedNodeMap::removeNamedItemNS( const DOMString& namespaceURI, const DOMString& localname) { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::removeNamedItemNS()\n"); } if (readOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (myNodeList.size() == 0) { throw DOMException(DOMException::NOT_FOUND_ERR); } list::iterator ppNode = myNodeList.begin(); list::iterator ppName = myNameList.begin(); list::iterator ppNamespaceURI = myNamespaceURIList.begin(); bool found = 0; while ((ppNode != myNodeList.end()) & !found) { found = (**ppName == localname) & (**ppNamespaceURI == namespaceURI); if (!found) { ppNode++; ppName++; ppNamespaceURI++; } } if (ppNode != myNodeList.end()) { Node* removedNode = *ppNode; myNodeList.erase(ppNode); myNameList.erase(ppName); myNamespaceURIList.erase(ppNamespaceURI); return removedNode; } // if not found by now throw DOMException(DOMException::NOT_FOUND_ERR); } // ************************************************************************** void KissNamedNodeMap::setReadOnly( const bool& newReadOnly) { readOnly = newReadOnly; } // ************************************************************************** const Document* KissNamedNodeMap::ownerDocument() const { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::ownerDocument()\n"); } return myOwnerDocument; } // ************************************************************************** void KissNamedNodeMap::setOwnerDocument( const Document* yourOwnerDocument) { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::setOwnerDocument()\n"); } myOwnerDocument = yourOwnerDocument; } // ************************************************************************** void KissNamedNodeMap::canAddThisNode( const Node& arg) const { if (DEBUGKISSDOM) { printf("KissNamedNodeMap::canAddThisNode()\n"); } if (readOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (arg.ownerDocument() != ownerDocument()) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } if (arg.nodeType() != myNodeType) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } } // ************************************************************************** // ************************************************************************** // KissNode // ************************************************************************** // ************************************************************************** long nKissNodes = 0; //!< Number of KISS node objects // ************************************************************************** KissNode::KissNode( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNodeName) : myKissNodeList(&myNodeList) { if (DEBUGKISSDOM) { nKissNodes++; printf("KissNode::KissNode(); [%s]\n", yourNodeName.c_str()); printf("nKissNodes=%li\n", nKissNodes); } myOwnerDocument = yourOwnerDocument; myParentNode = yourParentNode; myNodeName = yourNodeName; myReadOnly = 0; if (myOwnerDocument != 0) { myDOMKey = myOwnerDocument->getDOMKey(); } else { myDOMKey = 0; } } // ************************************************************************** KissNode::~KissNode() { if (DEBUGKISSDOM) { printf("KissNode::~KissNode(%li); [%s]\n", myDOMKey, myNodeName.c_str()); } for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { if (DEBUGKISSDOM) { printf("deleting *ppNode=%li\n", (long)*ppNode); } delete(*ppNode); } if (DEBUGKISSDOM) { nKissNodes--; printf(" ...(%li); [%s] deleted\n", myDOMKey, myNodeName.c_str()); printf("nKissNodes=%li\n", nKissNodes); } } // ************************************************************************** const DOMString* KissNode::nodeName() const { return &myNodeName; } // ************************************************************************** const DOMString* KissNode::nodeValue() const { return 0; } // ************************************************************************** void KissNode::setNodeValue( const DOMString& newNodeValue) { } // ************************************************************************** Node* KissNode::parentNode() const { return myParentNode; } // ************************************************************************** void KissNode::setParentNode( Node* newParentNode) { if (DEBUGKISSDOM) { printf("KissNode::setParentNode() [%s]\n", nodeName()->c_str()); } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myParentNode = newParentNode; } // ************************************************************************** const NodeList* KissNode::childNodes() const { return &myKissNodeList; } // ************************************************************************** Node* KissNode::firstChild() const { return *myNodeList.begin(); } // ************************************************************************** Node* KissNode::lastChild() const { return *myNodeList.end(); } // ************************************************************************** Node* KissNode::previousSibling() const { if (myParentNode == 0) { return 0; } for (unsigned long i = 0; i < myParentNode->childNodes()->length(); i++) { if ((const Node*) myParentNode->childNodes()->item(i) == this) { return myParentNode->childNodes()->item(i-1); } } return 0; } // ************************************************************************** Node* KissNode::nextSibling() const { if (myParentNode == 0) { return 0; } for (unsigned long i = 0; i < myParentNode->childNodes()->length(); i++) { if ((const Node*) myParentNode->childNodes()->item(i) == this) { return myParentNode->childNodes()->item(i+1); } } return 0; } // ************************************************************************** const NamedNodeMap* KissNode::attributes() const { return 0; } // ************************************************************************** const Document* KissNode::ownerDocument() const { return myOwnerDocument; } // ************************************************************************** void KissNode::setOwnerDocument( const Document *const newOwnerDocument) { if (DEBUGKISSDOM) { printf("KissNode::setOwnerDocument() [%s]\n", nodeName()->c_str()); } myOwnerDocument = newOwnerDocument; myDOMKey = newOwnerDocument->getDOMKey(); for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { (*ppNode)->setOwnerDocument(newOwnerDocument); } } // ************************************************************************** Node* KissNode::insertBefore( Node* newChild, Node* refChild) { if (newChild == 0) { return 0; } if (refChild == 0) { return (appendChild(newChild)); } checkChildAddingConstraints1(newChild); checkChildAddingConstraints2(newChild); list::iterator ppNode = myNodeList.begin(); while ((ppNode != myNodeList.end()) & (*ppNode != refChild)) { ppNode++; } if (*ppNode != refChild) { throw DOMException(DOMException::NOT_FOUND_ERR); } if (newChild->parentNode() != 0) { newChild->parentNode()->removeChild(newChild); } if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) { while (newChild->hasChildNodes()) { Node* nextChild = newChild->removeChild(newChild->firstChild()); nextChild->setParentNode(this); myNodeList.insert(ppNode, nextChild); } } else { newChild->setParentNode(this); myNodeList.insert(ppNode, newChild); } return newChild; } // ************************************************************************** Node* KissNode::replaceChild( Node* newChild, Node* oldChild) { if (newChild == 0) { return 0; } checkChildAddingConstraints1(newChild); checkChildAddingConstraints2(newChild); list::iterator ppNode = myNodeList.begin(); while ((ppNode != myNodeList.end()) & (*ppNode != oldChild)) { ppNode++; } if (*ppNode != oldChild) { throw DOMException(DOMException::NOT_FOUND_ERR); } if (newChild->parentNode() != 0) { newChild->parentNode()->removeChild(newChild); } if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) { while (newChild->hasChildNodes()) { Node* nextChild = newChild->removeChild(newChild->firstChild()); nextChild->setParentNode(this); myNodeList.insert(ppNode, nextChild); } } else { newChild->setParentNode(this); myNodeList.insert(ppNode, newChild); } oldChild->setParentNode(0); myNodeList.erase(ppNode); return oldChild; } // ************************************************************************** Node* KissNode::removeChild( Node* oldChild) { if (oldChild == 0) { return 0; } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } list::iterator ppNode = myNodeList.begin(); while ((ppNode != myNodeList.end()) & (*ppNode != oldChild)) { ppNode++; } if (*ppNode != oldChild) { throw DOMException(DOMException::NOT_FOUND_ERR); } myNodeList.erase(ppNode); oldChild->setParentNode(0); return oldChild; } // ************************************************************************** Node* KissNode::appendChild( Node* newChild) { if (newChild == 0) { return 0; } checkChildAddingConstraints1(newChild); checkChildAddingConstraints2(newChild); if (newChild->parentNode() != 0) { newChild->parentNode()->removeChild(newChild); } if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) { while (newChild->hasChildNodes()) { Node* nextChild = newChild->removeChild(newChild->firstChild()); nextChild->setParentNode(this); myNodeList.push_back(nextChild); } } else { newChild->setParentNode(this); myNodeList.push_back(newChild); } return newChild; } // ************************************************************************** bool KissNode::hasChildNodes() const { return (myNodeList.size() > 0); } // ************************************************************************** void KissNode::normalize() { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } unsigned long i; // firstly remove empty text nodes i = 0; while (i < myNodeList.size()) { Node* testNode = myKissNodeList.item(i); if (testNode->nodeType() == TEXT_NODE) { if (testNode->nodeValue()->length() == 0) { removeChild(testNode); delete testNode; i--; } i++; } } i = 0; while (i+1 < myNodeList.size()) { Node* testNode1 = myKissNodeList.item(i); Node* testNode2 = myKissNodeList.item(i + 1); if ((testNode1->nodeType() == TEXT_NODE) & (testNode2->nodeType() == TEXT_NODE)) { DOMString s = *(testNode1->nodeValue()); s += *(testNode2->nodeValue()); testNode1->setNodeValue(s); removeChild(testNode2); delete testNode2; i--; } i++; } } // ************************************************************************** bool KissNode::isSupported( DOMString& feature, DOMString& version) const { return 0; } // ************************************************************************** const DOMString* KissNode::namespaceURI() const { return 0; } // ************************************************************************** const DOMString* KissNode::prefix() const { return 0; } // ************************************************************************** void KissNode::setPrefix( const DOMString& newPrefix) { } // ************************************************************************** const DOMString* KissNode::localName() const { return 0; } // ************************************************************************** bool KissNode::hasAttributes() const { return 0; } // ************************************************************************** const DOMString* KissNode::baseURI() const { return 0; } // ************************************************************************** Node::DocumentOrder KissNode::compareDocumentOrder( const Node* other) const { if (other == this) { return DOCUMENT_ORDER_SAME; } if (other->ownerDocument() != 0) { if (other->ownerDocument() != myOwnerDocument); { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } else { if (other != myOwnerDocument) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } if (other->nodeType() == ATTRIBUTE_NODE) { return DOCUMENT_ORDER_UNORDERED; } bool passedThisNode = 0; // work forwards from top node looking for other node const Node* nextNode = myOwnerDocument; while (nextNode != 0) { if (nextNode == other) { if (passedThisNode) { return DOCUMENT_ORDER_FOLLOWING; } else { return DOCUMENT_ORDER_PRECEDING; } } passedThisNode = passedThisNode | (nextNode == this); if (nextNode->hasChildNodes()) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & (nextNode->parentNode() != 0)) { nextNode = nextNode->parentNode(); } } if (nextNode != 0) { nextNode = nextNode->nextSibling(); } } return DOCUMENT_ORDER_UNORDERED; } // ************************************************************************** Node::TreePosition KissNode::compareTreePosition( const Node* other) const { if (other == this) { return TREE_POSITION_SAME; } if (other->ownerDocument() != 0) { if (other->ownerDocument() != myOwnerDocument) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } else { if (other != myOwnerDocument) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } const Node* nextNode; // look for other as ancestor nextNode = myParentNode; while (nextNode != 0) { if (nextNode == other) { return TREE_POSITION_ANCESTOR; } nextNode = nextNode->parentNode(); } // look for other as child nextNode = other->parentNode(); while (nextNode != 0) { if (nextNode == this) { return TREE_POSITION_DESCENDANT; } nextNode = nextNode->parentNode(); } // else use document order switch (compareDocumentOrder(other)) { case DOCUMENT_ORDER_PRECEDING : return TREE_POSITION_PRECEDING; break; case DOCUMENT_ORDER_FOLLOWING : return TREE_POSITION_FOLLOWING; break; default : return TREE_POSITION_UNORDERED; } } // ************************************************************************** const DOMString* KissNode::textContent( const bool& deep) const { const DOMString* pS = nodeValue(); if (pS != 0) { myTextContent = *pS; } else { myTextContent = EMPTY_STRING; } if (deep) { for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode ++) { if (((*ppNode)->nodeType() != COMMENT_NODE) & ((*ppNode)->nodeType() != PROCESSING_INSTRUCTION_NODE)) { myTextContent += *(*ppNode)->textContent(deep); } } } else { for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode ++) { if (((*ppNode)->nodeType() == TEXT_NODE) | ((*ppNode)->nodeType() == CDATA_SECTION_NODE)) { myTextContent += *(*ppNode)->textContent(deep); } } } return &myTextContent; } // ************************************************************************** void KissNode::setTextContent( const DOMString& newTextContent) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // delete all children for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { delete(*ppNode); } Node* newTextNode = new KissText(myOwnerDocument, myParentNode, newTextContent); appendChild(newTextNode); } // ************************************************************************** bool KissNode::isSameNode( const Node* other) const { return (other == this); } // ************************************************************************** const DOMString* KissNode::lookupNamespacePrefix( const DOMString& namespaceURI) const { if (DEBUGKISSDOM) { printf("KissNode::lookupNamespacePrefix() [%s]\n", nodeName()->c_str()); } if (namespaceURI.length() == 0) { return 0; } const Node* nextAncestor = this; while (nextAncestor != 0) { if (nextAncestor->hasAttributes()) { for (unsigned long i = 0; i < nextAncestor->attributes()->length(); i++) { if (*nextAncestor->attributes()->item(i)->nodeValue() == namespaceURI) { if (nextAncestor->attributes()->item(i)->namespaceURI() != 0) { if (nextAncestor->attributes()->item(i)->prefix()->eqxmlns()) { return nextAncestor->attributes()->item(i)->localName(); } } } } } nextAncestor = nextAncestor->parentNode(); } return 0; } // ************************************************************************** const DOMString* KissNode::lookupNamespaceURI( const DOMString& prefix) const { if (DEBUGKISSDOM) { printf("KissNode::lookupNamespaceURI() [%s]\n", nodeName()->c_str()); } if (prefix.eqxml()) { return &XML_NAMESPACEURI; } if (prefix.eqxmlns()) { return &XMLNS_NAMESPACEURI; } const Node* nextAncestor = this; while (nextAncestor != 0) { if (nextAncestor->hasAttributes()) { if (prefix.length() > 0) { // look for explicitly defined namespace for (unsigned long i = 0; i < nextAncestor->attributes()->length(); i++) { if (nextAncestor->attributes()->item(i)->namespaceURI() != 0) { if (nextAncestor->attributes()->item(i)->prefix()->eqxmlns() &(*nextAncestor->attributes()->item(i)->localName() == prefix)) { return nextAncestor->attributes()->item(i)->nodeValue(); } } } } else { // look for first default namespace for (unsigned long i = 0; i < nextAncestor->attributes()->length(); i++) { if (nextAncestor->attributes()->item(i)->namespaceURI() != 0) { if (nextAncestor->attributes()->item(i)->nodeName()->eqxmlns()) { return (nextAncestor->attributes()->item(i)->nodeValue()); } } } } } nextAncestor = nextAncestor->parentNode(); } return 0; } // ************************************************************************** void KissNode::normalizeNS() { } // ************************************************************************** DOMKey KissNode::key() const { return myDOMKey; } // ************************************************************************** bool KissNode::equalsNode( const Node* arg, bool deep) const { // check for the obvious first! if (arg == 0) { return 0; } if (arg == this) { return 1; } const DOMString* s1; const DOMString* s2; const NamedNodeMap* a1 = arg->attributes(); const NamedNodeMap* a2 = attributes(); unsigned long i; // compare nodeTypes if (arg->nodeType() != nodeType()) { return 0; } // compare nodeNames if (arg->nodeName() != nodeName()) { return 0; } // compare nodeValues s1 = arg->nodeValue(); s2 = nodeValue(); if ((s1 == 0) != (s1 == 0)) { return 0; } if ((s1 != 0) && (s2 != 0)) { if (*s1 != *s2) { return 0; } } // compare namespaceURIs; s1 = arg->namespaceURI(); s2 = namespaceURI(); if ((s1 == 0) != (s1 == 0)) { return 0; } if ((s1 != 0) && (s2 != 0)) { if (*s1 != *s2) { return 0; } } // compare attributes (if any) if ((a1 == 0) != (a1 == 0)) { return 0; } if (a1 != 0) { if (a1->length() != a2->length()) { return 0; } for (i = 0; i < a1->length(); i++) { if (!a1->item(i)->equalsNode(a2->item(i), deep)) { return 0; } } } if (deep) { // compare children if (arg->childNodes()->length() != childNodes()->length()) { return 0; } for (i = 0; i < childNodes()->length(); i++) { if (!childNodes()->item(i)->equalsNode(arg->childNodes()->item(i), deep)) { return 0; } } } // well, if we have gotten this far then these nodes must be, // to all intents, equal! return 1; } // ************************************************************************** Node* KissNode::getAs( DOMString& feature) { return this; } // ************************************************************************** bool KissNode::readOnly() const { return myReadOnly; } // ************************************************************************** void KissNode::setReadOnly( const bool& newReadOnly, const bool& deep) { myReadOnly = newReadOnly; if (deep) { for (list::const_iterator ppNode = myNodeList.begin(); ppNode != myNodeList.end(); ppNode++) { (*ppNode)->setReadOnly(newReadOnly, deep); } } } // ************************************************************************** void KissNode::checkChildAddingConstraints1( const Node* newChild) const { // this node is not read only if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // that new node's parent is not read only - // i.e. it will allow this node to be removed from it if (newChild->parentNode() != 0) { if (newChild->parentNode()->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } } // if the new node is a document fragment node that is itself // not read only - i.e. it will allow its children to be removed if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) { if (newChild->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } } // that the node to add is not this node or one of its ancestors const Node* ancestorNode = this; while (ancestorNode != 0) { if (newChild == ancestorNode) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } ancestorNode = ancestorNode->parentNode(); } // new node has same owner document if (myOwnerDocument == 0) { if (nodeType() == DOCUMENT_NODE) { // I am a document! if ((const Node*) newChild->ownerDocument() != this) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } else if (newChild->ownerDocument() != myOwnerDocument) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } } } // ************************************************************************** void KissNode::checkChildAddingConstraints2( const Node* newChild) const { // this base class routine only checks that the new child is not // an illegal type to add to the majority of other classes. // the Document and Attr classes have more stringent constraints // and so these classes override this function switch (newChild->nodeType()) { case DOCUMENT_NODE : case DOCUMENT_TYPE_NODE : case ATTRIBUTE_NODE : case ENTITY_NODE : case NOTATION_NODE : throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); break; } } // ************************************************************************** // ************************************************************************** // KissDocument // ************************************************************************** // ************************************************************************** long nKissDocuments = 0; //!< Number of KISS document objects // ************************************************************************** unsigned long KissDocument::nodeType() const { return DOCUMENT_NODE; } // ************************************************************************** void KissDocument::setParentNode( Node* newParentNode) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** void KissDocument::setOwnerDocument( const Document *const newOwnerDocument) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** Node* KissDocument::insertBefore( Node* newChild, Node* refChild) { if (refChild == 0) { return appendChild(newChild); } if (newChild == 0) { return 0; } // may only have one DOCUMENT_TYPE_NODE if ((newChild->nodeType() == DOCUMENT_TYPE_NODE) & (myDoctype != 0)) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // may only have one ELEMENT_NODE if ((newChild->nodeType() == ELEMENT_NODE) & (myDocumentElement != 0)) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } KissNode::insertBefore(newChild, refChild); if (newChild->nodeType() == DOCUMENT_TYPE_NODE) { myDoctype = newChild; } if (newChild->nodeType() == ELEMENT_NODE) { myDocumentElement = newChild; } return newChild; } // ************************************************************************** Node* KissDocument::replaceChild( Node* newChild, Node* oldChild) { if (newChild == 0) { return 0; } KissNode::replaceChild(newChild, oldChild); if (newChild->nodeType() == DOCUMENT_TYPE_NODE) { myDoctype = newChild; } if (newChild->nodeType() == ELEMENT_NODE) { myDocumentElement = newChild; } return oldChild; } // ************************************************************************** Node* KissDocument::removeChild( Node* oldChild) { KissNode::removeChild(oldChild); if (oldChild->nodeType() == DOCUMENT_TYPE_NODE) { myDoctype = 0; } if (oldChild->nodeType() == ELEMENT_NODE) { myDocumentElement = 0; } return oldChild; } // ************************************************************************** Node* KissDocument::appendChild( Node* newChild) { if (newChild == 0) { return 0; } // may only have one DOCUMENT_TYPE_NODE if ((newChild->nodeType() == DOCUMENT_TYPE_NODE) & (myDoctype != 0)) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // may only have one ELEMENT_NODE if ((newChild->nodeType() == ELEMENT_NODE) & (myDocumentElement != 0)) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } KissNode::appendChild(newChild); if (newChild->nodeType() == DOCUMENT_TYPE_NODE) { myDoctype = newChild; } if (newChild->nodeType() == ELEMENT_NODE) { myDocumentElement = newChild; } return newChild; } // ************************************************************************** Node* KissDocument::cloneNode( const bool& deep) const { Document* newDocument = new KissDocument(myDOMImplementation); newDocument->setActualEncoding(myActualEncoding); newDocument->setEncoding(myEncoding); newDocument->setVersion(myVersion); newDocument->setStandalone(myStandalone); newDocument->setStrictErrorChecking(myStrictErrorChecking); if (deep) { for (unsigned long i = 0; i < childNodes()->length(); i++) { Node* newChild = childNodes()->item(i)->cloneNode(deep); newChild->setOwnerDocument(this); newDocument->appendChild(newChild); } } return newDocument; } // ************************************************************************** const DOMString* KissDocument::namespaceURI() const { return &myNamespaceURI; } // ************************************************************************** Node::DocumentOrder KissDocument::compareDocumentOrder( const Node* other) const { if (other == this) { return DOCUMENT_ORDER_SAME; } if (other->ownerDocument() != this) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } if (other->nodeType() == ATTRIBUTE_NODE) { return DOCUMENT_ORDER_UNORDERED; } return DOCUMENT_ORDER_FOLLOWING; } // ************************************************************************** Node::TreePosition KissDocument::compareTreePosition( const Node* other) const { if (other == this) { return TREE_POSITION_SAME; } if (other->ownerDocument() != this) { throw DOMException(DOMException::WRONG_DOCUMENT_ERR); } return TREE_POSITION_DESCENDANT; } // ************************************************************************** void KissDocument::setTextContent( const DOMString& newTextContent) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** void KissDocument::normalizeNS() { if (myDocumentElement != 0) { myDocumentElement->normalizeNS(); } } // ************************************************************************** void KissDocument::checkChildAddingConstraints2( const Node* newChild) const { switch (newChild->nodeType()) { case DOCUMENT_TYPE_NODE : case ELEMENT_NODE : case PROCESSING_INSTRUCTION_NODE : case COMMENT_NODE : break; case DOCUMENT_FRAGMENT_NODE : for (unsigned long i = 0; i < newChild->childNodes()->length(); i++) { unsigned long nextType = newChild->childNodes()->item(i)->nodeType(); if (!((nextType == PROCESSING_INSTRUCTION_NODE) | (nextType == COMMENT_NODE))) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } } break; default : throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } } // ************************************************************************** KissDocument::KissDocument( const DOMImplementation* yourDOMImplementation) : KissNode(0, 0, "#document"), myElementNodeList(&myElementList) { if (DEBUGKISSDOM) { nKissDocuments++; printf("KissDocument::KissDocument(); [%s]\n", nodeName()->c_str()); printf("nKissDocuments=%li\n", nKissDocuments); } myDoctype = 0; myDocumentElement = 0; nextKey = 0; myDOMImplementation = yourDOMImplementation; myStandalone = 0; myStrictErrorChecking = 1; } // ************************************************************************** KissDocument::~KissDocument() { if (DEBUGKISSDOM) { nKissDocuments--; printf("KissDocument::~KissDocument(); [%s]\n", nodeName()->c_str()); printf("nKissDocuments=%li\n", nKissDocuments); } } // ************************************************************************** DOMKey KissDocument::getDOMKey() const { nextKey++; return nextKey; } // ************************************************************************** const DocumentType* KissDocument::doctype() const { return dynamic_cast(myDoctype); } // ************************************************************************** const DOMImplementation* KissDocument::implementation() const { return myDOMImplementation; } // ************************************************************************** Element* KissDocument::documentElement() const { return dynamic_cast(myDocumentElement); } // ************************************************************************** Element* KissDocument::createElement( const DOMString &tagName) { if (DEBUGKISSDOM) { printf("KissDocument::createElement(); [%s]\n", nodeName()->c_str()); } if ((!tagName.isName()) | tagName.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } return new KissElement(this, 0, "", tagName); } // ************************************************************************** DocumentFragment* KissDocument::createDocumentFragment() { return new KissDocumentFragment(this); } // ************************************************************************** Text* KissDocument::createTextNode( const DOMString &data) { return new KissText(this, 0, data); } // ************************************************************************** Comment* KissDocument::createComment( const DOMString &data) { return new KissComment(this, 0, data); } // ************************************************************************** CDATASection* KissDocument::createCDATASection( const DOMString &data) { return new KissCDATASection(this, 0, data); } // ************************************************************************** ProcessingInstruction* KissDocument::createProcessingInstruction( const DOMString &target, const DOMString &data) { if (target.hasIllegalCharacters()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } return new KissProcessingInstruction(this, 0, target, data); } // ************************************************************************** Attr* KissDocument::createAttribute( const DOMString &name) { if (DEBUGKISSDOM) { printf("KissDocument::createAttribute(); [%s]\n", nodeName()->c_str()); } if ((!name.isName()) | name.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } return new KissAttr(ownerDocument(), 0, "", name, 1); } // ************************************************************************** EntityReference* KissDocument::createEntityReference( const DOMString &name) { if (name.hasIllegalCharacters()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } return new KissEntityReference(this, 0, name); } // ************************************************************************** NodeList* KissDocument::getElementsByTagName( const DOMString &tagName) { myElementList.clear(); Node* nextNode = myDocumentElement; while (nextNode != 0) { if (nextNode->nodeType() == ELEMENT_NODE) { if (tagName == "*") { myElementList.push_back(nextNode); } else if (*nextNode->nodeName() == tagName) { myElementList.push_back(nextNode); } } if (nextNode->hasChildNodes()) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & (nextNode->parentNode() != 0)) { nextNode = nextNode->parentNode(); } } if (nextNode != 0) { nextNode = nextNode->nextSibling(); } } return &myElementNodeList; } // ************************************************************************** Node* KissDocument::importNode( const Node* importNode, const bool &deep) { if ((importNode->nodeType() == DOCUMENT_NODE) | (importNode->nodeType() == DOCUMENT_TYPE_NODE)) { throw DOMException(DOMException::NOT_SUPPORTED_ERR); } Node* newNode; if (importNode->nodeType() == ATTRIBUTE_NODE) { newNode = importNode->cloneNode(1); } else { newNode = importNode->cloneNode(deep); } return adoptNode(newNode); } // ************************************************************************** Element* KissDocument::createElementNS( const DOMString& namespaceURI, const DOMString& qualifiedName) { if (DEBUGKISSDOM) { printf("KissDocument::createElementNS(); [%s]\n", nodeName()->c_str()); } if (!qualifiedName.isNSWellFormed()) { throw DOMException(DOMException::NAMESPACE_ERR); } DOMString namePrefix; DOMString nameLocalPart; // We are definicately making a namespace element. if (qualifiedName.splitNSName(namePrefix, nameLocalPart)) { // was a namespace name // if the prefix is xml the namespaceURI must be exactly XML_NAMESPACEURI if (namePrefix.eqxml()) { if (namespaceURI != XML_NAMESPACEURI) { throw DOMException(DOMException::NAMESPACE_ERR); } } else if ((!namePrefix.isNCName()) | namePrefix.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if ((!nameLocalPart.isNCName()) | nameLocalPart.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } else { // was not a namespace name, in which case the usual xml criterior apply. if ((!qualifiedName.isName()) | qualifiedName.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } return new KissElement(this, 0, namespaceURI, qualifiedName); } // ************************************************************************** Attr* KissDocument::createAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName) { if (DEBUGKISSDOM) { printf("KissDocument::createAttributeNS(); [%s]\n", nodeName()->c_str()); } if (!qualifiedName.isNSWellFormed()) { throw DOMException(DOMException::NAMESPACE_ERR); } DOMString namePrefix; DOMString nameLocalPart; if (qualifiedName.splitNSName(namePrefix, nameLocalPart)) { // was a namespace name // if the prefix is xml the namespaceURI must be exactly XML_NAMESPACEURI if (namePrefix.eqxml()) { // if the prefix is xml // the namespaceURI must be exactly XML_NAMESPACEURI if (namespaceURI != XML_NAMESPACEURI) { throw DOMException(DOMException::NAMESPACE_ERR); } } else if (namePrefix.eqxmlns()) { // or if the prefix is xmlns // the namespaceURI must be exactly XMLNS_NAMESPACEURI if (namespaceURI != XMLNS_NAMESPACEURI) { throw DOMException(DOMException::NAMESPACE_ERR); } } else if ((!namePrefix.isNCName()) | namePrefix.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if ((!nameLocalPart.isNCName()) | nameLocalPart.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } else { // was not a namespace name, in which case the name may be 'xmlns' // or any other normal xml name, if (!qualifiedName.eqxmlns()) { if ((qualifiedName.isName()) | qualifiedName.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } } return new KissAttr(ownerDocument(), 0, namespaceURI, qualifiedName, 1); } // ************************************************************************** NodeList* KissDocument::getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname) { if (namespaceURI.length() == 0) { return getElementsByTagName(localname); } myElementList.clear(); Node* nextNode = myDocumentElement; while (nextNode != 0) { if (nextNode->nodeType() == ELEMENT_NODE) { if (nextNode->namespaceURI() != 0) { if (localname == "*") { myElementList.push_back(nextNode); } else if ((*nextNode->namespaceURI() == namespaceURI) & (*nextNode->localName() == localname)) { myElementList.push_back(nextNode); } } } if (nextNode->hasChildNodes()) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & (nextNode->parentNode() != 0)) { nextNode = nextNode->parentNode(); } } if (nextNode != 0) { nextNode = nextNode->nextSibling(); } } return &myElementNodeList; } // ************************************************************************** Element* KissDocument::getElementById( const DOMString& elementId) { return 0; } // ************************************************************************** const DOMString* KissDocument::actualEncoding() const { return &myActualEncoding; } // ************************************************************************** void KissDocument::setActualEncoding( const DOMString& newActualEncoding) { myActualEncoding = newActualEncoding; } // ************************************************************************** const DOMString* KissDocument::encoding() const { return &myEncoding; } // ************************************************************************** void KissDocument::setEncoding( const DOMString& newEncoding) { myEncoding = newEncoding; } // ************************************************************************** bool KissDocument::standalone() const { return myStandalone; } // ************************************************************************** void KissDocument::setStandalone( const bool& newStandalone) { myStandalone = newStandalone; } // ************************************************************************** bool KissDocument::strictErrorChecking() const { return myStrictErrorChecking; } // ************************************************************************** void KissDocument::setStrictErrorChecking( const bool& newStrictErrorChecking) { myStrictErrorChecking = newStrictErrorChecking; } // ************************************************************************** const DOMString* KissDocument::version() const { return &myVersion; } // ************************************************************************** void KissDocument::setVersion( const DOMString& newVersion) { myVersion = newVersion; } // ************************************************************************** Node* KissDocument::adoptNode( Node* source) { if (source->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (source->parentNode() != 0) { if (source->parentNode()->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } source->parentNode()->removeChild(source); } if (source->ownerDocument() != 0) { if (source->ownerDocument()->implementation() != myDOMImplementation) { return 0; } } if ((source->nodeType() == DOCUMENT_NODE) | (source->nodeType() == DOCUMENT_TYPE_NODE)) { throw DOMException(DOMException::NOT_SUPPORTED_ERR); } Node* nextNode; if ((source->nodeType() == ATTRIBUTE_NODE) |(source->nodeType() == DOCUMENT_FRAGMENT_NODE) |(source->nodeType() == ELEMENT_NODE) |(source->nodeType() == ENTITY_REFERENCE_NODE)) { // need to check that there are no read only nodes in source's subtree nextNode = source->firstChild(); while (nextNode != 0) { if (nextNode->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (nextNode->hasChildNodes()) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & (nextNode->parentNode() != 0) & (nextNode != source)) { nextNode = nextNode->parentNode(); } } if (nextNode == source) { nextNode = 0; } if (nextNode != 0) { nextNode = nextNode->nextSibling(); } } } Attr* attrNode; nextNode = source; while (nextNode != 0) { switch (nextNode->nodeType()) { case ATTRIBUTE_NODE: attrNode = dynamic_cast(nextNode); attrNode->setOwnerElement(0); attrNode->setSpecified(1); break; case ELEMENT_NODE: // we are supposed to remove unspecified attributes here // how do we do this? break; case ENTITY_REFERENCE_NODE: while (nextNode->hasChildNodes()) { delete nextNode->removeChild(source->firstChild()); } break; case DOCUMENT_FRAGMENT_NODE: case PROCESSING_INSTRUCTION_NODE: case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: break; default : return 0; } if (nextNode->hasChildNodes()) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & (nextNode->parentNode() != 0) & (nextNode != source)) { nextNode = nextNode->parentNode(); } } if (nextNode == source) { nextNode = 0; } if (nextNode != 0) { nextNode = nextNode->nextSibling(); } } source->setOwnerDocument(this); return source; } // ************************************************************************** void KissDocument::setBaseURI( const DOMString *const baseURI) { } // ************************************************************************** // ************************************************************************** // KissElement // ************************************************************************** // ************************************************************************** long nKissElements = 0; //!< Number of KISS element objects // ************************************************************************** unsigned long KissElement::nodeType() const { return Node::ELEMENT_NODE; } // ************************************************************************** const NamedNodeMap* KissElement::attributes() const { return &myAttributesMap; } // ************************************************************************** void KissElement::setOwnerDocument( const Document *const newOwnerDocument) { if (DEBUGKISSDOM) { printf("KissElement::setOwnerDocument() [%s]\n", nodeName()->c_str()); } KissNode::setOwnerDocument(newOwnerDocument); myAttributesMap.setOwnerDocument(newOwnerDocument); for (unsigned long i = 0; i < myAttributesMap.length(); i++) { myAttributesMap.item(i)->setOwnerDocument(newOwnerDocument); } } // ************************************************************************** Node* KissElement::cloneNode( const bool& deep) const { Element* newElement = new KissElement(ownerDocument(), 0, myNamespaceURI, myNodeName); for (unsigned long i = 0; i < myAttributesMap.length(); i++) { Attr* nextAttr = dynamic_cast(myAttributesMap.item(i)); Attr* newAttr = dynamic_cast(myAttributesMap.item(i)->cloneNode(deep)); newAttr->setSpecified(nextAttr->specified()); newElement->setAttributeNode(*newAttr); } if (deep) { for (unsigned long i = 0; i < childNodes()->length(); i++) { newElement->appendChild(childNodes()->item(i)->cloneNode(deep)); } } return newElement; } // ************************************************************************** const DOMString* KissElement::namespaceURI() const { return &myNamespaceURI; } // ************************************************************************** const DOMString* KissElement::prefix() const { return &myPrefix; } // ************************************************************************** void KissElement::setPrefix( const DOMString& newPrefix) { // if I am not a namespace element do nothing if (myNamespaceURI.length() == 0) { return; } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (newPrefix == 0) { throw DOMException(DOMException::NAMESPACE_ERR); } if (!newPrefix.isNCName()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if (newPrefix.eqxml() &(myNamespaceURI != XML_NAMESPACEURI)) { throw DOMException(DOMException::NAMESPACE_ERR); } myPrefix = newPrefix; if (myPrefix.length() != 0) { myNodeName = myPrefix; myNodeName += ":"; myNodeName += myLocalname; } else myNodeName = myLocalname; } // ************************************************************************** const DOMString* KissElement::localName() const { return &myLocalname; } // ************************************************************************** bool KissElement::hasAttributes() const { return (myAttributesMap.length() != 0); } // ************************************************************************** void KissElement::normalizeNS() { enum { ACTION_ARBITRARY_PREFIX = 1, ACTION_CHANGE_PREFIX = 2, ACTION_NEW_BINDING = 4 }; unsigned long i; unsigned long action; const DOMString* boundPrefix = 0; const DOMString* boundURI = 0; DOMString newAttrName; const DOMString* newPrefix =0; if (DEBUGKISSDOM) { printf("KissElement::normalizeNS() [%s]\n", nodeName()->c_str()); } if (myReadOnly) { return; } for (i = 0; i < myAttributesMap.length(); i++) { if (myAttributesMap.item(i)->readOnly()) { return; } } // examine element's namespace action = 0; if (myNamespaceURI.length() > 0) { if (DEBUGKISSDOM) { printf(" I have a namespaceURI:\n"); printf(" myPrefix = '%s'\n", myPrefix.c_str()); printf(" myLocalname = '%s'\n", myNamespaceURI.c_str()); printf(" myNamespaceURI = '%s'\n", myNamespaceURI.c_str()); } if (myPrefix.eqxml()) { if (DEBUGKISSDOM) { printf(" Element tag is already NS well formed.\n"); } } else { boundPrefix = lookupNamespacePrefix(myNamespaceURI); bool needNewBinding = 0; if (boundPrefix == 0) { needNewBinding = 1; } else if (*boundPrefix != myPrefix) { needNewBinding = 1; } if (needNewBinding) { if (DEBUGKISSDOM) { printf(" There is either no prefix bound to myNamespaceURI\n"); printf(" or else there is one that is different to mine\n"); printf(" I need a new binding.\n"); } newPrefix = &myPrefix; action |= ACTION_NEW_BINDING; } else { if (DEBUGKISSDOM) { printf(" Prefix binding found, and is same as mine.\n"); } } } } else { if (DEBUGKISSDOM) { printf(" I am not a namespace element.\n"); printf(" myNodeName = '%s'\n", myNodeName.c_str()); } DOMString namePrefix; DOMString nameLocalPart; if (myNodeName.splitNSName(namePrefix, nameLocalPart)) { if (DEBUGKISSDOM) { printf(" I have a prefix in my name.\n"); printf(" Looking for bound URI.\n"); } boundURI = lookupNamespaceURI(namePrefix); if (boundURI != 0) { printf("Namespace error in Element '%s'\n", nodeName()->c_str()); printf(" Element has no declared namespace but has the prefix '%s'\n", namePrefix.c_str()); printf(" which is otherwise bound to '%s'\n", boundURI->c_str()); return; } else { if (DEBUGKISSDOM) { printf(" There is no URI bound to my prefix. I may be skipped.\n"); } } } else { if (DEBUGKISSDOM) { printf(" I do not have a prefix in my name.\n"); printf(" Looking for default URI binding.\n"); } boundURI = lookupNamespaceURI(""); if (boundURI != 0) { if (DEBUGKISSDOM) { printf(" There is a default namespaceURI binding\n"); printf(" for my empty prefix and so I must override\n"); printf(" it by becoming a namespace element\n"); printf(" and creating a new empty default namespace.\n"); } newPrefix = &myPrefix; action |= ACTION_NEW_BINDING; } else { if (DEBUGKISSDOM) { printf(" There is no default URI binding.\n"); } } } } // now process actions if (action && ACTION_NEW_BINDING) { newAttrName = "xmlns"; if (newPrefix->length() != 0) { newAttrName += ":"; newAttrName += *newPrefix; } if (DEBUGKISSDOM) { printf(" Creating binding %s='%s'.\n", newAttrName.c_str(), myNamespaceURI.c_str()); } setAttributeNS(XMLNS_NAMESPACEURI, newAttrName, myNamespaceURI); } // examine attributes' namespaces for (i = 0; i < myAttributesMap.length(); i++) { action = 0; const DOMString* attributePrefix = myAttributesMap.item(i)->prefix(); const DOMString* attributeLocalname = myAttributesMap.item(i)->localName(); const DOMString* attributeNodeName = myAttributesMap.item(i)->nodeName(); const DOMString* attributeURI = myAttributesMap.item(i)->namespaceURI(); if (DEBUGKISSDOM) { printf(" Examining attribute %li:\n", i); } if (attributeURI->length() != 0) { if (DEBUGKISSDOM) { printf(" Attribute has a namespaceURI:\n"); printf(" attributePrefix = '%s'\n", attributePrefix->c_str()); printf(" attributeLocalname = '%s'\n", attributeLocalname->c_str()); printf(" attributeURI = '%s'\n", attributeURI->c_str()); } if (attributePrefix->eqxml() | attributePrefix->eqxmlns() | attributeNodeName->eqxmlns()) { if (DEBUGKISSDOM) { printf(" Attribute is already NS well formed.\n"); } } else { bool needNewPrefix = 0; if (attributePrefix->length() == 0) { if (DEBUGKISSDOM) { printf(" Attribute has zero length prefix. Will need a new one.\n"); } needNewPrefix = 1; } else { boundURI = lookupNamespaceURI(*attributePrefix); if (boundURI != 0) { if (*boundURI != *attributeURI) { if (DEBUGKISSDOM) { printf(" Attribute has a prefix which is already bound to\n" " a different URI. Will need a new one.\n"); } needNewPrefix = 1; } } } if (needNewPrefix) { if (DEBUGKISSDOM) { printf(" Looking for non-default binding\n"); } boundPrefix = lookupNamespacePrefixNonDefault(*attributeURI); if (boundPrefix == 0) { if (DEBUGKISSDOM) { printf(" No non-default binding found.\n"); printf(" Will need to create arbitrary prefix.\n"); } action |= ACTION_ARBITRARY_PREFIX|ACTION_NEW_BINDING; } else { if (DEBUGKISSDOM) { printf(" Non-default binding found (%s).\n", boundPrefix->c_str()); printf(" Will change prefix to this.\n"); } newPrefix = boundPrefix; action |= ACTION_CHANGE_PREFIX; } } else { if (DEBUGKISSDOM){ printf(" Attribute has a prefix which is not already bound to\n"); printf(" a different URI. Looking for non-default binding.\n"); } boundPrefix = lookupNamespacePrefixNonDefault(*attributeURI); if (boundPrefix == 0) { if (DEBUGKISSDOM) { printf(" No non-default binding found.\n"); printf(" Will need to create new binding.\n"); } action |= ACTION_NEW_BINDING; } else { if (DEBUGKISSDOM) { printf(" Non-default binding found (%s).\n", boundPrefix->c_str()); printf(" Will change prefix to this.\n"); } newPrefix = boundPrefix; action |= ACTION_CHANGE_PREFIX; } } } } else { if (DEBUGKISSDOM) { printf(" Attribute is not a namespace attribute:\n"); printf(" attributeNodeName = '%s'\n", attributeNodeName->c_str()); } if (attributeNodeName->eqxmlns()) { if (DEBUGKISSDOM) { printf(" Attribute is already NS well formed.\n"); } } else { DOMString namePrefix; DOMString nameLocalPart; if (attributeNodeName->splitNSName(namePrefix, nameLocalPart)) { if (DEBUGKISSDOM) { printf(" Attribute has a prefix in its name.\n"); printf(" Looking for bound URI.\n"); } boundURI = lookupNamespaceURI(namePrefix); if (boundURI != 0) { printf("Namespace error in attribute '%s'\n", nodeName()->c_str()); printf(" Attribute has no declared namespace but has the prefix '%s'\n", namePrefix.c_str()); printf(" which is otherwise bound to '%s'\n", boundURI->c_str()); return; } else { if (DEBUGKISSDOM) { printf(" There is no URI bound to my prefix. I may be skipped.\n"); } } } else { if (DEBUGKISSDOM) { printf(" I do not have a prefix in my name.\n"); printf(" I am fine as I am.\n"); } } } } // process actions if (action && ACTION_ARBITRARY_PREFIX) { if (DEBUGKISSDOM) { printf(" Creating arbitrary prefix.\n"); } char s[100]; sprintf(s, "DOMImplied%li", ownerDocument()->getDOMKey()); myAttributesMap.item(i)->setPrefix(s); } if (action && ACTION_CHANGE_PREFIX) { if (DEBUGKISSDOM) { printf(" Changing attribute prefix to '%s'.\n", newPrefix->c_str()); } myAttributesMap.item(i)->setPrefix(*newPrefix); } if (action && ACTION_NEW_BINDING) { newAttrName = "xmlns"; if (newPrefix->length() != 0) { newAttrName += ":"; newAttrName += *newPrefix; } if (DEBUGKISSDOM) { printf(" Creating binding %s='%s'.\n", newAttrName.c_str(), attributeURI->c_str()); } setAttributeNS(XMLNS_NAMESPACEURI, newAttrName, myNamespaceURI); } } // move on to children for (i = 0; i < childNodes()->length(); i++) { childNodes()->item(i)->normalizeNS(); } } // ************************************************************************** KissElement::KissElement( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNamespaceURI, const DOMString& yourTagName) : KissNode(yourOwnerDocument, yourParentNode, yourTagName), myAttributesMap(ATTRIBUTE_NODE), myElementNodeList(&myElementList), myNamespaceURI(yourNamespaceURI) { if (DEBUGKISSDOM) { nKissElements++; printf("KissElement::KissElement(); [%s]\n", nodeName()->c_str()); printf("nKissElements=%li\n", nKissElements); } yourTagName.splitNSName(myPrefix, myLocalname); myAttributesMap.setOwnerDocument(yourOwnerDocument); } // ************************************************************************** KissElement::~KissElement() { if (DEBUGKISSDOM) { nKissElements--; printf("KissElement::~KissElement(); [%s]\n", myNodeName.c_str()); printf("nKissElements=%li\n", nKissElements); } } // ************************************************************************** const DOMString* KissElement::tagName() const { return &myNodeName; } // ************************************************************************** const DOMString* KissElement::getAttribute( const DOMString& name) const { if (DEBUGKISSDOM) { printf("KissElement::getAttribute() myAttributesMap.length() = %ld\n", myAttributesMap.length()); } const Node* oldNode = myAttributesMap.getNamedItem(name); if (oldNode == 0) { return &EMPTY_STRING; } else { return oldNode->nodeValue(); } } // ************************************************************************** void KissElement::setAttribute( const DOMString& name, const DOMString& value) { if (DEBUGKISSDOM) { printf("KissElement::setAttribute(); [%s]\n", nodeName()->c_str()); } if (DEBUGKISSDOM) { printf("KissElement::setAttribute(); name = %s, value = %s\n", name.c_str(), value.c_str()); } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if ((!name.isName()) | name.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } Node* oldNode = myAttributesMap.getNamedItem(name); if (oldNode != 0) { oldNode->setNodeValue(value); } else { Node* newAttr = new KissAttr(ownerDocument(), this, "", name, 1); newAttr->setNodeValue(value); myAttributesMap.setNamedItem(*newAttr); } } // ************************************************************************** void KissElement::removeAttribute( const DOMString& name) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } try { Node* oldNode = myAttributesMap.removeNamedItem(name); if (oldNode != 0) { delete oldNode; } } catch(DOMException) { }; } // ************************************************************************** Attr* KissElement::getAttributeNode( const DOMString& name) { return dynamic_cast(myAttributesMap.getNamedItem(name)); } // ************************************************************************** Attr* KissElement::setAttributeNode( Attr& newAttr) { if (myReadOnly | newAttr.readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (newAttr.ownerElement() != 0) { throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR); } newAttr.setOwnerElement(this); return dynamic_cast(myAttributesMap.setNamedItem(newAttr)); } // ************************************************************************** Attr* KissElement::removeAttributeNode( Attr& oldAttr) { return dynamic_cast (myAttributesMap.removeNamedItem(*oldAttr.nodeName())); } // ************************************************************************** const NodeList* KissElement::getElementsByTagName( const DOMString& tagName, const bool& deep) const { myElementList.clear(); Node* nextNode = firstChild(); while ((const Node*) nextNode != this) { if (nextNode->nodeType() == ELEMENT_NODE) { if (tagName == "*") { myElementList.push_back(nextNode); } else if (*nextNode->nodeName() == tagName) { myElementList.push_back(nextNode); } } if (nextNode->hasChildNodes()&deep) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & ((const Node*) nextNode != this)) { nextNode = nextNode->parentNode(); } if ((const Node*) nextNode != this) { nextNode = nextNode->nextSibling(); } } } return &myElementNodeList; } // ************************************************************************** const DOMString* KissElement::getAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const { if (namespaceURI.length()>0) { return getAttribute(localname); } Node* oldNode = myAttributesMap.getNamedItemNS(namespaceURI, localname); if (oldNode != 0) { return oldNode->nodeValue(); } else { return &EMPTY_STRING; } } // ************************************************************************** void KissElement::setAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName, const DOMString& value) { if (DEBUGKISSDOM) { printf("KissElement::setAttributeNS()\n"); } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (!qualifiedName.isNSWellFormed()) { throw DOMException(DOMException::NAMESPACE_ERR); } if (namespaceURI.length() == 0) { return setAttribute(qualifiedName, value); } DOMString namePrefix; DOMString nameLocalPart; Node* oldNode; // We are definitely making a namespace attribute. if (qualifiedName.splitNSName(namePrefix, nameLocalPart)) { // was a namespace name // if the prefix is xml the namespaceURI must be exactly XML_NAMESPACEURI if (namePrefix.eqxml()) { // if the prefix is xml // the namespaceURI must be exactly XML_NAMESPACEURI if (namespaceURI != XML_NAMESPACEURI) { throw DOMException(DOMException::NAMESPACE_ERR); } } else if (namePrefix.eqxmlns()) { // or if the prefix is xmlns // the namespaceURI must be exactly XMLNS_NAMESPACEURI if (namespaceURI != XMLNS_NAMESPACEURI) { throw DOMException(DOMException::NAMESPACE_ERR); } } else if ((!namePrefix.isNCName()) | namePrefix.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if ((!nameLocalPart.isNCName()) | nameLocalPart.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } oldNode = myAttributesMap.getNamedItemNS(namespaceURI, nameLocalPart); } else { // was not a namespace name, in which case the name may be 'xmlns' // or anything not begining with xml, if (!qualifiedName.eqxmlns()) { if ((!qualifiedName.isName()) | qualifiedName.beginsWithxml()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } } oldNode = myAttributesMap.getNamedItemNS(namespaceURI, qualifiedName); } if (oldNode != 0) { oldNode->setPrefix(namePrefix); oldNode->setNodeValue(value); } else { Node* newAttr = new KissAttr(ownerDocument(), this, namespaceURI, qualifiedName, 1); newAttr->setNodeValue(value); myAttributesMap.setNamedItemNS(*newAttr); } } // ************************************************************************** void KissElement::removeAttributeNS( const DOMString& namespaceURI, const DOMString& localname) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (namespaceURI.length() == 0) { removeAttribute(localname); } try { Node* oldNode = myAttributesMap.removeNamedItemNS(namespaceURI, localname); if (oldNode != 0) { delete oldNode; } } catch(DOMException) { }; } // ************************************************************************** Attr* KissElement::getAttributeNodeNS( const DOMString& namespaceURI, const DOMString& localname) { if (namespaceURI.length() == 0) { return getAttributeNode(localname); } return dynamic_cast (myAttributesMap.getNamedItemNS(namespaceURI, localname)); } // ************************************************************************** Attr* KissElement::setAttributeNodeNS( Attr& newAttr) { if (myReadOnly | newAttr.readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (newAttr.ownerElement() != 0) { throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR); } newAttr.setOwnerElement(this); return dynamic_cast(myAttributesMap.setNamedItemNS(newAttr)); } // ************************************************************************** NodeList* KissElement::getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname) { myElementList.clear(); Node* nextNode = firstChild(); while (nextNode != 0) { if (nextNode->nodeType() == ELEMENT_NODE) { if (nextNode->namespaceURI()->length() > 0) { if (localname == "*") { myElementList.push_back(nextNode); } else if ((*nextNode->namespaceURI() == namespaceURI) & (*nextNode->localName() == localname)) { myElementList.push_back(nextNode); } } } if (nextNode->hasChildNodes()) { nextNode = nextNode->firstChild(); } else { while ((nextNode->nextSibling() == 0) & (nextNode->parentNode() != 0) & (nextNode != this)) { nextNode = nextNode->parentNode(); } } if (nextNode == this) { nextNode = 0; } if (nextNode != 0) { nextNode = nextNode->nextSibling(); } } return &myElementNodeList; } // ************************************************************************** bool KissElement::hasAttribute( const DOMString& name) const { const Node* oldNode = myAttributesMap.getNamedItem(name); return (oldNode != 0); } // ************************************************************************** bool KissElement::hasAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const { if (namespaceURI.length() == 0) { return hasAttribute(localname); } const Node* oldNode = myAttributesMap.getNamedItemNS(namespaceURI, localname); return (oldNode != 0); } // ************************************************************************** const DOMString* KissElement::lookupNamespacePrefixNonDefault( const DOMString& namespaceURI) const { if (DEBUGKISSDOM) { printf("KissElement::lookupNamespacePrefixNonDefault() [%s]\n", nodeName()->c_str()); } if (namespaceURI.length() == 0) { return 0; } const Node* nextAncestor = this; while (nextAncestor != 0) { if (nextAncestor->hasAttributes()) { for (unsigned long i = 0; i < nextAncestor->attributes()->length(); i++) { if (*nextAncestor->attributes()->item(i)->nodeValue() == namespaceURI) { if (nextAncestor->attributes()->item(i)->prefix()->eqxmlns()) { return nextAncestor->attributes()->item(i)->localName(); } } } } nextAncestor = nextAncestor->parentNode(); } return 0; } // ************************************************************************** // ************************************************************************** // KissAttr // ************************************************************************** // ************************************************************************** long nKissAttrs = 0; //!< Number of KISS attribute objects // ************************************************************************** const DOMString* KissAttr::nodeValue() const { return &myAttributeValue; } // ************************************************************************** void KissAttr::setNodeValue( const DOMString& newNodeValue) { if (DEBUGKISSDOM) { printf("KissAttr::setNodeValue()\n"); } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myAttributeValue = newNodeValue; } // ************************************************************************** unsigned long KissAttr::nodeType() const { return ATTRIBUTE_NODE; } // ************************************************************************** void KissAttr::setParentNode( Node* newParentNode) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** Node* KissAttr::cloneNode( const bool& deep) const { Node* newAttr = new KissAttr(ownerDocument(), 0, myNamespaceURI, myNodeName, 1); newAttr->setNodeValue(myAttributeValue); if (deep) { for (unsigned long i = 0; i < childNodes()->length(); i++) { newAttr->appendChild(childNodes()->item(i)->cloneNode(deep)); } } return newAttr; } // ************************************************************************** const DOMString* KissAttr::namespaceURI() const { return &myNamespaceURI; } // ************************************************************************** const DOMString* KissAttr::prefix() const { return &myPrefix; } // ************************************************************************** void KissAttr::setPrefix( const DOMString& newPrefix) { // if I am not a namespace element do nothing if (myNamespaceURI.length() == 0) { return; } if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (newPrefix == 0) { throw DOMException(DOMException::NAMESPACE_ERR); } if (!newPrefix.isNCName()) { throw DOMException(DOMException::INVALID_CHARACTER_ERR); } if (newPrefix.eqxml() &(myNamespaceURI != XML_NAMESPACEURI)) { throw DOMException(DOMException::NAMESPACE_ERR); } if (newPrefix.eqxmlns() & ((myNamespaceURI != XMLNS_NAMESPACEURI) | (myNodeName.eqxmlns()))) { throw DOMException(DOMException::NAMESPACE_ERR); } myPrefix = newPrefix; if (myPrefix.length() != 0) { myNodeName = myPrefix; myNodeName += ":"; myNodeName += myLocalname; } else myNodeName = myLocalname; } // ************************************************************************** const DOMString* KissAttr::localName() const { return &myLocalname; } // ************************************************************************** Node::DocumentOrder KissAttr::compareDocumentOrder( const Node* other) const { return DOCUMENT_ORDER_UNORDERED; } // ************************************************************************** Node::TreePosition KissAttr::compareTreePosition( const Node* other) const { return TREE_POSITION_UNORDERED; } // ************************************************************************** void KissAttr::checkChildAddingConstraints2(const Node* newChild) const { switch (newChild->nodeType()) { case TEXT_NODE : case ENTITY_REFERENCE_NODE : break; default : throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } } // ************************************************************************** KissAttr::KissAttr( const Document *const yourOwnerDocument, const Element *const yourOwnerElement, const DOMString& yourNamespaceURI, const DOMString& yourAttributeName, const bool& isSpecified) : KissNode(yourOwnerDocument, 0, yourAttributeName), myNamespaceURI(yourNamespaceURI) { if (DEBUGKISSDOM) { nKissAttrs++; printf("KissAttr::KissAttr(); [%s]\n", yourAttributeName.c_str()); printf("nKissAttrs=%li\n", nKissAttrs); } myOwnerElement = yourOwnerElement; yourAttributeName.splitNSName(myPrefix, myLocalname); amSpecified = isSpecified; } // ************************************************************************** KissAttr::~KissAttr() { if (DEBUGKISSDOM) { nKissAttrs--; printf("KissAttr::~KissAttr(); [%s]\n", myNodeName.c_str()); printf("nKissAttrs=%li\n", nKissAttrs); } } // ************************************************************************** const DOMString* KissAttr::name() const { return nodeName(); } // ************************************************************************** bool KissAttr::specified() const { return amSpecified; } // ************************************************************************** void KissAttr::setSpecified( const bool& newSpecified) { amSpecified = newSpecified; } // ************************************************************************** const DOMString* KissAttr::value() const { return nodeValue(); } // ************************************************************************** void KissAttr::setValue( const DOMString& newValue) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myAttributeValue = newValue; } // ************************************************************************** const Element* KissAttr::ownerElement() const { return myOwnerElement; } // ************************************************************************** void KissAttr::setOwnerElement( const Element* newOwnerElement) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myOwnerElement = newOwnerElement; } // ************************************************************************** // ************************************************************************** // KissCharacterData // ************************************************************************** // ************************************************************************** long nKissCharacterDatas = 0; //!< Number of KISS character data objects // ************************************************************************** const DOMString* KissCharacterData::nodeValue() const { return &myData; } // ************************************************************************** void KissCharacterData::setNodeValue( const DOMString& newNodeValue) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myData = newNodeValue; } // ************************************************************************** Node* KissCharacterData::insertBefore( Node* newChild, Node* refChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissCharacterData::replaceChild( Node* newChild, Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissCharacterData::removeChild( Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissCharacterData::appendChild( Node* newChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** void KissCharacterData::setTextContent( const DOMString& newTextContent) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myData = newTextContent; } // ************************************************************************** KissCharacterData::KissCharacterData( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNodeName, const DOMString& yourData) : KissNode(yourOwnerDocument, yourParentNode, yourNodeName) { if (DEBUGKISSDOM) { nKissCharacterDatas++; printf("KissCharacterData::KissCharacterData(); [%s]\n", yourNodeName.c_str()); printf("nKissCharacterDatas=%li\n", nKissCharacterDatas); } myData = yourData; } // ************************************************************************** KissCharacterData::~KissCharacterData() { if (DEBUGKISSDOM) { nKissCharacterDatas--; printf("KissCharacterData::~KissCharacterData(); [%s]\n", myNodeName.c_str()); printf("nKissCharacterDatas=%li\n", nKissCharacterDatas); } } // ************************************************************************** const DOMString* KissCharacterData::data() const { return &myData; } // ************************************************************************** unsigned long KissCharacterData::length() const { return myData.length(); } // ************************************************************************** const DOMString* KissCharacterData::substringData( unsigned long offset, unsigned long count) const { if (offset > myData.length()) { throw DOMException(DOMException::INDEX_SIZE_ERR); } unsigned long end = offset + count; if (end > myData.length()) { end = myData.length(); } myData.subString(mySubStringData, offset, end); return &mySubStringData; } // ************************************************************************** void KissCharacterData::appendData( const DOMString& arg) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myData += arg; } // ************************************************************************** void KissCharacterData::insertData( unsigned long offset, const DOMString& arg) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (offset > myData.length()) { throw DOMException(DOMException::INDEX_SIZE_ERR); } myData.insertString(offset, arg); } // ************************************************************************** void KissCharacterData::deleteData( unsigned long offset, unsigned long count) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (offset > myData.length()) { throw DOMException(DOMException::INDEX_SIZE_ERR); } myData.deleteData(offset, count); } // ************************************************************************** void KissCharacterData::replaceData( unsigned long offset, unsigned long count, const DOMString& arg) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (offset > myData.length()) { throw DOMException(DOMException::INDEX_SIZE_ERR); } myData.replaceData(offset, count, arg); } // ************************************************************************** void KissCharacterData::setData( const DOMString& newData) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myData = newData; } // ************************************************************************** // ************************************************************************** // KissTextInt // ************************************************************************** // ************************************************************************** long nKissTextInts = 0; //!< Number of KISS text int objects // ************************************************************************** KissTextInt::KissTextInt( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNodeName, const DOMString& yourTextContent) : KissCharacterData(yourOwnerDocument, yourParentNode, yourNodeName, yourTextContent) { if (DEBUGKISSDOM) { nKissTextInts++; printf("KissTextInt::KissTextInt(); [%s]\n", yourNodeName.c_str()); printf("nKissTextInts=%li\n", nKissTextInts); } } // ************************************************************************** KissTextInt::~KissTextInt() { if (DEBUGKISSDOM) { nKissTextInts--; printf("KissTextInt::~KissTextInt(); [%s]\n", myNodeName.c_str()); printf("nKissTextInts=%li\n", nKissTextInts); } } // ************************************************************************** Text* KissTextInt::splitText( unsigned long offset) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } if (parentNode() != 0) { if (parentNode()->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } } if (offset > length()) { throw DOMException(DOMException::INDEX_SIZE_ERR); } const DOMString* data2 = substringData(offset, length()-offset); Text* newKissText = new KissText(ownerDocument(), 0, *data2); deleteData(offset, length()-offset); if (parentNode() != 0) { parentNode()->insertBefore(newKissText, nextSibling()); } return newKissText; } // ************************************************************************** bool KissTextInt::isWhiteSpaceInElementContent() const { return 0; } // ************************************************************************** const DOMString* KissTextInt::wholeText() const { const Node* nextNode; myWholeTextString = *data(); // add text nodes before this one nextNode = previousSibling(); while (nextNode != 0) { if (nextNode->nodeType() == TEXT_NODE) { myWholeTextString.insertString(0, *nextNode->nodeValue()); nextNode = previousSibling(); } else nextNode = 0; } // add text nodes after this one nextNode = nextSibling(); while (nextNode != 0) { if (nextNode->nodeType() == TEXT_NODE) { myWholeTextString += *nextNode->nodeValue(); nextNode = nextSibling(); } else nextNode = 0; } return &myWholeTextString; } // ************************************************************************** Text* KissTextInt::replaceWholeText( const DOMString& content) { if (parentNode() == 0) { setData(content); return this; } if (parentNode()->readOnly() | myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } Node* nextNode; // check readOnly for text nodes before this one nextNode = previousSibling(); while (nextNode != 0) { if (nextNode->nodeType() == TEXT_NODE) { if (nextNode->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } nextNode = previousSibling(); } else nextNode = 0; } // check readOnly for text nodes after this one nextNode = nextSibling(); while (nextNode != 0) { if (nextNode->nodeType() == TEXT_NODE) { if (nextNode->readOnly()) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } nextNode = nextSibling(); } else nextNode = 0; } // remove text nodes before this one nextNode = previousSibling(); while (nextNode != 0) { if (nextNode->nodeType() == TEXT_NODE) { parentNode()->removeChild(nextNode); delete nextNode; nextNode = previousSibling(); } else nextNode = 0; } // remove text nodes after this one nextNode = nextSibling(); while (nextNode != 0) { if (nextNode->nodeType() == TEXT_NODE) { parentNode()->removeChild(nextNode); delete nextNode; nextNode = nextSibling(); } else nextNode = 0; } setData(content); return this; } // ************************************************************************** // ************************************************************************** // KissText // ************************************************************************** // ************************************************************************** long nKissTexts = 0; //!< Number of KISS text objects // ************************************************************************** unsigned long KissText::nodeType() const { return TEXT_NODE; } // ************************************************************************** Node* KissText::cloneNode( const bool& deep) const { return new KissText(ownerDocument(), 0, *data()); } // ************************************************************************** KissText::KissText( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourTextContent) : KissTextInt(yourOwnerDocument, yourParentNode, "#text", yourTextContent) { if (DEBUGKISSDOM) { nKissTexts++; printf("KissText::KissText();\n"); printf("nKissTexts=%li\n", nKissTexts); } } // ************************************************************************** KissText::~KissText() { if (DEBUGKISSDOM) { nKissTexts--; printf("KissText::~KissText();\n"); printf("nKissTexts=%li\n", nKissTexts); } } // ************************************************************************** // ************************************************************************** // KissDocumentFragment // ************************************************************************** // ************************************************************************** long nKissDocumentFragments = 0; //!< Number of KISS document fragment objects // ************************************************************************** unsigned long KissDocumentFragment::nodeType() const { return DOCUMENT_FRAGMENT_NODE; } // ************************************************************************** Node* KissDocumentFragment::cloneNode( const bool& deep) const { Node* newDocumentFragment = new KissDocumentFragment(ownerDocument()); if (deep) { for (unsigned long i = 0; i < childNodes()->length(); i++) { newDocumentFragment->appendChild(childNodes()->item(i)->cloneNode(deep)); } } return newDocumentFragment; } // ************************************************************************** void KissDocumentFragment::normalizeNS() { for (unsigned long i = 0; i < childNodes()->length(); i++) { childNodes()->item(i)->normalizeNS(); } } // ************************************************************************** KissDocumentFragment::KissDocumentFragment( const Document *const yourOwnerDocument) : KissNode(yourOwnerDocument, 0, "#document-fragment") { if (DEBUGKISSDOM) { nKissDocumentFragments++; printf("KissDocumentFragment::KissDocumentFragment();\n"); printf("nKissDocumentFragments=%li\n", nKissDocumentFragments); } } // ************************************************************************** KissDocumentFragment::~KissDocumentFragment() { if (DEBUGKISSDOM) { nKissDocumentFragments--; printf("KissDocumentFragment::~KissDocumentFragment();\n"); printf("nKissDocumentFragments=%li\n", nKissDocumentFragments); } } // ************************************************************************** // ************************************************************************** // KissComment // ************************************************************************** // ************************************************************************** long nKissComments = 0; //!< Number of KISS comment objects // ************************************************************************** unsigned long KissComment::nodeType() const { return COMMENT_NODE; } // ************************************************************************** Node* KissComment::cloneNode( const bool& deep) const { return new KissComment(ownerDocument(), 0, *data()); } // ************************************************************************** KissComment::KissComment( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourTextContent) : KissCharacterData(yourOwnerDocument, yourParentNode, "#comment", yourTextContent) { if (DEBUGKISSDOM) { nKissComments++; printf("KissComment::KissComment();\n"); printf("nKissComments=%li\n", nKissComments); } } // ************************************************************************** KissComment::~KissComment() { if (DEBUGKISSDOM) { nKissComments--; printf("KissComment::~KissComment();\n"); printf("nKissComments=%li\n", nKissComments); } } // ************************************************************************** // ************************************************************************** // ************************************************************************** // The Extended Interfaces // ************************************************************************** // ************************************************************************** // ************************************************************************** // ************************************************************************** // ************************************************************************** // KissEntity // ************************************************************************** // ************************************************************************** long nKissEntitys = 0; //!< Number of KISS entity objects // ************************************************************************** unsigned long KissEntity::nodeType() const { return ENTITY_NODE; } // ************************************************************************** const DOMString* KissEntity::nodeValue() const { return &myEntityValue; } // ************************************************************************** void KissEntity::setParentNode( Node* newParentNode) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** Node* KissEntity::cloneNode( const bool& deep) const { Node* newEntity = new KissEntity(ownerDocument(), myNodeName, myPublicId, mySystemId, myNotationName, myEntityValue); if (deep) { for (unsigned long i = 0; i < childNodes()->length(); i++) { newEntity->appendChild(childNodes()->item(i)->cloneNode(deep)); } } return newEntity; } // ************************************************************************** Node::DocumentOrder KissEntity::compareDocumentOrder( const Node* other) const { return DOCUMENT_ORDER_UNORDERED; } // ************************************************************************** Node::TreePosition KissEntity::compareTreePosition( const Node* other) const { return TREE_POSITION_UNORDERED; } // ************************************************************************** KissEntity::KissEntity( const Document *const yourOwnerDocument, const DOMString& yourEntityName, const DOMString& yourPublicId, const DOMString& yourSystemId, const DOMString& yourNotationName, const DOMString& yourEntityValue) : KissNode(yourOwnerDocument, 0, yourEntityName), myPublicId(yourPublicId), mySystemId(yourSystemId), myNotationName(yourNotationName), myEntityValue(yourEntityValue) { if (DEBUGKISSDOM) { nKissEntitys++; printf("KissEntity::KissEntity(); [%s]\n", myNodeName.c_str()); printf("nKissEntitys=%li\n", nKissEntitys); } myReadOnly = 1; } // ************************************************************************** KissEntity::~KissEntity() { if (DEBUGKISSDOM) { nKissEntitys--; printf("KissEntity::~KissEntity(); [%s]\n", myNodeName.c_str()); printf("nKissEntitys=%li\n", nKissEntitys); } } // ************************************************************************** const DOMString* KissEntity::publicId() const { return &myPublicId; } // ************************************************************************** const DOMString* KissEntity::systemId() const { return &mySystemId; } // ************************************************************************** const DOMString* KissEntity::notationName() const { return &myNotationName; } // ************************************************************************** const DOMString* KissEntity::actualEncoding() const { return &myActualEncoding; } // ************************************************************************** void KissEntity::setActualEncoding( const DOMString& newActualEncoding) { myActualEncoding = newActualEncoding; } // ************************************************************************** const DOMString* KissEntity::encoding() const { return &myEncoding; } // ************************************************************************** void KissEntity::setEncoding( const DOMString& newEncoding) { myEncoding = newEncoding; } // ************************************************************************** const DOMString* KissEntity::version() const { return &myVersion; } // ************************************************************************** void KissEntity::setVersion( const DOMString& newVersion) { myVersion = newVersion; } // ************************************************************************** // ************************************************************************** // KissDocumentType // ************************************************************************** // ************************************************************************** long nKissDocumentTypes = 0; //!< Number of KISS document type objects // ************************************************************************** unsigned long KissDocumentType::nodeType() const { return DOCUMENT_TYPE_NODE; } // ************************************************************************** Node* KissDocumentType::insertBefore( Node* newChild, Node* refChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissDocumentType::replaceChild( Node* newChild, Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissDocumentType::removeChild( Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissDocumentType::appendChild( Node* newChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissDocumentType::cloneNode( const bool& deep) const { return new KissDocumentType(myNodeName, myPublicId, mySystemId); } // ************************************************************************** void KissDocumentType::setTextContent( const DOMString& newTextContent) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** KissDocumentType::KissDocumentType( const DOMString& yourDocumentTypeName, const DOMString& yourPublicId, const DOMString& yourSystemId) : KissNode(0, 0, yourDocumentTypeName), myEntitiesMap(ENTITY_NODE), myNotationsMap(NOTATION_NODE) { if (DEBUGKISSDOM) { nKissDocumentTypes++; printf("KissDocumentType::KissDocumentType(); [%s]\n", yourDocumentTypeName.c_str()); printf("nKissDocumentTypes=%li\n", nKissDocumentTypes); } myPublicId = yourPublicId; mySystemId = yourSystemId; } // ************************************************************************** KissDocumentType::~KissDocumentType() { if (DEBUGKISSDOM) { nKissDocumentTypes--; printf("KissDocumentType::~KissDocumentType(); [%s]\n", myNodeName.c_str()); printf("nKissDocumentTypes=%li\n", nKissDocumentTypes); } } // ************************************************************************** const DOMString* KissDocumentType::name() const { return nodeName(); } // ************************************************************************** const NamedNodeMap* KissDocumentType::entities() const { return &myEntitiesMap; } // ************************************************************************** const NamedNodeMap* KissDocumentType::notations() const { return &myNotationsMap; } // ************************************************************************** const DOMString* KissDocumentType::publicId() const { return &myPublicId; } // ************************************************************************** const DOMString* KissDocumentType::systemId() const { return &mySystemId; } // ************************************************************************** const DOMString* KissDocumentType::internalSubset() const { return 0; } // ************************************************************************** // ************************************************************************** // KissProcessingInstruction // ************************************************************************** // ************************************************************************** long nKissProcessingInstructions = 0; //!< Number of KISS processing instruction objects // ************************************************************************** const DOMString* KissProcessingInstruction::nodeValue() const { return &myContent; } // ************************************************************************** void KissProcessingInstruction::setNodeValue( const DOMString& newNodeValue) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myContent = newNodeValue; } // ************************************************************************** unsigned long KissProcessingInstruction::nodeType() const { return PROCESSING_INSTRUCTION_NODE; } // ************************************************************************** Node* KissProcessingInstruction::insertBefore( Node* newChild, Node* refChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissProcessingInstruction::replaceChild( Node* newChild, Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissProcessingInstruction::removeChild( Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissProcessingInstruction::appendChild( Node* newChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissProcessingInstruction::cloneNode( const bool& deep) const { return new KissProcessingInstruction(ownerDocument(), 0, myNodeName, myContent); } // ************************************************************************** void KissProcessingInstruction::setTextContent( const DOMString& newTextContent) { if (myReadOnly) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } myContent = newTextContent; } // ************************************************************************** KissProcessingInstruction::KissProcessingInstruction( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourTarget, const DOMString& yourContent) : KissNode(yourOwnerDocument, yourParentNode, yourTarget) { if (DEBUGKISSDOM) { nKissProcessingInstructions++; printf("KissProcessingInstruction::KissProcessingInstruction(); [%s]\n", yourTarget.c_str()); printf("nKissProcessingInstructions=%li\n", nKissProcessingInstructions); } myContent = yourContent; } // ************************************************************************** KissProcessingInstruction::~KissProcessingInstruction() { if (DEBUGKISSDOM) { nKissProcessingInstructions--; printf("KissProcessingInstruction::~KissProcessingInstruction(); [%s]\n", myNodeName.c_str()); printf("nKissProcessingInstructions=%li\n", nKissProcessingInstructions); } } // ************************************************************************** const DOMString* KissProcessingInstruction::target() const { if (DEBUGKISSDOM) { printf("KissProcessingInstruction::target(); [%s]\n", myNodeName.c_str()); } return nodeName(); } // ************************************************************************** const DOMString* KissProcessingInstruction::data() const { if (DEBUGKISSDOM) { printf("KissProcessingInstruction::data(); [%s]\n", myNodeName.c_str()); } return nodeValue(); } // ************************************************************************** void KissProcessingInstruction::setData( const DOMString& newData) { if (DEBUGKISSDOM) { printf("KissProcessingInstruction::setData(); [%s]\n", myNodeName.c_str()); } setNodeValue(newData); } // ************************************************************************** // ************************************************************************** // KissNotation // ************************************************************************** // ************************************************************************** long nKissNotations = 0; //!< Number of KISS notation objects // ************************************************************************** unsigned long KissNotation::nodeType() const { return NOTATION_NODE; } // ************************************************************************** void KissNotation::setParentNode( Node* newParentNode) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** Node* KissNotation::insertBefore( Node* newChild, Node* refChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissNotation::replaceChild( Node* newChild, Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissNotation::removeChild( Node* oldChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissNotation::appendChild( Node* newChild) { throw DOMException(DOMException::HIERARCHY_REQUEST_ERR); } // ************************************************************************** Node* KissNotation::cloneNode( const bool& deep) const { return new KissNotation(myNodeName, myPublicId, mySystemId); } // ************************************************************************** Node::DocumentOrder KissNotation::compareDocumentOrder( const Node* other) const { return DOCUMENT_ORDER_UNORDERED; } // ************************************************************************** Node::TreePosition KissNotation::compareTreePosition( const Node* other) const { return TREE_POSITION_UNORDERED; } // ************************************************************************** void KissNotation::setTextContent( const DOMString& newTextContent) { throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR); } // ************************************************************************** KissNotation::KissNotation( const DOMString& yourNotationName, const DOMString& yourPublicId, const DOMString& yourSystemId) : KissNode(0, 0, yourNotationName), myNotationName(yourNotationName), myPublicId(yourPublicId), mySystemId(yourSystemId) { if (DEBUGKISSDOM) { nKissNotations++; printf("KissNotation::KissNotation(); [%s]\n", myNodeName.c_str()); printf("nKissNotations=%li\n", nKissNotations); } } // ************************************************************************** KissNotation::~KissNotation() { if (DEBUGKISSDOM) { nKissNotations--; printf("KissNotation::~KissNotation(); [%s]\n", myNodeName.c_str()); printf("nKissNotations=%li\n", nKissNotations); } } // ************************************************************************** const DOMString* KissNotation::publicId() const { return &myPublicId; } // ************************************************************************** const DOMString* KissNotation::systemId() const { return &mySystemId; } // ************************************************************************** // ************************************************************************** // KissEntityReference // ************************************************************************** // ************************************************************************** long nKissEntityReferences = 0; //!< Number of KISS entity reference objects // ************************************************************************** unsigned long KissEntityReference::nodeType() const { return ENTITY_REFERENCE_NODE; } // ************************************************************************** Node* KissEntityReference::cloneNode( const bool& deep) const { Node* newEntityReference = new KissEntityReference(ownerDocument(), 0, myNodeName); if (deep) { for (unsigned long i = 0; i < childNodes()->length(); i++) { newEntityReference->appendChild(childNodes()->item(i)->cloneNode(deep)); } } return newEntityReference; } // ************************************************************************** KissEntityReference::KissEntityReference( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourEntityNameReference) : KissNode(yourOwnerDocument, yourParentNode, yourEntityNameReference) { if (DEBUGKISSDOM) { nKissEntityReferences++; printf("KissEntityReference::KissEntityReference(); [%s]\n", yourEntityNameReference.c_str()); printf("nKissEntityReferences=%li\n", nKissEntityReferences); } } // ************************************************************************** KissEntityReference::~KissEntityReference() { if (DEBUGKISSDOM) { nKissEntityReferences--; printf("KissEntityReference::~KissEntityReference(); [%s]\n", myNodeName.c_str()); printf("nKissEntityReferences=%li\n", nKissEntityReferences); } } // ************************************************************************** // ************************************************************************** // KissCDATASection // ************************************************************************** // ************************************************************************** long nKissCDATASections = 0; //!< Number of KISS CDATA section objects // ************************************************************************** unsigned long KissCDATASection::nodeType() const { return CDATA_SECTION_NODE; } // ************************************************************************** Node* KissCDATASection::cloneNode( const bool& deep) const { return new KissCDATASection(ownerDocument(), 0, *data()); } // ************************************************************************** KissCDATASection::KissCDATASection( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourCDATASectionContent) : KissTextInt(yourOwnerDocument, yourParentNode, "#cdata-section", yourCDATASectionContent) { if (DEBUGKISSDOM) { nKissCDATASections++; printf("KissCDATASection::KissCDATASection();\n"); printf("nKissCDATASections=%li\n", nKissCDATASections); } } // ************************************************************************** KissCDATASection::~KissCDATASection() { if (DEBUGKISSDOM) { nKissCDATASections--; printf("KissCDATASection::~KissCDATASection();\n"); printf("nKissCDATASections=%li\n", nKissCDATASections); } } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/kissdom.h0000644000076500000240000012223311033277417012550 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: kissdom.h 1637 2007-12-31 04:00:26Z joehope $ */ /*! @file kissdom.h @brief Greg Collecutt's implementation of DOM3 Greg Collecutt's implementation of the XML Document Object Model level 3 */ /* This header file provides the definition of my implementation DOM3, called "kiss", which of course is the acronym for "Keep It Simple Stupid". */ #ifndef LIST #include #define LIST #endif #ifndef DOM3 #include #endif // ***************************************************************************** // ***************************************************************************** // KissDOMImplementation // ***************************************************************************** // ***************************************************************************** //! Implementation of the KISS version of DOM class KissDOMImplementation : public DOMImplementation { public : //! Constructor of a KissDOMImplementation object KissDOMImplementation(); //! Destructor virtual ~KissDOMImplementation(); //! Determines if feature exists in this version bool hasFeature( DOMString& feature, DOMString& version) const; // Introduced in DOM Level 2: //! Creates a document type DocumentType* createDocumentType( const DOMString& qualifiedName, const DOMString& publicId, const DOMString& systemId); //! Creates a document Document* createDocument( const DOMString& namespaceURI, const DOMString& qualifiedName, DocumentType* doctype); // Introduced in DOM Level 3: //! Makes available DOMImplementation's specialised interface DOMImplementation* getAs( DOMString& feature); //! Prints all nodes void printAll(); //! Prints a node void printNode( const unsigned long& indent, const Node* node2Print); private : list myNodeList; //!< The node list }; // ****************************************************************************** // ****************************************************************************** // KissNodeList // ****************************************************************************** // ****************************************************************************** //! Node list class in KISS DOM implementation class KissNodeList : public NodeList { public : //! Constructor of KissNodeList object KissNodeList( const list* yourPNodeList); //! Destructor virtual ~KissNodeList(); //! Obtains item in node list at index Node* item( unsigned long index) const; //! Returns the length of the node list unsigned long length() const; private : const list* myPNodeList; //!< Node list pointer (I think) }; // ****************************************************************************** // ****************************************************************************** // KissNamedNodeMap // ****************************************************************************** // ****************************************************************************** //! The named node map class in the KISS DOM implementation class KissNamedNodeMap : public NamedNodeMap { public: //! Constructor for KissNamedNodeMap object KissNamedNodeMap( const unsigned long& yourNodeType); //! Destructor virtual ~KissNamedNodeMap(); //! Gets a named item Node* getNamedItem( const DOMString& name) const ; //! Sets a named item Node* setNamedItem( Node& arg); //! Removes a named item Node* removeNamedItem( const DOMString& name); //! Returns the length (of what?) unsigned long length() const; //! Gets an item as a node object Node* item( const unsigned long index) const; // Introduced in DOM Level 2: //! Gets a named item namespace Node* getNamedItemNS( const DOMString& namespaceURI, const DOMString& localname) const; //! Sets a named item namespace Node* setNamedItemNS( Node& arg); //! Removes a named item namespace Node* removeNamedItemNS( const DOMString& namespaceURI, const DOMString& localname); //! Sets document readonly void setReadOnly( const bool& newReadOnly); //! Gets the owner document as a Document object const Document* ownerDocument() const; //! Sets the owner document void setOwnerDocument( const Document* yourOwnerDocument); private : const Document* myOwnerDocument; //!< The owner document object const unsigned long myNodeType; //!< The node type bool readOnly; //!< Whether or not the document is read only list myNodeList; //!< The list of nodes list myNameList; //!< The list of names (of what?) list myNamespaceURIList; //!< The list of namespace URIs //! Whether or not can add this node (but why doesn't this return anything?) void canAddThisNode(const Node& arg) const; }; // ****************************************************************************** // ****************************************************************************** // KissNode // ****************************************************************************** // ****************************************************************************** //! Node class in KISS DOM implementation class KissNode : public virtual Node { public : //! Constructor of KissNode object KissNode( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNodeName); //! Destructor ~KissNode(); //! Returns name of node const DOMString* nodeName() const; //! Returns value of node const DOMString* nodeValue() const; //! Sets value of node virtual void setNodeValue( const DOMString& newNodeValue); //! Returns parent node Node* parentNode() const; //! Sets parent node virtual void setParentNode( Node* newParentNode); //! Returns a list of child nodes const NodeList* childNodes() const; //! Returns the first child node Node* firstChild() const; //! Returns the last child node Node* lastChild() const; //! Returns the previous sibling node Node* previousSibling() const; //! Returns the next sibling node Node* nextSibling() const; //! Returns the attributes as a NamedNodeMap const NamedNodeMap* attributes() const; //! Returns the owner document const Document* ownerDocument() const; //! Sets the owner document virtual void setOwnerDocument( const Document *const newOwnerDocument); //! Inserts a new child node before a reference child node Node* insertBefore( Node* newChild, Node* refChild); //! Replaces a child node Node* replaceChild( Node* newChild, Node* oldChild); //! Removes a child node Node* removeChild( Node* oldChild); //! Appends a child node Node* appendChild( Node* newChild); //! Determines if object has child nodes bool hasChildNodes() const; //! Puts nodes into a normal form void normalize(); // Introduced in DOM Level 2: //! Determines if feature is supported in current version of xml/dom? bool isSupported( DOMString& feature, DOMString& version) const; //! Gets the namespace URI as a DOMString const DOMString* namespaceURI() const; //! Gets some prefix (of what?) const DOMString* prefix() const; //! Sets the prefix (of what?) void setPrefix( const DOMString& newPrefix); //! Gets the local name (of what?) const DOMString* localName() const; // Introduced in DOM Level 3: //! Determines if object/element has attributes bool hasAttributes() const; //! Returns the base URI as a DOMString const DOMString* baseURI() const; //! Compares the document order with another node DocumentOrder compareDocumentOrder( const Node* other) const; //! Compares the tree position with another node TreePosition compareTreePosition( const Node* other) const; //! Returns the text content of this node and its decendants const DOMString* textContent( const bool& deep) const; //! Sets the text content (of what?) virtual void setTextContent( const DOMString& newTextContent); //! Determines if the current node is the same as argument node bool isSameNode( const Node* other) const; //! Looks up namespace prefix and returns as DOMString const DOMString* lookupNamespacePrefix( const DOMString& namespaceURI) const; //! Looks up namespace URI and returns as DOMString const DOMString* lookupNamespaceURI( const DOMString& prefix) const; //! Puts the namespace into a normal form void normalizeNS(); //! Returns a key identifying this node DOMKey key() const; //! Determines if node is equal to argument node bool equalsNode( const Node* arg, bool deep) const; //! Gets the node's specialised interface Node* getAs( DOMString& feature); //! Determines if (something) is read only bool readOnly() const; //! Sets something read only void setReadOnly( const bool& newReadOnly, const bool& deep); //! Checks the child adding constraints void checkChildAddingConstraints1( const Node* newChild) const; //! Checks the child adding constraints virtual void checkChildAddingConstraints2( const Node* newChild) const; protected : DOMString myNodeName; //!< The current node as a DOMString bool myReadOnly; //!< The read only status of the node/document? private : const Document* myOwnerDocument; //!< The owner document Node* myParentNode; //!< The parent of the current node DOMKey myDOMKey; //!< The DOM key list myNodeList; //!< The node list KissNodeList myKissNodeList; //!< The Kiss node list mutable DOMString myTextContent; //!< The text content of the node }; // ****************************************************************************** // ****************************************************************************** // KissDocument // ****************************************************************************** // ****************************************************************************** //! Document class for the KISS DOM implementation class KissDocument : public KissNode, public Document { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::setParentNode() void setParentNode( Node* newParentNode); //! Override of KissNode::setOwnerDocument() void setOwnerDocument( const Document *const newOwnerDocument); //! Override of KissNode::insertBefore() Node* insertBefore( Node* newChild, Node* refChild); //! Override of KissNode::replaceChild() Node* replaceChild( Node* newChild, Node* oldChild); //! Override of KissNode::removeChild() Node* removeChild( Node* oldChild); //! Override of KissNode::appendChild() Node* appendChild( Node* newChild); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::namespaceURI() const DOMString* namespaceURI() const; //! Override of KissNode::compareDocumentOrder() DocumentOrder compareDocumentOrder( const Node* other) const; //! Override of KissNode::compareTreePosition() TreePosition compareTreePosition( const Node* other) const; //! Override of KissNode::setTextContent() void setTextContent( const DOMString& newTextContent); //! Override of KissNode::normalizeNS() void normalizeNS(); //! Override of KissNode::checkChildAddingConstraints2() void checkChildAddingConstraints2(const Node* newChild) const; //! Constructor of KissDocument object KissDocument( const DOMImplementation* yourDOMImplementation); //! Destructor ~KissDocument(); //! Gets the DOM key DOMKey getDOMKey() const; //! Obtains the doctype const DocumentType* doctype() const; //! Obtains the DOM implementation const DOMImplementation* implementation() const; //! Obtains a document element Element* documentElement() const; //! Creates an element Element* createElement( const DOMString& tagName); //! Creates a document fragment DocumentFragment* createDocumentFragment(); //! Creates a text node Text* createTextNode( const DOMString& data); //! Creates a comment Comment* createComment( const DOMString& data); //! Creates a CDATA section CDATASection* createCDATASection( const DOMString& data); //! Creates a processing instruction ProcessingInstruction* createProcessingInstruction( const DOMString& target, const DOMString& data); //! Creates an attribute Attr* createAttribute( const DOMString& name); //! Creates an entity reference EntityReference* createEntityReference( const DOMString& name); //! Gets the elements by tag name NodeList* getElementsByTagName( const DOMString& tagName); //! Gets the elements by tag name NodeList* getVectorElementsByTagName( const DOMString& tagName); // Introduced in DOM Level 2: //! Imports a node Node* importNode( const Node* importNode, const bool& deep); //! Creates an elements namespace Element* createElementNS( const DOMString& namespaceURI, const DOMString& qualifiedName); //! Creates an attributes namespace Attr* createAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName); //! Gets elements by tag name's namespace NodeList* getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname); //! Gets elements by id Element* getElementById( const DOMString& elementId); // Introduced in DOM Level 3: //! Determines actual encoding const DOMString* actualEncoding() const; //! Sets actual encoding void setActualEncoding( const DOMString& newActualEncoding); //! Determines encoding const DOMString* encoding() const; //! Sets encoding void setEncoding( const DOMString& newEncoding); //! Specifies if the document is standalone bool standalone() const; //! Sets standalone boolean void setStandalone( const bool& newStandalone); //! Gets strict error checking flag bool strictErrorChecking() const ; //! Sets strict error checking flag void setStrictErrorChecking( const bool& newStrictErrorChecking); //! Gets the version const DOMString* version() const; //! Sets the version void setVersion( const DOMString& newVersion); //! Adopts another node Node* adoptNode( Node* source); //! Sets the base URI void setBaseURI( const DOMString *const baseURI); private : Node* myDoctype; //!< The document type of the Document Node* myDocumentElement; //!< The document element const DOMImplementation* myDOMImplementation; //!< The DOM implementation mutable DOMKey nextKey; //!< The next key DOMString myNamespaceURI; //!< The namespace URI for the document list myElementList; //!< The document element list KissNodeList myElementNodeList; //!< The document element node list DOMString myActualEncoding; //!< The actual encoding DOMString myEncoding; //!< The encoding DOMString myVersion; //!< The document(?) version bool myStandalone; //!< Whether or not the document is standalone bool myStrictErrorChecking; //!< Whether or not strict error checking is on }; // ****************************************************************************** // ****************************************************************************** // KissElement // ****************************************************************************** // ****************************************************************************** //! Element class in KISS DOM implementation class KissElement : public KissNode, public Element { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::attributes() const NamedNodeMap* attributes() const; //! Override of KissNode::setOwnerDocument() void setOwnerDocument( const Document *const newOwnerDocument); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::namespaceURI() const DOMString* namespaceURI() const; //! Override of KissNode::prefix() const DOMString* prefix() const; //! Override of KissNode::setPrefix() void setPrefix( const DOMString& newPrefix); //! Override of KissNode::localName() const DOMString* localName() const; //! Override of KissNode::hasAttributes() bool hasAttributes() const; //! Override of KissNode::normalizeNS() void normalizeNS(); //! Constructor for KissElement object KissElement( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNamespaceURI, const DOMString& yourTagName); //! Destructor ~KissElement(); //! Gets the tag name const DOMString* tagName() const; //! Gets the attributes of a tag const DOMString* getAttribute( const DOMString& name) const; //! Sets the attributes of a tag void setAttribute( const DOMString& name, const DOMString& value); //! Removes the attributes of a tag void removeAttribute( const DOMString& name); //! Gets the attribute's node (I think) Attr* getAttributeNode( const DOMString& name); //! Sets the attribute's node (I think) Attr* setAttributeNode( Attr& newAttr); //! Removes the attribute's node (I think) Attr* removeAttributeNode( Attr& oldAttr) ; //! Gets the elements by tag name const NodeList* getElementsByTagName( const DOMString& name, const bool& deep) const; // Introduced in DOM Level 2: //! Gets the attribute's namespace const DOMString* getAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const; //! Sets the attribute's namespace void setAttributeNS( const DOMString& namespaceURI, const DOMString& qualifiedName, const DOMString& value); //! Removes the attribute's namespace void removeAttributeNS( const DOMString& namespaceURI, const DOMString& localname); //! Gets the attribute node's namespace Attr* getAttributeNodeNS( const DOMString& namespaceURI, const DOMString& localname); //! Sets the attribute node's namespace Attr* setAttributeNodeNS( Attr& newAttr); //! Gets the elements by the tag's namespace NodeList* getElementsByTagNameNS( const DOMString& namespaceURI, const DOMString& localname); //! Returns true if element/tag/object/thing has attribute bool hasAttribute( const DOMString& name) const; //! Returns true if element/tag/object/thing has attribute namespace bool hasAttributeNS( const DOMString& namespaceURI, const DOMString& localname) const; private : KissNamedNodeMap myAttributesMap; //!< The node map of attributes of the element KissNodeList myElementNodeList; //!< The element node list const DOMString myNamespaceURI; //!< The namespace URI of the element DOMString myPrefix; //!< The prefix of the current element DOMString myLocalname; //!< The local name of the current element mutable list myElementList; //!< The list of (sub?)elements //! Performs a non-default namespace prefix lookup const DOMString* lookupNamespacePrefixNonDefault( const DOMString& namespaceURI) const; }; // ****************************************************************************** // ****************************************************************************** // KissAttr // ****************************************************************************** // ****************************************************************************** //! Attribute class for the KISS DOM implementation class KissAttr : public KissNode, public Attr { public : //! Override of KissNode::nodeValue() const DOMString* nodeValue() const; //! Override of Node::setNodeValue() void setNodeValue( const DOMString& newNodeValue); //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::setParentNode() void setParentNode( Node* newParentNode); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::namespaceURI() const DOMString* namespaceURI() const; //! Override of KissNode::prefix() const DOMString* prefix() const; //! Override of KissNode::setPrefix() void setPrefix( const DOMString& newPrefix); //! Override of KissNode::localName() const DOMString* localName() const; //! Override of KissNode::compareDocumentOrder() Node::DocumentOrder compareDocumentOrder( const Node* other) const; //! Override of KissNode::compareTreePosition() TreePosition compareTreePosition( const Node* other) const; //! Override of KissNode::checkChildAddingConstraints2() void checkChildAddingConstraints2(const Node* newChild) const; //! Constructor of KissAttr object KissAttr( const Document *const yourOwnerDocument, const Element *const yourOwnerElement, const DOMString& yourNamespaceURI, const DOMString& yourAttributeName, const bool& isSpecified); //! Destructor ~KissAttr(); //! Obtains name of something const DOMString* name() const; //! Tells if this attribute is specified in the original document bool specified() const; //! Sets the specified boolean void setSpecified( const bool& newSpecified); //! Obtains the value of something const DOMString* value() const; //! Sets the value of something void setValue( const DOMString& newValue); // Introduced in DOM Level 2: //! Obtains the owner element of an xml element const Element* ownerElement() const; //! Sets the owner element in xml void setOwnerElement( const Element* newOwnerElement); private : const Element* myOwnerElement; //!< The element owning the attribute const DOMString myNamespaceURI; //!< The attribute namespace URI DOMString myPrefix; //!< The attribute prefix DOMString myLocalname; //!< The attribute local name DOMString myAttributeValue; //!< The attribute value bool amSpecified; //!< Whether or not the attribute is specified }; // ****************************************************************************** // ****************************************************************************** // KissCharacterData // ****************************************************************************** // ****************************************************************************** //! Character data class for KISS DOM implementation class KissCharacterData : public KissNode, public virtual CharacterData { public : //! Override of KissNode::nodeValue() const DOMString* nodeValue() const; //! Override of Node::setNodeValue() void setNodeValue( const DOMString& newNodeValue); //! Override of KissNode::insertBefore() Node* insertBefore( Node* newChild, Node* refChild); //! Override of KissNode::replaceChild() Node* replaceChild( Node* newChild, Node* oldChild); //! Override of KissNode::removeChild() Node* removeChild( Node* oldChild); //! Override of KissNode::appendChild() Node* appendChild( Node* newChild); //! Override of KissNode::setTextContent() void setTextContent( const DOMString& newTextContent); //! Constructor of KissCharacterData object KissCharacterData( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNodeName, const DOMString& yourData); //! Destructor ~KissCharacterData(); //! Obtains the character data string const DOMString* data() const; //! Returns the length of the data (I believe) unsigned long length() const; //! Obtains the substring data const DOMString* substringData( unsigned long offset, unsigned long count) const; //! Appends data to a string void appendData( const DOMString& arg); //! Inserts data into a string void insertData( unsigned long offset, const DOMString& arg); //! Deletes data from a string void deleteData( unsigned long offset, unsigned long count); //! Replaces data in a string void replaceData( unsigned long offset, unsigned long count, const DOMString& arg); //! Sets a data string void setData( const DOMString& newData); private : DOMString myData; //!< The data of the character string mutable DOMString mySubStringData; //!< The substring data of the character string }; // ****************************************************************************** // ****************************************************************************** // KissTextInt // ****************************************************************************** // ****************************************************************************** //! Text int (?) class in KISS DOM implementation class KissTextInt : public KissCharacterData, public virtual Text { public : //! Constructor of KissTextInt object KissTextInt( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourNodeName, const DOMString& yourTextContent); //! Destructor ~KissTextInt(); //! Splits text at offset Text* splitText( unsigned long offset); // Introduced in DOM Level 3: //! Determines if whitespace is in the element content bool isWhiteSpaceInElementContent() const; //! Returns the whole text as a DOMString const DOMString* wholeText() const; //! Replaces the whole text Text* replaceWholeText( const DOMString& content); private : mutable DOMString myWholeTextString; //!< The whole text string }; // ****************************************************************************** // ****************************************************************************** // KissText // ****************************************************************************** // ****************************************************************************** //! Text class in KISS DOM implementation class KissText : public KissTextInt { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Constructor of KissText object KissText( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourTextContent); //! Destructor ~KissText(); }; // ****************************************************************************** // ****************************************************************************** // KissDocumentFragment // ****************************************************************************** // ****************************************************************************** //! Document fragment class in KISS DOM implementation class KissDocumentFragment : public KissNode, public DocumentFragment { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::normalizeNS() void normalizeNS(); //! Constructor for KissDocumentFragment object KissDocumentFragment( const Document *const yourOwnerDocument); //! Destructor ~KissDocumentFragment(); }; // ****************************************************************************** // ****************************************************************************** // KissComment // ****************************************************************************** // ****************************************************************************** //! Comment class in KISS DOM implementation class KissComment : public KissCharacterData, public Comment { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Constructor of KissComment object KissComment( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourTextContent); //! Destructor ~KissComment(); }; // ****************************************************************************** // ****************************************************************************** // ****************************************************************************** // The Extended Interfaces // ****************************************************************************** // ****************************************************************************** // ****************************************************************************** // ****************************************************************************** // ****************************************************************************** // KissEntity // ****************************************************************************** // ****************************************************************************** //! Entity class in KISS DOM implementation class KissEntity : public KissNode, public Entity { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::nodeValue() const DOMString* nodeValue() const; //! Override of KissNode::setParentNode() void setParentNode( Node* newParentNode); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::compareDocumentOrder() Node::DocumentOrder compareDocumentOrder( const Node* other) const; //! Override of KissNode::compareTreePosition() TreePosition compareTreePosition( const Node* other) const; //! Constructor of KissEntity object KissEntity( const Document *const yourOwnerDocument, const DOMString& yourEntityName, const DOMString& yourPublicID, const DOMString& yourSystemID, const DOMString& yourNotationName, const DOMString& yourEntityValue); //! Desctructor ~KissEntity(); //! Obtains public id string const DOMString* publicId() const; //! Obtains system id string const DOMString* systemId() const; //! Obtains notation name (whatever that is) const DOMString* notationName() const; // Introduced in DOM Level 3: //! Obtains actual encoding string const DOMString* actualEncoding() const; //! Sets actual enconding void setActualEncoding( const DOMString& newActualEncoding); //! Obtains encoding const DOMString* encoding() const; //! Sets encoding void setEncoding( const DOMString& newEncoding); //! Obtains version string const DOMString* version() const; //! Sets version void setVersion( const DOMString& newVersion); private : const DOMString myPublicId; //!< Entity public id const DOMString mySystemId; //!< Entity system id const DOMString myNotationName; //!< Entity notation name const DOMString myEntityValue; //!< Entity value DOMString myActualEncoding; //!< Actual encoding of entity DOMString myEncoding; //!< Encoding of entity DOMString myVersion; //!< Version of entity (?) }; // ****************************************************************************** // ****************************************************************************** // KissDocumentType // ****************************************************************************** // ****************************************************************************** //! Document type class in KISS DOM implementation class KissDocumentType : public KissNode, public DocumentType { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::insertBefore() Node* insertBefore( Node* newChild, Node* refChild); //! Override of KissNode::replaceChild() Node* replaceChild( Node* newChild, Node* oldChild); //! Override of KissNode::removeChild() Node* removeChild( Node* oldChild); //! Override of KissNode::appendChild() Node* appendChild( Node* newChild); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::setTextContent() void setTextContent( const DOMString& newTextContent); //! Constructor for KissDocumentType object KissDocumentType( const DOMString& yourDocumentTypeName, const DOMString& yourPublicId, const DOMString& yourSystemId); //! Destructor ~KissDocumentType(); //! Gets the name (of what?) as a DOMString const DOMString* name() const; //! Returns a named node map of general entities both external and internal declared in the DTD const NamedNodeMap* entities() const; //! Returns a named node mape of notations declared in the DTD const NamedNodeMap* notations() const; // Introduced in DOM Level 2: //! The public identifier of the external subset const DOMString* publicId() const; //! The system identifier of the external subset const DOMString* systemId() const; //! The internal subset as a string, or null if there is none const DOMString* internalSubset() const; private : DOMString myPublicId; //!< The public id of the document type DOMString mySystemId; //!< The system id of the document type KissNamedNodeMap myEntitiesMap; //!< The entities map of the document type KissNamedNodeMap myNotationsMap; //!< The notation map of the document type }; // ****************************************************************************** // ****************************************************************************** // KissProcessingInstruction // ****************************************************************************** // ****************************************************************************** //! Processing instruction class in KISS DOM implementation class KissProcessingInstruction : public KissNode, public ProcessingInstruction { public : //! Override of KissNode::nodeValue() const DOMString* nodeValue() const; //! Override of Node::setNodeValue() void setNodeValue( const DOMString& newNodeValue); //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::insertBefore() Node* insertBefore( Node* newChild, Node* refChild); //! Override of KissNode::replaceChild() Node* replaceChild( Node* newChild, Node* oldChild); //! Override of KissNode::removeChild() Node* removeChild( Node* oldChild); //! Override of KissNode::appendChild() Node* appendChild( Node* newChild); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::setTextContent() void setTextContent( const DOMString& newTextContent); //! Constructor of KissProcessingInstruction object KissProcessingInstruction( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourTarget, const DOMString& yourContent); //! Destructor ~KissProcessingInstruction(); //! Returns target as DOMString const DOMString* target() const; //! Returns data as DOMString const DOMString* data() const; //! Sets data void setData( const DOMString& newData); private : DOMString myContent; //!< Processing instruction content }; // ****************************************************************************** // ****************************************************************************** // KissNotation // ****************************************************************************** // ****************************************************************************** //! Notation class in KISS DOM implementation class KissNotation : public KissNode, public Notation { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Override of KissNode::setParentNode() void setParentNode( Node* newParentNode); //! Override of KissNode::insertBefore() Node* insertBefore( Node* newChild, Node* refChild); //! Override of KissNode::replaceChild() Node* replaceChild( Node* newChild, Node* oldChild); //! Override of KissNode::removeChild() Node* removeChild( Node* oldChild); //! Override of KissNode::appendChild() Node* appendChild( Node* newChild); //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Override of KissNode::compareDocumentOrder() Node::DocumentOrder compareDocumentOrder( const Node* other) const; //! Override of KissNode::compareTreePosition() TreePosition compareTreePosition( const Node* other) const; //! Override of KissNode::setTextContent() void setTextContent( const DOMString& newTextContent); //! Constructor of KissNotation object KissNotation( const DOMString& yourNotationName, const DOMString& yourPublicId, const DOMString& yourSystemId); //! Destructor ~KissNotation(); //! Returns the public id as a DOMString const DOMString* publicId() const; //! Returns the system id as a DOMString const DOMString* systemId() const; private : const DOMString myNotationName; //!< The name of the notation const DOMString myPublicId; //!< Notation public id const DOMString mySystemId; //!< Notation system id }; // ****************************************************************************** // ****************************************************************************** // KissEntityReference // ****************************************************************************** // ****************************************************************************** //! Entity reference class in KISS DOM implementation class KissEntityReference : public KissNode, public EntityReference { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Constructor for KissEntityReference object KissEntityReference( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourEntityNameReference); //! Destructor ~KissEntityReference(); }; // ****************************************************************************** // ****************************************************************************** // KissCDATASection // ****************************************************************************** // ****************************************************************************** //! CDATA section class in KISS DOM implementation class KissCDATASection : public KissTextInt, public CDATASection { public : //! Override of KissNode::nodeType() unsigned long nodeType() const; //! Implementation of Node::cloneNode() Node* cloneNode( const bool& deep) const; //! Constructor of the KissCDATASection object KissCDATASection( const Document *const yourOwnerDocument, Node *const yourParentNode, const DOMString& yourCDATASectionContent); //! Destructor ~KissCDATASection(); }; /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/loadxsil.m0000644000076500000240000003762311033277417012733 00000000000000function loadxsil(fname, debug) % % Syntax: loadxsil(Filename [, debug]) % % filename is a string the xsil file to load, e.g. 'foo.xsil' % debug is optional and specifies the level of debugging information % debug = 0 is no debugging % " = 1 displays lines to be evaluated before evaluating % " = 2 displays the lines to be evaluated without evaluating % % Copyright (C) 2003-2007 % % Code contributed by Paul Cochrane and the xmds-devel team % % This file is part of xmds. % % This program is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License % as published by the Free Software Foundation; either version 2 % of the License, or (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. % % $Id: loadxsil.m 1566 2007-08-31 06:23:38Z grahamdennis $ if nargin == 0 disp('Must specify a filename. See help loadxsil') return end strOut = sprintf('%s%s', 'Parsing xsil file: ', fname); disp(strOut) % debug: 0 show no info % 1 show lines to be evaluated and evaluate % 2 show lines to be evaluated but do not evaluate if nargin == 1 debug = 0; % just a variable useful for testing stuff else strOut = sprintf('%s%d', 'Using debug level: ', debug); disp(strOut) end clear strOut; % open the xsil file for reading fp = fopen(fname, 'r'); if (fp == -1) disp('cannot open xsil file') disp('exiting...') return end binaryFound = 0; singleFound = 0; samplesFound = 0; while 1 line = fgetl(fp); % if we get to the end of the file, break out of loop if ~isstr(line) break end while (isempty(findstr(line, ' tag, and work out how many moment groups there are % and their parameters (ie 1 or 0) if (~isempty(findstr(line, '')) & samplesFound ==0) samplesFound = 1; indStart = findstr(line, ''); indEnd = findstr(line, ''); samplesElement = line(indStart+9:indEnd-1); % remove spaces, then check the length of the string, if longer than % one, iterate over it finding values of moment groups samplesElement = strrep(samplesElement, ' ', ''); samplesLen = length(samplesElement); % for some reason data is still kept even if one of the % samples variables is 0... Oh well, I'll just set % numMomentGroups to the length of the samplesElement then... numMomentGroups = samplesLen; end line = fgetl(fp); end % ok, if we got this far, then we must make some assumptions % if binary_output isn't set then assume it's text % if use_double isn't set then assume it's double if (findstr(line, ''); if (momentGroupNumber ~= imoments) fprintf('(Warning) Moment group %i is missing...\n', imoments); continue; end end % look for number of independent variables searchStr = ''; while (isempty(findstr(line, searchStr))) line = fgetl(fp); end indStart = findstr(line, searchStr); indEnd = findstr(line, ''); numIndepVars = str2num(line(indStart+length(searchStr):indEnd-1)); % look for the variables, how many of them and their names searchStr = ''; while (isempty(findstr(line, searchStr))) line = fgetl(fp); end % grab the next line, it *should* be a tag line = fgetl(fp); indStart = findstr(line, ''); indEnd = findstr(line, ''); % get the number of variables numVars = str2num(line(indStart+5:indEnd-1)); % now grab the next line, it *should* be a ') & findstr(line, '"Text"')) % now, this line should be the variables, space delimited line = fgetl(fp); inds = findstr(line, ' '); if (length(inds) ~= numVars) disp('Number of variable names found not equal to number of variables') disp('Exiting...'); return end indStart = 1; varNames = {}; for i = 1:length(inds) indEnd = inds(i)-1; if (indEnd == indStart) varNames{i}.name = strcat(line(indStart:indEnd), '_' , num2str(imoments)); elseif (indEnd > indStart) varNames{i}.name = strcat(line(indStart:indEnd), '_', num2str(imoments)); else disp('For some reason, indEnd is less than indStart') disp('Exiting...') return end indStart = inds(i)+1; end else disp('for some reason I could not find a tag with "Text" field') end % now go looking for the data while (isempty(findstr(line, ' or % loop until I find the stream line = fgetl(fp); i = 1; while(isempty(findstr(line, ''))) indStart = findstr(line, ''); indEnd = findstr(line, ''); loopInd(i) = str2num(line(indStart+5:indEnd-1)); i = i + 1; line = fgetl(fp); end % ok, this line should tell me if the output was binary or text % however, I should already know (maybe I should error check....) if (useBinary) disp('loading binary file') % the line just read tells us if we are using % bigendian or littleendian binary format if (~isempty(findstr(line, 'BigEndian'))) machineFormat = 'ieee-be'; elseif (~isempty(findstr(line, 'LittleEndian'))) machineFormat = 'ieee-le'; else machineFormat = 'native'; end % the line also contains info about 64-bit integers if (~isempty(findstr(line, 'uint64'))) UnsignedLong = 'uint64'; else UnsignedLong = 'ulong'; end % right, it's binary, now run the binary loading routine % this is the binary data filename line = fgetl(fp); % strip superfluous spaces... datFname = strrep(line, ' ', ''); % set the precison if (useDouble == 0) precision = 'single'; disp('using single precision data') else precision = 'double'; disp('using double precision data') end evalStr = ''; evalStr = sprintf('%s%s\n', evalStr, '% open the binary data file for reading'); evalStr = sprintf('%s%s%s%s%s%s\n', evalStr, 'fpDat = fopen(''', datFname, ''', ''r'', ''', machineFormat, ''');'); evalStr = sprintf('%s%s\n', evalStr, 'if (fpDat < 0)'); evalStr = sprintf('%s%s%s%s\n', evalStr, ' fprintf(''Cannot open binary data file: ', datFname, ''')'); evalStr = sprintf('%s%s\n', evalStr, ' return'); evalStr = sprintf('%s%s\n', evalStr, 'end'); % now the time to be a little tricky for i = 1:numIndepVars indexStrArray(i) = cellstr(strcat('index', num2str(i))); end % now try and load the variables into memory % I'm automatically generating the string that needs to be evaluated % by matlab and then running eval on it. % first, create a string of the variables to be loaded (this saves % shitloads (technical unit) of time). subscriptArray = {}; varsStr = ''; indepVarsStr = ''; if (debug ~= 0) fprintf('num independent vars = %d\n', numIndepVars); fprintf('num variables in total = %d\n', numVars); end for k = 1:numVars if (debug ~= 0) fprintf('varNames(%d).name = %s\n', k, varNames{k}.name); end if (k <= numIndepVars) indepVarsStr = sprintf('%s%s%s%s\n', indepVarsStr, varNames{k}.name, 'Len', ' = fread(fpDat, 1, UnsignedLong);'); indepVarsStr = sprintf('%s%s%s%s%s\n', indepVarsStr, varNames{k}.name, ' = fread(fpDat, ', varNames{k}.name, 'Len, precision);'); elseif (k > numIndepVars) varsStr = sprintf('%s%s%s%s\n', varsStr, varNames{k}.name, 'Len', ' = fread(fpDat, 1, UnsignedLong);'); if (numIndepVars == 0 || numIndepVars == 1) varsStr = sprintf('%s%s%s%s%s\n', varsStr, varNames{k}.name, ' = fread(fpDat, ', varNames{1}.name, 'Len, precision);'); elseif (numIndepVars == 2) varsStr = sprintf('%s%s%s%s%s%s%s\n', varsStr, varNames{k}.name, ' = fread(fpDat, [', varNames{2}.name, 'Len, ', varNames{1}.name, 'Len], precision);'); elseif (numIndepVars > 2) % now we need to create a multi-dimensional matrix, and this % is harder to do... we need to read in a matrix-sized (ie 2D) % block at a time, and append this to the other dimensions % the number of independent variables determines the dimensions % of the N-D matrix to produce % Initialise the memory for the array -- significantly speeds up % the loading array_size_str = []; for array_k = numIndepVars:-1:1; array_size_str = [array_size_str, ' ', varNames{array_k}.name, 'Len']; end; varsStr = sprintf('%s%s%s%s%s\n', varsStr, varNames{k}.name, ' = zeros([', array_size_str, ']);'); % construct the for loop to loop over the third and subsequent % dimensions for inumIndepVars = 1:numIndepVars-2 varsStr = sprintf('%s%s%s%s%s%s\n', varsStr, 'for ', char(indexStrArray(inumIndepVars)), ' = 1:', varNames{inumIndepVars}.name, 'Len'); end % generate the first part of the string, which is the array to % be assigned into varsStr = sprintf('%s%s%s', varsStr, varNames{k}.name, '(:, :, '); for inumIndepVars = (numIndepVars-2):-1:1 varsStr = sprintf('%s%s', varsStr, char(indexStrArray(inumIndepVars))); % need to append a comma if not last index to append if (inumIndepVars ~= 1) varsStr = sprintf('%s%s', varsStr, ', '); end end % generate the fread statement varsStr = sprintf('%s%s%s%s%s%s\n', varsStr, ') = fread(fpDat, [', varNames{numIndepVars}.name, 'Len, ', varNames{numIndepVars-1}.name, 'Len], precision);'); % finish off the for loop for inumIndepVars = 1:numIndepVars-2 varsStr = sprintf('%s%s\n', varsStr, 'end'); end end end end % now generate the string to evaluate evalStr = sprintf('%s%s', evalStr, indepVarsStr); evalStr = sprintf('%s%s', evalStr, varsStr); % remember to close the binary file evalStr = sprintf('%s%s\n', evalStr, 'fclose(fpDat);'); if (debug ~= 0) disp(' ') disp('This is the string to be evaluated:') disp(' ') disp(evalStr) if (debug == 2) return end end % and evaluate it eval(evalStr) % assign output variables for i = 1:numVars assignin('caller', varNames{i}.name, eval(varNames{i}.name)); end % clean up and return if (imoments == numMomentGroups) fclose(fp); disp('done!') return end else % well, it's text, so now call the text loading routine disp('loading ascii data (this may take a while)') % now the time to be a little tricky for i = 1:numIndepVars indexStrArray(i) = cellstr(strcat('index', num2str(i))); end % now try and load the variables into memory % I'm automatically generating the string that needs to be evaluated % by matlab and then running eval on it. % first, create a string of the variables to be loaded (this saves % shitloads (this just *has* to be a unit) of time). subscriptArray = {}; % make the fscanf %e bit at the front of the string varsStr = ' A = fscanf(fp, '''; for k = 1:numVars varsStr = sprintf('%s%s', varsStr, '%e '); end varsStr = sprintf('%s%s%s%s\n', varsStr, ''', ', num2str(numVars), ');'); for k = 1:numVars if (k <= numIndepVars) indexStr = strcat('(', char(indexStrArray(k)), ')'); subscriptArray(k) = cellstr(indexStr); elseif (k > numIndepVars) indexStr = strcat('(', char(indexStrArray(1))); for j = 2:numIndepVars indexStr = strcat(indexStr, ', ', char(indexStrArray(j))); end indexStr = strcat(indexStr, ')'); subscriptArray(k) = cellstr(indexStr); end varsStr = sprintf('%s %s%s%s%s%s\n', varsStr, varNames{k}.name, char(subscriptArray(k)), ' = A(', num2str(k), ');'); end % now generate the string for preallocation preStr = ''; for k = 1:numVars if (k <= numIndepVars) indexStr = strcat('(', num2str(loopInd(k)), ', 1)'); subscriptArray(k) = cellstr(indexStr); elseif (k > numIndepVars) indexStr = strcat('(', num2str(loopInd(1))); for j = 2:numIndepVars indexStr = strcat(indexStr, ', ', num2str(loopInd(j))); end indexStr = strcat(indexStr, ')'); subscriptArray(k) = cellstr(indexStr); end preStr = sprintf('%s%s%s%s%s\n', preStr, varNames{k}.name, ' = zeros', char(subscriptArray(k)), ';'); end % now generate the string to evaluate evalStr = ''; for i = 1:numIndepVars evalStr = sprintf('%s%s%s%s%s\n', evalStr, 'for ', char(indexStrArray(i)), ' = 1:', num2str(loopInd(i))); if (i == 1) evalStr = sprintf('%s%s%s%s%s%s\n', evalStr, ' if (rem(', char(indexStrArray(i)), ', ', num2str(loopInd(i)/10), ') < 1)'); evalStr = sprintf('%s fprintf(''%%3.0f%%%% completed\\n'', %s%s%s%s\n', evalStr, char(indexStrArray(i)), '*100/', num2str(loopInd(i)), ')'); evalStr = sprintf('%s%s\n', evalStr, ' end'); end end evalStr = sprintf('%s%s', evalStr, varsStr); for i = 1:numIndepVars evalStr = sprintf('%s%s\n', evalStr, 'end'); end if (debug ~= 0) disp(evalStr); else % and evaluate it eval(evalStr); % assign output variables for i = 1:numVars assignin('caller', varNames{i}.name, eval(varNames{i}.name)); end end % clean up and return if (imoments == numMomentGroups) fclose(fp); disp('done!') return end end end end fclose(fp); return % vim: shiftwidth=2 tabstop=2: xmds-1.6.6/source/main.cc0000644000076500000240000010407511033277417012165 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: main.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @mainpage Documentation for xmds @section intro Introduction xmds is the eXtensible Multi-Dimensional Simulator. XMDS is a code generator that integrates equations. You write them down in human readable form in a XML file, and it goes away and writes and compiles a C++ program that integrates those equations as fast as it can possibly be done in your architecture. Originally written by Greg Collecutt (and the majority of the code base is still due to him), however is now maintained by Joe Hope and the xmds development team. @section install Installation Download the source tarball from http://www.xmds.org, unpack, and run the configure script in the xmds directory.
(as root, to be installed into /usr/local/bin)
./configure
(as a user, to be installed the bin/ directory in your home directory)
./configure --with-user
For more details you can also read the INSTALL file, and even the hand-written documentation. */ /*! @file main.cc @brief The main routine and supporting routines More detailed explanation... */ // This is the main entry routine for xmds #include #include #include #include #include #include #include #include #include #include #include #include #include #include "version.h" using namespace std; //! Escape the given string for inclusion as a string in C source. //! e.g. escapeStringC(a\b"c) -> a\\b\"c //! (Read the above as actual strings, not C strings.) //! \todo Should we also escape e.g. non-printable characters? void escapeStringC(string& s) { for (size_t i = 0; i < s.length(); i++) { if (s[i] == '\\' || s[i] == '"') { // escape the character s.insert(i, "\\"); // move one forward i++; } } } // ********************************************************************* //! Displays xmds usage void display_usage() { cout << "\n" << "This is xmds version " << VERSION << " (" << REVISION << ")\n\n" << " using C compiler " << XMDS_CC; if (strcmp(MPICC, "")) { cout << " (and C compiler " << MPICC << " for parallel work)\n"; } cout << "\n" "Usage: xmds [options] infile\n" "Options:\n" " infile: required, The input file\n" " -h/--help: optional, Display this information\n" " -v/--verbose: optional, Verbose mode\n" " -n/--nocompile: optional, " "Turns off automatic compilation of simulation\n" " -t/--template: optional, " "Outputs an xmds template either to the terminal,\n" " or to an optionally specified file\n" "\n" "For further help, please see http://www.xmds.org\n" ; } // ******************************************************************** /*! @brief Routine to parse the preferences file @param fPrefs The input preferences file stream @param cc The string representing the C/C++ compiler @param cflags The C/C++ compiler flags @param clibs The libraries and library directories for the C/C++ compiler @param cincludes The include files and directories for the C/C++ compiler @param cthreadlibs The threading libraries for the C/C++ compiler @param mpicc The C/C++ compiler for MPI (i.e. parallel) simulations @param mpicflags The C/C++ compiler flags for the MPI C/C++ compiler @param fftwlibs The libraries for using fftw @param fftw_mpi_libs The libraries necessary for using fftw with MPI @param fftw3libs The libraries for using fftw3 @param fftw3threadlibs The libraries for using fftw3 with threads @param verbose Whether or not to print verbose information @param debug Whether or not to print debugging information */ int parsePrefs(ifstream &fPrefs, string &cc, string &cflags, string &clibs, string &cincludes, string &cthreadlibs, string &mpicc, string &mpicflags, string &fftwlibs, string &fftw_mpi_libs, string &fftw3libs, string &fftw3threadlibs, bool verbose, bool debug) { /*! \todo I've thought of a better way to do this, but first I'll just get this version going so that the feature is in, and then I'll go back and make it a bit more elegant. The idea is to read in each line of the prefs file individually (into a string), and then process the line. I'll need to read characters until I find an equals sign (ignoring spaces as I go), biff that into macroVar and then grab everything else and put that into macroVarValue. I could treat the string read in (ie the line I'm parsing) as a stack and pop characters off it until the equals sign is found, putting chars into macroVar and then put the rest (without equals sign into macroVarValue. Anyway, to be done... Also, I should make this into a function so that the code is only written the once! */ /*! * \todo this routine should really be part of xmdsUtility, and therefore * an instance of an xmdsUtility object (or something like that), because * there are far too many parameters being passed into the function, and * they could be packaged more nicely into an object, rather than as * params. Anyway, something else to do.... */ //! \todo replace if (debug) etc... with debug() routine. // grab the text char currentChar; string macroVar, macroVarValue, prefsString; bool commentCharFlag; prefsString = ""; while (!fPrefs.eof()) { // now we try the next line macroVar = ""; macroVarValue = ""; commentCharFlag = 0; // wait until we find the equals sign while ((currentChar = fPrefs.get()) != '=' && !fPrefs.eof() && !commentCharFlag) { if (currentChar == ' ') { if (debug) { cout << "space character before '=' found\n"; } } else if (currentChar == '#') { if (debug) { cout << "comment character found (before '=' found)\n"; } commentCharFlag = 1; while ((currentChar = fPrefs.get()) != '\n' && !fPrefs.eof()) { if (debug) { cout << "looping until end of line\n"; } } break; } else { macroVar = macroVar + currentChar; } } // now loop until we find the return character while (!commentCharFlag && (currentChar = fPrefs.get()) != '\n' && !fPrefs.eof()) { if (currentChar == '#') { if (debug) { cout << "comment character found\n"; } commentCharFlag = 1; while ((currentChar = fPrefs.get()) != '\n' && !fPrefs.eof()) { if (debug) { cout << "looping until end of line\n"; } } break; } macroVarValue = macroVarValue + currentChar; } /*! * \todo this if-elseif sequence can be replaced by a switch-case * sequence if the strings are replaced by enums or something similar */ // now do some assignments if (macroVar == "XMDS_CC") { cc = macroVarValue; if (verbose) { cout << "cc set to " + macroVarValue + "\n"; } } else if (macroVar == "XMDS_CFLAGS") { cflags = macroVarValue; if (verbose) { cout << "cflags set to " + macroVarValue + "\n"; } } else if (macroVar == "XMDS_LIBS") { clibs = macroVarValue; if (verbose) { cout << "clibs set to " + macroVarValue + "\n"; } } else if (macroVar == "XMDS_INCLUDES") { cincludes = macroVarValue; if (verbose) { cout << "cincludes set to " + macroVarValue + "\n"; } } else if (macroVar == "THREADLIBS") { cthreadlibs = macroVarValue; if (verbose) { cout << "cthreadlibs set to " + macroVarValue + "\n"; } } else if (macroVar == "MPICC") { mpicc = macroVarValue; if (verbose) { cout << "mpicc set to " + macroVarValue + "\n"; } } else if (macroVar == "MPICCFLAGS") { mpicflags = macroVarValue; if (verbose) { cout << "mpicflags set to " + macroVarValue + "\n"; } } else if (macroVar == "FFTW_LIBS") { fftwlibs = macroVarValue; if (verbose) { cout << "fftwlibs set to " + macroVarValue + "\n"; } } else if (macroVar == "FFTW3_LIBS") { fftw3libs = macroVarValue; if (verbose) { cout << "fftw3libs set to " + macroVarValue + "\n"; } } else if (macroVar == "FFTW3_THREADLIBS") { fftw3threadlibs = macroVarValue; if (verbose) { cout << "fftw3threadlibs set to " + macroVarValue + "\n"; } } else if (macroVar == "FFTW_MPI_LIBS") { fftw_mpi_libs = macroVarValue; if (verbose) { cout << "fftw_mpi_libs set to " + macroVarValue + "\n"; } } } return 0; } // ******************************************************************** //! Routine to write to either stdout or file a template simulation script /*! @param outfilename The output filename to sent the template simulation script to */ void outputTemplate(const char* outfilename) { // this is the template text, at present taken directly from the // tutorial, tutTemplateStart.tex of the latex documentation // and relevant characters escaped so that they print out properly const string templateText = "\n" "\n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " no \n" " \n" " \n" " 1 2 \n" " \n" " \n" " no \n" " \n" " Scheduling \n" " yes \n" " yes \n" " yes \n" " yes \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " main \n" " \n" " \n" " (, ) \n" " \n" " \n" " \n" " main \n" " complex \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " yes \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" "\n"; // check to see if an output file was given if (outfilename == 0) { // ok, so no input file specified, we therefore spit it out to stdout cout << templateText; } else if (outfilename != 0) { // ok, we have an input file, open it, biff out the string, close it // btw, why am I using the old C syntax for this and not C++??? ofstream templateFile; templateFile.open(outfilename); if (templateFile.fail()) { // make sure can actually open the file cout << "Unable to open output file: " << outfilename << "\n"; cout << "Sending output to stdout\n\n"; cout << templateText; } else { /*! * \todo the xmds version/copyright info is repeated too often * put this into a routine! */ cout << "This is xmds, version " << VERSION << " (" << REVISION <<")\n" << "Copyright 2000-2008 Greg Collecutt, Joseph Hope "<< "and the xmds-devel team\n" << "xmds is available from http://www.xmds.org\n\n" << "Writing a template to file with filename: " << outfilename << "\n"; // actually write the template to the file templateFile << templateText; cout << "Done!\n"; } templateFile.close(); } } /* ******************************************************************** */ bool debugFlag = 0; //!< Print debugging info about xmds processes bool xmlDebugFlag = 0; //!< Print debugging info about xml parsing processes vector simulationText; //!< The text of the xmds simulation script //! The lines of the xmds script's header. Escaped for source output. vector simHeaderText; //! The lines of the xmds script's body. Escaped for source output. vector simBodyText; //! The lines of the xmds script's footer. Escaped for source output. vector simFooterText; /*! @brief The main routine. @param argc The number of arguments to the program @param argv The "vector" of arguments to the program */ int main( int argc, char **argv) { bool verbose = 0; bool compileFlag = 1; bool templateGenFlag = 0; const char* infilename = 0; int resp; while (1) { static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"verbose", no_argument, 0, 'v'}, {"debug", no_argument, 0, 'd'}, {"nocompile", no_argument, 0, 'n'}, {"template", optional_argument, 0, 't'}, {"xmldebug", no_argument, 0, 'x'}, {0, 0, 0, 0} }; int option_index = 0; resp = getopt_xmds_long(argc, argv, "hvdnxt", long_options, &option_index); if (resp == -1) { break; } switch (resp) { case 'h': display_usage(); return 0; case 'v': verbose = 1; break; case 'd': debugFlag = 1; break; case 'n': compileFlag = 0; break; case 't': templateGenFlag = 1; break; case 'x': xmlDebugFlag = 1; break; default: display_usage(); return 0; } } // process non-option command line elements if (optind_xmds < argc) { int fnameCount = 0; while (optind_xmds < argc) { fnameCount++; if (fnameCount > 1) { // error, input file name already exists printf("Error: multiple input files not allowed\n\n"); display_usage(); return 0; } // assign infilename pointer to the appropriate // member of the argv array infilename = argv[optind_xmds++]; } } // if asked to make a template, then just spit it out, either to file // or to stdout and then return nicely if (templateGenFlag) { /*! \todo * at present, we'll reuse the input file. I intend to change this to * use the getopt_xmds stuff later, so will have to do that at some stage. */ outputTemplate(infilename); return 0; } // check to see that an input file was given if (infilename == 0) { // error, no input file was specified cout << "Error: no input file specified!\n\n"; display_usage(); return 1; } if (verbose) { cout << "xmds: inputfile = '" << infilename << "'\n"; } // create the XMLParser XMLParser myXMLParser; // now load xmds script into the DOMImplementation Document* theDocument=0; if (verbose) { cout << "Parsing file '" << infilename << "' ...\n"; } try { theDocument=myXMLParser.parseFromFile(infilename); // now load the xmds file into memory for later use // I tried doing this in vanilla C++, but couldn't // it looks like it'll have to be in C for the most part FILE *fin; if ((fin = fopen(infilename, "r")) == NULL) { cerr << "Can't open the input xmds script file: " << infilename << "Exiting\n"; return 1; // and barf } // now grab the file one line at a time unsigned char temp; string tempString = ""; while (!feof(fin)) { temp = fgetc(fin); if (temp != '\n') { tempString += temp; } else { simulationText.push_back(tempString); tempString = ""; } } fclose(fin); if (debugFlag) { for (unsigned int i=0; i tag // then, go from the back, dropping anything that isn't a > symbol, // keep that, and then try and get a
tag. // the header, (ie the (plus possibly more text) // and then the tag), the body (the rest of the simulationText // up until the footer, which is just the tag. // This ripping to bits is necessary so that we can piece together the // simulation script with the xsil output at the end of the simulation // without relying on system() calls. // search for the text "" // barf if we get to the end of the file, and still haven't found it. string simulationStartTag = ""; string simulationEndTag = ""; bool foundSimStartTag = false, foundSimEndTag = false; // go through the text and rip out the header, body and footer for (unsigned int i=0; i start tag when pulling to bits!\n"); } } if (simulationText[i].find(simulationEndTag) != string::npos) { foundSimEndTag = true; if (verbose) { printf("Found the end tag when pulling to bits!\n"); } } if (!foundSimStartTag && !foundSimEndTag) { simHeaderText.push_back(simulationText[i]); escapeStringC(simHeaderText.back()); } if (foundSimStartTag && !foundSimEndTag) { simBodyText.push_back(simulationText[i]); escapeStringC(simBodyText.back()); } if (foundSimStartTag && foundSimEndTag) { simFooterText.push_back(simulationText[i]); escapeStringC(simFooterText.back()); } } // if we got to here and foundSimStart tag is still false, then barf appropriately if (!foundSimStartTag) { cerr << "Failed to find the string \"\" within the simulation text\n"; cerr << "Exiting\n"; // I'm sure we should do something more intelligent here... //! \todo use xmdsException objects to handle exceptions/exits properly return 1; } if (debugFlag) { // have a look at the header if it exists cout << "-----------------------------\n"; cout << "The simulation header follows:\n"; for (unsigned int i=0; i\" within the simulation text\n"; cerr << "Exiting\n"; // I'm sure we should do something more intelligent here... //! \todo use xmdsException objects to handle exceptions/exits properly return 1; } if (debugFlag) { // have a look at the footer if it exits cout << "-----------------------------\n"; cout << "The simulation footer follows:\n"; for (unsigned int i=0; idocumentElement()->nodeName() != "simulation") { cerr << "Error: Expecting root element in '" << infilename << "' to be \n" << "Exiting.\n"; return 1; } unsigned long xmdsBytePoint = myXMLParser.xmdsBytePoint(); // create the xmdsSimulation xmdsSimulation myxmdsSimulation(infilename, verbose, strcmp(MPICC, "")); if (verbose) { cout << "Processing simulation ...\n"; } // print out some info about xmds cout << "This is xmds, version " << myxmdsSimulation.parameters()->version.c_str() << " (" << REVISION << ")" << "\n"; cout << "Copyright 2000-2008 Greg Collecutt, Joseph Hope " << "and the xmds-devel team\n" << "xmds is available from http://www.xmds.org\n\n"; try { myxmdsSimulation.processElement(theDocument->documentElement()); } catch(xmdsException xmdsExceptionErr) { cerr << "Error: simulation element could not be processed\n" << "due to the following xmdsException:\n" << xmdsExceptionErr.getError() << "Exiting.\n"; return 1; } if (verbose) { cout << "Writing output code ...\n"; } try { myxmdsSimulation.makeCode(xmdsBytePoint); } catch(xmdsException xmdsExceptionErr) { cerr << "Error: simulation failed to write output code\n" << "due to the following xmdsException:\n" << xmdsExceptionErr.getError() << "Exiting.\n"; return 1; } string cc = XMDS_CC; string cflags = XMDS_CFLAGS; string mpicc = MPICC; string mpicflags = MPICCFLAGS; string cincludes = XMDS_INCLUDES; string clibs = XMDS_LIBS; string fftwlibs = FFTW_LIBS; string fftw3libs = FFTW3_LIBS; string fftw_mpi_libs = FFTW_MPI_LIBS; string cthreadlibs = THREADLIBS; string fftw3threadlibs = FFTW3_THREADLIBS; // this is just some code to show what the defaults are if (verbose) { cout << "Defaults: (from when xmds was built)\n" << " cc = " << cc << "\n" << " cflags = " << cflags << "\n" << " mpicc = " << mpicc << "\n" << " mpicflags = " << mpicflags << "\n" << " cincludes = " << cincludes << "\n" << " clibs = " << clibs << "\n" << " fftwlibs = " << fftwlibs << "\n" << " fftw3libs = " << fftw3libs << "\n" << " fftw_mpi_libs = " << fftw_mpi_libs << "\n" << " cthreadlibs = " << cthreadlibs << "\n" << " fftw3_threadlibs = " << fftw3threadlibs << "\n"; } // if the usePrefs flag is true then try to find the prefs file // and then try to parse it, falling back to the above values if // we fail if (myxmdsSimulation.parameters()->usePrefs) { if (verbose) { cout << "Using user-defined preferences\n"; } // now try and open the file // first look in ~/.xmds/xmds.prefs // work out what the home directory is ifstream fIn, fPrefs; string findHomeString, homeStuff, homeDir, rmString; homeStuff = "home.stuff"; findHomeString = "echo $HOME > " + homeStuff; system(findHomeString.c_str()); fIn.open(homeStuff.c_str()); if (fIn.fail()) { cerr << "Unable to determine the user's home directory\n" << "Exiting\n"; return 1; } fIn >> homeDir; fIn.close(); rmString = "rm " + homeStuff; system(rmString.c_str()); // ~/.xmds/xmds.prefs string prefsFname; prefsFname = homeDir + "/.xmds/xmds.prefs"; fPrefs.open(prefsFname.c_str()); if (!fPrefs.fail()) { if (verbose) { cout << "Prefs file found: " << prefsFname.c_str() << "\n"; } // ok, now try and parse the sucker... parsePrefs(fPrefs, cc, cflags, clibs, cincludes, cthreadlibs, mpicc, mpicflags, fftwlibs, fftw_mpi_libs, fftw3libs, fftw3threadlibs, verbose, debugFlag); fPrefs.close(); } // if that didn't work, try the local directory else if (fPrefs.fail()) { string localDir; if (verbose) { cout << "Prefs file not found at " << prefsFname.c_str() << "\n"; cout << "Trying in the local directory\n"; // work out what the local directory is, and report it system("echo $PWD > localDir.test"); fIn.open("localDir.test"); if (fIn.fail()) { cerr << "Unable to properly determine the current directory\n" << "Exiting\n"; return 1; } fIn >> localDir; fIn.close(); system("rm localDir.test"); cout << "The local directory is " << localDir.c_str() << "\n"; } prefsFname = "xmds.prefs"; ifstream fPrefs; // need to define fPrefs again (local to this block) fPrefs.open(prefsFname.c_str()); if (!fPrefs.fail()) { if (verbose) { cout << "Prefs file found in local directory: " << localDir.c_str() << "\n"; } // ok, now try and parse the sucker... parsePrefs(fPrefs, cc, cflags, clibs, cincludes, cthreadlibs, mpicc, mpicflags, fftwlibs, fftw_mpi_libs, fftw3libs, fftw3threadlibs, verbose, debugFlag); fPrefs.close(); } // if we get to here, and things have still failed, print a warning // and just use the defaults else if (fPrefs.fail() && verbose) { cout << "Warning: no preferences file found. " << "Using default values instead\n"; } } } if (!myxmdsSimulation.parameters()->usePrefs && verbose) { cout << "Warning: User-defined preferences NOT being used. " << "Using defaults instead\n"; } // this is just some code to show what the compilation values are after the prefs have been added if (verbose) { cout << "User defined preferences: (some will be the default values)\n" << "These are used by xmds to build the simulation\n" << " cc = " << cc << "\n" << " cflags = " << cflags << "\n" << " mpicc = " << mpicc << "\n" << " mpicflags = " << mpicflags << "\n" << " cincludes = " << cincludes << "\n" << " clibs = " << clibs << "\n" << " fftwlibs = " << fftwlibs << "\n" << " fftw_mpi_libs = " << fftw_mpi_libs << "\n" << " fftw3libs = " << fftw3libs << "\n" << " cthreadlibs = " << cthreadlibs << "\n" << " fftw3threadlibs = " << fftw3threadlibs << "\n"; } // now set up the system command to compile the simulation char command[1024]; if (compileFlag) { if (myxmdsSimulation.parameters()->usempi) { //Joe mark if ((myxmdsSimulation.parameters()->nThreads > 1) || (myxmdsSimulation.parameters()->mpiMethod == "Scheduling")) { cout << "compiling for MPI parallel execution with threads...\n"; sprintf(command, "%s -D_REENTRANT -o %s %s.cc %s %s %s %s %s %s", mpicc.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), mpicflags.c_str(), cincludes.c_str(), clibs.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? cthreadlibs.c_str() : fftw3threadlibs.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? fftw_mpi_libs.c_str() : fftw3libs.c_str(), myxmdsSimulation.parameters()->useIntelMKL ? "-lguide -lvml" : ""); cout << " " << command << "\n"; if (system(command)) { cout << "compilation failed.\n"; return 1; } } else if (!(myxmdsSimulation.parameters()->stochastic)) { cout << "compiling for MPI parallel execution for a " "nondeterministic simulation...\n"; sprintf(command, "%s -o %s %s.cc %s %s %s %s %s", mpicc.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), mpicflags.c_str(), clibs.c_str(), cincludes.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? fftw_mpi_libs.c_str() : fftw3libs.c_str(), myxmdsSimulation.parameters()->useIntelMKL ? "-lguide -lvml" : ""); cout << " " << command << "\n"; if (system(command)) { cout << "compilation failed.\n"; return 1; } } else { printf("compiling for MPI parallel execution ...\n"); sprintf(command, "%s -o %s %s.cc %s %s %s %s %s", mpicc.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), mpicflags.c_str(), clibs.c_str(), cincludes.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? fftw_mpi_libs.c_str() : fftw3libs.c_str(), myxmdsSimulation.parameters()->useIntelMKL ? "-lguide -lvml" : ""); cout << " " << command << "\n"; if (system(command)) { cout << "compilation failed.\n"; return 1; } } } else { if (myxmdsSimulation.parameters()->nThreads > 1) { cout << "compiling for threaded parallel execution...\n"; sprintf(command, "%s -D_REENTRANT %s -o %s %s.cc %s %s %s %s %s %s", cc.c_str(), cflags.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), cincludes.c_str(), clibs.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? cthreadlibs.c_str() : fftw3threadlibs.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? fftwlibs.c_str() : fftw3libs.c_str(), myxmdsSimulation.parameters()->useOpenMP ? "-openmp" : "", myxmdsSimulation.parameters()->useIntelMKL ? "-lguide -lvml" : ""); cout << " " << command << "\n"; if (system(command)) { cout << "compilation failed.\n"; return 1; } } else { cout << "compiling ...\n"; sprintf(command, "%s %s -o %s %s.cc %s %s %s %s", cc.c_str(), cflags.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), myxmdsSimulation.parameters()->simulationName.c_str(), cincludes.c_str(), clibs.c_str(), myxmdsSimulation.parameters()->fftwVersion == 2 ? fftwlibs.c_str() : fftw3libs.c_str(), myxmdsSimulation.parameters()->useIntelMKL ? "-lguide -lvml" : ""); cout << " " << command << "\n"; if (system(command)) { cout << "compilation failed.\n"; return 1; } } } // ok, we're ready to go; tell the user about it cout << "\n" << myxmdsSimulation.parameters()->simulationName.c_str() << " ready to execute\n"; } return 0; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/Makefile.am0000644000076500000240000000573711033277417012773 00000000000000## Process this file with automake to produce Makefile.in # $Id: Makefile.am 1667 2008-01-21 22:12:20Z paultcochrane $ version.h: $(xmds_SOURCES_temp) ./version.sh XML_PARSER_SOURCES = dom3.h\ kissdom.h\ kissdom.cc\ xml_basics.h\ xml_basics.cc\ xml_parser.h\ xml_parser.cc ALGORITHM_SOURCES = \ xmds_integrate_ip.h\ xmds_integrate_ip.cc\ xmds_integrate_ex.h\ xmds_integrate_ex.cc\ xmds_integrate_si.h\ xmds_integrate_si.cc\ xmds_integrate_siip.h\ xmds_integrate_siip.cc\ xmds_integrate_siex.h\ xmds_integrate_siex.cc\ xmds_integrate_rk4.h\ xmds_integrate_rk4.cc\ xmds_integrate_rk4ip.h\ xmds_integrate_rk4ip.cc\ xmds_integrate_rk4ex.h\ xmds_integrate_rk4ex.cc\ xmds_integrate_ark45.h\ xmds_integrate_ark45.cc\ xmds_integrate_ark45ip.h\ xmds_integrate_ark45ip.cc\ xmds_integrate_ark45ex.h\ xmds_integrate_ark45ex.cc\ xmds_integrate_rk9.h\ xmds_integrate_rk9.cc\ xmds_integrate_rk9ip.h\ xmds_integrate_rk9ip.cc\ xmds_integrate_rk9ex.h\ xmds_integrate_rk9ex.cc\ xmds_integrate_ark89.h\ xmds_integrate_ark89.cc\ xmds_integrate_ark89ip.h\ xmds_integrate_ark89ip.cc\ xmds_integrate_ark89ex.h\ xmds_integrate_ark89ex.cc ARGUMENT_PARSING_SOURCES = \ xmds_argv.h\ xmds_argv.cc\ xmds_arg.h\ xmds_arg.cc\ xmds_arg_element.h\ xmds_arg_element.cc bin_PROGRAMS = xmds xsil2graphics xmds_SOURCES_temp = \ $(XML_PARSER_SOURCES)\ xmds_common.h\ xmds_complex.h\ xmds_utils.h\ xsil_field.h\ xmds_utils.cc\ xmds_element.h\ xmds_element.cc\ xmds_globals.h\ xmds_globals.cc\ xmds_field.h\ xmds_field.cc\ xmds_vector.h\ xmds_vector.cc\ xmds_vector_element.h\ xmds_vector_element.cc\ xmds_moment_group.h\ xmds_moment_group.cc\ xmds_output.h\ xmds_output.cc\ xmds_segment.h\ xmds_segment.cc\ xmds_sequence.h\ xmds_sequence.cc\ xmds_integrate.h\ xmds_integrate.cc\ xmds_filter.h\ xmds_filter.cc\ xmds_simulation.h\ xmds_simulation.cc\ xmds_breakpoint.h\ xmds_breakpoint.cc\ $(ARGUMENT_PARSING_SOURCES)\ $(ALGORITHM_SOURCES)\ main.cc xmds_SOURCES = version.h $(xmds_SOURCES_temp) xsil2graphics_SOURCES = xml_basics.cc\ kissdom.cc\ xml_parser.cc\ xmds_utils.cc\ xsil_field.cc\ xsil2graphics.cc dist_include_HEADERS = xmds_complex.h getopt_xmds.h nodist_include_HEADERS = xmds_config.h DISTCLEANFILES = xmds_config.h lib_LIBRARIES = libxmds.a libxmds_a_SOURCES = getopt_xmds.h\ getopt_xmds.c\ getopt_xmds1.c\ getopt_xmds_init.c\ xsil_field.cc\ xml_basics.cc\ kissdom.cc\ xml_parser.cc\ xmds_utils.cc api: doxygen Doxyfile xmds-1.6.6/source/Makefile.in0000644000076500000240000006335511033307502012771 00000000000000# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # $Id: Makefile.am 1667 2008-01-21 22:12:20Z paultcochrane $ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = xmds$(EXEEXT) xsil2graphics$(EXEEXT) subdir = source DIST_COMMON = $(dist_include_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/acx_pthread.m4 $(top_srcdir)/acx_mpi.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)" libLIBRARIES_INSTALL = $(INSTALL_DATA) LIBRARIES = $(lib_LIBRARIES) AR = ar ARFLAGS = cru libxmds_a_AR = $(AR) $(ARFLAGS) libxmds_a_LIBADD = am_libxmds_a_OBJECTS = getopt_xmds.$(OBJEXT) getopt_xmds1.$(OBJEXT) \ getopt_xmds_init.$(OBJEXT) xsil_field.$(OBJEXT) \ xml_basics.$(OBJEXT) kissdom.$(OBJEXT) xml_parser.$(OBJEXT) \ xmds_utils.$(OBJEXT) libxmds_a_OBJECTS = $(am_libxmds_a_OBJECTS) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__objects_1 = kissdom.$(OBJEXT) xml_basics.$(OBJEXT) \ xml_parser.$(OBJEXT) am__objects_2 = xmds_argv.$(OBJEXT) xmds_arg.$(OBJEXT) \ xmds_arg_element.$(OBJEXT) am__objects_3 = xmds_integrate_ip.$(OBJEXT) \ xmds_integrate_ex.$(OBJEXT) xmds_integrate_si.$(OBJEXT) \ xmds_integrate_siip.$(OBJEXT) xmds_integrate_siex.$(OBJEXT) \ xmds_integrate_rk4.$(OBJEXT) xmds_integrate_rk4ip.$(OBJEXT) \ xmds_integrate_rk4ex.$(OBJEXT) xmds_integrate_ark45.$(OBJEXT) \ xmds_integrate_ark45ip.$(OBJEXT) \ xmds_integrate_ark45ex.$(OBJEXT) xmds_integrate_rk9.$(OBJEXT) \ xmds_integrate_rk9ip.$(OBJEXT) xmds_integrate_rk9ex.$(OBJEXT) \ xmds_integrate_ark89.$(OBJEXT) \ xmds_integrate_ark89ip.$(OBJEXT) \ xmds_integrate_ark89ex.$(OBJEXT) am__objects_4 = $(am__objects_1) xmds_utils.$(OBJEXT) \ xmds_element.$(OBJEXT) xmds_globals.$(OBJEXT) \ xmds_field.$(OBJEXT) xmds_vector.$(OBJEXT) \ xmds_vector_element.$(OBJEXT) xmds_moment_group.$(OBJEXT) \ xmds_output.$(OBJEXT) xmds_segment.$(OBJEXT) \ xmds_sequence.$(OBJEXT) xmds_integrate.$(OBJEXT) \ xmds_filter.$(OBJEXT) xmds_simulation.$(OBJEXT) \ xmds_breakpoint.$(OBJEXT) $(am__objects_2) $(am__objects_3) \ main.$(OBJEXT) am_xmds_OBJECTS = $(am__objects_4) xmds_OBJECTS = $(am_xmds_OBJECTS) xmds_LDADD = $(LDADD) am_xsil2graphics_OBJECTS = xml_basics.$(OBJEXT) kissdom.$(OBJEXT) \ xml_parser.$(OBJEXT) xmds_utils.$(OBJEXT) xsil_field.$(OBJEXT) \ xsil2graphics.$(OBJEXT) xsil2graphics_OBJECTS = $(am_xsil2graphics_OBJECTS) xsil2graphics_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libxmds_a_SOURCES) $(xmds_SOURCES) \ $(xsil2graphics_SOURCES) DIST_SOURCES = $(libxmds_a_SOURCES) $(xmds_SOURCES) \ $(xsil2graphics_SOURCES) dist_includeHEADERS_INSTALL = $(INSTALL_HEADER) nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(dist_include_HEADERS) $(nodist_include_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MPICC = @MPICC@ MPILIBS = @MPILIBS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ THREADLIBS = @THREADLIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ XML_PARSER_SOURCES = dom3.h\ kissdom.h\ kissdom.cc\ xml_basics.h\ xml_basics.cc\ xml_parser.h\ xml_parser.cc ALGORITHM_SOURCES = \ xmds_integrate_ip.h\ xmds_integrate_ip.cc\ xmds_integrate_ex.h\ xmds_integrate_ex.cc\ xmds_integrate_si.h\ xmds_integrate_si.cc\ xmds_integrate_siip.h\ xmds_integrate_siip.cc\ xmds_integrate_siex.h\ xmds_integrate_siex.cc\ xmds_integrate_rk4.h\ xmds_integrate_rk4.cc\ xmds_integrate_rk4ip.h\ xmds_integrate_rk4ip.cc\ xmds_integrate_rk4ex.h\ xmds_integrate_rk4ex.cc\ xmds_integrate_ark45.h\ xmds_integrate_ark45.cc\ xmds_integrate_ark45ip.h\ xmds_integrate_ark45ip.cc\ xmds_integrate_ark45ex.h\ xmds_integrate_ark45ex.cc\ xmds_integrate_rk9.h\ xmds_integrate_rk9.cc\ xmds_integrate_rk9ip.h\ xmds_integrate_rk9ip.cc\ xmds_integrate_rk9ex.h\ xmds_integrate_rk9ex.cc\ xmds_integrate_ark89.h\ xmds_integrate_ark89.cc\ xmds_integrate_ark89ip.h\ xmds_integrate_ark89ip.cc\ xmds_integrate_ark89ex.h\ xmds_integrate_ark89ex.cc ARGUMENT_PARSING_SOURCES = \ xmds_argv.h\ xmds_argv.cc\ xmds_arg.h\ xmds_arg.cc\ xmds_arg_element.h\ xmds_arg_element.cc xmds_SOURCES_temp = \ $(XML_PARSER_SOURCES)\ xmds_common.h\ xmds_complex.h\ xmds_utils.h\ xsil_field.h\ xmds_utils.cc\ xmds_element.h\ xmds_element.cc\ xmds_globals.h\ xmds_globals.cc\ xmds_field.h\ xmds_field.cc\ xmds_vector.h\ xmds_vector.cc\ xmds_vector_element.h\ xmds_vector_element.cc\ xmds_moment_group.h\ xmds_moment_group.cc\ xmds_output.h\ xmds_output.cc\ xmds_segment.h\ xmds_segment.cc\ xmds_sequence.h\ xmds_sequence.cc\ xmds_integrate.h\ xmds_integrate.cc\ xmds_filter.h\ xmds_filter.cc\ xmds_simulation.h\ xmds_simulation.cc\ xmds_breakpoint.h\ xmds_breakpoint.cc\ $(ARGUMENT_PARSING_SOURCES)\ $(ALGORITHM_SOURCES)\ main.cc xmds_SOURCES = version.h $(xmds_SOURCES_temp) xsil2graphics_SOURCES = xml_basics.cc\ kissdom.cc\ xml_parser.cc\ xmds_utils.cc\ xsil_field.cc\ xsil2graphics.cc dist_include_HEADERS = xmds_complex.h getopt_xmds.h nodist_include_HEADERS = xmds_config.h DISTCLEANFILES = xmds_config.h lib_LIBRARIES = libxmds.a libxmds_a_SOURCES = getopt_xmds.h\ getopt_xmds.c\ getopt_xmds1.c\ getopt_xmds_init.c\ xsil_field.cc\ xml_basics.cc\ kissdom.cc\ xml_parser.cc\ xmds_utils.cc all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .cc .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu source/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu source/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status source/config.h $(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ p=$(am__strip_dir) \ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) libxmds.a: $(libxmds_a_OBJECTS) $(libxmds_a_DEPENDENCIES) -rm -f libxmds.a $(libxmds_a_AR) libxmds.a $(libxmds_a_OBJECTS) $(libxmds_a_LIBADD) $(RANLIB) libxmds.a install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) xmds$(EXEEXT): $(xmds_OBJECTS) $(xmds_DEPENDENCIES) @rm -f xmds$(EXEEXT) $(CXXLINK) $(xmds_OBJECTS) $(xmds_LDADD) $(LIBS) xsil2graphics$(EXEEXT): $(xsil2graphics_OBJECTS) $(xsil2graphics_DEPENDENCIES) @rm -f xsil2graphics$(EXEEXT) $(CXXLINK) $(xsil2graphics_OBJECTS) $(xsil2graphics_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt_xmds.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt_xmds1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt_xmds_init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kissdom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_arg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_arg_element.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_argv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_breakpoint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_element.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_field.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_filter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_globals.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ark45.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ark45ex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ark45ip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ark89.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ark89ex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ark89ip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_ip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_rk4.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_rk4ex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_rk4ip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_rk9.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_rk9ex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_rk9ip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_si.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_siex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_integrate_siip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_moment_group.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_output.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_segment.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_sequence.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_simulation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_vector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmds_vector_element.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml_basics.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml_parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsil2graphics.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsil_field.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` install-dist_includeHEADERS: $(dist_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(dist_include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(dist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-dist_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(dist_include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done install-nodist_includeHEADERS: $(nodist_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(nodist_include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ done uninstall-nodist_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_include_HEADERS)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ rm -f "$(DESTDIR)$(includedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dist_includeHEADERS \ install-nodist_includeHEADERS install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-libLIBRARIES install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-dist_includeHEADERS \ uninstall-libLIBRARIES uninstall-nodist_includeHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dist_includeHEADERS install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-libLIBRARIES install-man install-nodist_includeHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-dist_includeHEADERS uninstall-libLIBRARIES \ uninstall-nodist_includeHEADERS version.h: $(xmds_SOURCES_temp) ./version.sh api: doxygen Doxyfile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmds-1.6.6/source/version.h0000644000076500000240000000003111033307510012537 00000000000000#define REVISION "r2041" xmds-1.6.6/source/xmds_arg.cc0000644000076500000240000000612311033277417013040 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_arg.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_arg.cc @brief Command line argument parsing classes and methods More detailed explanation... */ #include #include // ************************************************************************** // ************************************************************************** // xmdsArg public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsArgs = 0; //!< Number of xmds argument objects // ************************************************************************** xmdsArg::xmdsArg( const xmdsArgv *const yourArgv) : myArgv(yourArgv) { if (debugFlag) { nxmdsArgs++; printf("xmdsArg::xmdsArg\n"); printf("nxmdsArgs=%li\n", nxmdsArgs); } } // ************************************************************************** xmdsArg::~xmdsArg() { if (debugFlag) { nxmdsArgs--; printf("xmdsArg::~xmdsArg\n"); printf("nxmdsArgs=%li\n", nxmdsArgs); } } // ************************************************************************** const XMLString* xmdsArg::name() const { if (debugFlag) { printf("xmdsArg::name\n"); } return &myName; } // ************************************************************************** void xmdsArg::setName( const XMLString& yourName) { if (debugFlag) { printf("xmdsArg::setName\n"); } myName = yourName; } // ************************************************************************** // ************************************************************************** // xmdsArg protected // ************************************************************************** // ************************************************************************** // ************************************************************************** const xmdsArgv* xmdsArg::argv() const { if (debugFlag) { printf("xmdsArg::argv\n"); } return myArgv; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_arg.h0000644000076500000240000000422411033277417012702 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_arg.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_arg.h @brief More detailed explanation... */ #ifndef XMDS_ARG_H #define XMDS_ARG_H #include // ***************************************************************************** // ***************************************************************************** // xmdsArg // ***************************************************************************** // ***************************************************************************** //! xmds arg class /*! The class that handles individual arguments for the simulation command line. More specifically, it handles the name, type and default value of arguments to be used on the command line. */ class xmdsArg { public : //! Constructor for xmdsArg object xmdsArg( const xmdsArgv *const yourArgv); //! Destructor virtual ~xmdsArg(); //! grabs the argument name const XMLString* name() const; //! Sets the argument name void setName( const XMLString& yourName); protected: //! Obtains an instance of the xmdsArgv object const xmdsArgv* argv() const; private : const xmdsArgv *const myArgv; //!< The "vector" of arguments XMLString myName; //!< The name of the argument }; #endif // XMDS_ARG_H xmds-1.6.6/source/xmds_arg_element.cc0000644000076500000240000002060711033277417014554 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_arg_element.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_arg_element.cc @brief Command line argument parsing classes and methods for argument elements More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsArgElement public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsArgElements = 0; //!< Number of xmds argument element objects // ************************************************************************** xmdsArgElement::xmdsArgElement( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const xmdsArgv *const yourArgv) : xmdsArg(yourArgv), xmdsElement(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsArgElements++; printf("xmdsArgElement::xmdsArgElement\n"); printf("nxmdsArgElements=%li\n", nxmdsArgElements); } } // ************************************************************************** xmdsArgElement::~xmdsArgElement() { if (debugFlag) { nxmdsArgElements--; printf("xmdsArgElement::~xmdsArgElement\n"); printf("nxmdsArgElements=%li\n", nxmdsArgElements); } } // ************************************************************************** void xmdsArgElement::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsArgElement::processElement\n"); } list anXMLStringList; string aString; if (verbose()) { printf("Processing arg element ...\n"); } // ************************************ // find name getAssignmentStrings(yourElement, "name", 1, 1, anXMLStringList); const xmdsArg* possibleTwin; if (argv()->getArg(*anXMLStringList.begin(), possibleTwin)) { sprintf(errorMessage(), "an arg of name '%s' already exists in this argv", anXMLStringList.begin()->c_str()); throw xmdsException(yourElement, errorMessage()); } // I think by leaving this here, we can check for duplicate names setName(*anXMLStringList.begin()); XMLString xmltempString = *anXMLStringList.begin(); string nameString = (string) xmltempString.c_str(); simulation()->argStruct()->nameList.push_back(nameString); if (verbose()) { printf("argument name is '%s'\n", nameString.c_str()); } // now I need to work out what the short option should be string testChar; bool shortOptExists; for (unsigned long int j=0; j::const_iterator ishort = simulation()->argStruct()->shortOptionList.begin(); for (unsigned long int i = 0; i < simulation()->argStruct()->shortOptionList.size(); i++) { if (verbose()) { printf("Testing %s with %s against %s\n", nameString.c_str(), testChar.c_str(), ishort->c_str()); } // the short option can't be 'h' since this is used to output the // help and usage information if ((testChar.find(*ishort) != string::npos) || (testChar.find("h") != string::npos)) { if (verbose()) { printf("short option '%s' already exists\n", testChar.c_str()); } // it exists already, set a flag to go around again. shortOptExists = true; } if (testChar.find(*ishort) == string::npos && shortOptExists) { sprintf(errorMessage(), "Haven't been able to make a short option for '%s'.\n" "Please use another name and retry.\n", nameString.c_str()); throw xmdsException(yourElement, errorMessage()); } ishort++; } if (!shortOptExists) { // if get to here without the option turning up, break. if (verbose()) { printf("Using %s as short option for %s\n", testChar.c_str(), nameString.c_str()); } simulation()->argStruct()->shortOptionList.push_back(testChar); break; } } // ************************************ // find type getAssignmentStrings(yourElement, "type", 1, 0, anXMLStringList); // now biff the XMLStringList into an XMLString and set that to the // argument type XMLString xmltypeString, spaceString; spaceString = " "; list::const_iterator iType; iType = anXMLStringList.begin(); for (unsigned long int i = 0; i < anXMLStringList.size(); i++) { xmltypeString += *iType; xmltypeString += spaceString; iType++; } string typeString = (string) xmltypeString.c_str(); simulation()->argStruct()->typeList.push_back(typeString); if (debugFlag) { printf("typeString is: %s\n", typeString.c_str()); } if (verbose()) { printf("argument type is '%s'\n", typeString.c_str()); } // now need to define the conversion function string // e.g. double -> atof() if (typeString.find("double") != string::npos) { // setting type to double if (verbose()) { printf("typeString matches 'double': using atof() as type conversion\n"); } simulation()->argStruct()->typeConversionList.push_back("atof"); } else if (typeString.find("float") != string::npos) { // setting type to double anyway... (should I really do this?) if (verbose()) { printf("typeString matches 'float': using atof() as type conversion\n"); } simulation()->argStruct()->typeConversionList.push_back("atof"); } else if (typeString.find("string") != string::npos) { // setting type to string if (verbose()) { printf("typeString matches 'string': no need for type conversion\n"); } simulation()->argStruct()->typeConversionList.push_back(""); } else if (typeString.find("char") != string::npos) { // setting type to char * if (verbose()) { printf("typeString matches 'char': no need for type conversion\n"); } simulation()->argStruct()->typeConversionList.push_back(""); } else if (typeString.find("int") != string::npos) { // setting type to int if (verbose()) { printf("typeString matches 'int': using atoi() as type conversion\n"); } simulation()->argStruct()->typeConversionList.push_back("atoi"); } else { printf("Hmmm, I don't know how your type should be converted\n"); printf("Hoping that double is ok...\n"); simulation()->argStruct()->typeConversionList.push_back("atof"); } // ************************************ // find default_value getAssignmentStrings(yourElement, "default_value", 1, 1, anXMLStringList); xmltempString = *anXMLStringList.begin(); string defaultValueString = (string) xmltempString.c_str(); simulation()->argStruct()->defaultValueList.push_back(defaultValueString); if (verbose()) { printf("argument default value is '%s'\n", defaultValueString.c_str()); } } // ************************************************************************** // ************************************************************************** // xmdsArgElement private // ************************************************************************** // ************************************************************************** /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_arg_element.h0000644000076500000240000000453511033277417014420 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_arg_element.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_arg_element.h @brief Headers for the xmdsArgElement class More detailed explanation... */ #ifndef XMDS_ARG_ELEMENT_H #define XMDS_ARG_ELEMENT_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsArgElement // ***************************************************************************** // ***************************************************************************** //! xmds arg element class /*! The class that handles individual elements of an argument. These are the name of the argument, its type and its default value. */ class xmdsArgElement : public xmdsArg, public xmdsElement { public : //! Constructor for the xmdsArgElement object xmdsArgElement( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const xmdsArgv *const yourArgv); //! Destructor ~xmdsArgElement(); //! Processes an element of an xmds vector element void processElement( const Element *const yourElement); private : // void writeArgDeclaration( // FILE *const outfile) const; // void writeArgCode( // FILE *const outfile) const; // list myArgNamesList; }; #endif // XMDS_ARG_ELEMENT_H xmds-1.6.6/source/xmds_argv.cc0000644000076500000240000001714311033277417013232 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_argv.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_argv.cc @brief Command line argument vector parsing classes and methods More detailed explanation... */ #include #include #include #include #include extern bool debugFlag; // ************************************************************************** // ************************************************************************** // xmdsArgv Public // ************************************************************************** // ************************************************************************** // ************************************************************************** xmdsArgv::xmdsArgv( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsElement(yourSimulation, yourVerboseMode) { if (debugFlag) { printf("xmdsArgv::xmdsArgv\n"); } } // ************************************************************************** xmdsArgv::~xmdsArgv() { if (debugFlag) { printf("xmdsArgv::~xmdsArgv\n"); } // destroy xmdsArgs, since they are not managed by the xmdsElement class for (list::const_iterator ppxmdsArg = myArgsList.begin(); ppxmdsArg != myArgsList.end(); ppxmdsArg++) { delete(*ppxmdsArg); } } // ************************************************************************** void xmdsArgv::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsArgv::processElement\n"); } if (verbose()) { printf("Processing argv element ...\n"); } list anXMLStringList; // ************************************ // find and process arg elements // ************************************ const NodeList* candidateElements; candidateElements = yourElement->getElementsByTagName("arg", 0); if (candidateElements->length() == 0) { throw xmdsException(yourElement, "at least one argument expected"); } for (unsigned long i=0; ilength(); i++) { const Element* nextElement = dynamic_cast(candidateElements->item(i)); xmdsElement* newxmdsArgElement = createxmdsArgElement(); newxmdsArgElement->processElement(nextElement); } } // ************************************************************************** void xmdsArgv::processArgs( const list& argNamesList, const unsigned long& space) const { if (debugFlag) { printf("xmdsArgv::processArgs\n"); } for (list::const_iterator pXMLString = argNamesList.begin(); pXMLString != argNamesList.end(); pXMLString++) { const xmdsArg* nextArg; if (!getArg(*pXMLString, nextArg)) { sprintf(errorMessage(), "Arg '%s' unknown", pXMLString->c_str()); throw xmdsException(errorMessage()); } for (list::const_iterator pXMLString2 = argNamesList.begin(); pXMLString2 != pXMLString; pXMLString2++) { if (*pXMLString == *pXMLString2) { sprintf(errorMessage(), "Duplicate arg '%s'", pXMLString->c_str()); throw xmdsException(errorMessage()); } } if (verbose()) { printf("adding arg '%s' to accessible args list\n", pXMLString->c_str()); } } } // ************************************************************************** bool xmdsArgv::getArg( const XMLString& argName, const xmdsArg*& theArg) const { if (debugFlag) { printf("xmdsArgv::getArg\n"); } theArg = 0; for (list::const_iterator ppxmdsArg = myArgsList.begin(); ppxmdsArg != myArgsList.end(); ppxmdsArg++) { if (*(*ppxmdsArg)->name() == argName) { theArg = *ppxmdsArg; return 1; } } return 0; } // ************************************************************************** void xmdsArgv::argNames( list& argNamesList) const { if (debugFlag) { printf("xmdsArgv::argNames\n"); } argNamesList.clear(); for (list::const_iterator ppxmdsArg = myArgsList.begin(); ppxmdsArg != myArgsList.end(); ppxmdsArg++) { argNamesList.push_back(*(*ppxmdsArg)->name()); } } // ************************************************************************** xmdsArg* xmdsArgv::createxmdsArg() { if (debugFlag) { printf("xmdsArgv::createxmdsArg\n"); } xmdsArg* newArg = new xmdsArg(this); myArgsList.push_back(newArg); return newArg; } // ************************************************************************** // ************************************************************************** // xmdsArgv protected // ************************************************************************** // ************************************************************************** void xmdsArgv::writeGlobals(FILE *const outfile) const { if (debugFlag) { printf("xmdsArgv::writeGlobals\n"); } if (simulation()->argStruct()->nameList.size() != 0) { fprintf(outfile, "\n" "// *********** Command line argument global variables *********\n"); list::const_iterator inameList = simulation()->argStruct()->nameList.begin(); list::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); list::const_iterator idefaultValueList = simulation()->argStruct()->defaultValueList.begin(); for (long unsigned int i = 0; i < simulation()->argStruct()->nameList.size(); i++) { fprintf(outfile, "%s %s = %s;\n", itypeList->c_str(), inameList->c_str(), idefaultValueList->c_str()); itypeList++; inameList++; idefaultValueList++; } fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); } } // ************************************************************************** // ************************************************************************** // xmdsArgv private // ************************************************************************** // ************************************************************************** // ************************************************************************** xmdsArgElement* xmdsArgv::createxmdsArgElement() { if (debugFlag) { printf("xmdsArgv::createxmdsArgElement\n"); } xmdsArgElement* newArgElement = new xmdsArgElement(simulation(), verbose(), this); myArgsList.push_back(newArgElement); return newArgElement; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_argv.h0000644000076500000240000000537111033277417013074 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_argv.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_argv.h @brief More detailed explanation... */ #ifndef XMDS_ARGV_H #define XMDS_ARGV_H #include // ***************************************************************************** // ***************************************************************************** // xmdsArgv // ***************************************************************************** // ***************************************************************************** class xmdsArg; class xmdsArgElement; //! xmds argv class /*! The class that handles command line arguments to xmds simulations. This is equivalent to the **argv array in C. */ class xmdsArgv : public xmdsElement { public : //! Constructor of xmdsArgv object xmdsArgv( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsArgv(); //! Processes the xmds element void processElement( const Element *const yourElement); //! Processes the args in the argument names list void processArgs( const list& argNamesList, const unsigned long& space) const; //! Gets the arg? /*! Why does this return boolean if it gets the argument? */ bool getArg( const XMLString& argName, const xmdsArg*& theArg) const; //! Returns the argument names in a list void argNames( list& argNamesList) const; //! Creates an xmds argument xmdsArg* createxmdsArg(); protected: //! Writes the globals code to the output file void writeGlobals( FILE *const outfile) const; private : list myArgsList; //!< The list of arguments //! Create an xmds argument element object xmdsArgElement* createxmdsArgElement(); }; #endif // XMDS_ARGV_H xmds-1.6.6/source/xmds_breakpoint.cc0000644000076500000240000006644411033277417014441 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_breakpoint.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_breakpoint.cc @brief Breakpoint classes and methods More detailed explanation... */ #include #include #include #include #include #include #include #include #include "version.h" // ************************************************************************** // ************************************************************************** // xmdsBreakpoint public // ************************************************************************** // ************************************************************************** extern bool debugFlag; extern vector simHeaderText, simBodyText, simFooterText; long nxmdsBreakpoints = 0; //!< Number of xmds breakpoint objects // ************************************************************************** xmdsBreakpoint::xmdsBreakpoint( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsSegment(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsBreakpoints++; printf("xmdsBreakpoint::xmdsBreakpoint\n"); printf("nxmdsBreakpoints=%li\n", nxmdsBreakpoints); } } // ************************************************************************** xmdsBreakpoint::~xmdsBreakpoint() { if (debugFlag) { nxmdsBreakpoints--; printf("xmdsBreakpoint::~xmdsBreakpoint\n"); printf("nxmdsBreakpoints=%li\n", nxmdsBreakpoints); } } // ************************************************************************** bool xmdsBreakpoint::runsInOvertime() const { return true; } // ************************************************************************** void xmdsBreakpoint::processElement(const Element *const yourElement) { if (debugFlag) { printf("xmdsBreakpoint::processElement\n"); } if (simulation()->parameters()->stochastic && simulation()->parameters()->nPaths != "1") { printf( "Warning: For stochastic simulations, each time a breakpoint element\n" "is reached for a path, the same file will be overwritten.\n"); } const long unsigned int nDims = simulation()->field()->geometry()->nDims(); const NodeList* candidateElements; list bpFnameList; // ************************************ // find filename element candidateElements = yourElement->getElementsByTagName("filename", NOT_DEEP); if (candidateElements->length() == 0) { printf("Breakpoint names defaulting to the sequence 1.xsil, 2.xsil, etc.\n"); autoIncrementFilenames = true; } else if (candidateElements->length()>1) { throw xmdsException(yourElement, "Multiple elements defined"); } else { // find out what the filename is, and if no string is specified then // barf, because the tag has been specified, but no name getAssignmentStrings(yourElement, "filename", NOT_REQD, 1, bpFnameList); list::const_iterator tmpIter = bpFnameList.begin(); breakpointFilename = *tmpIter; autoIncrementFilenames = false; } if (nDims>0) { // ************************************ // find space list aSpaceList; getAssignmentBools(yourElement, "fourier_space", 0, simulation()->field()->geometry()->nDims(), aSpaceList); if (aSpaceList.size() == 0) { printf("Breakpoint space for defaulting to x-space.\n"); outputSpace = 0; } else { list::const_iterator pBool = aSpaceList.begin(); for (long unsigned int i = 0; i < simulation()->field()->geometry()->nDims(); i++) { if (verbose()) { if (*pBool) printf("Breakpoint will be written with dimension #%li in fourier space\n", i+1); else printf("Breakpoint will be written with dimension #%li in normal space\n", i+1); } pBool++; } outputSpace = spaceList2ULong(aSpaceList); } } // ************************************ // find vectors // Vector names are required getAssignmentStrings(yourElement, "vectors", 1, 0, myVectorNamesList); simulation()->field()->processVectors(myVectorNamesList, outputSpace); if (verbose()) { printf("The breakpoint options are:\n"); printf(" filename = %s\n", breakpointFilename.c_str()); } } // ************************************************************************** // ************************************************************************** // xmdsBreakpoint private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsBreakpoint::writePrototypes(FILE *const outfile) const { if (debugFlag) { printf("xmdsBreakpoint::writePrototypes\n"); } if (verbose()) { printf("Writing breakpoint prototypes ...\n"); } fprintf(outfile, "void _segment%li(unsigned long cycle); // breakpoint\n", segmentNumber); } // ************************************************************************** void xmdsBreakpoint::writeRoutines(FILE *const outfile) const { if (debugFlag) { printf("xmdsBreakpoint::writeRoutines\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); long unsigned int i; if (verbose()) { printf("Writing breakpoint routines ...\n"); } fprintf(outfile, "// ********************************************************\n" "// segment %li (breakpoint) routines\n" "\n", segmentNumber); fprintf(outfile, "// *************************\n" "void _segment%li(unsigned long cycle) {\n" "\n", segmentNumber); if (autoIncrementFilenames) { fprintf(outfile, "_breakpointAutoIncrementCounter++;\n" "char *_baseFilename = (char*)malloc(100);\n" "snprintf(_baseFilename, 100, \"%%li\", _breakpointAutoIncrementCounter);\n"); } else { // get the xsil filename, rip off the extension if it equals '.xsil' // otherwise, leave it alone XMLString xsilFilename = breakpointFilename; XMLString xsilExtension; xsilExtension += ".xsil"; XMLString testExtension; xsilFilename.subString(testExtension, xsilFilename.length()-5, xsilFilename.length()); if (testExtension == xsilExtension) { xsilFilename.deleteData(xsilFilename.length()-5, 5); } fprintf(outfile, "char *_baseFilename = \"%s\";\n", xsilFilename.c_str()); } if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) fprintf(outfile, "MPI_Barrier(MPI_COMM_WORLD);\n"); simulation()->field()->vectors2space(outfile, outputSpace, myVectorNamesList, ""); bool swapped = false; if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { if ((outputSpace & 1) & ((outputSpace >> 1) & 1)) { swapped = true; } fprintf(outfile, "// Only write to file if you are rank 0, as we cannot assume\n" "// that the nodes have equal access to the filesystem\n" "if (rank == 0) {\n"); } fprintf(outfile, "char *_xsilFilename = (char*)malloc(200), *_datFilename = (char*)malloc(200);\n" "strncpy(_xsilFilename, _baseFilename, 200);\n" "strncpy(_datFilename, _baseFilename, 200);\n" "strcat(_xsilFilename, \".xsil\");\n" "strcat(_datFilename, \".dat\");\n"); fprintf(outfile, " FILE* _outfile = fopen(_xsilFilename, \"w\");\n" "\n" " if (_outfile == 0) {\n" " printf(\"Unable to open output file %%s\\n\", _xsilFilename);\n" " printf(\"Exiting.\\n\");\n" " return;\n" " }\n" "\n"); // put the header text into the output from the xmds script fprintf(outfile, "\n"); for (unsigned int i = 0; i < simHeaderText.size(); i++) { fprintf(outfile, " fprintf(_outfile, \"%%s\\n\", \"%s\");\n", simHeaderText[i].c_str()); } // put the body text into the output from the xmds script fprintf(outfile, "\n"); for (unsigned int i = 0; i < simBodyText.size(); i++) { fprintf(outfile, " fprintf(_outfile, \"%%s\\n\", \"%s\");\n", simBodyText[i].c_str()); } // biff out some informative text about xmds - this is the footer fprintf(outfile, " fprintf(_outfile, \"\\n\\n\");\n" " fprintf(_outfile, \"Output generated with xmds version %s (%s).\\n\");\n", simulation()->parameters()->version.c_str(), simulation()->parameters()->revision.c_str()); fprintf(outfile, " fprintf(_outfile, " "\"See http://www.xmds.org for more information.\\n\");\n"); if (simulation()->argStruct()->nameList.size() != 0) { fprintf(outfile, " fprintf(_outfile, \" " "Variables that can be specified on the command line: \\n\");\n"); list::const_iterator inameList = simulation()->argStruct()->nameList.begin(); list::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); for (long unsigned int i = 0; i < simulation()->argStruct()->nameList.size(); i++) { string theType = itypeList->c_str(); if (theType == "double ") { fprintf(outfile, " fprintf(_outfile, \" " "Command line argument '%s' = %%e \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else if (theType == "long ") { fprintf(outfile, " fprintf(_outfile, \" " "Command line argument '%s' = %%li \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else if (theType == "float ") { fprintf(outfile, " fprintf(_outfile, \" " "Command line argument '%s' = %%e \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else if (theType == "int ") { fprintf(outfile, " fprintf(_outfile, \" " "Command line argument '%s' = %%i \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else { fprintf(outfile, " fprintf(_outfile, \" " "Command line argument '%s' is an unimplemented output type '%s'\\n\");\n", inameList->c_str(), itypeList->c_str()); } itypeList++; inameList++; } fprintf(outfile, "\n"); } fprintf(outfile, " fprintf(_outfile, \"\\n\");\n"); // end of informative text // this is where the moment groups are written fprintf(outfile, "fprintf(_outfile, \"\\n\");\n" "fprintf(_outfile, \"\\n\");\n"); unsigned long nVariables =0; list variableNames; for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { const xmdsVector *vector; simulation()->field()->getVector(*pXMLString, vector); if (vector->vectorType() == DOUBLE) { nVariables += vector->nComponents(); for (long unsigned int i = 0; i < vector->nComponents(); i++) { XMLString realPartName = *vector->componentName(i); realPartName += "R"; variableNames.push_back(realPartName); } } else { // complex vector nVariables += 2*vector->nComponents(); for (long unsigned int i = 0; i < vector->nComponents(); i++) { XMLString baseName = *vector->componentName(i); XMLString realPartName = baseName; realPartName += "R"; XMLString imagPartName = baseName; imagPartName += "I"; variableNames.push_back(realPartName); variableNames.push_back(imagPartName); } } } fprintf(outfile, "fprintf(_outfile, " "\" %li\\n\");\n", nDims); fprintf(outfile, "fprintf(_outfile, " "\" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, " "\" %li\\n\");\n", nVariables+nDims); fprintf(outfile, "fprintf(_outfile, " "\" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, \""); for (i = 0; i < nDims; i++) { if (space(i)) { fprintf(outfile, "k"); } fprintf(outfile, "%s ", simulation()->field()->geometry()->dimension(i)->name.c_str()); } for (list::const_iterator pXMLString = variableNames.begin(); pXMLString != variableNames.end(); pXMLString++) fprintf(outfile, "%s ", pXMLString->c_str()); fprintf(outfile, "\\n\");\n"); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, " "\" \\n\");\n"); for (i = 0; i < nDims; i++) fprintf(outfile, "fprintf(_outfile, " "\" %li\\n\");\n", simulation()->field()->geometry()->dimension(i)->lattice); fprintf(outfile, "fprintf(_outfile, " "\" %li\\n\");\n", nVariables+nDims); // the "precision" variable is for the xsil output, and for matlab string precisionString, precision; fprintf(outfile, "\nstring encodingStr;\n" "if (CPU_IS_BIG_ENDIAN) {\n" " // big endian\n" " encodingStr = \"BigEndian\";\n" "}\n" "else if (CPU_IS_LITTLE_ENDIAN) {\n" " // little endian\n" " encodingStr = \"LittleEndian\";\n" "}\n" "else {\n" " // dunno what the byte order is\n" " cout << \"I don't know what kind of byte ordering you're using\\n\";\n" " cout << \"Using \\\"Binary\\\" as encoding\\n\";\n" " encodingStr = \"Binary\";\n" "}\n" "\nstring ulongTypeStr;\n" "if (SIZEOF_UNSIGNED_LONG == 4) {\n" " // 32 bit\n" " ulongTypeStr = \"uint32\";\n" "}\n" "else if (SIZEOF_UNSIGNED_LONG == 8) {\n" " // 64 bit\n" " ulongTypeStr = \"uint64\";\n" "}\n" "else {\n" " // dunno what the default size of the unsigned long is\n" " ulongTypeStr = \"ulong\";\n" "}\n" "fprintf(_outfile, " "\" \", " "encodingStr.c_str());\n"); fprintf(outfile, "fprintf(_outfile, \"\\n%%s\\n\", _datFilename);\n" "fprintf(_outfile, \" \\n\");\n" "fprintf(_outfile, \"\\n\\n\");\n"); // put the footer text into the xmds simulation output fprintf(outfile, "\n"); for (unsigned int i = 0; i < simFooterText.size(); i++) { fprintf(outfile, " fprintf(_outfile, \"%%s\\n\", \"%s\");\n", simFooterText[i].c_str()); } // close things down and tidy up a bit fprintf(outfile, "\n" " fclose(_outfile);\n" "\n"); fprintf(outfile, "FILE *fpBinary;\n" "if ((fpBinary = fopen(_datFilename, \"wb\")) == NULL) {\n" " printf(\"Unable to open output file %%s\\n\", _datFilename);\n" " printf(\"Chucking a spack....\\n\");\n" " exit(255);\n" "}\n"); fprintf(outfile, "unsigned long dataSize;\n" "off_t fieldOffset = 0;\n" "double coordinate;\n"); for (long unsigned int i = 0; i < nDims; i++) { fprintf(outfile, "dataSize = _main_lattice%li;\n" "fwrite(&dataSize, sizeof(unsigned long), 1, fpBinary);\n", i); if (space(i)) { // k-space fprintf(outfile, "coordinate = -(_main_lattice%1$li)/2 * _main_dk%1$li;\n" "for (long _i0 = -(_main_lattice%1$li)/2; _i0 < (_main_lattice%1$li+1)/2; _i0++, coordinate += _main_dk%1$li) {\n", i); } else { // x-space fprintf(outfile, "coordinate = _main_xmin%1$li;\n" "for (long _i0 = 0; _i0 < _main_lattice%1$li; _i0++, coordinate += _main_dx%1$li) {\n", i); } fprintf(outfile, "\tfwrite(&coordinate, sizeof(double), 1, fpBinary);\n" "}\n" "fieldOffset += sizeof(unsigned long) + sizeof(double)*_main_lattice%li;\n", i); } fprintf(outfile, "off_t vectorFieldSize = _main_size*sizeof(double) + sizeof(unsigned long);\n" "dataSize = _main_size;\n\n"); for (long unsigned int i = 0; i < nVariables; i++) fprintf(outfile, "fseeko(fpBinary, fieldOffset + %li*vectorFieldSize, SEEK_SET);\n" "fwrite(&dataSize, sizeof(unsigned long), 1, fpBinary);\n\n", i); // Insert code that does the magic of accumulating all the data if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { /* BEGIN MPI-SPECIFIC CODE */ // nightmare. But this is the bit I care about... fprintf(outfile, "int my_local_nx = local_nx;\n" "int my_local_x_start = local_x_start;\n" "int my_local_ny_after_transpose = local_ny_after_transpose;\n" "int my_local_y_start_after_transpose = local_y_start_after_transpose;\n" "int my_total_local_size = total_local_size;\n" "for (int dataForRank = 0; dataForRank < size; dataForRank++) {\n" "int local_nx;\n" "int local_x_start;\n" "int local_ny_after_transpose;\n" "int local_y_start_after_transpose;\n" "int total_local_size;\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { const xmdsVector *vector; simulation()->field()->getVector(*pXMLString, vector); fprintf(outfile, "%s *_outputfield_%s;\n", vector->vectorType() == DOUBLE ? "double" : "complex", pXMLString->c_str()); } fprintf(outfile, "if (dataForRank == 0) {\n" " local_nx = my_local_nx;\n" " local_x_start = my_local_x_start;\n" " local_ny_after_transpose = my_local_ny_after_transpose;\n" " local_y_start_after_transpose = my_local_y_start_after_transpose;\n" " total_local_size = my_total_local_size;\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _active_main_%1$s = _main_%1$s;\n", pXMLString->c_str()); } fprintf(outfile, "}\n" "else {\n" " MPI_Status status;\n" " MPI_Recv(&local_nx, 1, MPI_INT, dataForRank, MPI_ANY_TAG, MPI_COMM_WORLD, &status);\n" " MPI_Recv(&local_x_start, 1, MPI_INT, dataForRank, MPI_ANY_TAG, MPI_COMM_WORLD, &status);\n" " MPI_Recv(&local_ny_after_transpose, 1, MPI_INT, dataForRank, MPI_ANY_TAG, MPI_COMM_WORLD, &status);\n" " MPI_Recv(&local_y_start_after_transpose, 1, MPI_INT, dataForRank, MPI_ANY_TAG, MPI_COMM_WORLD, &status);\n" " MPI_Recv(&total_local_size, 1, MPI_INT, dataForRank, MPI_ANY_TAG, MPI_COMM_WORLD, &status);\n" " // Now allocate the space needed locally, and receive the entire buffer\n\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { const xmdsVector *vector; simulation()->field()->getVector(*pXMLString, vector); fprintf(outfile, " _outputfield_%1$s = (%2$s *)fftw_malloc(sizeof(%2$s)*total_local_size*_main_%1$s_ncomponents);\n", pXMLString->c_str(), vector->vectorType() == DOUBLE ? "double" : "complex"); fprintf(outfile, " MPI_Recv(_outputfield_%1$s, %2$s*total_local_size*_main_%1$s_ncomponents, MPI_DOUBLE, dataForRank, MPI_ANY_TAG, MPI_COMM_WORLD, &status);\n", pXMLString->c_str(), vector->vectorType() == DOUBLE ? "1" : "2"); fprintf(outfile, " _active_main_%1$s = _outputfield_%1$s;\n\n", pXMLString->c_str()); } fprintf(outfile, "}\n\n"); /* END MPI-SPECIFIC CODE */ } int variablesInEarlierVectors = 0; for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { const xmdsVector *vector; simulation()->field()->getVector(*pXMLString, vector); fprintf(outfile, "{ // Begin block for vector '%1$s'\n", pXMLString->c_str()); fprintf(outfile, "off_t _outputfield_index_pointer, _outputfield_old_index_pointer;\n" "for (unsigned int _component = 0; _component < %li; _component++) { \n" "_outputfield_index_pointer = -42; // Just so that we always seek the first time\n", vector->nComponents() * (vector->vectorType() == DOUBLE ? 1 : 2)); // write vector data simulation()->field()->openLoops(outfile, outputSpace, myVectorNamesList, DO_NOT_PARALLELISE_LOOP); // write data fprintf(outfile, "_outputfield_old_index_pointer = _outputfield_index_pointer;\n" "_outputfield_index_pointer = 0;\n"); for (long unsigned int i = 0; i < simulation()->field()->geometry()->nDims(); i++) { // Calculate the output field index pointer if ((outputSpace >> i) & 1) { fprintf(outfile, "_outputfield_index_pointer += (lround(k%2$s/_main_dk%1$li) + (_main_lattice%1$li/2))", i, simulation()->field()->geometry()->dimension(i)->name.c_str()); } else { fprintf(outfile, "_outputfield_index_pointer += lround((%2$s - _main_xmin%1$li)/_main_dx%1$li)", i, simulation()->field()->geometry()->dimension(i)->name.c_str()); } for (long unsigned int j = i+1; j < simulation()->field()->geometry()->nDims(); j++) { fprintf(outfile, "*_main_lattice%li", j); } fprintf(outfile, ";\n\n"); } fprintf(outfile, "if (_outputfield_index_pointer != _outputfield_old_index_pointer + 1)\n" "\t fseeko(fpBinary, fieldOffset + _outputfield_index_pointer*sizeof(double) + (%i + _component)*vectorFieldSize + sizeof(unsigned long), SEEK_SET);\n", variablesInEarlierVectors); if (vector->vectorType() == DOUBLE) { fprintf(outfile, "fwrite(&_active_main_%1$s[_main_%1$s_index_pointer + _component], sizeof(double), 1, fpBinary);\n", vector->name()->c_str()); } else { // COMPLEX fprintf(outfile, "if (_component & 1) \n" "\t fwrite(&_active_main_%1$s[_main_%1$s_index_pointer + _component/2].im, sizeof(double), 1, fpBinary);\n" "else \n" "\t fwrite(&_active_main_%1$s[_main_%1$s_index_pointer + _component/2].re, sizeof(double), 1, fpBinary);\n", vector->name()->c_str()); } simulation()->field()->closeLoops(outfile, outputSpace, myVectorNamesList); fprintf(outfile, "} // end for loop over components of vector '%s'\n", vector->name()->c_str()); fprintf(outfile, "} // end block for vector '%s'\n", vector->name()->c_str()); variablesInEarlierVectors += vector->nComponents(); if (vector->vectorType() == COMPLEX) { variablesInEarlierVectors += vector->nComponents(); } } // end for loop if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { /* BEGIN MPI-SPECIFIC CODE */ fprintf(outfile, "if (dataForRank != 0) {\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, //" fprintf(stderr, \"Freeing _outputfield_%1$s\\n\");\n" " fftw_free(_outputfield_%1$s);\n", pXMLString->c_str()); } fprintf(outfile, "}\n" "// End looping over the ranks\n" "}\n" "local_nx = my_local_nx;\n" "local_x_start = my_local_x_start;\n" "local_ny_after_transpose = my_local_ny_after_transpose;\n" "local_y_start_after_transpose = my_local_y_start_after_transpose;\n" "total_local_size = my_total_local_size;\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "_active_main_%1$s = _main_%1$s;\n", pXMLString->c_str()); } /* END MPI-SPECIFIC CODE */ } // close the binary file fprintf(outfile, "fclose(fpBinary);\n"); // close the main file-writing code for rank == 0 if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { if ((outputSpace & 1) & ((outputSpace >> 1) & 1)) { swapped = true; } fprintf(outfile, "// Only write to file if you are rank 0, as we cannot assume\n" "// that the nodes have equal access to the filesystem\n" "}\n" "else {\n" "// We are some other rank that isn't 0\n" " MPI_Ssend(&local_nx, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);\n" " MPI_Ssend(&local_x_start, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);\n" " MPI_Ssend(&local_ny_after_transpose, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);\n" " MPI_Ssend(&local_y_start_after_transpose, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);\n" " MPI_Ssend(&total_local_size, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);\n\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { const xmdsVector *vector; simulation()->field()->getVector(*pXMLString, vector); fprintf(outfile, " MPI_Ssend(_main_%1$s, %2$s*total_local_size*_main_%1$s_ncomponents, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD);\n", pXMLString->c_str(), vector->vectorType() == DOUBLE ? "1" : "2"); } fprintf(outfile, "}\n" "MPI_Barrier(MPI_COMM_WORLD);\n"); } fprintf(outfile, "}\n\n"); xmdsElement::writeRoutines(outfile); } // ************************************************************************** //! Returns space at index. Don't ask me why this returns boolean bool xmdsBreakpoint::space( const long unsigned int& index) const { if (debugFlag) { printf("xmdsFilter::space\n"); } if (index >= simulation()->field()->geometry()->nDims()) { throw xmdsException("Internal range error in xmdsBreakpoint::space()"); } return (outputSpace >> index) & 1; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_breakpoint.h0000644000076500000240000000544211033277417014272 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_breakpoint.h 1619 2007-11-25 03:52:46Z grahamdennis $ */ /*! @file xmds_breakpoint.h @brief More detailed explanation... */ #ifndef XMDS_BREAKPOINT_H #define XMDS_BREAKPOINT_H #include // ***************************************************************************** // ***************************************************************************** // xmdsBreakpoint // ***************************************************************************** // ***************************************************************************** //! xmds break point class class xmdsBreakpoint : public xmdsSegment { public : //! Constructor for the xmdsBreakpoint class /*! @param yourSimulation an xmdsSimulation object @param yourVerboseMode a boolean */ xmdsBreakpoint( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsBreakpoint(); //! Process elements within a moment group void processElement(const Element *const yourElement); //! Whether or not the segment needs to run when the simulation is in overtime bool runsInOvertime() const; private : XMLString breakpointFilename; //!< The filename for the breakpoint file unsigned long outputSpace; //!< The space the output will be written in (x-space or k-space) list myVectorNamesList; //!< The list of vector names bool autoIncrementFilenames; //!< Should the breakpoint filenames be called 1.xsil, 2.xsil, etc? //! Write the filter prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the filter routines to file void writeRoutines( FILE *const outfile) const; //! Determine the space at index (buh?) bool space( const long unsigned int& index) const; }; #endif // XMDS_BREAKPOINT_H xmds-1.6.6/source/xmds_common.h0000644000076500000240000000242111033277417013416 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_common.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_common.h @brief Common headers used in xmds More detailed explanation... */ #ifndef XMDS_COMMON_H #define XMDS_COMMON_H #include #include #include #endif // XMDS_COMMON_H /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_complex.h0000644000076500000240000003442611033277417013607 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_complex.h 2040 2008-07-02 08:46:15Z grahamdennis $ */ /*! @file xmds_complex.h @brief Functions and overloads for fftw_complex types */ #include extern "C++" { #include #ifdef FFTW3_H typedef struct { double re; double im; } fftw_complex3; #define fftw_complex fftw_complex3 #endif //FFTW3_H // ********************************************** // rectangular complex and polar complex creation // ********************************************** //! Rectangular complex object creation inline fftw_complex rcomplex(const double& re, const double& im) { fftw_complex z; z.re = re; z.im = im; return z; } //! Polar complex object creation inline fftw_complex pcomplex(const double& mag, const double& phase) { fftw_complex z; z.re = mag*cos(phase); z.im = mag*sin(phase); return z; } // ********************************************** // external fftw_complex overloads // ********************************************** //! Overloaded complex addition operator inline fftw_complex operator + (fftw_complex z) { return z; } //! Overloaded complex addition operator inline fftw_complex operator + (fftw_complex z1, const fftw_complex& z2) { z1.re += z2.re; z1.im += z2.im; return z1; } //! Overloaded complex addition operator inline fftw_complex operator + (fftw_complex z, const double& d) { z.re += d; return z; } //! Overloaded complex addition operator inline fftw_complex operator + (const double& d, fftw_complex z) { z.re += d; return z; } //! Overloaded complex addition operator inline fftw_complex operator + (fftw_complex z, const int& j) { z.re += j; return z; } //! Overloaded complex addition operator inline fftw_complex operator + (const int& j, fftw_complex z) { z.re += j; return z; } //! Overloaded complex unary negation operator inline fftw_complex operator - (fftw_complex z) { z.im = -z.im; z.re = -z.re; return z; } //! Overloaded complex subtraction operator inline fftw_complex operator - (fftw_complex z1, const fftw_complex& z2) { z1.re -= z2.re; z1.im -= z2.im; return z1; } //! Overloaded complex subtraction operator inline fftw_complex operator - (fftw_complex z, const double& d) { z.re -= d; return z; } //! Overloaded complex subtraction operator inline fftw_complex operator - (const double& d, fftw_complex z) { z.re = d-z.re; z.im = -z.im; return z; } //! Overloaded complex subtraction operator inline fftw_complex operator - (fftw_complex z, const int& j) { z.re -= j; return z; } //! Overloaded complex subtraction operator inline fftw_complex operator - (const int& j, fftw_complex z) { z.re = j-z.re; z.im = -z.im; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (const fftw_complex& z1, const fftw_complex& z2) { fftw_complex z; z.re = z1.re*z2.re - z1.im*z2.im; z.im = z1.im*z2.re + z1.re*z2.im; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (fftw_complex z, const double& d) { z.re *= d; z.im *= d; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (const double& d, fftw_complex z) { z.re *= d; z.im *= d; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (fftw_complex z, const int& j) { z.re *= j; z.im *= j; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (fftw_complex z, const long& j) { z.re *= j; z.im *= j; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (const int& j, fftw_complex z) { z.re *= j; z.im *= j; return z; } //! Overloaded complex multiplication operator inline fftw_complex operator * (const long& j, fftw_complex z) { z.re *= j; z.im *= j; return z; } //! Overloaded complex division operator inline fftw_complex operator / (fftw_complex z1, const fftw_complex& z2) { const double c = z2.re*z2.re + z2.im*z2.im; const double temp = (z1.re*z2.re + z1.im*z2.im)/c; z1.im = (z1.im*z2.re - z1.re*z2.im)/c; z1.re = temp; return z1; } //! Overloaded complex division operator inline fftw_complex operator / (fftw_complex z, const double& d) { z.re /= d; z.im /= d; return z; } //! Overloaded complex division operator inline fftw_complex operator / (const double& d, fftw_complex z) { double c = z.re*z.re + z.im*z.im; z.re *= d/c; z.im *= -d/c; return z; } //! Overloaded complex division operator inline fftw_complex operator / (fftw_complex z, const int& j) { z.re /= j; z.im /= j; return z; } //! Overloaded complex division operator inline fftw_complex operator / (const int& j, fftw_complex z) { double c = z.re*z.re + z.im*z.im; z.re *= j/c; z.im *= -j/c; return z; } //! Overloaded complex division operator inline fftw_complex operator / (fftw_complex z, const long& j) { z.re /= j; z.im /= j; return z; } //! Overloaded complex division operator inline fftw_complex operator / (const long& j, fftw_complex z) { double c = z.re*z.re + z.im*z.im; z.re *= j/c; z.im *= -j/c; return z; } //! Overloaded complex less than operator inline bool operator < (const double& d, const fftw_complex& z) { return d < z.re*z.re+z.im*z.im; } //! Overloaded complex greater than operator inline bool operator > (const double& d, const fftw_complex& z) { return d > z.re*z.re+z.im*z.im; } //! Overloaded complex less than or equal to operator inline bool operator <= (const double& d, const fftw_complex& z) { return d <= z.re*z.re+z.im*z.im; } //! Overloaded complex greater than or equal to operator inline bool operator >= (const double& d, const fftw_complex& z) { return d >= z.re*z.re+z.im*z.im; } //! Overloaded complex equality operator inline bool operator == (const double& d, const fftw_complex& z) { return d == z.re*z.re+z.im*z.im; } //! Overloaded complex inequality operator inline bool operator != (const double& d, const fftw_complex& z) { return d != z.re*z.re+z.im*z.im; } // ********************************************** // some unary complex functions // ********************************************** //! Returns real part of a complex number inline double real(const fftw_complex& z) { return z.re; } //! Returns imaginary part of a complex number inline double imag(const fftw_complex& z) { return z.im; } //! Returns modulus squared of a complex number inline double mod2(const fftw_complex& z) { return z.re*z.re + z.im*z.im; } //! Returns modulus of a complex number inline double mod(const fftw_complex& z) { return sqrt(z.re*z.re + z.im*z.im); } //! Returns arg of a complex number inline double arg(const fftw_complex& z) { return atan2(z.im, z.re); } //! Returns the complex conjugate inline fftw_complex conj(fftw_complex z) { z.im = -z.im; return z; } //! Returns the complex exponential inline fftw_complex c_exp(const fftw_complex& z1) { fftw_complex z; z.re = exp(z1.re)*cos(z1.im); z.im = exp(z1.re)*sin(z1.im); return z; } //! Returns the complex natural logarithm inline fftw_complex c_log(const fftw_complex& z1) { fftw_complex z; double _m = mod(z1); if (fabs(_m)>1e-100) z.re = log(_m); else z.re = -46; z.im = arg(z1); return z; } //! Returns the complex square root inline fftw_complex c_sqrt(const fftw_complex z1) { const double _m = sqrt(mod(z1)); const double _a = arg(z1)/2; return pcomplex(_m, _a); } // ********************************************** // a nice complex class // ********************************************** //! A nice complex class class complex : public fftw_complex { public: //Constructors //! Constructor of complex object complex() { re = 0; im = 0; } //! Constructor of complex object /*! This could be "explicit", providing extra warnings */ complex(const fftw_complex& z) { re = z.re; im = z.im; } //! Constructor of complex object /*! This could be "explicit", providing extra warnings */ complex(const double& d) { re = d; im = 0; } //! Constructor of complex object complex(const double& real, const double& imag, const bool& polar=false) { if (polar) { re = real*cos(imag); im = real*sin(imag); } else { re = real; im = imag; } } //! Addition operator inline complex& operator + () { return *this; } //! Unary negation operator inline complex operator - () { return complex(-re, -im); } //! Assignment operator inline complex& operator = (const fftw_complex& z) { re = z.re; im = z.im; return *this; } //! Assignment operator inline complex& operator = (const double& d) { re = d; im = 0; return *this; } //! Conversion to double operator inline operator double () const { return re; } //! += operator inline complex& operator += (const fftw_complex& z) { re += z.re; im += z.im; return *this; } //! += operator inline complex& operator += (const double& d) { re += d; return *this; } //! -= operator inline complex& operator -= (const fftw_complex& z) { re -= z.re; im -= z.im; return *this; } //! -= operator inline complex& operator -= (const double& d) { re -= d; return *this; } //! *= operator inline complex& operator *= (const fftw_complex& z) { const double temp = re*z.re - im*z.im; im = im*z.re + re*z.im; re = temp; return *this; } //! *= operator inline complex& operator *= (const double& d) { re *= d; im *= d; return *this; } //! /= operator inline complex& operator /= (const fftw_complex& z) { const double c = z.re*z.re + z.im*z.im; const double temp = (re*z.re + im*z.im)/c; im = (im*z.re - re*z.im)/c; re=temp; return *this; } //! /= operator inline complex& operator /= (const double& d) { re /= d; im /= d; return *this; } //! /= operator inline complex& operator /= (const int& j) { re /= j; im /= j; return *this; } //! /= operator inline complex& operator /= (const long& j) { re /= j; im /= j; return *this; } //! Less than comparison operator inline bool operator < (const fftw_complex& z) const { return re*re+im*im < z.re*z.re+z.im*z.im; } //! Less than comparison operator inline bool operator < (const double& d) const { return re*re+im*im < d; } //! Greater than comparison operator inline bool operator > (const fftw_complex& z) const { return re*re+im*im > z.re*z.re+z.im*z.im; } //! Greater than comparison operator inline bool operator > (const double& d) const { return re*re+im*im > d; } //! Less than or equal to comparison operator inline bool operator <= (const fftw_complex& z) const { return re*re+im*im <= z.re*z.re+z.im*z.im; } //! Less than or equal to comparison operator inline bool operator <= (const double& d) const { return re*re+im*im <= d; } //! Greater than or equal to comparison operator inline bool operator >= (const fftw_complex& z) const { return re*re+im*im >= z.re*z.re+z.im*z.im; } //! Greater than or equal to comparison operator inline bool operator >= (const double& d) const { return re*re+im*im >= d; } //! Equality comparison operator inline bool operator == (const complex& z) const { return re == z.re && im == z.im; } //! Equality comparison operator inline bool operator == (const double& d) const { return re == d && im == 0; } //! Inequality comparison operator inline bool operator != (const complex& z) const { return re!=z.re || im!=z.im; } //! Inequality comparison operator inline bool operator != (const double& d) const { return re!=d || im!=0; } //! Complex conjugate operator /*! We define operator ~ to be the complex conjugate */ inline complex operator ~ () const { complex z = *this; z.im = -z.im; return z; } }; //! Define the complex number i const complex i = complex(0, 1); #ifdef FFTW3_H #undef fftw_complex #endif //FFTW3_H } // extern "C++" //! To be documented!!! /*! This is not actually part of the complex class, but declaring it here saves creating another xmds include header */ extern bool initialiseFieldFromXSILFile(const char *filename, const char *mgName, unsigned long dimension, char **dimNames, char **componentNames, // output variables char**binaryDataFilename, int *unsignedLongSize, bool *dataEncodingIsNative, bool *isPrecisionDouble, unsigned long *nDataComponents, unsigned long **inputLattice, int **componentIndicesPtr); /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_element.cc0000644000076500000240000001224111033277417013716 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_element.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_element.cc @brief Element parsing classes and methods More detailed explanation... */ #include #include // ************************************************************************** // ************************************************************************** // xmdsElement public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsElements = 0; //!< Number of xmds element objects // ************************************************************************** xmdsElement::xmdsElement( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : mySimulation(yourSimulation), myVerbose(yourVerboseMode) { if (debugFlag) { nxmdsElements++; printf("xmdsElement::xmdsElement\n"); printf("nxmdsElements=%li\n", nxmdsElements); } } // ************************************************************************** xmdsElement::~xmdsElement() { if (debugFlag) { nxmdsElements--; printf("xmdsElement::~xmdsElement\n"); printf("nxmdsElements=%li\n", nxmdsElements); } for (list::const_iterator ppxmdsElement = myChildList.begin(); ppxmdsElement != myChildList.end(); ppxmdsElement++) { delete *ppxmdsElement; } } // ************************************************************************** // ************************************************************************** // xmdsElement protected // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsElement::writeDefines( FILE *const outfile) const { if (debugFlag) { printf("xmdsElement::writeDefines\n"); } for (list::const_iterator ppxmdsElement = myChildList.begin(); ppxmdsElement != myChildList.end(); ppxmdsElement++) { (*ppxmdsElement)->writeDefines(outfile); } } // ************************************************************************** void xmdsElement::writeGlobals( FILE *const outfile) const { if (debugFlag) { printf("xmdsElement::writeGlobals\n"); } for (list::const_iterator ppxmdsElement = myChildList.begin(); ppxmdsElement != myChildList.end(); ppxmdsElement++) { (*ppxmdsElement)->writeGlobals(outfile); } } // ************************************************************************** void xmdsElement::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsElement::writePrototypes\n"); } for (list::const_iterator ppxmdsElement = myChildList.begin(); ppxmdsElement != myChildList.end(); ppxmdsElement++) { (*ppxmdsElement)->writePrototypes(outfile); } } // ************************************************************************** void xmdsElement::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsElement::writeRoutines\n"); } for (list::const_iterator ppxmdsElement = myChildList.begin(); ppxmdsElement != myChildList.end(); ppxmdsElement++) { (*ppxmdsElement)->writeRoutines(outfile); } } // ************************************************************************** void xmdsElement::addChild( const xmdsElement *const newChild) { if (debugFlag) { printf("xmdsElement::addChild\n"); } myChildList.push_back(newChild); } // ************************************************************************** const xmdsSimulation* xmdsElement::simulation() const { return mySimulation; } // ************************************************************************** bool xmdsElement::verbose() const { return myVerbose; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_element.h0000644000076500000240000000601711033277417013564 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_element.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_element.h @brief More detailed explanation... */ #ifndef XMDS_ELEMENT_H #define XMDS_ELEMENT_H #include // ***************************************************************************** // ***************************************************************************** // xmdsElement // ***************************************************************************** // ***************************************************************************** class xmdsSimulation; //! Class representing an element in an xmds simulation class xmdsElement : public xmdsUtility { public : //! Constructor of xmdsElement object xmdsElement( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); ~xmdsElement(); //!< xmdsElement destructor // This was in protected! //! Returns the xmds simulation const xmdsSimulation* simulation() const; protected : //! Writes the defines of output C++ code virtual void writeDefines( FILE *const outfile) const; //! Writes the global variables to output C++ code virtual void writeGlobals( FILE *const outfile) const; //! Writes the prototypes of the C++ code virtual void writePrototypes( FILE *const outfile) const; //! Writes the routines of the xmds C++ code virtual void writeRoutines( FILE *const outfile) const; //! Adds a child void addChild( const xmdsElement *const newChild); //! Determines if output is verbose bool verbose() const; private : const xmdsSimulation *const mySimulation; //!< The main simulation object const bool myVerbose; //!< Variable describing if the output should be verbose or not list myChildList; //!< List of child elements //! Parse the XMLString inString and generate the output list of XML strings outXMLStringList void parseXMLString( const XMLString *const inString, list& outXMLStringList); }; #endif // XMDS_ELEMENT_H xmds-1.6.6/source/xmds_field.cc0000644000076500000240000014170011033277417013353 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_field.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_field.cc @brief Field element parsing classes and methods More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsFieldGeometry // ************************************************************************** // ************************************************************************** extern bool debugFlag; // ************************************************************************** void xmdsFieldGeometry::clear() { if (debugFlag) { printf("xmdsFieldGeometry::clear\n"); } myDimensionsList.clear(); } // ************************************************************************** unsigned long xmdsFieldGeometry::nDims() const { if (debugFlag) { printf("xmdsFieldGeometry::nDims\n"); } return myDimensionsList.size(); } // ************************************************************************** const dimensionStruct* xmdsFieldGeometry::dimension( const unsigned long& index) const { if (debugFlag) { printf("xmdsFieldGeometry::dimension\n"); } if (index >= myDimensionsList.size()) { throw xmdsException("Internal range error in xmdsFieldGeometry::dimension"); } list::const_iterator pdimensionStruct = myDimensionsList.begin(); for (unsigned long i=0; i myDimensionsList.size()) { throw xmdsException( "Internal range error in xmdsFieldGeometry::setDimension"); } if (index == myDimensionsList.size()) { myDimensionsList.push_back(newDimension); } list::iterator pdimensionStruct = myDimensionsList.begin(); for (unsigned long i=0; i::const_iterator pDim = myDimensionsList.begin(); pDim != myDimensionsList.end(); pDim++) { if (pDim->name == dimName) { dimNumber = i; return 1; } i++; } return 0; } // ************************************************************************** unsigned long xmdsFieldGeometry::fullSpace() const { if (debugFlag) { printf("xmdsFieldGeometry::fullSpace\n"); } unsigned long two2n = 1; for (unsigned long i=0; i::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { delete(*ppxmdsVector); } } // ************************************************************************** void xmdsField::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsField::processElement\n"); } if (verbose()) { printf("Processing field element ...\n"); } myNeedsFFTWPlans = 0; list anXMLStringList; list::const_iterator pXMLString; // ************************************ // find name getAssignmentStrings(yourElement, "name", 0, 1, anXMLStringList); if (anXMLStringList.size() == 1) { myName = *anXMLStringList.begin(); if (verbose()) { printf("field name is '%s'\n", myName.c_str()); } } else { myName = "main"; printf("field name defaulting to '%s'\n", myName.c_str()); } list aLatticeList; list::const_iterator pULong; list aDomainList; list::const_iterator pDomain; // ************************************ // find transverse dimensions getAssignmentStrings(yourElement, "dimensions", 0, 0, anXMLStringList); if (anXMLStringList.size() > 63) { throw xmdsException(yourElement, "xmds currently limited to 63 transverse dimensions"); } if (anXMLStringList.size() > 0) { unsigned long i; // ************************************ // find transverse lattice getAssignmentULongs(yourElement, "lattice", 1, anXMLStringList.size(), aLatticeList); i = 0; for (pULong = aLatticeList.begin(); pULong != aLatticeList.end(); pULong++) { if (*pULong < 2) { sprintf(errorMessage(), "lattice for dimension #%li must be > 1", i+1); throw xmdsException(yourElement, errorMessage()); } if (verbose()) { printf("transverse lattice #%li has %li points\n", i+1, *pULong); } i++; } // ************************************ // find transverse domains getAssignmentDomains(yourElement, "domains", 1, anXMLStringList.size(), aDomainList); if (verbose()) { i = 0; for (pDomain = aDomainList.begin(); pDomain != aDomainList.end(); pDomain++) { printf("transverse domain #%li:\n", i+1); printf(" begin = %s\n", pDomain->begin.c_str()); printf(" end = %s\n", pDomain->end.c_str()); i++; } } } else { if (verbose()) { printf("No transverse dimensions found.\n"); } } // build field geometry dimensions myGeometry.clear(); pXMLString = anXMLStringList.begin(); pULong = aLatticeList.begin(); pDomain = aDomainList.begin(); for (unsigned long i = 0; i < anXMLStringList.size(); i++) { dimensionStruct nextDimension; for (unsigned long j=0; jname) { sprintf(errorMessage(), "duplicate dimension '%s'", pXMLString->c_str()); throw xmdsException(yourElement, errorMessage()); } } if (verbose()) { printf("adding transverse dimension '%s'\n", pXMLString->c_str()); } nextDimension.name = *pXMLString; nextDimension.lattice = *pULong; nextDimension.domain = *pDomain; myGeometry.addDimension(nextDimension); pXMLString++; pULong++; pDomain++; } // ************************************ // find samples getAssignmentULongs(yourElement, "samples", 1, 0, mySamplesList); // ************************************ // find and process vector elements // ************************************ const NodeList* candidateElements; candidateElements = yourElement->getElementsByTagName("vector", 0); if (candidateElements->length() == 0) { throw xmdsException(yourElement, "at least one vector expected"); } for (unsigned long i = 0; i < candidateElements->length(); i++) { const Element* nextElement = dynamic_cast(candidateElements->item(i)); xmdsElement* newxmdsVectorElement = createxmdsVectorElement(); newxmdsVectorElement->processElement(nextElement); } } // ************************************************************************** void xmdsField::processVectors( const list& vectorNamesList, const unsigned long& space) const { if (debugFlag) { printf("xmdsField::processVectors\n"); } for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { const xmdsVector* nextVector; if (!getVector(*pXMLString, nextVector)) { sprintf(errorMessage(), "Vector '%s' unknown", pXMLString->c_str()); throw xmdsException(errorMessage()); } for (list::const_iterator pXMLString2 = vectorNamesList.begin(); pXMLString2 != pXMLString; pXMLString2++) { if (*pXMLString == *pXMLString2) { sprintf(errorMessage(), "Duplicate vector '%s'", pXMLString->c_str()); throw xmdsException(errorMessage()); } } if (nextVector->initialSpace() != space) { if (nextVector->vectorType() != COMPLEX) { const char* spaceDescription; if (space == 0) { spaceDescription = "x-space"; } else if (space == myGeometry.fullSpace()) { spaceDescription = "k-space"; } else { spaceDescription = "mixed fourier space"; } sprintf(errorMessage(), "Cannot convert vector '%s' to %s since it is not of type 'complex'", pXMLString->c_str(), spaceDescription); throw xmdsException(errorMessage()); } myNeedsFFTWPlans = 1; nextVector->setNeedsFFTWRoutines(); } // Always write FFTW Plans for main vector // (otherwise a rare exception for deterministic MPI which uses FFTW // to split field across processes) // Could make this MPI specifc, or else define the appropriate if (*pXMLString == "main" && (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic)) { myNeedsFFTWPlans = 1; } if (verbose()) { printf("adding vector '%s' to accessible vectors list\n", pXMLString->c_str()); } } } // ************************************************************************** void xmdsField::outputSampleCount() const { if (debugFlag) { printf("xmdsField::outputSampleCount\n"); } if (mySamplesList.size() != simulation()->output()->nMomentGroups()) { throw xmdsException( "number of samples in field element does not match number of " "output moment groups"); } simulation()->output()->addSamples(mySamplesList); } // ************************************************************************** bool xmdsField::needsFFTWPlans() const { if (debugFlag) { printf("xmdsField::needsFFTWPlans\n"); } return myNeedsFFTWPlans; } // ************************************************************************** void xmdsField::writeInitialisationCalls( FILE *const outfile, const char *const indent) const { if (debugFlag) { printf("xmdsField::writeInitialisationCalls\n"); } for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { (*ppxmdsVector)->writeInitialisationCall(outfile, indent); } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::writeSampleCalls( FILE *const outfile, const char *const indent) const { if (debugFlag) { printf("xmdsField::writeSampleCalls\n"); } unsigned long i = 0; for (list::const_iterator pULong = mySamplesList.begin(); pULong != mySamplesList.end(); pULong++) { if (*pULong > 0) { fprintf(outfile, "%s_mg%li_sample();\n", indent, i); } i++; } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::assignActiveVectorPointers( FILE *const outfile, const char *const tempVectorName) const { if (debugFlag) { printf("xmdsField::assignActiveVectorPointers\n"); } for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { fprintf(outfile, "_active_%s_%s = %s_%s_%s;\n", myName.c_str(), (*ppxmdsVector)->name()->c_str(), tempVectorName, myName.c_str(), (*ppxmdsVector)->name()->c_str()); } fprintf(outfile, "\n"); } // ************************************************************************** const XMLString* xmdsField::name() const { if (debugFlag) { printf("xmdsField::name\n"); } return &myName; } // ************************************************************************** const xmdsFieldGeometry* xmdsField::geometry() const{ if (debugFlag) { printf("xmdsField::geometry\n"); } return &myGeometry; } // ************************************************************************** bool xmdsField::getVector( const XMLString& vectorName, const xmdsVector*& theVector) const { if (debugFlag) { printf("xmdsField::getVector\n"); } theVector = 0; for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { if (*(*ppxmdsVector)->name() == vectorName) { theVector = *ppxmdsVector; return 1; } } return 0; } // ************************************************************************** void xmdsField::vectorNames( list& vectorNamesList) const { if (debugFlag) { printf("xmdsField::vectorNames\n"); } vectorNamesList.clear(); for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { vectorNamesList.push_back(*(*ppxmdsVector)->name()); } } // ************************************************************************** void xmdsField::vectors2space( FILE *const outfile, const unsigned long& space, const list& vectorNamesList, const char *const indent) const { if (debugFlag) { printf("xmdsField::vectors2space\n"); } if (myGeometry.nDims() == 0) { return; } for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { const xmdsVector* nextVector; if (!getVector(*pXMLString, nextVector)) { throw xmdsException( "Internal error in xmdsField::vectors2space: cannot find vector"); } if (nextVector->needsFFTWRoutines()) { fprintf(outfile, "%s_%s_%s_go_space(%li);\n", indent, myName.c_str(), pXMLString->c_str(), space); fprintf(outfile, "\n"); } } } // ************************************************************************** void xmdsField::openLoops( FILE *const outfile, unsigned long space, const list& vectorNamesList, xmdsIsLoopParallelisable paralleliseLoop, const list& threadPrivateVariables) const { if (debugFlag) { printf("xmdsField::openLoops\n"); } if (paralleliseLoop && !simulation()->parameters()->useOpenMP) { // only parallelise if we are told to use OpenMP paralleliseLoop = DO_NOT_PARALLELISE_LOOP; } for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { fprintf(outfile, "unsigned long _%s_%s_index_pointer = 0;\n", myName.c_str(), pXMLString->c_str()); } fprintf(outfile, "\n"); bool swapped = false; if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { if ((space & 1) & ((space >> 1) & 1)) { swapped = true; } } if ((!simulation()->parameters()->stochastic) & (simulation()->parameters()->usempi) & swapped) { fprintf(outfile, "double k%1$s = local_y_start_after_transpose*_%2$s_dk1;\n" "if (k%1$s > ((_%2$s_lattice1-1)/2 + 0.1)*_%2$s_dk1) {\n" " k%1$s -= _%2$s_lattice1*_%2$s_dk1;\n" "}\n" "for(long _i0 = 0; _i0 < local_ny_after_transpose; _i0++) {\n\n", myGeometry.dimension(1)->name.c_str(), myName.c_str()); space >>= 1; fprintf(outfile, " " "double k%s = 0;\n" "\n" " " "for(long _i1 = 0; _i1 < _%s_lattice0; _i1++) {\n" "\n", myGeometry.dimension(0)->name.c_str(), myName.c_str()); space >>= 1; for (unsigned long i = 2; i < myGeometry.nDims(); i++) { for (unsigned long j=0; jname.c_str()); } else { fprintf(outfile, "double %s = _%s_xmin%li;\n", myGeometry.dimension(i)->name.c_str(), myName.c_str(), i); } fprintf(outfile, "\n"); for (unsigned long j=0; j>= 1; } } else if ((!simulation()->parameters()->stochastic) & (simulation()->parameters()->usempi)) { if (space & 1) { fprintf(outfile, "double k%1$s = local_x_start*_%2$s_dk0;\n" "if (k%1$s > ((_%2$s_lattice0-1)/2 + 0.1)*_%2$s_dk0) {\n" " k%1$s -= _%2$s_lattice0*_%2$s_dk0;\n" "}\n", myGeometry.dimension(0)->name.c_str(), myName.c_str()); } else { fprintf(outfile, "double %1$s = _%2$s_xmin0+local_x_start*_%2$s_dx0;\n", myGeometry.dimension(0)->name.c_str(), myName.c_str()); } fprintf(outfile, "\n" "for(long _i0 = 0; _i0 < local_nx; _i0++) {\n" "\n"); space >>= 1; for (unsigned long i = 1; i < myGeometry.nDims(); i++) { for (unsigned long j=0; jname.c_str()); } else { fprintf(outfile, "double %s = _%s_xmin%li;\n", myGeometry.dimension(i)->name.c_str(), myName.c_str(), i); } fprintf(outfile, "\n"); for (unsigned long j=0; j>= 1; } } else { for (unsigned long i = 0; i < myGeometry.nDims(); i++) { for (unsigned long j=0; jname.c_str()); } else { fprintf(outfile, "double %s = _%s_xmin%li;\n", myGeometry.dimension(i)->name.c_str(), myName.c_str(), i); } fprintf(outfile, "\n"); for (unsigned long j=0; j allThreadPrivateVariables(threadPrivateVariables); allThreadPrivateVariables.push_back(XMLString("_firstTime")); XMLString dimName; if (space & 1) { dimName = XMLString("k"); } dimName += myGeometry.dimension(i)->name; allThreadPrivateVariables.push_back(dimName); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { XMLString indexPointerName("_"); indexPointerName += myName; indexPointerName += XMLString("_"); indexPointerName += *pXMLString; indexPointerName += XMLString("_index_pointer"); allThreadPrivateVariables.push_back(indexPointerName); } fprintf(outfile, "#ifdef _OPENMP\n" "bool _firstTime = true;\n" "#pragma omp parallel for firstprivate("); int i = 0; for (list::const_iterator pXMLString = allThreadPrivateVariables.begin(); pXMLString != allThreadPrivateVariables.end(); pXMLString++, i++) { if (i != 0) { fprintf(outfile, ", "); } fprintf(outfile, "%s", pXMLString->c_str()); } fprintf(outfile, ")\n" "#endif\n"); } fprintf(outfile, "for(long _i%1$li = 0; _i%1$li < _%2$s_lattice%1$li; _i%1$li++) {\n", i, myName.c_str()); fprintf(outfile, "\n"); if (i == 0 && paralleliseLoop == true) { fprintf(outfile, "#ifdef _OPENMP\n" "if (_firstTime == true) {\n" "\t _firstTime = false;\n" "\t long startPoint = _i0"); for (unsigned long j = 1; j < myGeometry.nDims(); j++) { fprintf(outfile, "*_%s_lattice%li", myName.c_str(), j); } fprintf(outfile, ";\n"); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { fprintf(outfile, "\t _%1$s_%2$s_index_pointer += " "startPoint*_%1$s_%2$s_ncomponents;\n", myName.c_str(), pXMLString->c_str()); } if (space & 1) { fprintf(outfile, "\t k%1$s += _i0*_%2$s_dk0;\n" "\t if (k%1$s > ((_%2$s_lattice0-1)/2 + 0.1)*_%2$s_dk0)\n", myGeometry.dimension(0)->name.c_str(), myName.c_str()); for (unsigned long j=0; jname.c_str(), myName.c_str()); } else { fprintf(outfile, "\t %s += _i0*_%s_dx0;\n", myGeometry.dimension(0)->name.c_str(), myName.c_str()); } fprintf(outfile, "}\n" "#endif // _OPENMP\n\n"); } space >>= 1; } } } // ************************************************************************** void xmdsField::closeLoops( FILE *const outfile, unsigned long space, const list& vectorNamesList) const { if (debugFlag) { printf("xmdsField::closeLoops\n"); } if (myGeometry.nDims() > 0) { fprintf(outfile, "\n"); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { for (unsigned long j = 0; j < myGeometry.nDims(); j++) { fprintf(outfile, " "); } fprintf(outfile, "_%1$s_%2$s_index_pointer += _%1$s_%2$s_ncomponents;\n", myName.c_str(), pXMLString->c_str()); } } bool *isKSpace = new bool[myGeometry.nDims()]; unsigned long tempSpace = space; for (long unsigned int i = 0; i < myGeometry.nDims(); i++) { if (tempSpace & 1) { isKSpace[i] = true; } else { isKSpace[i] = false; } tempSpace >>= 1; } bool swapped = false; if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { if ((space & 1) & ((space >> 1) & 1)) { swapped = true; } } if ((!simulation()->parameters()->stochastic) & (simulation()->parameters()->usempi) & swapped) { for (unsigned long i = myGeometry.nDims(); i > 2; i--) { fprintf(outfile, "\n"); if (isKSpace[i-1]) { for (unsigned long j=0; jname.c_str(), myName.c_str(), i-1); for (unsigned long j=0; j ((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li)\n", myGeometry.dimension(i-1)->name.c_str(), myName.c_str(), i-1, myName.c_str(), i-1); for (unsigned long j=0; jname.c_str(), myName.c_str(), i-1, myName.c_str(), i-1); } else { for (unsigned long j=0; jname.c_str(), myName.c_str(), i-1); } for (unsigned long j=0; jname.c_str(), myName.c_str()); for (unsigned long j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "if (k%s>((_%s_lattice0-1)/2 + 0.1)*_%s_dk0)\n", myGeometry.dimension(0)->name.c_str(), myName.c_str(), myName.c_str()); for (unsigned long j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, " k%s -= _%s_lattice0*_%s_dk0;\n", myGeometry.dimension(0)->name.c_str(), myName.c_str(), myName.c_str()); for (unsigned long j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "}\n" "\n" " " "k%1$s += _%2$s_dk1;\n" " " "if (k%1$s > ((_%2$s_lattice1-1)/2 + 0.1)*_%2$s_dk1)\n" " " " k%1$s -= _%2$s_lattice1*_%2$s_dk1;\n" " " "}\n", myGeometry.dimension(1)->name.c_str(), myName.c_str()); } else { for (unsigned long i = myGeometry.nDims(); i > 0; i--) { fprintf(outfile, "\n"); if (isKSpace[i-1]) { for (unsigned long j=0; jname.c_str(), myName.c_str(), i-1); for (unsigned long j=0; j ((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li)\n", myGeometry.dimension(i-1)->name.c_str(), myName.c_str(), i-1, myName.c_str(), i-1); for (unsigned long j=0; jname.c_str(), myName.c_str(), i-1, myName.c_str(), i-1); } else { for (unsigned long j=0; jname.c_str(), myName.c_str(), i-1); } for (unsigned long j=0; jparameters()->simulationName.c_str(); if (useFFTWMeasure) { useMeasureStr = "|FFTW_MEASURE"; } if (useWisdom) { useWisdomStr = "|FFTW_USE_WISDOM"; } for (unsigned long i = 0; i < myGeometry.nDims(); i++) { fprintf(outfile, "_fftw_lattice[%li] = _%s_lattice%li;\n", i, myName.c_str(), i); } if ((!(simulation()->parameters()->stochastic)) & (simulation()->parameters()->usempi)) { if (useWisdom) { fprintf(outfile, "{\n" "\nFILE *fWisdom;\n" "ifstream fIn;\n" "ofstream fOut;\n" "// this is a dodgy hack, but it should work\n" "string findHostString, findHomeString, hostStuff, homeStuff, " "rmString, rankString;\n" "ostringstream outString;\n" "outString << rank;\n" "rankString = outString.str();\n" "hostStuff = \"host_rank_\" + rankString + \".stuff\";\n" "findHostString = \"uname -n > \" + hostStuff;\n" "system(findHostString.c_str());\n" "homeStuff = \"home_rank_\" + rankString + \".stuff\";\n" "findHomeString = \"echo $HOME > \" + homeStuff;\n" "system(findHomeString.c_str());\n" "string hostName, homeDir;\n" "fIn.open(hostStuff.c_str());\n" "if (fIn.fail()) {\n" " // do something\n" "}\n" "fIn >> hostName;\n" "fIn.close();\n" "fIn.open(homeStuff.c_str());\n" "if (fIn.fail()) {\n" " // do something\n" "}\n" "fIn >> homeDir;\n" "fIn.close();\n" "rmString = \"rm \" + hostStuff + \" \" + homeStuff;\n" "system(rmString.c_str());\n\n" "string testFname, wisdomFname;\n" "testFname = homeDir + \"/.xmds/wisdom/test-\" + rankString;\n" "fOut.open(testFname.c_str());\n" "if (fOut.fail()) {\n" " cout << \"Warning: ~/.xmds/wisdom directory doesn't seem " "to exist.\\n\";\n" " cout << \"Using current directory instead\\n\";\n" " wisdomFname = hostName + \".wisdom\";\n" "}\n" "else {\n" " fOut.close();\n" " rmString = \"rm \" + testFname;\n" " system(rmString.c_str());\n" " wisdomFname = homeDir + \"/.xmds/wisdom/\" + hostName + " "\".wisdom\";\n" "}\n" "printf(\"Performing fftw calculations\\n\");\n" "if ((fWisdom = fopen(wisdomFname.c_str(), \"r\")) != NULL) {\n" " cout << \"Standing upon the shoulders of giants... " "(Importing wisdom)\\n\";\n" " fftw_import_wisdom_from_file(fWisdom);\n" " fclose(fWisdom);\n" "}\n"); } fprintf(outfile, "printf(\"Making forward plan\\n\");\n" "_%s_forward_plan = fftwnd_mpi_create_plan(MPI_COMM_WORLD, _%s_ndims, " "_fftw_lattice, FFTW_FORWARD, FFTW_IN_PLACE%s%s);\n", myName.c_str(), myName.c_str(), useMeasureStr, useWisdomStr); // Using FFTW_TRANSPOSED_ORDER, so backward plan has different array sizes fprintf(outfile, "_fftw_lattice[0] = _%1$s_lattice1;\n" "_fftw_lattice[1] = _%1$s_lattice0;\n", myName.c_str()); for (unsigned long i = 2; i < myGeometry.nDims(); i++) { fprintf(outfile, "_fftw_lattice[%li] = _%s_lattice%li;\n", i, myName.c_str(), i); } fprintf(outfile, "printf(\"Making backward plan\\n\");\n" "_%s_backward_plan = fftwnd_mpi_create_plan(" "MPI_COMM_WORLD, _%s_ndims, _fftw_lattice, FFTW_BACKWARD, " "FFTW_IN_PLACE%s%s);\n", myName.c_str(), myName.c_str(), useMeasureStr, useWisdomStr); if (useWisdom) { fprintf(outfile, "printf(\"Keeping accumulated wisdom\\n\");\n" "fWisdom = fopen(wisdomFname.c_str(), \"w\");\n" "fftw_export_wisdom_to_file(fWisdom);\n" "fclose(fWisdom);\n" "}\n" "printf(\"Finished fftw calculations\\n\");\n"); } } else { if (useWisdom) { fprintf(outfile, "{\n" "FILE *fWisdom;\n" "ifstream fIn;\n" "ofstream fOut;\n" "// this is a dodgy hack, but it should work\n" "string findHostString, findHomeString, hostStuff, homeStuff, " "rmString, rankString, additionalExtension;\n"); if (simulation()->parameters()->fftwVersion == 3) { if (simulation()->parameters()->nThreads > 1) { fprintf(outfile, "additionalExtension = \".fftw3_threads\";\n"); } else { fprintf(outfile, "additionalExtension = \".fftw3\";\n"); } } if (!simulation()->parameters()->usempi) { fprintf(outfile, "int rank = 0;\n"); } fprintf(outfile, "ostringstream outString;\n" "outString << rank;\n" "rankString = outString.str();\n" "hostStuff = \"host_rank_\" + rankString + \".stuff\";\n" "findHostString = \"uname -n > \" + hostStuff;\n" "system(findHostString.c_str());\n" "homeStuff = \"home_rank_\" + rankString + \".stuff\";\n" "findHomeString = \"echo $HOME > \" + homeStuff;\n" "system(findHomeString.c_str());\n" "string hostName, homeDir;\n" "fIn.open(hostStuff.c_str());\n" "if (fIn.fail()) {\n" " // do something\n" "}\n" "fIn >> hostName;\n" "fIn.close();\n" "fIn.open(homeStuff.c_str());\n" "if (fIn.fail()) {\n" " // do something\n" "}\n" "fIn >> homeDir;\n" "fIn.close();\n" "rmString = \"rm \" + hostStuff + \" \" + homeStuff;\n" "system(rmString.c_str());\n\n" "string testFname, wisdomFname;\n" "testFname = homeDir + \"/.xmds/wisdom/test-\" + rankString;\n" "fOut.open(testFname.c_str());\n" "if (fOut.fail()) {\n" " cout << \"Warning: ~/.xmds/wisdom directory doesn't seem " "to exist.\\n\";\n" " cout << \"Using current directory instead\\n\";\n" " wisdomFname = hostName + \".wisdom\" + " "additionalExtension;\n" "}\n" "else {\n" " fOut.close();\n" " wisdomFname = homeDir + \"/.xmds/wisdom/\" + hostName + " "\".wisdom\" + additionalExtension;\n" " rmString = \"rm \" + testFname;\n" " system(rmString.c_str());\n" "}\n" "printf(\"Performing fftw calculations\\n\");\n" "if ((fWisdom = fopen(wisdomFname.c_str(), \"r\")) != NULL) {\n" " cout << \"Standing upon the shoulders of giants... " "(Importing wisdom)\\n\";\n" " fftw_import_wisdom_from_file(fWisdom);\n" " fclose(fWisdom);\n" "}\n"); } fprintf(outfile, "printf(\"Making forward plan\\n\");\n"); if (simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, "_%s_forward_plan = fftwnd_create_plan(_%s_ndims, _fftw_lattice, " "FFTW_FORWARD, FFTW_IN_PLACE%s%s);\n", myName.c_str(), myName.c_str(), useMeasureStr, useWisdomStr); } else if (simulation()->parameters()->fftwVersion == 3) { list vectorNamesList; // get the names of all vectors in this field vectorNames(vectorNamesList); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { const xmdsVector *nextVector; getVector(*pXMLString, nextVector); if (!nextVector->needsFFTWRoutines()) { continue; } fprintf(outfile, "_%1$s_%2$s_forward_plan = fftw_plan_many_dft(_%1$s_ndims, " "_fftw_lattice, _%1$s_%2$s_ncomponents, \n" " " "reinterpret_cast(_%1$s_%2$s), NULL, " "_%1$s_%2$s_ncomponents, 1, \n" " " "reinterpret_cast(_%1$s_%2$s), NULL, " "_%1$s_%2$s_ncomponents, 1, \n" " FFTW_FORWARD, 0%3$s);\n", myName.c_str(), pXMLString->c_str(), useMeasureStr); } } fprintf(outfile, "printf(\"Making backward plan\\n\");\n"); if (simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, "_%s_backward_plan = fftwnd_create_plan(_%s_ndims, _fftw_lattice, " "FFTW_BACKWARD, FFTW_IN_PLACE%s%s);\n", myName.c_str(), myName.c_str(), useMeasureStr, useWisdomStr); } else if (simulation()->parameters()->fftwVersion == 3) { list vectorNamesList; // get the names of all vectors in this field vectorNames(vectorNamesList); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { const xmdsVector *nextVector; getVector(*pXMLString, nextVector); if (nextVector->needsFFTWRoutines()) { fprintf(outfile, "_%1$s_%2$s_backward_plan = fftw_plan_many_dft(_%1$s_ndims, " "_fftw_lattice, _%1$s_%2$s_ncomponents, \n" " " "reinterpret_cast(_%1$s_%2$s), NULL, " "_%1$s_%2$s_ncomponents, 1, \n" " " "reinterpret_cast(_%1$s_%2$s), NULL, " "_%1$s_%2$s_ncomponents, 1, \n" " " "FFTW_BACKWARD, 0%3$s);\n", myName.c_str(), pXMLString->c_str(), useMeasureStr); } } } if (useWisdom) { fprintf(outfile, "printf(\"Keeping accumulated wisdom\\n\");\n" "fWisdom = fopen(wisdomFname.c_str(), \"w\");\n" "fftw_export_wisdom_to_file(fWisdom);\n" "fclose(fWisdom);\n" "}\n" "printf(\"Finished fftw calculations\\n\");\n"); } } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::writePlanDeletionCalls( FILE *const outfile) const { if (debugFlag) { printf("xmdsField::writePlanDeletionCalls\n"); } if (!myNeedsFFTWPlans) { return; } if ((!(simulation()->parameters()->stochastic)) & (simulation()->parameters()->usempi)) { fprintf(outfile, "fftwnd_mpi_destroy_plan(_%1$s_forward_plan);\n" "fftwnd_mpi_destroy_plan(_%1$s_backward_plan);\n", myName.c_str()); } else if (simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, "fftwnd_destroy_plan(_%1$s_forward_plan);\n" "fftwnd_destroy_plan(_%1$s_backward_plan);\n", myName.c_str()); } else if (simulation()->parameters()->fftwVersion == 3) { list vectorNamesList; vectorNames(vectorNamesList); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { const xmdsVector *nextVector; getVector(*pXMLString, nextVector); if (!nextVector->needsFFTWRoutines()) { continue; } fprintf(outfile, "fftw_destroy_plan(_%1$s_%2$s_forward_plan);\n" "fftw_destroy_plan(_%1$s_%2$s_backward_plan);\n", myName.c_str(), pXMLString->c_str()); } } fprintf(outfile, "\n"); } // ************************************************************************** xmdsVector* xmdsField::createxmdsVector() { if (debugFlag) { printf("xmdsField::createxmdsVector\n"); } xmdsVector* newVector = new xmdsVector(this); myVectorsList.push_back(newVector); return newVector; } // ************************************************************************** // ************************************************************************** // xmdsField protected // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsField::writeDefines( FILE *const outfile) const { if (debugFlag) { printf("xmdsField::writeDefines\n"); } const char *fieldName = myName.c_str(); fprintf(outfile, "// ********************************************************\n" "// field %s defines\n" "\n" "#define _%s_ndims %li\n", fieldName, fieldName, myGeometry.nDims()); for (unsigned long i = 0; i < myGeometry.nDims(); i++) { const dimensionStruct* dimI = myGeometry.dimension(i); const char *domainBegin = dimI->domain.begin.c_str(); const char *domainEnd = dimI->domain.end.c_str(); fprintf(outfile, "#define _%s_lattice%li %li\n", fieldName, i, dimI->lattice); fprintf(outfile, "#define _%1$s_xmin%2$li static_cast(%4$s)\n" "#define _%1$s_dx%2$li " " ((static_cast(%3$s) - static_cast(%4$s))" " / (double)_%1$s_lattice%2$li)\n" "#define _%1$s_dk%2$li " " (2*M_PI/(static_cast(%3$s) - static_cast(%4$s)))\n", fieldName, i, domainEnd, domainBegin); fprintf(outfile, "#define d%1$s _%2$s_dx%3$li\n" "#define dk%1$s _%2$s_dk%3$li\n", dimI->name.c_str(), fieldName, i); } fprintf(outfile, "\n"); for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { (*ppxmdsVector)->writeDefines(outfile); } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::writeGlobals( FILE *const outfile) const { if (debugFlag) { printf("xmdsField::writeGlobals\n"); } fprintf(outfile, "// ********************************************************\n" "// field %s globals\n" "\n", myName.c_str()); if (myGeometry.nDims() > 0) { fprintf(outfile, "const unsigned long _%s_size = _%s_lattice0", myName.c_str(), myName.c_str()); for (unsigned long i = 1; i < myGeometry.nDims(); i++) { fprintf(outfile, "*_%s_lattice%li", myName.c_str(), i); } fprintf(outfile, ";\n"); } else { fprintf(outfile, "const unsigned long _%s_size = 1;\n", myName.c_str()); } fprintf(outfile, "\n"); if (myNeedsFFTWPlans) { if ((!(simulation()->parameters()->stochastic)) & (simulation()->parameters()->usempi)) { fprintf(outfile, "fftwnd_mpi_plan _%1$s_forward_plan;\n" "fftwnd_mpi_plan _%1$s_backward_plan;\n", myName.c_str()); } else if (simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, "fftwnd_plan _%1$s_forward_plan;\n" "fftwnd_plan _%1$s_backward_plan;\n", myName.c_str()); } else if (simulation()->parameters()->fftwVersion == 3) { list vectorNamesList; vectorNames(vectorNamesList); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { const xmdsVector *nextVector; getVector(*pXMLString, nextVector); if (!nextVector->needsFFTWRoutines()) { continue; } fprintf(outfile, "fftw_plan _%1$s_%2$s_forward_plan;\n" "fftw_plan _%1$s_%2$s_backward_plan;\n", myName.c_str(), pXMLString->c_str()); } } } fprintf(outfile, "\n"); for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { (*ppxmdsVector)->writeGlobals(outfile); } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsField::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n" "// field %s prototypes\n" "\n", myName.c_str()); for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { (*ppxmdsVector)->writePrototypes(outfile); } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsField::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n" "// field %s routines\n" "// ********************************************************\n" "\n", myName.c_str()); for (list::const_iterator ppxmdsVector = myVectorsList.begin(); ppxmdsVector != myVectorsList.end(); ppxmdsVector++) { (*ppxmdsVector)->writeRoutines(outfile); } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsField::setName( const XMLString& yourName) { if (debugFlag) { printf("xmdsField::setName\n"); } myName = yourName; } // ************************************************************************** void xmdsField::setGeometry( const xmdsFieldGeometry& yourGeometry) { if (debugFlag) { printf("xmdsField::setGeometry\n"); } myGeometry = yourGeometry; } // ************************************************************************** // ************************************************************************** // xmdsField private // ************************************************************************** // ************************************************************************** // ************************************************************************** xmdsVectorElement* xmdsField::createxmdsVectorElement() { if (debugFlag) { printf("xmdsField::createxmdsVectorElement\n"); } xmdsVectorElement* newVectorElement = new xmdsVectorElement(simulation(), verbose(), this); myVectorsList.push_back(newVectorElement); return newVectorElement; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_field.h0000644000076500000240000001777211033277417013230 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_field.h 1604 2007-11-18 18:47:23Z paultcochrane $ */ /*! @file xmds_field.h @brief More detailed explanation... */ #ifndef XMDS_FIELD_H #define XMDS_FIELD_H #include // ***************************************************************************** // ***************************************************************************** // dimension // ***************************************************************************** // ***************************************************************************** //! Structure containing dimension parameters struct dimensionStruct { XMLString name; //!< The name of the dimension unsigned long lattice; //!< The lattice of the dimension domainStruct domain; //!< The structure of the domain's dimension }; // ***************************************************************************** // ***************************************************************************** // xmdsFieldGeometry // ***************************************************************************** // ***************************************************************************** //! xmds field geometry class class xmdsFieldGeometry { public : //! Clears the dimensions list void clear(); //! Returns the number of dimensions unsigned long nDims() const; //! Returns the dimension of the field geometry as a dimensionStruct const dimensionStruct* dimension( const unsigned long& index) const; //! Sets the dimension of the field geometry void setDimension( const unsigned long& index, const dimensionStruct& newDimension); //! Adds a dimension to the field geometry void addDimension( const dimensionStruct& newDimension); //! Gets dimension number /*! Why in the crap is this called getDimNumber if it returns boolean? And if it actually does return the dimension number then why does it return boolean? */ bool getDimNumber( const XMLString& dimName, unsigned long& dimNumber) const; //! Returns the full space unsigned long fullSpace() const; private : list myDimensionsList; //!< The list of the dimensions of the field }; // ***************************************************************************** // ***************************************************************************** // xmdsField // ***************************************************************************** // ***************************************************************************** //! Enumerator of the different kinds of type a vector can be enum xmdsVectorType { COMPLEX = 0, DOUBLE = 1 }; //! The different kinds of parallelisation that we have enum xmdsIsLoopParallelisable { PARALLELISE_LOOP = true, DO_NOT_PARALLELISE_LOOP = false }; class xmdsVector; class xmdsVectorElement; //! xmds field class class xmdsField : public xmdsElement { public : //! Constructor of xmdsField object xmdsField( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsField(); //! Processes the xmds element void processElement( const Element *const yourElement); //! Processes the vectors in the vector names list void processVectors( const list& vectorNamesList, const unsigned long& space) const; //! The output sample count (but doesn't return anything... Why?) void outputSampleCount() const; //! Determines if needs FFTW plans bool needsFFTWPlans() const; //! Writes the initialisation calls to the C++ file virtual void writeInitialisationCalls( FILE *const outfile, const char *const indent) const; //! Writes the sample calls to the C++ file void writeSampleCalls( FILE *const outfile, const char *const indent) const; //! Assigns the active vector pointers void assignActiveVectorPointers( FILE *const outfile, const char *const tempVectorName) const; //! Returns the name of the field(?) const XMLString* name() const; //! Returns the field geometry const xmdsFieldGeometry* geometry() const; //! Gets the vector? /*! Why does this return boolean if it gets the vector? */ bool getVector( const XMLString& vectorName, const xmdsVector*& theVector) const; //! Returns the vector names in a list void vectorNames( list& vectorNamesList) const; //! Converts the vectors to the relevant space void vectors2space( FILE *const outfile, const unsigned long& space, const list& vectorNamesList, const char *const indent) const; //! Opens the loops void openLoops( FILE *const outfile, unsigned long space, const list& vectorNamesList, xmdsIsLoopParallelisable isLoopParallelisable = DO_NOT_PARALLELISE_LOOP, const list& threadPrivateVariables = list()) const; //! Closes the loops void closeLoops( FILE *const outfile, unsigned long space, const list& vectorNamesList) const; //! Writes the plan creation calls for fftw void writePlanCreationCalls( FILE *const outfile, const bool& useFFTWMeasure, const bool& useWisdom) const; //! Writes the plan deletion calls for fftw void writePlanDeletionCalls( FILE *const outfile) const; //! Creats an xmds vector xmdsVector* createxmdsVector(); protected: //! Writes defines to outfile void writeDefines( FILE *const outfile) const; //! Writes global variables to outfile void writeGlobals( FILE *const outfile) const; //! Writes function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes simulation routines to outfile void writeRoutines( FILE *const outfile) const; //! Sets the name of the field void setName( const XMLString& yourName); //! Sets the geometry of the field void setGeometry( const xmdsFieldGeometry& yourGeometry); private : XMLString myName; //!< The name of the field xmdsFieldGeometry myGeometry; //!< The field geometry list myVectorsList; //!< The list of vectors in the field list mySamplesList; //!< The list of samples of the field mutable bool myNeedsFFTWPlans; //!< Whether or not the field needs the fftw plans //! Creates an xmds vector element xmdsVectorElement* createxmdsVectorElement(); }; #endif // XMDS_FIELD_H xmds-1.6.6/source/xmds_filter.cc0000644000076500000240000011140111033277417013550 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_filter.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_filter.cc @brief Filter element parsing classes and methods More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsFilter public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsFilters = 0; //!< Number of xmds filter objects // ************************************************************************** xmdsFilter::xmdsFilter( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsSegment(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsFilters++; printf("xmdsFilter::xmdsFilter\n"); printf("nxmdsFilters=%li\n", nxmdsFilters); } } // ************************************************************************** xmdsFilter::~xmdsFilter() { if (debugFlag) { nxmdsFilters--; printf("xmdsFilter::~xmdsFilter\n"); printf("nxmdsFilters=%li\n", nxmdsFilters); } } // ************************************************************************** bool xmdsFilter::runsInOvertime() const { return false; } // ************************************************************************** void xmdsFilter::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsFilter::processElement\n"); } const long unsigned int nDims = simulation()->field()->geometry()->nDims(); if (verbose()) { printf("Processing filter element ...\n"); } if (nDims>0) { // ************************************ // find space list aSpaceList; getAssignmentBools(yourElement, "fourier_space", 0, simulation()->field()->geometry()->nDims(), aSpaceList); if (aSpaceList.size() == 0) { printf("Filter space for defaulting to x-space.\n"); mySpace = 0; } else { list::const_iterator pBool = aSpaceList.begin(); for (long unsigned int i = 0; i < simulation()->field()->geometry()->nDims(); i++) { if (verbose()) { if (*pBool) { printf("Filter will be performed with dimension #%li in fourier space\n", i+1); } else { printf("Filter will be performed with dimension #%li in normal space\n", i+1); } } pBool++; } mySpace = spaceList2ULong(aSpaceList); } } // ************************************ // find nonoises flag list tempNonoise; myNonoises = false; getAssignmentBools(yourElement, "no_noise", 0, 1, tempNonoise); if (tempNonoise.size() == 1) { if (*tempNonoise.begin()) { myNonoises = true; if (verbose()) printf("No noises will be definied in the filter.\n"); } } // ************************************ // find vectors getAssignmentStrings(yourElement, "vectors", 1, 0, myVectorNamesList); // Vectors are now required by law in order to place the code element /* if (myVectorNamesList.size()==0) { // no vectors specified, therefore assume using only main vector myVectorNamesList.push_back("main"); }*/ simulation()->field()->processVectors(myVectorNamesList, mySpace); // ************************************ // find code myCode=*yourElement->textContent(0); // check for non-white space charaters in code: if (myCode.isAllWhiteSpace()) { throw xmdsException(yourElement, "No filter code defined!"); } if (verbose()) { printf("filter code loaded\n"); } // ************************************ // process elements in order to process and place the code elements myNumNonLoopPropagation = 0; myNumIntegrateMomentGroups = 0; long unsigned int i; const NodeList* myElements; const Element* nextElement; myElements = yourElement->getElementsByTagName("*", 0); i = 0; while (i < myElements->length()) { nextElement = dynamic_cast (myElements->item(i)); if (*nextElement->nodeName() == "functions") { XMLString someLoopPropagationCode = *nextElement->textContent(0); // check for non-white space charaters in code: if (someLoopPropagationCode.isAllWhiteSpace()) { throw xmdsException(nextElement, "No code defined!"); } if (verbose()) { printf(" code loaded\n"); } myNumNonLoopPropagation++; myNonLoopPropagationCodeList.push_back(someLoopPropagationCode); myCodeElementList.push_back(*nextElement->nodeName()); } else if (*nextElement->nodeName() == "moment_group") { integrateMomentGroup tempIntegrateMG; XMLString someCode = *nextElement->textContent(0); // check for non-white space charaters in code: if (someCode.isAllWhiteSpace()) { throw xmdsException(nextElement, "No code defined!"); } if (verbose()) { printf(" code loaded\n"); } tempIntegrateMG.integrateMomentGroupCode = someCode; getAssignmentStrings(nextElement, "moments", 1, 0, tempIntegrateMG.momentNameList); getAssignmentBools(nextElement, "integrate_dimension", 1, simulation()->field()->geometry()->nDims(), tempIntegrateMG.integrateDimensionList); myNumIntegrateMomentGroups++; myIntegrateMomentGroupList.push_back(tempIntegrateMG); myCodeElementList.push_back(*nextElement->nodeName()); } else if (*nextElement->nodeName() == "vectors") { myCodeElementList.push_back(*nextElement->nodeName()); } i++; } } // ************************************************************************** // ************************************************************************** // xmdsFilter protected // ************************************************************************** // ************************************************************************** // ************************************************************************** list* xmdsFilter::codeElementList() { if (debugFlag) { printf("xmdsFilter::codeElementList\n"); } return &myCodeElementList; } // ************************************************************************** const list* xmdsFilter::codeElementList() const { if (debugFlag) { printf("xmdsFilter::codeElementList\n"); } return &myCodeElementList; } // ************************************************************************** list* xmdsFilter::nonLoopPropagationCodeList() { if (debugFlag) { printf("xmdsFilter::nonLoopPropagationCodeList\n"); } return &myNonLoopPropagationCodeList; } // ************************************************************************** const list* xmdsFilter::nonLoopPropagationCodeList() const { if (debugFlag) { printf("xmdsFilter::nonLoopPropagationCodeList\n"); } return &myNonLoopPropagationCodeList; } // ************************************************************************** long unsigned int xmdsFilter::numNonLoopPropagation() const { if (debugFlag) { printf("xmdsFilter::numNonLoopPropagation\n"); } return (myNumNonLoopPropagation); } // ************************************************************************** long unsigned int xmdsFilter::numIntegrateMomentGroups() const { if (debugFlag) { printf("xmdsFilter::numIntegrateMomentGroups\n"); } return (myNumIntegrateMomentGroups); } // ************************************************************************** list* xmdsFilter::integrateMomentGroupList() { if (debugFlag) { printf("xmdsFilter::integrateMomentGroupList\n"); } return &myIntegrateMomentGroupList; } // ************************************************************************** const list* xmdsFilter::integrateMomentGroupList() const { if (debugFlag) { printf("xmdsFilter::integrateMomentGroupList\n"); } return &myIntegrateMomentGroupList; } // ************************************************************************** // ************************************************************************** // xmdsFilter private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsFilter::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsFilter::writePrototypes\n"); } if (verbose()) { printf("Writing filter prototypes ...\n"); } fprintf(outfile, "void _segment%li(unsigned long cycle); // filter\n", segmentNumber); } // ************************************************************************** void xmdsFilter::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsFilter::writeRoutines\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const unsigned long nDims = simulation()->field()->geometry()->nDims(); long unsigned int i; if (verbose()) { printf("Writing filter routines ...\n"); } fprintf(outfile, "// ********************************************************\n" "// segment %1$li (filter) routines\n" "\n" "// *************************\n" "void _segment%1$li(unsigned long cycle) {\n" "\n", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!myNonoises)) { fprintf(outfile, "const double _var = 1.0"); for (i = 0; i < nDims; i++) { if (space(i)) { fprintf(outfile, "/_%s_dk%li", fieldName, i); } else { fprintf(outfile, "/_%s_dx%li", fieldName, i); } } fprintf(outfile, ";\n"); fprintf(outfile, "double _noises[_n_noises];\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double _noises2[_n_noises];\n"); } fprintf(outfile, "\n"); } simulation()->field()->vectors2space(outfile, mySpace, myVectorNamesList, ""); bool swapped = false; if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { if ((mySpace & 1) & ((mySpace >> 1) & 1)) { swapped = true; } } list::const_iterator nextNLPElement = myNonLoopPropagationCodeList.begin(); list::const_iterator nextMGElement = myIntegrateMomentGroupList.begin(); list theCodeList = *codeElementList(); long unsigned int filterCodeElemLen = 1 + numIntegrateMomentGroups() + numNonLoopPropagation(); if (!(theCodeList.size() == filterCodeElemLen)) { throw xmdsException("The list of filter code elements is the wrong length!"); } long unsigned int whichMG = 0; list deleteMGArrayList; for (list::const_iterator codeElement = theCodeList.begin(); codeElement != theCodeList.end(); codeElement++) { if (!strcmp(codeElement->c_str(), "vectors")) { simulation()->field()->openLoops(outfile, mySpace, myVectorNamesList); char indent[64]; for (i = 0; i < nDims; i++) { indent[i] = 0x09; } indent[nDims] = 0; if ((simulation()->parameters()->stochastic)&&(!myNonoises)) { if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%1$s_make_noises(_gen1, _var/2, 0, _noises, _n_noises);\n" "%1$s_make_noises(_gen2, _var/2, 0, _noises2, _n_noises);\n", indent); } else { fprintf(outfile, "%1$s_make_noises(_gen1, _var/2, _noises, _n_noises);\n" "%1$s_make_noises(_gen2, _var/2, _noises2, _n_noises);\n", indent); } fprintf(outfile, "%1$sfor (unsigned long _s0=0; _s0<_n_noises; _s0++)\n" "%1$s _noises[_s0] += _noises2[_s0];\n" "\n", indent); } else { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s_make_noises(_gen, _var, 0, _noises, _n_noises);\n", indent); } else { fprintf(outfile, "%s_make_noises(_gen, _var, _noises, _n_noises);\n", indent); } fprintf(outfile, "\n"); } } // integrate moment group pointer definition long unsigned int tempWhichMG = 0; for (list::const_iterator tempNextMGElement = myIntegrateMomentGroupList.begin(); tempNextMGElement != myIntegrateMomentGroupList.end(); tempNextMGElement++) { long unsigned int nDimsRemaining = simulation()->field()->geometry()->nDims(); tempWhichMG++; for (list::const_iterator nextIntegrateDimension = tempNextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != tempNextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { nDimsRemaining--; } } if (nDimsRemaining > 0) { fprintf(outfile, " long _img%li_pointer = ", tempWhichMG); for (long unsigned int j = 0; j < nDimsRemaining-1; j++) { fprintf(outfile, "("); } long unsigned int nDimsToAddToPointer = nDimsRemaining; long unsigned int whichMoment = 0; list::const_iterator nextIntegrateDimension = tempNextMGElement->integrateDimensionList.begin(); if (swapped) { // first two have to be checked in the reverse order nextIntegrateDimension++; if (!*nextIntegrateDimension) { fprintf(outfile, "_i%li", whichMoment); nextIntegrateDimension--; whichMoment++; nDimsToAddToPointer--; if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice0+_i%li)", fieldName, whichMoment); nDimsToAddToPointer--; } nextIntegrateDimension++; } else { nextIntegrateDimension--; whichMoment++; if (!*nextIntegrateDimension) { fprintf(outfile, "_i%li", whichMoment); nDimsToAddToPointer--; } nextIntegrateDimension++; } nextIntegrateDimension++; whichMoment++; } // first two via swapped version // the rest of the dimensions checked if (nDimsToAddToPointer == nDimsRemaining) { while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "_i%li", whichMoment); nDimsToAddToPointer--; nextIntegrateDimension++; whichMoment++; } for (long unsigned int k = 0; k < nDimsToAddToPointer; k++) { while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*_%s_lattice%li+_i%li)", fieldName, whichMoment, whichMoment); nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*%zi;\n", tempNextMGElement->momentNameList.size()); } // pointers for current moment group } // loop over all the moment groups fprintf(outfile, "// *************** Filter code ******************\n" "%s\n" "// **********************************************\n", myCode.c_str()); simulation()->field()->closeLoops(outfile, mySpace, myVectorNamesList); fprintf(outfile, "\n"); } else if (!strcmp(codeElement->c_str(), "functions")) { fprintf(outfile, "// ************** propagation code **************\n" "%s\n" "// **********************************************\n" "\n", nextNLPElement->c_str()); nextNLPElement++; } else if (!strcmp(codeElement->c_str(), "moment_group")) { whichMG++; long unsigned int nDimsRemaining = simulation()->field()->geometry()->nDims(); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { nDimsRemaining--; } } if (nDimsRemaining > 0) { deleteMGArrayList.push_back(whichMG); } fprintf(outfile, "// ************** integrate moment group code **************\n"); //setup defines for the integrate_moment_groups if they are arrays long unsigned int whichMoment = 0; if (nDimsRemaining > 0) { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++){ fprintf(outfile, "#define %s _img%li_array[_img%li_pointer+%li]\n", nextMomentName->c_str(), whichMG, whichMG, whichMoment); whichMoment++; } } fprintf(outfile, "\n"); //setup actual arrays for the integrate_moment_groups (MPI and non-MPI) if (nDimsRemaining > 0) { fprintf(outfile, "complex *_img%li_array = new complex[%zi", whichMG, nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment == 0) { if (swapped) { fprintf(outfile, "*_%s_lattice0", fieldName); } else { fprintf(outfile, "*local_nx"); } } else if (whichMoment == 1) { if (!swapped) { fprintf(outfile, "*_%s_lattice1", fieldName); } else { fprintf(outfile, "*local_ny_after_transpose"); } } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } fprintf(outfile, "];\n"); } else { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, "complex %s = rcomplex(0, 0);\n", nextMomentName->c_str()); } } fprintf(outfile, "\n"); //zero the arrays and setup a local environment for the sum if (nDimsRemaining > 0) { fprintf(outfile, "for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment == 0) { if (swapped) { fprintf(outfile, "*_%s_lattice0", fieldName); } else { fprintf(outfile, "*local_nx"); } } else if (whichMoment == 1) { if (!swapped) { fprintf(outfile, "*_%s_lattice1", fieldName); } else { fprintf(outfile, "*local_ny_after_transpose"); } } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } fprintf(outfile, "; _i0++) {\n" " _img%li_array[_i0] = rcomplex(0, 0);\n" "}\n", whichMG); } fprintf(outfile, "{\n"); // open loops simulation()->field()->openLoops(outfile, mySpace, myVectorNamesList); // pointer definition if (nDimsRemaining > 0) { fprintf(outfile, " long _img%li_pointer = ", whichMG); for (long unsigned int j = 0; j < nDimsRemaining-1; j++) { fprintf(outfile, "("); } long unsigned int nDimsToAddToPointer = nDimsRemaining; whichMoment = 0; list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); if (swapped) { // first two have to be checked in the reverse order nextIntegrateDimension++; if (!*nextIntegrateDimension) { fprintf(outfile, "_i%li", whichMoment); nextIntegrateDimension--; whichMoment++; nDimsToAddToPointer--; if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice0+_i%li)", fieldName, whichMoment); nDimsToAddToPointer--; } nextIntegrateDimension++; } else { nextIntegrateDimension--; whichMoment++; if (!*nextIntegrateDimension) { fprintf(outfile, "_i%li", whichMoment); nDimsToAddToPointer--; } nextIntegrateDimension++; } nextIntegrateDimension++; whichMoment++; } // first two via swapped version // the rest of the dimensions checked if (nDimsToAddToPointer == nDimsRemaining) { while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "_i%li", whichMoment); nDimsToAddToPointer--; nextIntegrateDimension++; whichMoment++; } for (long unsigned int k = 0; k < nDimsToAddToPointer; k++) { while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*_%s_lattice%li+_i%li)", fieldName, whichMoment, whichMoment); nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*%zi;\n", nextMGElement->momentNameList.size()); } // code fprintf(outfile, "%s\n", nextMGElement->integrateMomentGroupCode.c_str()); // close loops simulation()->field()->closeLoops(outfile, mySpace, myVectorNamesList); fprintf(outfile, "}\n"); // if there was any integration, multiply by the relevant volume element if (nDimsRemaining < simulation()->field()->geometry()->nDims()) { if (nDimsRemaining > 0) { fprintf(outfile, "\nfor (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment == 0) { if (swapped) { fprintf(outfile, "*_%s_lattice0", fieldName); } else { fprintf(outfile, "*local_nx"); } } else if (whichMoment == 1) { if (!swapped) { fprintf(outfile, "*_%s_lattice1", fieldName); } else { fprintf(outfile, "*local_ny_after_transpose"); } } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } whichMoment = 0; fprintf(outfile, "; _i0++) {\n" " _img%li_array[_i0] = _img%li_array[_i0]", whichMG, whichMG); long unsigned int tempSpace = mySpace; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { if (tempSpace & 1) { fprintf(outfile, "*_%s_dk%li", fieldName, whichMoment); } else { fprintf(outfile, "*_%s_dx%li", fieldName, whichMoment); } } tempSpace >>= 1; whichMoment++; } fprintf(outfile, ";\n"); fprintf(outfile, " }\n"); } else { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { whichMoment = 0; fprintf(outfile, " %s = %s", nextMomentName->c_str(), nextMomentName->c_str()); long unsigned int tempSpace = mySpace; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { if (tempSpace & 1) { fprintf(outfile, "*_%s_dk%li", fieldName, whichMoment); } else { fprintf(outfile, "*_%s_dx%li", fieldName, whichMoment); } } tempSpace >>= 1; whichMoment++; } fprintf(outfile, ";\n"); } } } // if mpi and first variable integrated then mpireduce if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { if (swapped) { // have to predicate on the second field at least list::const_iterator firstIntegrateDimension = nextMGElement->integrateDimensionList.begin(); firstIntegrateDimension++; if (* firstIntegrateDimension) { if (nDimsRemaining > 0) { fprintf(outfile, "\n complex *_temp_img%li_array = new complex[%zi", whichMG, nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "];\n" " MPI_Allreduce(_img%li_array, _temp_img%li_array, 2*%zi", whichMG, whichMG, nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ", MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n" " for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "; _i0++) {\n" " _img%1$li_array[_i0] = _temp_img%1$li_array[_i0];\n" " }\n" " delete[] _temp_img%1$li_array;\n", whichMG); } else { fprintf(outfile, "\n complex *_temp%li_mpireduce = new complex;\n", whichMG); for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, " MPI_Allreduce(&%1$s, _temp%2$li_mpireduce, 2, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n" " %1$s = *_temp%2$li_mpireduce;\n", nextMomentName->c_str(), whichMG); } fprintf(outfile, "\n delete _temp%li_mpireduce;\n", whichMG); } } } else { if (* nextMGElement->integrateDimensionList.begin()) { if (nDimsRemaining > 0) { fprintf(outfile, "\n complex *_temp_img%li_array = new complex[%zi", whichMG, nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "];\n" " MPI_Allreduce(_img%li_array, _temp_img%li_array, 2*%zi", whichMG, whichMG, nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ", MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n" " for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "; _i0++) {\n" " _img%1$li_array[_i0] = _temp_img%1$li_array[_i0];\n" " }\n" " delete[] _temp_img%1$li_array;\n", whichMG); } else { fprintf(outfile, "\n complex *_temp%li_mpireduce = new complex;\n", whichMG); for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, " MPI_Allreduce(&%1$s, _temp%2$li_mpireduce, 2, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n" " %1$s = *_temp%2$li_mpireduce;\n", nextMomentName->c_str(), whichMG); } fprintf(outfile, "\n delete _temp%li_mpireduce;\n", whichMG); } } } } fprintf(outfile, "\n" "// *********************************************************\n" "\n"); nextMGElement++; } else { throw xmdsException("Unknown code element in the integrate block!"); } } // delete any arrays that were generated for (list::const_iterator deleteMGArray = deleteMGArrayList.begin(); deleteMGArray != deleteMGArrayList.end(); deleteMGArray++) { fprintf(outfile, "delete[] _img%li_array;\n", *deleteMGArray); } fprintf(outfile, "}\n" "\n"); } // ************************************************************************** //! Returns space at index. Don't ask me why this returns boolean bool xmdsFilter::space( const long unsigned int& index) const { if (debugFlag) { printf("xmdsFilter::space\n"); } if (index >= simulation()->field()->geometry()->nDims()) { throw xmdsException("Internal range error in xmdsFilter::space()"); } return (mySpace >> index) & 1; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_filter.h0000644000076500000240000000765511033277417013431 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_filter.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_filter.h @brief More detailed explanation... */ #ifndef XMDS_FILTER_H #define XMDS_FILTER_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsFilter // ***************************************************************************** // ***************************************************************************** //! xmds filter class class xmdsFilter : public xmdsSegment { public : //! Constructor for xmdsFilter object xmdsFilter( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsFilter(); //! Processes filter element void processElement( const Element *const yourElement); //! Whether or not the segment needs to run when the simulation is in overtime bool runsInOvertime() const; protected: //! Returns the code element list list* codeElementList(); //! Returns the code element list const list* codeElementList() const; //! Returns number of non-loop propagation elements long unsigned int numNonLoopPropagation() const; //! Returns the non-loop propagation code list list* nonLoopPropagationCodeList(); //! Returns the non-loop propagation code list const list* nonLoopPropagationCodeList() const; //! Returns number of integrate moment groups long unsigned int numIntegrateMomentGroups() const; //! Returns the integrate moment group list list* integrateMomentGroupList(); //! Returns the integrate moment group list const list* integrateMomentGroupList() const; private : list myVectorNamesList; //!< List of vector names unsigned long mySpace; //!< Space of filter (x-space or k-space) XMLString myCode; //!< The filter code list myCodeElementList; //!< Names of code elements long myNumIntegrateMomentGroups; //!< Number of non-loop propagation elements list myIntegrateMomentGroupList; //!< The list of integrate moment group elements long myNumNonLoopPropagation; //!< Number of non-loop propagation elements list myNonLoopPropagationCodeList; //!< The list of non-loop propagation codes bool myNonoises; //!< Flag for turning off noise generation //! Write the filter prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the filter routines to file void writeRoutines( FILE *const outfile) const; //! Determine the space at index (buh?) bool space( const long unsigned int& index) const; }; #endif // XMDS_FILTER_H xmds-1.6.6/source/xmds_globals.cc0000644000076500000240000000707711033277417013723 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_globals.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_globals.cc @brief Globals element parsing classes and methods More detailed explanation... */ #include #include // ************************************************************************** // ************************************************************************** // xmdsGlobals public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsGlobals = 0; //!< Number of xmds global objects // ************************************************************************** xmdsGlobals::xmdsGlobals( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsElement(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsGlobals++; printf("xmdsGlobals::xmdsGlobals\n"); printf("nxmdsGlobals=%li\n", nxmdsGlobals); } } // ************************************************************************** xmdsGlobals::~xmdsGlobals() { if (debugFlag) { nxmdsGlobals--; printf("xmdsGlobals::~xmdsGlobals\n"); printf("nxmdsGlobals=%li\n", nxmdsGlobals); } } // ************************************************************************** void xmdsGlobals::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsGlobals::processXMLElement\n"); } if (verbose()) { printf("Processing constants element ...\n"); } myGlobalsCode = *yourElement->textContent(0); if (verbose()) { if (myGlobalsCode.isAllWhiteSpace()) { printf("No globals found\n"); } else { printf("Globals code loaded\n"); } } } // ************************************************************************** // ************************************************************************** // xmdsGlobals private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsGlobals::writeGlobals(FILE *const outfile) const { if (debugFlag) { printf("xmdsGlobals::writeGlobals\n"); } fprintf(outfile, "\n// ********** Code from globals element *********\n" "%s\n" "// **********************************************\n" "\n", myGlobalsCode.c_str()); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_globals.h0000644000076500000240000000407411033277417013557 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_globals.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_globals.h @brief More detailed explanation... */ #ifndef XMDS_GLOBALS_H #define XMDS_GLOBALS_H #include // ****************************************************************************** // ****************************************************************************** // xmdsGlobals // ****************************************************************************** // ****************************************************************************** //! Class containing the parameters used to control an entire xmds simulation class xmdsGlobals : public xmdsElement { public : //! Constructor of xmdsGlobals object xmdsGlobals( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsGlobals(); //! Processes an element void processElement( const Element *const yourElement); private : XMLString myGlobalsCode; //!< The XMLString containing the code entered in the globals section //! Writes the globals code to the output file void writeGlobals( FILE *const outfile) const; }; #endif // XMDS_GLOBALS_H xmds-1.6.6/source/xmds_integrate.cc0000644000076500000240000016652711033277417014270 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate.cc @brief Integrate element parsing classes and methods More detailed explanation... */ #include #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrate public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrates = 0; //!< Number of xmds integrate objects // ************************************************************************** xmdsIntegrate::xmdsIntegrate( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const bool& adaptiveIP, const bool& is9thOrderIP) : xmdsSegment(yourSimulation, yourVerboseMode) { myAdaptiveIP = adaptiveIP; myIs9thOrderIP = is9thOrderIP; if (debugFlag) { nxmdsIntegrates++; printf("xmdsIntegrate::xmdsIntegrate\n"); printf("nxmdsIntegrates=%li\n", nxmdsIntegrates); } myNextcoKey = 0; } // ************************************************************************** xmdsIntegrate::~xmdsIntegrate() { if (debugFlag) { nxmdsIntegrates--; printf("xmdsIntegrate::~xmdsIntegrate\n"); printf("nxmdsIntegrates=%li\n", nxmdsIntegrates); } } // ************************************************************************** void xmdsIntegrate::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrate::processElement\n"); } list myXMLStringList; list myULongList; if (verbose()) { printf("Processing integrate element ...\n"); } // ************************************ // find 'interval' getAssignmentStrings(yourElement, "interval", 1, 1, myXMLStringList); myInterval = *myXMLStringList.begin(); if (verbose()) { printf("integrate interval = %s\n", myInterval.c_str()); } // ************************************ // find 'lattice' getAssignmentULongs(yourElement, "lattice", 1, 1, myULongList); myLattice = *myULongList.begin(); if (myLattice == 0) { throw xmdsException(yourElement, "Integration lattice must be >= 1 !"); } if (verbose()) { printf("integrate lattice has %li points\n", myLattice); } // ************************************ // find 'samples' getAssignmentULongs(yourElement, "samples", 1, simulation()->output()->nMomentGroups(), mySamplesList); for (long unsigned int i = 0; i < mySamplesList.size(); i++) { if (samples(i) != 0) { if (myLattice != samples(i) * (myLattice/samples(i))) { throw xmdsException(yourElement, "moment group samples must be either 0 or else factors " "of the integration lattice"); } if (verbose()) { printf("moment group #%li is sampled every %li points\n", i+1, myLattice/samples(i)); } } else { if (verbose()) { printf("moment group #%li is not sampled\n", i+1); } } } // ************************************ // find 'smallmemory' if (myAdaptiveIP || myIs9thOrderIP) { list myBoolList; getAssignmentBools(yourElement, "smallmemory", 0, 1, myBoolList); if (myBoolList.size() == 1) { mySmallmemory = *myBoolList.begin(); if (verbose()) { if (mySmallmemory) printf("\"save memory\" in k_propagate is 'yes'\n"); else printf("\"save memory\" in k_propagate is 'no'\n"); } } else { printf("\"save memory\" in k_propagate defaulting to 'no'\n"); mySmallmemory = false; } } // ************************************ // find halt_non_finite flag //! \todo Code below should really be a function, //! for consistency and to avoid repitition list tempHaltNonFinite; getAssignmentBools(yourElement, "halt_non_finite", false, 1, tempHaltNonFinite); if (tempHaltNonFinite.size() == 1) { myHaltNonFinite = *tempHaltNonFinite.begin(); if (verbose()) { if (myHaltNonFinite) { printf("\"Halt non-finite\" in integrate is 'yes'\n"); } else { printf("\"Halt non-finite\" in integrate is 'no'\n"); } } } else { if (verbose()) { printf("\"Halt non-finite\" in integrate defaulting to 'no'\n"); } myHaltNonFinite = false; } // ************************************ // find no_noise flag list tempNonoise; myNonoises = false; getAssignmentBools(yourElement, "no_noise", 0, 1, tempNonoise); if (tempNonoise.size() == 1) { if (*tempNonoise.begin()) { myNonoises = true; if (verbose()) { printf("No noises will be defined in the filter.\n"); } } } // ************************************ // find min_time_step option list tempMinStep; getAssignmentDoubles(yourElement, "min_time_step", 0, 1, tempMinStep); if (tempMinStep.size() == 1) { myMinStep = *tempMinStep.begin(); if (!myAdaptiveIP) { printf("* WARNING: min_time_step in integrate is only applicable for adaptive integration routines."); } else if (verbose()) { printf("min_time_step in integrate is %e\n", myMinStep); } } else { myMinStep = 1e-13; if (verbose()) { printf("min_time_step in integrate defaulting to %e\n", myMinStep); } } if (simulation()->field()->geometry()->nDims() > 0) { // ************************************ // find k_operators element const NodeList *const candidateElements = yourElement->getElementsByTagName("k_operators", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Multiple elements defined"); } if (candidateElements->length() == 1) { // we have a k_operators element const Element *const kPropagationElement = dynamic_cast (candidateElements->item(0)); if (verbose()) { printf("Processing element ...\n"); } // ************************************ // find constantK list aBoolList; getAssignmentBools(kPropagationElement, "constant", 0, 1, aBoolList); if (aBoolList.size() > 0) { myConstantK = *aBoolList.begin(); if (verbose()) { if (myConstantK) printf("k-operators are propagation independent\n"); else printf("k-propagation are propagation dependent\n"); } } else { myConstantK = 1; printf("k-operators defaulting to propagation independent\n"); } if (!myConstantK && myAdaptiveIP) { throw xmdsException( "ARK45IP does not work with time-dependent k-operators. " "Use ARK45EX instead."); } // ************************************ // find vectors getAssignmentStrings(kPropagationElement, "vectors", 0, 0, myKVectorNamesList); if (myKVectorNamesList.size() == 0) { // no vectors specified, therefore assume using only main vector myKVectorNamesList.push_back("main"); } simulation()->field()->processVectors(myKVectorNamesList, simulation()->field()->geometry()->fullSpace()); // ************************************ // find operators getAssignmentStrings(kPropagationElement, "operator_names", 1, 0, myKOperatorNamesList); // ************************************ // find code myKOperatorsCode = *kPropagationElement->textContent(0); // check for non-white space charaters in code: if (myKOperatorsCode.isAllWhiteSpace()) { throw xmdsException(kPropagationElement, "No code defined!"); } if (verbose()) { printf(" code loaded\n"); } } } // ************************************ // find vectors getAssignmentStrings(yourElement, "vectors", 1, 0, myVectorNamesList); // Vectors are now required by law in order to place the code element /* if (myVectorNamesList.size()==0) { // no vectors specified, therefore assume using only main vector myVectorNamesList.push_back("main"); }*/ simulation()->field()->processVectors(myVectorNamesList, 0); // ************************************ // find code myPropagationCode = *yourElement->textContent(0); // check for non-white space charaters in code: if (myPropagationCode.isAllWhiteSpace()) { throw xmdsException(yourElement, "No propagation code defined!"); } if (verbose()) { printf("processing propagation code ...\n"); } if (simulation()->field()->geometry()->nDims() > 0) { // ************************************ // find cross_propagation const NodeList *const candidateElements = yourElement->getElementsByTagName("cross_propagation", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "only one allowed"); } if (candidateElements->length() == 1) { // we have a cross_propagation element const Element *const crossPropagationElement = dynamic_cast (candidateElements->item(0)); // ...but not if we're distributing the vector over many processors! if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { throw xmdsException(crossPropagationElement, "I really can't handle using MPI when there are " "cross-propagation elements."); } // ************************************ // find cross propagating vectors getAssignmentStrings(crossPropagationElement, "vectors", 1, 0, myCrossVectorNamesList); for (list::const_iterator pXMLString = myCrossVectorNamesList.begin(); pXMLString != myCrossVectorNamesList.end(); pXMLString++) { if (*pXMLString == "main") { throw xmdsException(crossPropagationElement, "Cannot cross-propagate 'main' vector!"); } } simulation()->field()->processVectors(myCrossVectorNamesList, 0); // ************************************ // find 'prop_dim' list anXMLStringList; getAssignmentStrings(crossPropagationElement, "prop_dim", 1, 1, anXMLStringList); // now find which member of the main field dimensions it is if (!simulation()->field()->geometry()->getDimNumber(*anXMLStringList.begin(), myCrossDimNumber)) { sprintf(errorMessage(), "prop_dim '%s' not a dimension of main field", anXMLStringList.begin()->c_str()); throw xmdsException(crossPropagationElement, errorMessage()); } if (verbose()) { printf("cross prop_dim is field dimension number %li\n", myCrossDimNumber); } // ************************************ // find cross_propagation code myCrossPropagationCode = *crossPropagationElement->textContent(0); // check for non-white space charaters in code: if (myCrossPropagationCode.isAllWhiteSpace()) { throw xmdsException(crossPropagationElement, "No code defined!"); } if (verbose()) { printf("cross_propagation code loaded\n"); } } } // ************************************ // process elements in order to process and place the code elements myNumNonLoopPropagation = 0; myNumIntegrateMomentGroups = 0; long unsigned int i; const NodeList* myElements; const Element* nextElement; myElements = yourElement->getElementsByTagName("*", 0); i = 0; while (i < myElements->length()) { nextElement = dynamic_cast (myElements->item(i)); if (*nextElement->nodeName() == "functions") { XMLString someLoopPropagationCode = *nextElement->textContent(0); // check for non-white space charaters in code: if (someLoopPropagationCode.isAllWhiteSpace()) { throw xmdsException(nextElement, "No code defined!"); } if (verbose()) { printf(" code loaded\n"); } myNumNonLoopPropagation++; myNonLoopPropagationCodeList.push_back(someLoopPropagationCode); myCodeElementList.push_back(*nextElement->nodeName()); } else if (*nextElement->nodeName() == "moment_group") { integrateMomentGroup tempIntegrateMG; XMLString someCode = *nextElement->textContent(0); // check for non-white space charaters in code: if (someCode.isAllWhiteSpace()) { throw xmdsException(nextElement, "No code defined!"); } if (verbose()) { printf(" code loaded\n"); } tempIntegrateMG.integrateMomentGroupCode = someCode; getAssignmentStrings(nextElement, "moments", 1, 0, tempIntegrateMG.momentNameList); getAssignmentBools(nextElement, "integrate_dimension", 1, simulation()->field()->geometry()->nDims(), tempIntegrateMG.integrateDimensionList); myNumIntegrateMomentGroups++; myIntegrateMomentGroupList.push_back(tempIntegrateMG); myCodeElementList.push_back(*nextElement->nodeName()); } else if (*nextElement->nodeName() == "vectors") { myCodeElementList.push_back(*nextElement->nodeName()); } i++; } } // ************************************************************************** // ************************************************************************** // xmdsIntegrate protected // ************************************************************************** // ************************************************************************** // ************************************************************************** const bool xmdsIntegrate::Smallmemory() const { if (debugFlag) { printf("xmdsIntegrate::Smallmemory\n"); } return mySmallmemory; } // ************************************************************************** void xmdsIntegrate::writeDefines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writeDefines\n"); } if (usesKOperators()) { if ((myIs9thOrderIP && !Smallmemory()) || (myAdaptiveIP && !Smallmemory()) || (!myAdaptiveIP && constantK())) { fprintf(outfile, "// integrate defines\n"); fprintf(outfile, "\n"); fprintf(outfile, "#define _segment%li_nkoperators %li\n", segmentNumber, (long)myKOperatorNamesList.size()); fprintf(outfile, "\n"); } } } // ************************************************************************** void xmdsIntegrate::writeGlobals(FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writeGlobals\n"); } if (usesKOperators()) { if (myAdaptiveIP || myIs9thOrderIP) { if (!Smallmemory()) { fprintf(outfile, "// integrate globals\n"); fprintf(outfile, "\n"); int max_n; if (myAdaptiveIP) { max_n = 6; } else { max_n = 15; } for (int n = 1; n < max_n; n++) { fprintf(outfile, "complex *_segment%li_k_operator_field_%i;\n", segmentNumber, n); } fprintf(outfile, "\n"); } } else { if (constantK()) { fprintf(outfile, "// integrate globals\n"); fprintf(outfile, "\n"); fprintf(outfile, "complex *_segment%li_k_operator_field;\n", segmentNumber); fprintf(outfile, "\n"); } } } } // ************************************************************************** void xmdsIntegrate::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writePrototypes\n"); } writexSpacePrototype(outfile); } // ************************************************************************** void xmdsIntegrate::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writeRoutines\n"); } writexSpaceRoutine(outfile); } // ************************************************************************** const XMLString* xmdsIntegrate::interval() const { if (debugFlag) { printf("xmdsIntegrate::interval\n"); } return &myInterval; } // ************************************************************************** unsigned long xmdsIntegrate::lattice() const { if (debugFlag) { printf("xmdsIntegrate::lattice\n"); } return myLattice; } // ************************************************************************** unsigned long xmdsIntegrate::samples( const unsigned long& index) const { if (debugFlag) { printf("xmdsIntegrate::KVectorNamesList\n"); } if (index >= mySamplesList.size()) { throw xmdsException("Internal range error in xmdsIntegrate::samples"); } list::const_iterator pULong = mySamplesList.begin(); for (unsigned long i=0; i* xmdsIntegrate::KVectorNamesList() const { if (debugFlag) { printf("xmdsIntegrate::KVectorNamesList\n"); } return &myKVectorNamesList; } // ************************************************************************** bool xmdsIntegrate::constantK() const { if (debugFlag) { printf("xmdsIntegrate::constantK\n"); } return myConstantK; } // ************************************************************************** bool xmdsIntegrate::noNoises() const { if (debugFlag) { printf("xmdsIntegrate::noNoises\n"); } return myNonoises; } // ************************************************************************** unsigned long xmdsIntegrate::nKOperators() const { if (debugFlag) { printf("xmdsIntegrate::nKOperators\n"); } return myKOperatorNamesList.size(); } // ************************************************************************** const XMLString* xmdsIntegrate::KOperator( const unsigned long& index) const { if (debugFlag) { printf("xmdsIntegrate::KOperator\n"); } if (index >= myKOperatorNamesList.size()) { throw xmdsException("Internal range error in xmdsIntegrate::KOperator"); } list::const_iterator pXMLString = myKOperatorNamesList.begin(); for (unsigned long i=0; i::const_iterator pXMLString = myKOperatorNamesList.begin(); pXMLString != myKOperatorNamesList.end(); pXMLString++) { if (*pXMLString == operatorName) { return 1; } index++; } return 0; } // ************************************************************************** const XMLString* xmdsIntegrate::KOperatorsCode() const { if (debugFlag) { printf("xmdsIntegrate::KOperatorsCode\n"); } return &myKOperatorsCode; } // ************************************************************************** list* xmdsIntegrate::vectorNamesList() { if (debugFlag) { printf("xmdsIntegrate::vectorNamesList\n"); } return &myVectorNamesList; } // ************************************************************************** const list* xmdsIntegrate::vectorNamesList() const { if (debugFlag) { printf("xmdsIntegrate::vectorNamesList\n"); } return &myVectorNamesList; } // ************************************************************************** XMLString* xmdsIntegrate::propagationCode() { if (debugFlag) { printf("xmdsIntegrate::propagationCode\n"); } return &myPropagationCode; } // ************************************************************************** const XMLString* xmdsIntegrate::propagationCode() const { if (debugFlag) { printf("xmdsIntegrate::propagationCode\n"); } return &myPropagationCode; } // ************************************************************************** const list* xmdsIntegrate::crossVectorNamesList() const { if (debugFlag) { printf("xmdsIntegrate::crossVectorNamesList\n"); } return &myCrossVectorNamesList; } // ************************************************************************** unsigned long xmdsIntegrate::crossDimNumber() const { if (debugFlag) { printf("xmdsIntegrate::crossDimNumber\n"); } return myCrossDimNumber; } // ************************************************************************** const XMLString* xmdsIntegrate::crossPropagationCode() const { if (debugFlag) { printf("xmdsIntegrate::crossPropagationCode\n"); } return &myCrossPropagationCode; } // ************************************************************************** list* xmdsIntegrate::nonLoopPropagationCodeList() { if (debugFlag) { printf("xmdsIntegrate::nonLoopPropagationCodeList\n"); } return &myNonLoopPropagationCodeList; } // ************************************************************************** const list* xmdsIntegrate::nonLoopPropagationCodeList() const { if (debugFlag) { printf("xmdsIntegrate::nonLoopPropagationCodeList\n"); } return &myNonLoopPropagationCodeList; } // ************************************************************************** list* xmdsIntegrate::codeElementList() { if (debugFlag) { printf("xmdsIntegrate::codeElementList\n"); } return &myCodeElementList; } // ************************************************************************** const list* xmdsIntegrate::codeElementList() const { if (debugFlag) { printf("xmdsIntegrate::codeElementList\n"); } return &myCodeElementList; } // ************************************************************************** bool xmdsIntegrate::usesKOperators() const { if (debugFlag) { printf("xmdsIntegrate::usesKOperators\n"); } return (mycoStructList.size() > 0); } // ************************************************************************** const bool xmdsIntegrate::AdaptiveIP() const { if (debugFlag) { printf("xmdsIntegrate::AdaptiveIP\n"); } return myAdaptiveIP; } // ************************************************************************** const bool xmdsIntegrate::Is9thOrderIP() const { if (debugFlag) { printf("xmdsIntegrate::Is9thOrderIP\n"); } return myIs9thOrderIP; } // ************************************************************************** long unsigned int xmdsIntegrate::numNonLoopPropagation() const { if (debugFlag) { printf("xmdsIntegrate::numNonLoopPropagation\n"); } return (myNumNonLoopPropagation); } // ************************************************************************** long unsigned int xmdsIntegrate::numIntegrateMomentGroups() const { if (debugFlag) { printf("xmdsIntegrate::numIntegrateMomentGroups\n"); } return (myNumIntegrateMomentGroups); } // ************************************************************************** list* xmdsIntegrate::integrateMomentGroupList() { if (debugFlag) { printf("xmdsIntegrate::integrateMomentGroupList\n"); } return &myIntegrateMomentGroupList; } // ************************************************************************** const list* xmdsIntegrate::integrateMomentGroupList() const { if (debugFlag) { printf("xmdsIntegrate::integrateMomentGroupList\n"); } return &myIntegrateMomentGroupList; } // ************************************************************************** bool xmdsIntegrate::runsInOvertime() const { return false; } // ************************************************************************** bool xmdsIntegrate::getcoStruct( const unsigned long& componentNumber, const coStruct*& thecoStruct) const { if (debugFlag) { printf("xmdsIntegrate::getcoStruct\n"); } for (list::const_iterator pcoStruct = mycoStructList.begin(); pcoStruct != mycoStructList.end(); pcoStruct++) { if (pcoStruct->componentNumber == componentNumber) { thecoStruct = &*pcoStruct; return 1; } } return 0; } // ************************************************************************** bool xmdsIntegrate::getcoKey( const unsigned long& componentNumber, const unsigned long& operatorNumber, unsigned long& coKey) const { if (debugFlag) { printf("xmdsIntegrate::getcoPairKey\n"); } const coStruct* thecoStruct; if (!getcoStruct(componentNumber, thecoStruct)) { return 0; } list::const_iterator pULong1 = thecoStruct->operatorNumbersList.begin(); list::const_iterator pULong2 = thecoStruct->coKeysList.begin(); while (pULong1 != thecoStruct->operatorNumbersList.end()) { if (*pULong1 == operatorNumber) { coKey = *pULong2; return 1; } pULong1++; pULong2++; } return 0; } // ************************************************************************** unsigned long xmdsIntegrate::addcoPair( const unsigned long& componentNumber, const unsigned long& operatorNumber, const unsigned long& componentLength) { if (debugFlag) { printf("xmdsIntegrate::addcoPair\n"); } coStruct* existingcoStruct = 0; for (list::iterator pcoStruct = mycoStructList.begin(); pcoStruct != mycoStructList.end(); pcoStruct++) { if (pcoStruct->componentNumber == componentNumber) { existingcoStruct = &*pcoStruct; } } if (existingcoStruct != 0) { existingcoStruct->operatorNumbersList.push_back(operatorNumber); existingcoStruct->coKeysList.push_back(myNextcoKey); } else { coStruct nextcoStruct; nextcoStruct.componentNumber = componentNumber; nextcoStruct.operatorNumbersList.push_back(operatorNumber); nextcoStruct.coKeysList.push_back(myNextcoKey); mycoStructList.push_back(nextcoStruct); } myNextcoKey += componentLength; return myNextcoKey-1; } // ************************************************************************** bool xmdsIntegrate::findNextcoPair( XMLString& operatorName, XMLString& componentName, unsigned long& start, unsigned long& end) const { if (debugFlag) { printf("xmdsIntegrate::findNextcoPair\n"); } // here we are looking for the next // **** operatorName S? '[' S? componentName S? ']' **** // production starting from the offset provided const char* code = myPropagationCode.c_str(); end = start; unsigned long openBrace; unsigned long nameStart; unsigned long nameEnd; // find next [ while ((code[end] != '[') && (code[end] != 0)) { end++; } if (code[end] == 0) { return 0; } // ok, we found the first [ openBrace = end; // now skip white space end++; while (XMLChar::isWhiteSpace(code[end]) && (code[end] != 0)) { end++; } if (code[end] == 0) { return 0; } // !\todo shouldn't the OR operators here be boolean and not bitwise? if (!(XMLChar::isLatinLetter(code[end]) | (code[end] == '_'))) { return 0; } nameStart = end; end++; while ((XMLChar::isLatinLetter(code[end]) | XMLChar::isLatinDigit(code[end]) | (code[end] == '_')) & (code[end] != 0)) { end++; } if (code[end] == 0) { return 0; } nameEnd = end; //check that we have a ] on the end // skip white space while (XMLChar::isWhiteSpace(code[end]) && (code[end] != 0)) { end++; } if (code[end] != ']') { return 0; } // ok, we definititely had a nice clean [name] end++; myPropagationCode.subString(componentName, nameStart, nameEnd); // now work backwards to find the operator name start = openBrace - 1; // skip any white space while (XMLChar::isWhiteSpace(code[start]) & (start > 0)) { start--; } if (!(XMLChar::isLatinLetter(code[start]) | XMLChar::isLatinDigit(code[start]) | (code[start] == '_'))) { return 0; } nameEnd = start + 1; while ((XMLChar::isLatinLetter(code[start]) | XMLChar::isLatinDigit(code[start]) | (code[start] == '_')) & (start > 0)) { start--; } if (!(XMLChar::isLatinLetter(code[start]) | XMLChar::isLatinDigit(code[start]) | (code[start] == '_'))) { start++; } if (!(XMLChar::isLatinLetter(code[start]) | (code[start] == '_'))) { return 0; } nameStart = start; myPropagationCode.subString(operatorName, nameStart, nameEnd); return 1; } // ************************************************************************** void xmdsIntegrate::writexSpacePrototype( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writexSpacePrototype\n"); } fprintf(outfile, "void _segment%li_calculate_delta_a(\n", segmentNumber); fprintf(outfile, " const double& _step"); fprintf(outfile, ", \n const unsigned long cycle"); if ((simulation()->parameters()->stochastic) && (!myNonoises)) { fprintf(outfile, ", \n const double *const _noise_vector"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrate::writexSpaceRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writexSpaceRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_delta_a(\n", segmentNumber); fprintf(outfile, " const double& _step"); fprintf(outfile, ", \n const unsigned long cycle"); if ((simulation()->parameters()->stochastic) && (!noNoises())) { fprintf(outfile, ", \n const double *const _noise_vector"); } fprintf(outfile, ") {\n"); fprintf(outfile, "\n"); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException( "Internal error in xmdsIntegrate::writexSpaceRoutine: " "cannot find 'main' vector"); } const char* typeName = ""; if (mainVector->vectorType() == COMPLEX) { typeName = "complex"; } else if (mainVector->vectorType() == DOUBLE) { typeName = "double"; } list threadPrivateVariables; for (unsigned long i = 0; i < mainVector->nComponents(); i++) { XMLString derivativeName = "d"; derivativeName += *mainVector->componentName(i); derivativeName += "_d"; derivativeName += simulation()->parameters()->propDimName; if (mainVector->componentLength(i) > 1) { fprintf(outfile, "%s *%s = new %s[%li];\n", typeName, derivativeName.c_str(), typeName, mainVector->componentLength(i)); fprintf(outfile, "#define %s(j) %s[j-1]\n", derivativeName.c_str(), derivativeName.c_str()); } else { fprintf(outfile, "%s %s;\n", typeName, derivativeName.c_str()); } threadPrivateVariables.push_back(derivativeName); } fprintf(outfile, "\n"); // add cross vectors to total vectors to use, but no duplicating names! list myTotalVectorsList = *vectorNamesList(); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = myTotalVectorsList.begin(); while ((pXMLString2 != myTotalVectorsList.end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myTotalVectorsList.push_back(*pXMLString); } } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); if (crossVectorNamesList()->size() > 0) { fprintf(outfile, "_segment%li_calculate_cross_field(", segmentNumber); if (simulation()->parameters()->stochastic && !noNoises()) { fprintf(outfile, "_noise_vector"); } fprintf(outfile, ");\n\n"); } if (simulation()->parameters()->stochastic && !myNonoises) { fprintf(outfile, "const double* _noises = _noise_vector;\n"); fprintf(outfile, "\n"); } list::const_iterator nextNLPElement = myNonLoopPropagationCodeList.begin(); list::const_iterator nextMGElement = myIntegrateMomentGroupList.begin(); // !\todo refactor the magic number here list theCodeList = *codeElementList(); if (!(theCodeList.size() == 1+numIntegrateMomentGroups()+numNonLoopPropagation())) { throw xmdsException( "The list of integrate code elements is the wrong length!"); } long unsigned int whichMG = 0; list deleteMGArrayList; // !\todo this for loop is almos 500 lines long! Refactor! for (list::const_iterator codeElement = theCodeList.begin(); codeElement != theCodeList.end(); codeElement++) { if (!strcmp(codeElement->c_str(), "vectors")) { // normal and cross-propagation simulation()->field()->openLoops(outfile, 0, myTotalVectorsList, PARALLELISE_LOOP, threadPrivateVariables); fprintf(outfile, "\n"); char indent[64]; for (unsigned long i = 0; i < nDims; i++) { indent[i] = 0x09; } indent[nDims] = 0; // integrate moment group pointer definition long unsigned int tempWhichMG = 0; for (list::const_iterator tempNextMGElement = myIntegrateMomentGroupList.begin(); tempNextMGElement != myIntegrateMomentGroupList.end(); tempNextMGElement++) { long unsigned int nDimsRemaining = simulation()->field()->geometry()->nDims(); tempWhichMG++; for (list::const_iterator nextIntegrateDimension = tempNextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != tempNextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (*nextIntegrateDimension) { nDimsRemaining--; } } if (nDimsRemaining > 0) { fprintf(outfile, " long _img%li_pointer = ", tempWhichMG); for (long unsigned int j = 0; j < nDimsRemaining-1; j++) { fprintf(outfile, "("); } long unsigned int whichMoment = 0; list::const_iterator nextIntegrateDimension = tempNextMGElement->integrateDimensionList.begin(); while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "_i%li", whichMoment); nextIntegrateDimension++; whichMoment++; for (long unsigned int k = 0; k < nDimsRemaining-1; k++) { while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*_%s_lattice%li+_i%li)", fieldName, whichMoment, whichMoment); nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*%zi;\n", tempNextMGElement->momentNameList.size()); } } fprintf(outfile, "// ************** propagation code **************\n"); fprintf(outfile, "%s\n", propagationCode()->c_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (long unsigned int i = 0; i < mainVector->nComponents(); i++) { unsigned long previousComponents = 0; for (unsigned long componentCounter = 0; componentCounter < i; componentCounter++) { previousComponents+=mainVector->componentLength(componentCounter); } if (mainVector->componentLength(i) > 1) { fprintf(outfile, "%sfor (unsigned long _j = 0; _j<%li; _j++) {\n", indent, mainVector->componentLength(i)); fprintf(outfile, "%s _active_%s_main[_%s_main_index_pointer +_j + %li] = " "d%s_d%s[_j]*_step;\n", indent, fieldName, fieldName, previousComponents, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); fprintf(outfile, "%s}\n",indent); } else { fprintf(outfile, "%s_active_%s_main[_%s_main_index_pointer + %li] = " "d%s_d%s*_step;\n", indent, fieldName, fieldName, previousComponents, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); } } fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic) && (!myNonoises)) { fprintf(outfile, "%s_noises += _n_noises;\n", indent); fprintf(outfile, "\n"); } simulation()->field()->closeLoops(outfile, 0, myTotalVectorsList); fprintf(outfile, "\n"); } else if (!strcmp(codeElement->c_str(), "functions")) { fprintf(outfile, "// ************** propagation code **************\n"); fprintf(outfile, "%s\n", nextNLPElement->c_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); nextNLPElement++; } else if (!strcmp(codeElement->c_str(), "moment_group")) { // moment_group element whichMG++; long unsigned int nDimsRemaining = simulation()->field()->geometry()->nDims(); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (*nextIntegrateDimension) { nDimsRemaining--; } } if (nDimsRemaining > 0) { deleteMGArrayList.push_back(whichMG); } fprintf(outfile, "// ************** integrate moment group code **************\n"); // set up defines for the integrate_moment_groups if they are arrays long unsigned int whichMoment = 0; if (nDimsRemaining > 0) { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, "#define %s _img%li_array[_img%li_pointer+%li]\n", nextMomentName->c_str(), whichMG, whichMG, whichMoment); whichMoment++; } } fprintf(outfile, "\n"); // set up actual arrays for integrate_moment_groups (MPI and non-MPI) if (nDimsRemaining > 0) { fprintf(outfile, "complex *_img%li_array = new complex[%zi", whichMG, nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi & !simulation()->parameters()->stochastic) { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment == 0) { fprintf(outfile, "*local_nx"); } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } fprintf(outfile, "];\n"); } else { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, "complex %s = rcomplex(0, 0);\n", nextMomentName->c_str()); } } fprintf(outfile, "\n"); //zero the arrays and setup a local environment for the sum if (nDimsRemaining > 0) { if (simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment == 0) { fprintf(outfile, "*local_nx"); } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } fprintf(outfile, "; _i0++) {\n" " _img%li_array[_i0] = rcomplex(0, 0);\n" "}\n", whichMG); } fprintf(outfile, "{\n"); // open loops // This cannot be parallelised as OpenMP only seems to support // reduction clauses for 'normal' types. i.e. no classes :-( simulation()->field()->openLoops(outfile, 0, myTotalVectorsList, DO_NOT_PARALLELISE_LOOP); // pointer definition if (nDimsRemaining > 0) { fprintf(outfile, " long _img%li_pointer = ", whichMG); for (long unsigned int j = 0; j < nDimsRemaining-1; j++) { fprintf(outfile, "("); } whichMoment = 0; list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "_i%li", whichMoment); nextIntegrateDimension++; whichMoment++; for (long unsigned int k = 0; k < nDimsRemaining-1; k++) { while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*_%s_lattice%li+_i%li)", fieldName, whichMoment, whichMoment); nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "*%zi;\n", nextMGElement->momentNameList.size()); } // code fprintf(outfile, "%s\n", nextMGElement->integrateMomentGroupCode.c_str()); // close loops simulation()->field()->closeLoops(outfile, 0, myTotalVectorsList); fprintf(outfile, "}\n"); // if there was any integration, multiply by the relevant volume element if (nDimsRemainingfield()->geometry()->nDims()) { if (nDimsRemaining > 0) { fprintf(outfile, "for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment == 0) { fprintf(outfile, "*local_nx"); } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } whichMoment = 0; fprintf(outfile, "; _i0++) {\n" " _img%li_array[_i0] = _img%li_array[_i0]", whichMG, whichMG); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (*nextIntegrateDimension) { fprintf(outfile, "*_%s_dx%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ";\n" " }\n"); } else { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { whichMoment = 0; fprintf(outfile, " %s = %s", nextMomentName->c_str(), nextMomentName->c_str()); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (*nextIntegrateDimension) { fprintf(outfile, "*_%s_dx%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ";\n"); } } } // if mpi and first variable integrated then mpireduce if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { if (* nextMGElement->integrateDimensionList.begin()) { if (nDimsRemaining > 0) { fprintf(outfile, "\n complex *_temp_img%li_array = new complex[%zi", whichMG, nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "];\n" " MPI_Allreduce(_img%li_array, _temp_img%li_array, 2*%zi", whichMG, whichMG, nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ", MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n" " for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); whichMoment = 0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "; _i0++) {\n" " _img%li_array[_i0] = _temp_img%li_array[_i0];\n }\n", whichMG, whichMG); fprintf(outfile, " delete[] _temp_img%li_array;\n", whichMG); } else { fprintf(outfile, "\n complex *_temp%li_mpireduce = new complex;\n", whichMG); for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, " MPI_Allreduce(&%s, _temp%li_mpireduce, 2, MPI_DOUBLE, " "MPI_SUM, MPI_COMM_WORLD);\n", nextMomentName->c_str(), whichMG); fprintf(outfile, " %s = *_temp%li_mpireduce;\n", nextMomentName->c_str(), whichMG); } fprintf(outfile, "\n delete _temp%li_mpireduce;\n", whichMG); } } } fprintf(outfile, "\n" "// *********************************************************\n" "\n"); nextMGElement++; } else { throw xmdsException("Unknown code element in the integrate block!"); } } // delete any arrays that were generated for (list::const_iterator deleteMGArray = deleteMGArrayList.begin(); deleteMGArray != deleteMGArrayList.end(); deleteMGArray++) { fprintf(outfile, "delete[] _img%li_array;\n", *deleteMGArray); } for (long unsigned int i = 0; i < mainVector->nComponents(); i++) { if (mainVector->componentLength(i) > 1) { fprintf(outfile, "delete[] d%s_d%s;\n", mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); } } fprintf(outfile, "}\n" "\n"); } // ************************************************************************** // ************************************************************************** // xmdsIntegrate private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrate::outputSampleCount() const { if (debugFlag) { printf("xmdsIntegrate::outputSampleCount\n"); } simulation()->output()->addSamples(mySamplesList); } // ************************************************************************** void xmdsIntegrate::writeInitialisationCalls(FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writeInitialisationCalls\n"); } if (usesKOperators() && !Smallmemory()) { if (myAdaptiveIP || myIs9thOrderIP) { // !\todo max_i (and max_n in a similar place above) are magic // numbers, these need to be replaced with something more meaningful // and should be defined to remove repeated code int max_i; if (myAdaptiveIP) { max_i = 6; } else { max_i = 15; } for (int i = 1; i < max_i; i++) { if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "_segment%li_k_operator_field_%i = " "new complex[total_local_size*_segment%li_nkoperators];\n", segmentNumber, i, segmentNumber); } else { fprintf(outfile, "_segment%li_k_operator_field_%i = " "new complex[_%s_size*_segment%li_nkoperators];\n", segmentNumber, i, simulation()->field()->name()->c_str(), segmentNumber); } } } else { if (constantK()) { if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "_segment%li_k_operator_field = " "new complex[total_local_size*_segment%li_nkoperators];\n", segmentNumber, segmentNumber); } else { fprintf(outfile, "_segment%li_k_operator_field = " "new complex[_%s_size*_segment%li_nkoperators];\n", segmentNumber, simulation()->field()->name()->c_str(), segmentNumber); } fprintf(outfile, "_segment%li_calculate_k_operator_field();\n", segmentNumber); } } } } void xmdsIntegrate::writeDestructionCalls(FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrate::writeDestructionCalls\n"); } if (usesKOperators() && !Smallmemory()) { if (myAdaptiveIP || myIs9thOrderIP) { // !\todo once again, use of magic numbers, replace with define int max_i; if (myAdaptiveIP) { max_i = 6; } else { max_i = 15; } for (int i=1; iparameters()->runTimeLimit > 0; if (timeLimit || myHaltNonFinite) { // open the if condition fprintf(outfile, " if (\n"); if (timeLimit) { fprintf(outfile, " _running_overtime()\n"); } if (timeLimit && myHaltNonFinite) { // we check both, so combine with OR fprintf(outfile, " ||\n"); } if (myHaltNonFinite) { fprintf(outfile, " // check if a component of the main vector is non-finite\n" " // no need to check all components,\n" " // since they will be quickly mixed together\n"); fprintf(outfile, " !isfinite(_active_%s_main[0])\n", simulation()->field()->name()->c_str()); } // close the if condition, open the if body fprintf(outfile, " ) {\n"); // Note that we _will_ generate duplicate exit code below, // but it is not a big problem. // It is not time-critical (after all, we are exiting). // And it makes _this_ code easier to read and maintain. if (timeLimit) { fprintf(outfile, " if (_overtime) {\n"); //! \todo runtime_limit option name is repeated here writeHaltCode(outfile, "runtime_limit", "Simulation running over-time."); fprintf(outfile, " }\n"); } if (myHaltNonFinite) { fprintf(outfile, " if (!isfinite(_active_%s_main[0])) {\n", simulation()->field()->name()->c_str()); //! \todo halt_non_finite option name is repeated here writeHaltCode(outfile, "halt_non_finite", "Non-finite number in main vector."); fprintf(outfile, " }\n"); } // close the if body fprintf(outfile, " }\n\n"); } } // Strictly, this doesn't belong in xmdsIntegrate because // it is used only for adaptive integration routines. // (Same goes for myMinStep and its code above.) // However, there is no xmdsIntegrateAdaptive class // (but maybe there should be), so this prevents code repetition // in the ark45 and ark89 classes. // And when/if the class heirarchy is redesigned, // it will be easier to move this function to the right place. void xmdsIntegrate::writeStepCheckingCode(FILE *outfile) const { //! \todo Does anyone actually use these debug statements? //! Isn't it easier to use a debugger (e.g. gdb)? if (debugFlag) { printf("xmdsIntegrate::writeStepCheckingCode\n"); } if (myMinStep > 0) { fprintf(outfile, " if (_step < %e) {\n", myMinStep); writeHaltCode(outfile, "min_time_step", "Minimum time step reached. See element documentation."); fprintf(outfile, " }\n"); } } // Remember, don't have back-slash escaped characters in title or msg! //! \todo Perhaps we should have a function that escapes a string? void xmdsIntegrate::writeHaltCode(FILE *outfile, const char *title, const char *msg) const { // Take one last sample for each moment group, if we have any left for (unsigned long mg = 0; mg < simulation()->output()->nMomentGroups(); mg++) { if (samples(mg)) { fprintf(outfile, " if (_mg%1$li_sample_pointer < %2$lu)\n" " _mg%1$li_sample();\n\n", mg, samples(mg)); } } // If title or msg have escaped characters, they get written raw to the C source. fprintf(outfile, " printf(\"* NOTICE: %s: Integration halted.\\n" "* %s\\n\");\n", title, msg); fprintf(outfile, " goto _SEGMENT%li_END;\n", segmentNumber); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate.h0000644000076500000240000002432111033277417014113 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate.h 1706 2008-01-29 04:42:30Z gmcmanus $ */ /*! @file xmds_integrate.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_H #define XMDS_INTEGRATE_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrate // ***************************************************************************** // ***************************************************************************** //! Class to organise integration of relevant equations in simulation class xmdsIntegrate : public xmdsSegment { public : //! Enumerator containing the half and full step integration parameters enum stepCaseEnum { FIRST_HALFSTEP, SECOND_HALFSTEP, FULLSTEP }; //! Constructor for xmdsIntegrate object xmdsIntegrate( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const bool& adaptiveIP, const bool& is9thOrderIP); //! Destructor ~xmdsIntegrate(); //! Processes the xmds element void processElement( const Element *const yourElement); //! Whether or not the segment needs to run when the simulation is in overtime bool runsInOvertime() const; protected : //! Writes the defines to outfile void writeDefines( FILE *const outfile) const; //! Writes global variables to outfile void writeGlobals( FILE *const outfile) const; //! Writes function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the x-space prototypes to outfile virtual void writexSpacePrototype( FILE *const outfile) const; //! Writes the simulation routines void writeRoutines( FILE *const outfile) const; //! Writes the x-space simulation routines virtual void writexSpaceRoutine( FILE *const outfile) const; //! Returns the interval (buh?) const XMLString* interval() const; //! Returns the lattice unsigned long lattice() const; //! Returns the number of samples unsigned long samples( const unsigned long& index) const; //! Returns the vector name list in k-space const list* KVectorNamesList() const; //! Return whether k-space operators are propagation independent bool constantK() const; //! Returns the number of operators in k-space unsigned long nKOperators() const; //! Returns the k-space operator as XMLString const XMLString* KOperator( const unsigned long& index) const; //! Try to store the index of the named k-space operator. //! Return whether the k-space operator exists. bool getKOperator( const XMLString& operatorName, unsigned long& index) const; //! k-space operators code const XMLString* KOperatorsCode() const; //! Returns the vector names list list* vectorNamesList(); //! Returns the vector names list const list* vectorNamesList() const; //! Returns the propagation code XMLString* propagationCode(); //! Returns the propagation code const XMLString* propagationCode() const; //! Returns the cross vector names list const list* crossVectorNamesList() const; //! Returns the cross dimension number unsigned long crossDimNumber() const; //! Returns the cross propagation code const XMLString* crossPropagationCode() const; //! Determines if k-space operators are used bool usesKOperators() const; //! returns true if the algorithm is ARK45IP const bool AdaptiveIP() const; //! returns true if the algorithm is RK9 or ARK89 const bool Is9thOrderIP() const; //! returns if k_propagate should always use the time-dependend version const bool Smallmemory() const; //! Returns the code element list list* codeElementList(); //! Returns the code element list const list* codeElementList() const; //! Returns number of non-loop propagation elements long unsigned int numNonLoopPropagation() const; //! Returns the non-loop propagation code list const list* nonLoopPropagationCodeList() const; //! Returns the non-loop propagation code list list* nonLoopPropagationCodeList(); //! Returns number of integrate moment groups long unsigned int numIntegrateMomentGroups() const; //! Returns the integrate moment group list const list* integrateMomentGroupList() const; //! Returns the integrate moment group list list* integrateMomentGroupList(); //! Try to store the component structure corresponding to the given number. //! Return whether such a coStruct exists. //! \todo Why are we passing references to constant ints, here and elsewhere? //! Why not just pass in the int? bool getcoStruct( const unsigned long& componentNumber, const coStruct*& thecoStruct) const; //! Gets the component key // Returns true if the component key has been used before. bool getcoKey( const unsigned long& componentNumber, const unsigned long& operatorNumber, unsigned long& coKey) const; //! Adds a component pair unsigned long addcoPair( const unsigned long& componentNumber, const unsigned long& operatorNumber, const unsigned long& componentLength); //! Store the next component pair and its start and end position, //! starting from the given position. //! Return whether a next component pair was found. bool findNextcoPair( XMLString& operatorName, XMLString& componentName, unsigned long& start, unsigned long& end) const; //! Determines if generation of noises is to be supressed bool noNoises() const; //! Write code to check if the simulation should halt void writeHaltCheckingCode(FILE *outfile) const; //! Write code to check if the step-size is too small //! (for adapative integration). void writeStepCheckingCode(FILE *outfile) const; private : XMLString myInterval; //!< The interval over which to integrate unsigned long myLattice; //!< The integration lattice list mySamplesList; //!< The list of samples over the lattice list myKVectorNamesList; //!< The list of the names of the k-space vectors bool myConstantK; //!< Whether or not the k-operators are constant list myKOperatorNamesList; //!< The list of k-operator names XMLString myKOperatorsCode; //!< The k-operators code list myVectorNamesList; //!< The list of vector names XMLString myPropagationCode; //!< The propagation code list myCrossVectorNamesList; //!< The list of cross-propagation vector names unsigned long myCrossDimNumber; //!< The cross-propagation dimension number list myCodeElementList; //!< Names of code elements long myNumIntegrateMomentGroups; //!< Number of non-loop propagation elements list myIntegrateMomentGroupList; //!< The list of integrate moment group elements long myNumNonLoopPropagation; //!< Number of non-loop propagation elements list myNonLoopPropagationCodeList; //!< The list of non-loop propagation codes XMLString myCrossPropagationCode; //!< The cross-propagation code list mycoStructList; //!< The component structure list unsigned long myNextcoKey; //!< The key of the next component bool myNonoises; //!< Flag for turning off noise generation bool myAdaptiveIP; //!< Is it adaptive? bool myIs9thOrderIP; //!< Is it 9th order? bool mySmallmemory; //!< can it save six copies of k-op fields bool myHaltNonFinite; //!< If true, halt on non-finite numbers? double myMinStep; //!< Minimum allowed step size for adaptive integration //! The output sample count void outputSampleCount() const; //! Write the integrate initialisation calls to file void writeInitialisationCalls(FILE *const outfile) const; //! Write code to take a last sample, //! print a warning message with a title, //! and halt the integration pass. //! Important: Don't have back-slash escaped characters //! in title or msg! Or, escape the _back-slashes_, at your peril. void writeHaltCode(FILE *outfile, const char *title, const char *msg) const; //! Writes destruction calls to file virtual void writeDestructionCalls(FILE *const outfile) const; }; #endif // XMDS_INTEGRATE_H xmds-1.6.6/source/xmds_integrate_ark45.cc0000644000076500000240000020376511033277417015272 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark45.cc 1964 2008-04-09 00:42:11Z paultcochrane $ */ /*! @file xmds_integrate_ark45.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta More detailed explanation... */ #include #include #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45 public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateARK45s = 0; //!< Number of xmds integrate ARK45 objects // ************************************************************************** xmdsIntegrateARK45::xmdsIntegrateARK45( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateARK45s++; printf("xmdsIntegrateARK45::xmdsIntegrateARK45\n"); printf("nxmdsIntegrateARK45s=%li\n", nxmdsIntegrateARK45s); } } // ************************************************************************** xmdsIntegrateARK45::~xmdsIntegrateARK45() { if (debugFlag) { nxmdsIntegrateARK45s--; printf("xmdsIntegrateARK45::~xmdsIntegrateARK45\n"); printf("nxmdsIntegrateARK45s=%li\n", nxmdsIntegrateARK45s); } } // ************************************************************************** void xmdsIntegrateARK45::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateARK45::processElement\n"); } if (simulation()->parameters()->stochastic && !noNoises()) { throw xmdsException(yourElement, "ARK45 algorithms provide biased stochastic averages. We suggest ARK89 algorithms."); } list myXMLStringList; list myULongList; // ************************************ // find 'tolerance' getAssignmentStrings(yourElement, "tolerance", 1, 1, myXMLStringList); myTolerance = *myXMLStringList.begin(); if (verbose()) { printf("integration tolerance = %s\n", myTolerance.c_str()); } // ************************************ // find 'cutoff' getAssignmentStrings(yourElement, "cutoff", 0, 1, myXMLStringList); if (myXMLStringList.size() == 1) { myCutoff = *myXMLStringList.begin(); if (verbose()) { printf("cutoff = %s\n", myCutoff.c_str()); } } else { printf("cutoff defaulting to 1e-3 \n"); myCutoff = "1e-3"; } // ************************************ // find 'maximum iterations' getAssignmentULongs(yourElement, "max_iterations", 0, 1, myULongList); if (myULongList.size() == 1) { myMaxIterations = *myULongList.begin(); if (myMaxIterations == 0) { throw xmdsException(yourElement, "Maximum Iterations must be >= 1 !"); } if (verbose()) { printf("Maximum iterations = %li\n", myMaxIterations); } } else { if (verbose()) { printf("Maximum iterations = infinity \n"); } myMaxIterations = 0; // this means the feature is disabled } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45 protected // ************************************************************************** // ************************************************************************** const XMLString* xmdsIntegrateARK45::tolerance() const { if (debugFlag) { printf("xmdsIntegrateARK45::tolerance\n"); } return &myTolerance; } // ************************************************************************** const XMLString* xmdsIntegrateARK45::cutoff() const { if (debugFlag) { printf("xmdsIntegrateARK45::cutoff\n"); } return &myCutoff; } // ************************************************************************** void xmdsIntegrateARK45::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45::writePrototypes\n"); } const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45::writePrototypes: cannot find 'main' vector"); } const char* typeName = ""; if (mainVector->vectorType() == COMPLEX) { typeName = "complex"; } else if (mainVector->vectorType() == DOUBLE) { typeName = "double"; } fprintf(outfile, "\n" "// integrate (ARK45) prototypes\n" "\n"); fprintf(outfile, "double _segment%li_timestep_error(%s* _checkfield);\n", segmentNumber, typeName); fprintf(outfile, "\n"); fprintf(outfile, "double _segment%li_setup_sampling(bool* _next_sample_flag, unsigned long* _next_sample_counter);\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li(unsigned long cycle);\n", segmentNumber); fprintf(outfile, "\n"); if (crossVectorNamesList()->size() > 0) { fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if (simulation()->parameters()->stochastic && !noNoises()) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } } // ************************************************************************** void xmdsIntegrateARK45::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45::writeRoutines\n"); } writeTimestepErrorRoutine(outfile); writeSetupSamplingRoutine(outfile); writeMainIntegrateRoutine(outfile); if (crossVectorNamesList()->size() > 0) { writeCalculateCrossFieldRoutine(outfile); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45 private // ************************************************************************** // ************************************************************************** void xmdsIntegrateARK45::writeTimestepErrorRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45::writeTimestepErrorRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45::writeTimestepErrorRoutine: cannot find 'main' vector"); } const char* typeName = ""; if (mainVector->vectorType() == COMPLEX) { typeName = "complex"; } else if (mainVector->vectorType() == DOUBLE) { typeName = "double"; } fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "double _segment%li_timestep_error(%s* _checkfield) {\n", segmentNumber, typeName); fprintf(outfile, "\n"); fprintf(outfile, "double _error=1e-24;\n"); fprintf(outfile, "double _result[_%s_main_ncomponents];\n", fieldName); if (simulation()->field()->geometry()->nDims() > 0) { // finds one peak value for each component of field fprintf(outfile, "double _peak[_%s_main_ncomponents];\n", fieldName); fprintf(outfile, "for(unsigned long _i0=0; _i0<_%s_main_ncomponents; _i0++){\n", fieldName); fprintf(outfile, " _peak[_i0]=0.0;\n" " _result[_i0]=0.0;\n" " }\n" "\n"); } fprintf(outfile, "double _temp_error=0.0;\n" "double _temp_mod=0.0;\n" "\n" "unsigned long _%s_main_index_pointer=0;\n", fieldName); fprintf(outfile, "\n"); if (simulation()->field()->geometry()->nDims() > 0) { if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "for(unsigned long _i0=0; _i0peak /* this construction was * _peak[_i1] += 0.5*(_temp_mod - _peak[_i1] + fabs(_temp_mod - _peak[_i1])); * It was a bad idea because it leads to NaNs for the peak value when it * should be infinite, because it tries to add values to Inf, leading to * NaN. The other problem with this construction is that it requires a * store on each loop which will be slower than a branch (particularly * when that branch is predicted correctly as it will be by modern CPUs). */ fprintf(outfile, " if (!isfinite(_temp_mod)) _peak[_i1] = INFINITY;\n" " else if (_peak[_i1] < _temp_mod) _peak[_i1] = _temp_mod;\n" " }\n" " _%s_main_index_pointer+=_%s_main_ncomponents;\n" " }\n" "\n", fieldName, fieldName); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "MPI_Allreduce(&_peak, &_result, _%s_main_ncomponents, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);\n", fieldName); fprintf(outfile, "for(unsigned long _i0=0; _i0<_%s_main_ncomponents; _i0++){\n", fieldName); fprintf(outfile, " _peak[_i0]=_result[_i0];\n" " _result[_i0]=0;\n" "}\n"); } // now the peak value is multiplied with the cutoff so that it is now in // fact the amplitude-threshold for error determination fprintf(outfile, "for(unsigned long _i0=0; _i0<_%s_main_ncomponents; _i0++) {\n", fieldName); fprintf(outfile, " if (!isfinite(_peak[_i0]))\n" " // We return the maximum possible error in this case because the timestep must be reduced\n" " // for the error to be calculated correctly\n" " return 1.0;\n"); fprintf(outfile, " _peak[_i0]*=%s;\n", cutoff()->c_str()); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); fprintf(outfile, "_%s_main_index_pointer=0;\n", fieldName); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "for(long _i0=0; _i0_peak[_i1]){\n", fieldName, fieldName); fprintf(outfile, " _temp_error=mod(_%s_main[_%s_main_index_pointer + _i1]-_checkfield[_%s_main_index_pointer + _i1])/(mod(_%s_main[_%s_main_index_pointer + _i1])+1e-20);\n", fieldName, fieldName, fieldName, fieldName, fieldName); } else{ fprintf(outfile, " if(fabs(_%s_main[_%s_main_index_pointer + _i1])>_peak[_i1]){\n", fieldName, fieldName); fprintf(outfile, " _temp_error=fabs(_%s_main[_%s_main_index_pointer + _i1]-_checkfield[_%s_main_index_pointer + _i1])/(fabs(_%s_main[_%s_main_index_pointer + _i1])+1e-20);\n", fieldName, fieldName, fieldName, fieldName, fieldName); } fprintf(outfile, " if (_error < _temp_error) _error = _temp_error;\n"); fprintf(outfile, " }\n"); fprintf(outfile, " _%s_main_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " }\n"); } else{ // if ndims==0 fprintf(outfile, " for(unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++){\n", fieldName); if (std::strcmp(typeName, "complex") == 0) { fprintf(outfile, " _temp_error=mod(_%s_main[_i1]-_checkfield[_i1])/(mod(_%s_main[_i1])+1e-20);\n", fieldName, fieldName); } else{ fprintf(outfile, " _temp_error=fabs(_%s_main[_i1]-_checkfield[_i1])/(fabs(_%s_main[_i1])+1e-20);\n", fieldName, fieldName); } fprintf(outfile, " if (_error < _temp_error) _error = _temp_error;\n"); fprintf(outfile, " }\n"); } if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "MPI_Allreduce(&_error, &_result, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);\n"); } else { fprintf(outfile, "_result[0]=_error;\n"); } fprintf(outfile, "return(_result[0]);\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateARK45::writeSetupSamplingRoutine(FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45::writeSetupSamplingRoutine\n"); } const char *const propDim = simulation()->parameters()->propDimName.c_str(); fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "double _segment%li_setup_sampling(bool* _next_sample_flag, unsigned long* _next_sample_counter) {\n", segmentNumber); fprintf(outfile, "\n"); // will contain the numbers of all the moment groups that need to be sampled at the next sampling point. The N+1'th entry means "reached end of integration interval". fprintf(outfile, "unsigned long _number_next_mg[%li];\n", simulation()->output()->nMomentGroups()+1); // number of mg's that are sampled at the next sampling point fprintf(outfile, "unsigned long _number_minima=1;\n"); // The check if n (T_tot/N_samp) = (or<) m (T_tot/M_samp) for two momentgroups, where n, m are _next_sample_counters // T_tot is the integration interval and N_samp (M_samp) are the numbers of sampling points, will be replaced // by n M_samp = (or<) m N_samp to avoid floating point precision problems. fprintf(outfile, "unsigned long _previous_m=1;\n"); fprintf(outfile, "unsigned long _previous_M=1;\n"); fprintf(outfile, "\n"); fprintf(outfile, "double _%s_break_next=(double)%s;\n" , propDim, interval()->c_str()); fprintf(outfile, "_number_next_mg[0]=%li;\n", simulation()->output()->nMomentGroups()); // initialize all flags to false fprintf(outfile, "for(unsigned long _i0=0; _i0<%li; _i0++)\n", simulation()->output()->nMomentGroups() + 1); fprintf(outfile, " _next_sample_flag[_i0]=false;\n"); fprintf(outfile, "\n"); // check if moment group needs sampling at the same time as another, // already discovered sample (or the final time). If so, add this moment // group to the to-be-sampled-list. If moment group demands sampling // earlier than all previously noted mg's erase all previous ones from // list and set the brekpoint-time to this earlier one. for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { if (samples(i) != 0) { fprintf(outfile, "if(_next_sample_counter[%li]*_previous_M==_previous_m*%li){\n", i, samples(i)); fprintf(outfile, " _number_next_mg[_number_minima]=%li;\n", i); fprintf(outfile, " _number_minima++;\n"); fprintf(outfile, " }\n"); fprintf(outfile, "else if(_next_sample_counter[%li]*_previous_M<_previous_m*%li){\n", i, samples(i)); double temp_interval; // If the user specified a number, than we can compute some stuff now if (interval()->asDouble(temp_interval)) { fprintf(outfile, " _%s_break_next=_next_sample_counter[%li]*%.23e;\n", propDim, i, temp_interval/samples(i)); } // If the user specified something else (probably a const double in // ), then we need to let the compiler do it or do it at run time... else { fprintf(outfile, " _%s_break_next=_next_sample_counter[%li]*%s/%lu;\n", propDim, i, interval()->c_str(), samples(i)); } fprintf(outfile, " _number_minima=1;\n"); fprintf(outfile, " _number_next_mg[0]=%li;\n", i); fprintf(outfile, " _previous_M=%li;\n", samples(i)); fprintf(outfile, " _previous_m=_next_sample_counter[%li];\n", i); fprintf(outfile, " }\n"); } } fprintf(outfile, "\n"); // Values of _number_next_mg until _number_minima contain now the complete // list of mg's that need to be sampled at the next breakpoint. Set their // flags to true. fprintf(outfile, "for(unsigned long _i0=0; _i0<_number_minima; _i0++)\n"); fprintf(outfile, " _next_sample_flag[_number_next_mg[_i0]]=true;\n"); fprintf(outfile, "\n"); fprintf(outfile, "return(_%s_break_next);\n", propDim); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateARK45::writeMainIntegrateRoutine(FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45::writeMainIntegrateRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45::writeMainIntegrateRoutine: cannot find 'main' vector"); } const char* typeName = ""; if (mainVector->vectorType() == COMPLEX) { typeName = "complex"; } else if (mainVector->vectorType() == DOUBLE) { typeName = "double"; } bool max_iter = true; if (myMaxIterations == 0) { max_iter = false; } fprintf(outfile, "/* ******************************************** */\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); fprintf(outfile, "\n"); if ((simulation()->parameters()->usempi) && !(simulation()->parameters()->stochastic)){ fprintf(outfile, "%s *_akfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_aifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_ajfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_alfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s *_%s_check = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); } else { fprintf(outfile, "%s *_akfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_aifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_ajfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_alfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "\n"); //_main array will contain 5th order solution and _check array 4th order fprintf(outfile, "%s *_%s_check = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); } fprintf(outfile, "\n"); if (simulation()->parameters()->stochastic && !noNoises()) { fprintf(outfile, "const double _var = 1"); for (unsigned long i=0; ifield()->geometry()->nDims(); i++) { fprintf(outfile, "/_%s_dx%li", fieldName, i); } fprintf(outfile, ";\n"); fprintf(outfile, "double *_noise_vector = new double[_%s_size*_n_noises];\n", fieldName); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double *_noise_vector2 = new double[_%s_size*_n_noises];\n", fieldName); } fprintf(outfile, "\n"); } fprintf(outfile, "// Cash-Karp coefficients\n" "double _a_raw[7];\n" "double _a[7];\n" "double _b[7][7];\n" "double _c[7];\n" "double _cs[7];\n" "// linear combinations for the (k_i)s\n" "double _d[4];\n" "double _e[5];\n" "double _f[6];\n" "double _g[7];\n" "\n"); // fractions of _step where the intermediate points are taken fprintf(outfile, "_a_raw[0]=0.0;\n" "_a_raw[1]=0.0;\n" "_a_raw[2]=1.0/5;\n" "_a_raw[3]=3.0/10;\n" "_a_raw[4]=3.0/5;\n" "_a_raw[5]=1.0;\n" "_a_raw[6]=7.0/8.0;\n" "\n"); // timestep increments calculated from the above fprintf(outfile, "_a[0]=0.0;\n" "_a[1]=0.0;\n" "for(unsigned long _i0=2; _i0<7; _i0++)\n" " _a[_i0]=_a_raw[_i0]-_a_raw[_i0-1];\n" "\n"); // Cash-Karp coefficient, see numerical recipes fprintf(outfile, "_b[2][1]=1.0/5;\n" "_b[3][1]=3.0/40;\n" "_b[3][2]=9.0/40;\n" "_b[4][1]=3.0/10;\n" "_b[4][2]=-9.0/10;\n" "_b[4][3]=6.0/5;\n" "_b[5][1]=-11.0/54;\n" "_b[5][2]=5.0/2;\n" "_b[5][3]=-70.0/27;\n" "_b[5][4]=35.0/27;\n" "_b[6][1]=1631.0/55296;\n" "_b[6][2]=175.0/512;\n" "_b[6][3]=575.0/13824;\n" "_b[6][4]=44275.0/110592;\n" "_b[6][5]=253.0/4096;\n" "\n"); // for the 5th order solution fprintf(outfile, "_c[0]=0.0;\n" "_c[1]=37.0/378;\n" "_c[2]=0.0;\n" "_c[3]=250.0/621;\n" "_c[4]=125.0/594;\n" "_c[5]=0.0;\n" "_c[6]=512.0/1771;\n" "\n"); // for the 4th order solution fprintf(outfile, "_cs[0]=0.0;\n" "_cs[1]=2825.0/27648;\n" "_cs[2]=0.0;\n" "_cs[3]=18575.0/48384;\n" "_cs[4]=13525.0/55296;\n" "_cs[5]=277.0/14336;\n" "_cs[6]=1.0/4;\n" "\n"); // In order to save memory the intermediate results are not // using the b[i][j] and kjs directly. These coefficients are those // of the linearcombinations of aifield, ajfield, ..., main, check ... // at the 3rd intermediate step fprintf(outfile, "_d[0]=0.0;\n" "_d[1]=1.0-_b[3][1]/_c[1];\n" "_d[2]=_b[3][1]/_c[1];\n" "_d[3]=_b[3][2];\n" "\n"); // at the 4th intermediate step fprintf(outfile, "_e[0]=0.0;\n" "_e[1]=1.0-_b[4][1]/_c[1];\n" "_e[2]=_b[4][1]/_c[1];\n" "_e[3]=_b[4][2];\n" "_e[4]=_b[4][3];\n" "\n"); // at the 5th intermediate step fprintf(outfile, "_f[0]=0.0;\n" "_f[1]=1.0-_b[5][1]/_c[1];\n" "_f[2]=_b[5][1]/_c[1];\n" "_f[3]=_b[5][2];\n" "_f[4]=_b[5][3]-_b[5][1]/_c[1]*_c[3];\n" "_f[5]=_b[5][4]-_b[5][1]/_c[1]*_c[4];\n" "\n"); // at the 6th intermediate step fprintf(outfile, "double _den=_c[1]*_cs[4]-_cs[1]*_c[4];\n" "_g[0]=0.0;\n" "_g[1]=(_b[6][4]*(_cs[1]-_c[1]) + _b[6][1]*(_c[4]-_cs[4]))/_den + 1.0;\n" "_g[2]= _b[6][2];\n" "_g[3]=(_b[6][4]*(_cs[1]*_c[3] - _c[1]*_cs[3]) + _b[6][1]*(_cs[3]*_c[4] - _c[3]*_cs[4]))/_den + _b[6][3];\n" "_g[4]=(_b[6][1]*_cs[4]-_b[6][4]*_cs[1])/_den;\n" "_g[5]= _b[6][5] + _cs[5]*(_b[6][1]*_c[4]-_b[6][4]*_c[1])/_den;\n" "_g[6]=(-_b[6][1]*_c[4]+_b[6][4]*_c[1])/_den;\n" "\n"); fprintf(outfile, "double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "double _min_step=%s;\n", interval()->c_str()); fprintf(outfile, "double _max_step=0.0;\n"); fprintf(outfile, "double _tolerance=%s;\n", tolerance()->c_str()); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "if(_half_step)\n"); fprintf(outfile, " _tolerance=_tolerance/16.0;\n"); fprintf(outfile, "\n"); } fprintf(outfile, "double _error;\n"); fprintf(outfile, "bool _discard=false;\n"); fprintf(outfile, "bool _break_next=false;\n"); fprintf(outfile, "bool _next_sample_flag[%li];\n", simulation()->output()->nMomentGroups()+2); fprintf(outfile, "for(unsigned long _i0=0; _i0<%li; _i0++)\n", simulation()->output()->nMomentGroups()+2); fprintf(outfile, " _next_sample_flag[_i0]=false;\n"); fprintf(outfile, "unsigned long _next_sample_counter[%li];\n", simulation()->output()->nMomentGroups()); fprintf(outfile, "for(unsigned long _i0=0; _i0<%li; _i0++)\n", simulation()->output()->nMomentGroups()); fprintf(outfile, " _next_sample_counter[_i0]=1;\n"); fprintf(outfile, "\n"); fprintf(outfile, "const double _%s_ini=%s;\n", propDim, propDim); fprintf(outfile, "\n"); fprintf(outfile, "double _%s_break_next=_segment%li_setup_sampling(_next_sample_flag, _next_sample_counter);\n", propDim, segmentNumber); fprintf(outfile, "if((%s-_%s_ini+_step)>=_%s_break_next){\n", propDim, propDim, propDim); fprintf(outfile, " _break_next=true;\n"); fprintf(outfile, " _step=_%s_break_next-%s+_%s_ini;\n", propDim, propDim, propDim); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); if (max_iter) { fprintf(outfile, "unsigned long _step_counter=0;\n"); fprintf(outfile, "unsigned long _max_steps;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "if(_half_step)\n"); fprintf(outfile, " _max_steps=%li;\n", 2*myMaxIterations); fprintf(outfile, " else\n"); fprintf(outfile, " _max_steps=%li;\n", myMaxIterations); } else { fprintf(outfile, "_max_steps=%li;\n", myMaxIterations); } fprintf(outfile, "\n"); } fprintf(outfile, "do{\n do{\n"); fprintf(outfile, "\n"); if (simulation()->parameters()->stochastic && !noNoises()) { if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } else{ if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } } writeSingleStepCode(outfile, FULLSTEP); fprintf(outfile, "\n"); // Check if we need to halt before we try the next time-step, // and before we reset the segment. writeHaltCheckingCode(outfile); fprintf(outfile, " _error=_segment%li_timestep_error(_%s_check);\n", segmentNumber, fieldName); fprintf(outfile, "\n"); fprintf(outfile, " if(_error<_tolerance){;\n"); fprintf(outfile, " if(_step>_max_step)\n"); fprintf(outfile, " _max_step=_step;\n"); fprintf(outfile, " if(!_break_next && _step < _min_step)\n"); fprintf(outfile, " _min_step=_step;\n"); fprintf(outfile, " _step*=0.92*pow(fabs(_tolerance/_error), 0.2);\n"); fprintf(outfile, " _discard=false;\n"); fprintf(outfile, " }\n"); fprintf(outfile, " else{\n"); fprintf(outfile, " %s-=_step;\n", propDim); fprintf(outfile, " _step*=0.92*pow(fabs(_tolerance/_error), 0.25);\n"); fprintf(outfile, " _discard=true;\n"); fprintf(outfile, " _break_next=false;\n"); fprintf(outfile, " _segment%li_reset(_aifield_%s_main, _step);\n", segmentNumber, fieldName); // We only check step-size when error is intolerable, // so there is no cost when the integration is running successfully. writeStepCheckingCode(outfile); fprintf(outfile, " }\n"); if (max_iter){ fprintf(outfile, "\n"); fprintf(outfile, " _step_counter++;\n"); fprintf(outfile, " if(_step_counter>= _max_steps){\n"); fprintf(outfile, " _discard=false;\n"); fprintf(outfile, " _break_next=true;\n"); fprintf(outfile, " _next_sample_flag[%li]=true;\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, " }\n"); } fprintf(outfile, " }while(_discard);\n"); // We have now accepted the time-step fprintf(outfile, "\n"); fprintf(outfile, " if(_break_next){\n"); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) if (samples(i) != 0){ fprintf(outfile, " if(_next_sample_flag[%li]){\n", i); fprintf(outfile, " _mg%li_sample();\n", i); fprintf(outfile, " _next_sample_counter[%li]++;\n", i); fprintf(outfile, " }\n"); } fprintf(outfile, " if(_next_sample_flag[%li])\n", simulation()->output()->nMomentGroups()); fprintf(outfile, " _next_sample_flag[%li]=true;\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, " else{\n"); fprintf(outfile, " _break_next=false;\n"); fprintf(outfile, " _%s_break_next=_segment%li_setup_sampling(_next_sample_flag, _next_sample_counter);\n", propDim, segmentNumber); fprintf(outfile, " }\n"); fprintf(outfile, " }\n"); fprintf(outfile, " if((%s-_%s_ini+_step)>_%s_break_next){\n", propDim, propDim, propDim); fprintf(outfile, " _break_next=true;\n"); if (simulation()->parameters()->nPaths == "1") { // Don't print lots of stuff for each path, because we're running lots of them. if (simulation()->parameters()->usempi) { fprintf(outfile, " if(rank==0)\n"); } // calculate the previous timestep which was actually accepted while the current // value of _step is only the guess for the next iteration. fprintf(outfile, " printf(\"Current timestep: %%e\\n\", _step/(0.92*pow(fabs(_tolerance/_error), 0.2)));\n"); } fprintf(outfile, " _step=_%s_break_next-%s+_%s_ini;\n", propDim, propDim, propDim); fprintf(outfile, " }\n"); fprintf(outfile, "}while(!_next_sample_flag[%li]);\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, "\n"); // This label is used in the halt checking code fprintf(outfile, "_SEGMENT%li_END:\n", segmentNumber); if (simulation()->parameters()->nPaths == "1") { // Don't print lots of stuff for each path, because we're running lots of them. if (simulation()->parameters()->usempi) { fprintf(outfile, "if (rank==0)\n"); } fprintf(outfile, "printf(\"Segment %li: minimum timestep: %%e maximum timestep: %%e \\n\", _min_step, _max_step);\n", segmentNumber); } fprintf(outfile, "\n"); if (max_iter){ fprintf(outfile, "if(_step_counter>= _max_steps){\n"); fprintf(outfile, " printf(\" \\n \");\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " if(_half_step)\n"); fprintf(outfile, " printf(\"Reached %li iterations, exiting at %s = %%e \\n \", %s);\n", 2*myMaxIterations, propDim, propDim); fprintf(outfile, " else\n"); fprintf(outfile, " printf(\"Reached %li iterations, exiting at %s = %%e \\n \", %s);\n", myMaxIterations, propDim, propDim); } else{ fprintf(outfile, " printf(\"Reached %li iterations, exiting at %s = %%e \\n \", %s);\n", myMaxIterations, propDim, propDim); } fprintf(outfile, " printf(\"Last error: %%e \\n \", _error);\n"); fprintf(outfile, " printf(\"Last planned timestep: %%e \\n \", _step);\n"); fprintf(outfile, " printf(\" \\n \");\n"); fprintf(outfile, "}\n"); }//end max iter if (simulation()->parameters()->stochastic && !noNoises()) { fprintf(outfile, " delete[] _noise_vector;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noise_vector2;\n"); } } fprintf(outfile, " fftw_free(_akfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_aifield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_ajfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_alfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_%s_check);\n", fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateARK45::writeCalculateCrossFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writeCalculateCrossFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if (simulation()->parameters()->stochastic && !noNoises()) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ") {\n"); fprintf(outfile, "\n"); if (simulation()->parameters()->stochastic && !noNoises()) { fprintf(outfile, "const double* _noises = _noise_vector;\n"); fprintf(outfile, "\n"); } if (crossDimNumber()+1 myMainVectorNamesList; for (list::const_iterator pXMLString = vectorNamesList()->begin(); pXMLString != vectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = crossVectorNamesList()->begin(); while ((pXMLString2 != crossVectorNamesList()->end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myMainVectorNamesList.push_back(*pXMLString); } } const char* typeName; list mainVectorList; for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { const xmdsVector* mainVector; if (!simulation()->field()->getVector(*pXMLString, mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45::writeCalculateCrossFieldRoutine: cannot find main vector"); } mainVectorList.push_back(mainVector); if (mainVector->vectorType() == DOUBLE) { typeName = "double"; } else { typeName = "complex"; } fprintf(outfile, "%s *_%s_%s_old = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, pXMLString->c_str(), typeName, typeName, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } list crossVectorList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { const xmdsVector* crossVector; if (!simulation()->field()->getVector(*pXMLString, crossVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45::writeCalculateCrossFieldRoutine: cannot find cross vector"); } crossVectorList.push_back(crossVector); if (crossVector->vectorType() == DOUBLE) { typeName = "double"; } else { typeName = "complex"; } fprintf(outfile, "%s *_%s_%s_K = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_I = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_d = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { fprintf(outfile, "%s d%s_d%s;\n", typeName, crossVector->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str()); } fprintf(outfile, "\n"); } // add cross vectors to total vectors to use list myTotalVectorsList = myMainVectorNamesList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { myTotalVectorsList.push_back(*pXMLString); } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); // open outer loops for (unsigned long i=0; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%sunsigned long _%s_%s_index_pointer_begin=0;\n", indent, fieldName, pXMLString->c_str()); for (unsigned long i=0; ic_str(), i); for (unsigned long j=i+1; jc_str()); } fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy cross vectors into K and I vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++) {\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_I[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); } fprintf(outfile, "%s// store main vectors into old\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_old[_j] = _active_%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 1 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create midpoint main vectors for steps 2 and 3\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = (_active_%s_%s[_j]+_active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j])/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to lattice midpoint for steps 2 and 3\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 2 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 3 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1 < nDims) { for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move main vectors to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = _active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 4 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy I cross vector back into old main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy K cross vector into next main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents + _j] = _%s_%s_K[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy old main vectors back into last lattice point\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_old[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // close outer loops fprintf(outfile, "%s}\n", indent); for (unsigned long i=crossDimNumber(); i>0; i--) { fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_old);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "fftw_free(_%s_%s_K);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_I);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_d);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ark45.h0000644000076500000240000000661711033277417015131 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark45.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ark45.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_ARK45_H #define XMDS_INTEGRATE_ARK45_H #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateARK45 // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method class xmdsIntegrateARK45 : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateARK45 object xmdsIntegrateARK45( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateARK45(); //! Processes an element void processElement( const Element *const yourElement); protected : //! returns the tolerance const XMLString* tolerance() const; //! returns the cutoff const XMLString* cutoff() const; //! Writes the function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the routines to outfile void writeRoutines( FILE *const outfile) const; //! Writes the single step code to outfile virtual void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const = 0; private : //! Write the error-finding routine to file void writeTimestepErrorRoutine( FILE *const outfile) const; //! Write the routine that finds who to sample when void writeSetupSamplingRoutine( FILE *const outfile) const; //! Write the main integrate routine to file void writeMainIntegrateRoutine( FILE *const outfile) const; //! Write the routine to calculate the cross field to file void writeCalculateCrossFieldRoutine( FILE *const outfile) const; XMLString myTolerance; // error tolerance for adaptive timestep XMLString myCutoff; // optional function size cutoff for determination of timestep error unsigned long myMaxIterations; // optional safety-device: aborts integration when given number of iterations is reached }; #endif // XMDS_INTEGRATE_ARK45_H xmds-1.6.6/source/xmds_integrate_ark45ex.cc0000644000076500000240000006210411033277417015615 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark45ex.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_ark45ex.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta in the explicit picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45EX public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateARK45EXs=0; //!< The number of integrate ARK45EX objects // ************************************************************************** xmdsIntegrateARK45EX::xmdsIntegrateARK45EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateEX(yourSimulation, yourVerboseMode), xmdsIntegrateARK45(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateARK45EXs++; printf("xmdsIntegrateARK45EX::xmdsIntegrateARK45EX\n"); printf("nxmdsIntegrateARK45EXs=%li\n", nxmdsIntegrateARK45EXs); } } // ************************************************************************** xmdsIntegrateARK45EX::~xmdsIntegrateARK45EX() { if (debugFlag) { nxmdsIntegrateARK45EXs--; printf("xmdsIntegrateARK45EX::~xmdsIntegrateARK45EX\n"); printf("nxmdsIntegrateARK45EXs=%li\n", nxmdsIntegrateARK45EXs); } } // ************************************************************************** void xmdsIntegrateARK45EX::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateARK45EX::processElement\n"); } if (verbose()) { printf("Processing integrate ARK45EX element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateARK45::processElement(yourElement); xmdsIntegrateEX::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45EX private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateARK45EX::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45EX::writePrototypes\n"); } const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARKIP::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK45EX) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateEX::writePrototypes(outfile); fprintf(outfile, "\n"); fprintf(outfile, "// integrate (ARK45EX) prototypes\n"); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step);\n", segmentNumber, typeName); xmdsIntegrateARK45::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateARK45EX::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45EX::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK45EX) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); writeResetRoutine(outfile); xmdsIntegrateEX::writeRoutines(outfile); xmdsIntegrateARK45::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateARK45EX::writeResetRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45EX::writeResetRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step){\n", segmentNumber, typeName); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i1=0; _i1field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" "#endif\n"); } fprintf(outfile, "%s// a_k=y2=y1\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_i=y1\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" "#endif\n"); } fprintf(outfile, "%s// y1=y1+c_1*a_k\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// y2=y2+cs_1*a_k\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + b_21*a_k\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[2]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t+aa_2*dt]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// c_2==cs_2==0\n", indent); fprintf(outfile, "%s// a_j = d_1*a_i + d_2*y1 + d_3*a_k \n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_l = e_1*a_i + e_2*y1 + e_3*a_k + e_4*a_j\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for nowait\n" "#endif\n"); } fprintf(outfile, "%s// y1=y1+c_3*a_j\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// y2=y2+cs_3*a_j\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n\n"); } fprintf(outfile, "%s%s += _a[4]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _alfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_l=G[a_l, t+aa_4*dt]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" "#endif\n"); } fprintf(outfile, "%s// y1=y1+c_4*a_j\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// y2=y2+cs_4*a_j\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_l = f_1*a_i + f_2*y1 + f_3*a_k + f_4*a_j +f_5*a_l;\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[5]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_l=G[a_l, t+aa_5*dt]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// c_5==0\n", indent); fprintf(outfile, "%s// y2=y2+cs_5*a_l\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_l= g_1*a_i + g_2*a_k + g_3*a_j + g_4*y_1 +g_5*a_l +g_6*y_2;\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_l=G[a_l, t+aa_6*dt]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" "#endif\n"); } fprintf(outfile, "%s// y1=y1+c_6*a_l\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// y2=y2+cs_6*a_l\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n\n"); } fprintf(outfile, "%s// t->t+dt\n", indent); fprintf(outfile, "%s%s -= _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ark45ex.h0000644000076500000240000000514011033277417015454 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark45ex.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ark45ex.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_ARK45EX_H #define XMDS_INTEGRATE_ARK45EX_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateARK45EX // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the adaptive fourth-fifth order Runge-Kutta method in the explicit picture class xmdsIntegrateARK45EX : public xmdsIntegrateEX, public xmdsIntegrateARK45 { public : //! Constructor of an xmdsIntegrateARK45EX object xmdsIntegrateARK45EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateARK45EX(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate ARK45EX prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate ARK45EX routines to file void writeRoutines( FILE *const outfile) const; //! Writes the Routine to "undo" bad timesteps void writeResetRoutine( FILE *const outfile) const; //! Write the integrate ARK45EX single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_ARK45EX_H xmds-1.6.6/source/xmds_integrate_ark45ip.cc0000644000076500000240000006142711033277417015620 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark45ip.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_ark45ip.cc @brief Integrate element parsing classes and methods; ninth order Runge-Kutta in the interaction picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45IP public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateARK45IPs=0; //!< The number of xmds integrate ARK45IP objects // ************************************************************************** xmdsIntegrateARK45IP::xmdsIntegrateARK45IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, true, false), xmdsIntegrateIP(yourSimulation, yourVerboseMode), xmdsIntegrateARK45(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateARK45IPs++; printf("xmdsIntegrateARK45IP::xmdsIntegrateARK45IP\n"); printf("nxmdsIntegrateARK45IPs=%li\n", nxmdsIntegrateARK45IPs); } } // ************************************************************************** xmdsIntegrateARK45IP::~xmdsIntegrateARK45IP() { if (debugFlag) { nxmdsIntegrateARK45IPs--; printf("xmdsIntegrateARK45IP::~xmdsIntegrateARK45IP\n"); printf("nxmdsIntegrateARK45IPs=%li\n", nxmdsIntegrateARK45IPs); } } // ************************************************************************** void xmdsIntegrateARK45IP::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateARK45IP::processElement\n"); } if (verbose()) { printf("Processing integrate ARK45IP element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateARK45::processElement(yourElement); xmdsIntegrateIP::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45IP protected // ************************************************************************** // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK45IP private // ************************************************************************** // ************************************************************************** void xmdsIntegrateARK45IP::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writePrototypes\n"); } const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARKIP::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK45IP) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateIP::writePrototypes(outfile); fprintf(outfile, "// integrate (ARK45IP) prototypes\n"); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step);\n", segmentNumber, typeName); xmdsIntegrateARK45::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateARK45IP::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK45IP) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateIP::writeRoutines(outfile); writeResetRoutine(outfile); xmdsIntegrateARK45::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateARK45IP::writeResetRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writeResetRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARKIP::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step){\n", segmentNumber, typeName); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i1=0; _i1field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char* indent = " "; const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } if (usesKOperators()){ if (!Smallmemory()) fprintf(outfile, "%s_segment%li_calculate_k_operator_field(_step);\n", indent, segmentNumber); simulation()->field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); } else simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// a_k=y1\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// a_i=y2=y1\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); fprintf(outfile, "\n"); if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[a_k]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(1);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(1.0/5*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } if (simulation()->parameters()->useOpenMP) { // We begin a parallel for loop fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// c_2==cs_2==0\n", indent); fprintf(outfile, "%s// a_j = d_1*a_i + d_2*y1 + d_3*a_k \n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); fprintf(outfile, "\n"); if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// a_j=D(-(a_3-a_2)*dt)[a_j]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-2);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_j=D(-(a_3-a_2)*dt)[a_j]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-1.0/10*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); fprintf(outfile, "\n"); if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// a_l=D(-(a_4-a_2)*dt)[a_l]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-3);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_l=D(-(a_4-a_2)*dt)[a_l]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-2.0/5*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); fprintf(outfile, "\n"); if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// a_l=D(-(a_5-a_2)*dt)[a_l]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-4);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_l=D(-(a_5-a_2)*dt)[a_l]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-4.0/5*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1field()->vectors2space(outfile, fullSpace, tempVectorNamesList, indent); fprintf(outfile, "\n"); if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// a_l=D(-(a_6-a_2)*dt)[a_l]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-5);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_l=D(-(a_6-a_2)*dt)[a_l]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-27.0/40*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1t+dt\n", indent); fprintf(outfile, "%s%s -= _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_check;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); // these exponents are "accidentally" the same as for "4" if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// y2=D((1-a_2)*dt)[y2]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(4);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// y2=D((1-a_2)*dt)[y2]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(4.0/5*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) if (!Smallmemory()){ fprintf(outfile, "%s// y1=D((1-a_2)*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(4);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// y1=D((1-a_2)*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(4.0/5*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ark45ip.h0000644000076500000240000000514611033277417015456 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark45ip.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ark45ip.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_ARK45IP_H #define XMDS_INTEGRATE_ARK45IP_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateARK45IP // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the adaptive fourth-fifth order Runge-Kutta method in the interaction picture class xmdsIntegrateARK45IP : public xmdsIntegrateIP, public xmdsIntegrateARK45{ public : //! Constructor of xmdsIntetrageARK45IP object xmdsIntegrateARK45IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateARK45IP(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate ARK45IP prototypes to file void writePrototypes( FILE *const outfile) const; //! Writes the Routine to "undo" bad timesteps void writeResetRoutine( FILE *const outfile) const; //! Write the integrate ARK45IP routines to file void writeRoutines( FILE *const outfile) const; //! Write the integrate ARK45IP single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_ARK45IP_H xmds-1.6.6/source/xmds_integrate_ark89.cc0000644000076500000240000023171611033277417015277 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark89.cc 1964 2008-04-09 00:42:11Z paultcochrane $ */ /*! @file xmds_integrate_ark89.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta More detailed explanation... */ #include #include #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89 public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateARK89s=0; //!< Number of xmds integrate ARK89 objects // ************************************************************************** xmdsIntegrateARK89::xmdsIntegrateARK89( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateARK89s++; printf("xmdsIntegrateARK89::xmdsIntegrateARK89\n"); printf("nxmdsIntegrateARK89s=%li\n", nxmdsIntegrateARK89s); } } // ************************************************************************** xmdsIntegrateARK89::~xmdsIntegrateARK89() { if (debugFlag) { nxmdsIntegrateARK89s--; printf("xmdsIntegrateARK89::~xmdsIntegrateARK89\n"); printf("nxmdsIntegrateARK89s=%li\n", nxmdsIntegrateARK89s); } } // ************************************************************************** void xmdsIntegrateARK89::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateARK89::processElement\n"); } /* if ((simulation()->parameters()->stochastic)&&(!noNoises())) { printf("\n"); printf("WARNING: ARK89 methods may not always yield correct stochastic convergence.\n"); printf("\n"); }*/ if (simulation()->parameters()->noiseKind == "poissonian") { throw xmdsException(yourElement, "Adaptive methods are currently not capable of adjusting for " "Poissonian noise. We suggest RK9 algorithms."); } list myXMLStringList; list myULongList; // ************************************ // find 'tolerance' getAssignmentStrings(yourElement, "tolerance", 1, 1, myXMLStringList); myTolerance=*myXMLStringList.begin(); if (verbose()) { printf("integration tolerance = %s\n", myTolerance.c_str()); } // ************************************ // find 'cutoff' getAssignmentStrings(yourElement, "cutoff", 0, 1, myXMLStringList); if (myXMLStringList.size()==1) { myCutoff=*myXMLStringList.begin(); if (verbose()) { printf("cutoff = %s\n", myCutoff.c_str()); } } else { printf("cutoff defaulting to 1e-3 \n"); myCutoff="1e-3"; } // ************************************ // find 'maximum iterations' getAssignmentULongs(yourElement, "max_iterations", 0, 1, myULongList); if (myULongList.size()==1) { myMaxIterations=*myULongList.begin(); if (myMaxIterations==0) throw xmdsException(yourElement, "Maximum Iterations must be >= 1 !"); if (verbose()) { printf("Maximum iterations = %li\n", myMaxIterations); } } else { if (verbose()) printf("Maximum iterations = infinity \n"); myMaxIterations=0; // this means the feature is disabled } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89 protected // ************************************************************************** // ************************************************************************** const XMLString* xmdsIntegrateARK89::tolerance() const { if (debugFlag) { printf("xmdsIntegrateARK89::tolerance\n"); } return &myTolerance; } // ************************************************************************** const XMLString* xmdsIntegrateARK89::cutoff() const { if (debugFlag) { printf("xmdsIntegrateARK89::cutoff\n"); } return &myCutoff; } // ************************************************************************** void xmdsIntegrateARK89::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89::writePrototypes\n"); } const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK89::writePrototypes: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "\n"); fprintf(outfile, "// integrate (ARK89) prototypes\n"); fprintf(outfile, "\n"); fprintf(outfile, "double _segment%li_timestep_error(%s* _checkfield);\n", segmentNumber, typeName); fprintf(outfile, "\n"); fprintf(outfile, "double _segment%li_setup_sampling(bool* _next_sample_flag, unsigned long* _next_sample_counter);\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li(unsigned long cycle);\n", segmentNumber); fprintf(outfile, "\n"); if (crossVectorNamesList()->size() > 0) { fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } } // ************************************************************************** void xmdsIntegrateARK89::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89::writeRoutines\n"); } writeTimestepErrorRoutine(outfile); writeSetupSamplingRoutine(outfile); writeMainIntegrateRoutine(outfile); if (crossVectorNamesList()->size() > 0) { writeCalculateCrossFieldRoutine(outfile); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89 private // ************************************************************************** // ************************************************************************** void xmdsIntegrateARK89::writeTimestepErrorRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89::writeTimestepErrorRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK89::writeTimestepErrorRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "double _segment%li_timestep_error(%s* _checkfield) {\n", segmentNumber, typeName); fprintf(outfile, "\n"); fprintf(outfile, "double _error=1e-24;\n"); fprintf(outfile, "double _result[_%s_main_ncomponents];\n", fieldName); if (simulation()->field()->geometry()->nDims()>0){ // finds one peak value for each component of field fprintf(outfile, "double _peak[_%s_main_ncomponents];\n", fieldName); fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_main_ncomponents; _i0++){\n", fieldName); fprintf(outfile, " _peak[_i0]=0.0;\n"); fprintf(outfile, " _result[_i0]=0.0;\n"); fprintf(outfile, " }\n"); fprintf(outfile, "\n"); } fprintf(outfile, "double _temp_error=0.0;\n"); fprintf(outfile, "double _temp_mod=0.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "unsigned long _%s_main_index_pointer=0;\n", fieldName); fprintf(outfile, "\n"); if (simulation()->field()->geometry()->nDims()>0){ if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (unsigned long _i0=0; _i0peak // this construction was _peak[_i1] += 0.5*(_temp_mod - _peak[_i1] + fabs(_temp_mod - _peak[_i1])); // It was a bad idea because it leads to NaNs for the peak value when it should be infinite, because it tries to // add values to Inf, leading to NaN. // The other problem with this construction is that it requires a store on each loop which will be slower than // a branch (particularly when that branch is predicted correctly as it will be by modern CPUs). fprintf(outfile, " if (!isfinite(_temp_mod)) _peak[_i1] = INFINITY;\n"); fprintf(outfile, " else if (_peak[_i1] < _temp_mod) _peak[_i1] = _temp_mod;\n"); fprintf(outfile, " }\n"); fprintf(outfile, " _%s_main_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " }\n"); fprintf(outfile, "\n"); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "MPI_Allreduce(&_peak, &_result, _%s_main_ncomponents, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);\n", fieldName); fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_main_ncomponents; _i0++){\n", fieldName); fprintf(outfile, " _peak[_i0]=_result[_i0];\n"); fprintf(outfile, " _result[_i0]=0;\n"); fprintf(outfile, "}\n"); } // now the peak value is multiplied with the cutoff so that it is now in fact the amplitude-threshold for error determination fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_main_ncomponents; _i0++) {\n", fieldName); fprintf(outfile, " if (!isfinite(_peak[_i0]))\n"); fprintf(outfile, " // We return the maximum possible error in this case because the timestep must be reduced\n"); fprintf(outfile, " // for the error to be calculated correctly\n"); fprintf(outfile, " return 1.0;\n"); fprintf(outfile, " _peak[_i0]*=%s;\n", cutoff()->c_str()); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); fprintf(outfile, "_%s_main_index_pointer=0;\n", fieldName); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0_peak[_i1]){\n", fieldName, fieldName); fprintf(outfile, " _temp_error=mod(_%s_main[_%s_main_index_pointer + _i1]-_checkfield[_%s_main_index_pointer + _i1])/(mod(_%s_main[_%s_main_index_pointer + _i1])+1e-20);\n", fieldName, fieldName, fieldName, fieldName, fieldName); } else{ fprintf(outfile, " if (fabs(_%s_main[_%s_main_index_pointer + _i1])>_peak[_i1]){\n", fieldName, fieldName); fprintf(outfile, " _temp_error=fabs(_%s_main[_%s_main_index_pointer + _i1]-_checkfield[_%s_main_index_pointer + _i1])/(fabs(_%s_main[_%s_main_index_pointer + _i1])+1e-20);\n", fieldName, fieldName, fieldName, fieldName, fieldName); } fprintf(outfile, " if (_error < _temp_error) _error = _temp_error;\n"); fprintf(outfile, " }\n"); fprintf(outfile, " _%s_main_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " }\n"); } else{// if ndims==0 fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++){\n", fieldName); if (std::strcmp(typeName, "complex") == 0){ fprintf(outfile, " _temp_error=mod(_%s_main[_i1]-_checkfield[_i1])/(mod(_%s_main[_i1])+1e-20);\n", fieldName, fieldName); } else{ fprintf(outfile, " _temp_error=fabs(_%s_main[_i1]-_checkfield[_i1])/(fabs(_%s_main[_i1])+1e-20);\n", fieldName, fieldName); } fprintf(outfile, " if (_error < _temp_error) _error = _temp_error;\n"); fprintf(outfile, " }\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "MPI_Allreduce(&_error, &_result, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);\n"); } else { fprintf(outfile, "_result[0]=_error;\n"); } fprintf(outfile, "return(_result[0]);\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateARK89::writeSetupSamplingRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89::writeSetupSamplingRoutine\n"); } const char *const propDim = simulation()->parameters()->propDimName.c_str(); fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "double _segment%li_setup_sampling(bool* _next_sample_flag, unsigned long* _next_sample_counter) {\n", segmentNumber); fprintf(outfile, "\n"); // will contain the numbers of all the moment groups that need to be sampled at the next sampling point. The N+1'th entry means "reached end of integration interval". fprintf(outfile, "unsigned long _number_next_mg[%li];\n", simulation()->output()->nMomentGroups()+1); // number of mg's that are sampled at the next sampling point fprintf(outfile, "unsigned long _number_minima=1;\n"); // The check if n (T_tot/N_samp) = (or<) m (T_tot/M_samp) for two momentgroups, where n, m are _next_sample_counters // T_tot is the integration interval and N_samp (M_samp) are the numbers of sampling points, will be replaced // by n M_samp = (or<) m N_samp to avoid floating point precision problems. fprintf(outfile, "unsigned long _previous_m=1;\n"); fprintf(outfile, "unsigned long _previous_M=1;\n"); fprintf(outfile, "\n"); fprintf(outfile, "double _%s_break_next=(double)%s;\n", propDim, interval()->c_str()); fprintf(outfile, "_number_next_mg[0]=%li;\n", simulation()->output()->nMomentGroups()); // initialize all flags to false fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++)\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, " _next_sample_flag[_i0]=false;\n"); fprintf(outfile, "\n"); // check if moment group needs sampling at the same time as another, already discovered sample (or the final time). If so, add this moment group to the to-be-sampled-list. If moment group demands sampling earlier than all previously noted mg's erase all previous ones from list and set the brekpoint-time to this earlier one. for (unsigned long i=0; ioutput()->nMomentGroups(); i++) if (samples(i)!=0){ fprintf(outfile, "if (_next_sample_counter[%li]*_previous_M==_previous_m*%li){\n", i, samples(i)); fprintf(outfile, " _number_next_mg[_number_minima]=%li;\n", i); fprintf(outfile, " _number_minima++;\n"); fprintf(outfile, " }\n"); fprintf(outfile, "else if (_next_sample_counter[%li]*_previous_M<_previous_m*%li){\n", i, samples(i)); double temp_interval; if (interval()->asDouble(temp_interval)) { // If the user specified a number, than we can compute some stuff now fprintf(outfile, " _%s_break_next=_next_sample_counter[%li]*%.23e;\n", propDim, i, temp_interval/samples(i)); } else { // If the user specified something else (probably a const double in ), then we need to let the compiler do it or do it at run time... fprintf(outfile, " _%s_break_next=_next_sample_counter[%li]*%s/%lu;\n", propDim, i, interval()->c_str(), samples(i)); } fprintf(outfile, " _number_minima=1;\n"); fprintf(outfile, " _number_next_mg[0]=%li;\n", i); fprintf(outfile, " _previous_M=%li;\n", samples(i)); fprintf(outfile, " _previous_m=_next_sample_counter[%li];\n", i); fprintf(outfile, " }\n"); } fprintf(outfile, "\n"); //Values of _number_next_mg until _number_minima contain now the complete list of mg's that need to be sampled at the next breakpoint. Set their flags to true. fprintf(outfile, "for (unsigned long _i0=0; _i0<_number_minima; _i0++)\n"); fprintf(outfile, " _next_sample_flag[_number_next_mg[_i0]]=true;\n"); fprintf(outfile, "\n"); fprintf(outfile, "return(_%s_break_next);\n", propDim); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateARK89::writeMainIntegrateRoutine(FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89::writeMainIntegrateRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK89::writeMainIntegrateRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } bool max_iter=true; if (myMaxIterations == 0) { max_iter = false; } fprintf(outfile, "/* ******************************************** */\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); fprintf(outfile, "\n"); if ((simulation()->parameters()->usempi)&!(simulation()->parameters()->stochastic)){ fprintf(outfile, "%s *_akafield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akbfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akcfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akdfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akefield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akffield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akgfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akhfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akjfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s *_%s_init = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); } else { fprintf(outfile, "%s *_akafield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akbfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akcfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akdfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akefield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akffield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akgfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akhfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akjfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s *_%s_init = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); } fprintf(outfile, "\n"); fprintf(outfile, "// Runge Kutta method constants \n"); fprintf(outfile, "double _a_raw[16];\n"); fprintf(outfile, "double _a[16];\n"); fprintf(outfile, "double _b[16][16];\n"); fprintf(outfile, "double _c[16];\n"); fprintf(outfile, "double _cs[16];\n"); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<16; _i0++) {\n"); fprintf(outfile, " _a_raw[_i0]=0.0;\n"); fprintf(outfile, " _c[_i0]=0.0;\n"); fprintf(outfile, " for (unsigned long _i1=0; _i1<16; _i1++)\n"); fprintf(outfile, " _b[_i0][_i1]=0.0;\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); fprintf(outfile, "_a_raw[1] = 0.02173913043478260869565217391304347;\n"); fprintf(outfile, "_a_raw[2] = 0.09629581047800066670113001679819925;\n"); fprintf(outfile, "_a_raw[3] = 0.14444371571700100005169502519729888;\n"); fprintf(outfile, "_a_raw[4] = 0.52205882352941176470588235294117647;\n"); fprintf(outfile, "_a_raw[5] = 0.22842443612863469578031459099794265;\n"); fprintf(outfile, "_a_raw[6] = 0.54360353589933733219171338103002937;\n"); fprintf(outfile, "_a_raw[7] = 0.64335664335664335664335664335664335;\n"); fprintf(outfile, "_a_raw[8] = 0.48251748251748251748251748251748251;\n"); fprintf(outfile, "_a_raw[9] = 0.06818181818181818181818181818181818;\n"); fprintf(outfile, "_a_raw[10] = 0.25060827250608272506082725060827250;\n"); fprintf(outfile, "_a_raw[11] = 0.66736715965600568968278165443304378;\n"); fprintf(outfile, "_a_raw[12] = 0.85507246376811594202898550724637681;\n"); fprintf(outfile, "_a_raw[13] = 0.89795918367346938775510204081632653;\n"); fprintf(outfile, "_a_raw[14] = 1.0;\n"); fprintf(outfile, "_a_raw[15] = 1.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "_a[0]=0.0;\n"); fprintf(outfile, "for (unsigned long _i0=1; _i0<16; _i0++)\n"); fprintf(outfile, " _a[_i0]=_a_raw[_i0]-_a_raw[_i0-1];\n"); fprintf(outfile, "\n"); fprintf(outfile, "_b[1][0] = 1.0/46.0;\n"); fprintf(outfile, "_b[2][0] =-0.11698050118114486205818241524969622;\n"); fprintf(outfile, "_b[2][1] = 0.21327631165914552875931243204789548;\n"); fprintf(outfile, "_b[3][0] = 0.03611092892925025001292375629932472;\n"); fprintf(outfile, "_b[3][2] = 0.10833278678775075003877126889797416;\n"); fprintf(outfile, "_b[4][0] = 1.57329743908138605107331820072051125;\n"); fprintf(outfile, "_b[4][2] =-5.98400943754042002888532938159655553;\n"); fprintf(outfile, "_b[4][3] = 4.93277082198844574251789353381722074;\n"); fprintf(outfile, "_b[5][0] = 0.05052046351120380909008334360006234;\n"); fprintf(outfile, "_b[5][3] = 0.17686653884807108146683657390397612;\n"); fprintf(outfile, "_b[5][4] = 0.00103743376935980522339467349390418;\n"); fprintf(outfile, "_b[6][0] = 0.10543148021953768958529340893598138;\n"); fprintf(outfile, "_b[6][3] =-0.16042415162569842979496486916719383;\n"); fprintf(outfile, "_b[6][4] = 0.11643956912829316045688724281285250;\n"); fprintf(outfile, "_b[6][5] = 0.48215663817720491194449759844838932;\n"); fprintf(outfile, "_b[7][0] = 0.07148407148407148407148407148407148;\n"); fprintf(outfile, "_b[7][5] = 0.32971116090443908023196389566296464;\n"); fprintf(outfile, "_b[7][6] = 0.24216141096813279233990867620960722;\n"); fprintf(outfile, "_b[8][0] = 0.07162368881118881118881118881118881;\n"); fprintf(outfile, "_b[8][5] = 0.32859867301674234161492268975519694;\n"); fprintf(outfile, "_b[8][6] = 0.11622213117906185418927311444060725;\n"); fprintf(outfile, "_b[8][7] =-0.03392701048951048951048951048951048;\n"); fprintf(outfile, "_b[9][0] = 0.04861540768024729180628870095388582;\n"); fprintf(outfile, "_b[9][5] = 0.03998502200331629058445317782406268;\n"); fprintf(outfile, "_b[9][6] = 0.10715724786209388876739304914053506;\n"); fprintf(outfile, "_b[9][7] =-0.02177735985419485163815426357369818;\n"); fprintf(outfile, "_b[9][8] =-0.10579849950964443770179884616296721;\n"); fprintf(outfile, "_b[10][0] =-0.02540141041535143673515871979014924;\n"); fprintf(outfile, "_b[10][5] = 1.0/30.0;\n"); fprintf(outfile, "_b[10][6] =-0.16404854760069182073503553020238782;\n"); fprintf(outfile, "_b[10][7] = 0.03410548898794737788891414566528526;\n"); fprintf(outfile, "_b[10][8] = 0.15836825014108792658008718465091487;\n"); fprintf(outfile, "_b[10][9] = 0.21425115805975734472868683695127609;\n"); fprintf(outfile, "_b[11][0] = 0.00584833331460742801095934302256470;\n"); fprintf(outfile, "_b[11][5] =-0.53954170547283522916525526480339109;\n"); fprintf(outfile, "_b[11][6] = 0.20128430845560909506500331018201158;\n"); fprintf(outfile, "_b[11][7] = 0.04347222773254789483240207937678906;\n"); fprintf(outfile, "_b[11][8] =-0.00402998571475307250775349983910179;\n"); fprintf(outfile, "_b[11][9] = 0.16541535721570612771420482097898952;\n"); fprintf(outfile, "_b[11][10] = 0.79491862412512344573322086551518180;\n"); fprintf(outfile, "_b[12][0] =-0.39964965968794892497157706711861448;\n"); fprintf(outfile, "_b[12][5] =-3.79096577568393158554742638116249372;\n"); fprintf(outfile, "_b[12][6] =-0.40349325653530103387515807815498044;\n"); fprintf(outfile, "_b[12][7] =-2.82463879530435263378049668286220715;\n"); fprintf(outfile, "_b[12][8] = 1.04226892772185985533374283289821416;\n"); fprintf(outfile, "_b[12][9] = 1.12510956420436603974237036536924078;\n"); fprintf(outfile, "_b[12][10] = 3.32746188718986816186934832571938138;\n"); fprintf(outfile, "_b[12][11] = 2.77897957186355606325818219255783627;\n"); fprintf(outfile, "_b[13][0] = 0.39545306350085237157098218205756922;\n"); fprintf(outfile, "_b[13][5] = 5.82534730759650564865380791881446903;\n"); fprintf(outfile, "_b[13][6] =-0.36527452339161313311889856846974452;\n"); fprintf(outfile, "_b[13][7] = 1.18860324058346533283780076203192232;\n"); fprintf(outfile, "_b[13][8] = 0.57970467638357921347110271762687972;\n"); fprintf(outfile, "_b[13][9] =-0.86824862589087693262676988867897834;\n"); fprintf(outfile, "_b[13][10] =-5.20227677296454721392873650976792184;\n"); fprintf(outfile, "_b[13][11] =-0.79895541420753382543211121058675915;\n"); fprintf(outfile, "_b[13][12] = 0.14360623206363792632792463778889008;\n"); fprintf(outfile, "_b[14][0] = 8.49173149061346398013352206978380938;\n"); fprintf(outfile, "_b[14][5] = 86.32213734729036800877634194386790750;\n"); fprintf(outfile, "_b[14][6] = 1.02560575501091662034511526187393241;\n"); fprintf(outfile, "_b[14][7] = 85.77427969817339941806831550695235092;\n"); fprintf(outfile, "_b[14][8] =-13.98699305104110611795532466113248067;\n"); fprintf(outfile, "_b[14][9] =-20.71537405501426352265946477613161883;\n"); fprintf(outfile, "_b[14][10] =-72.16597156619946800281180102605140463;\n"); fprintf(outfile, "_b[14][11] =-76.71211139107806345587696023064419687;\n"); fprintf(outfile, "_b[14][12] = 4.22319427707298828839851258893735507;\n"); fprintf(outfile, "_b[14][13] =-1.25649850482823521641825667745565428;\n"); fprintf(outfile, "_b[15][0] =-0.42892119881959353241190195318730008;\n"); fprintf(outfile, "_b[15][5] =-9.16865700950084689999297912545025359;\n"); fprintf(outfile, "_b[15][6] = 1.08317616770620939241547721530003920;\n"); fprintf(outfile, "_b[15][7] =-1.23501525358323653198215832293981810;\n"); fprintf(outfile, "_b[15][8] =-1.21438272617593906232943856422371019;\n"); fprintf(outfile, "_b[15][9] = 1.37226168507232166621351243731869914;\n"); fprintf(outfile, "_b[15][10] = 9.15723239697162418155377135344394113;\n"); fprintf(outfile, "_b[15][11] = 1.30616301842220047563298585480401671;\n"); fprintf(outfile, "_b[15][12] =-0.25285618808937955976690569433069974;\n"); fprintf(outfile, "_b[15][13] = 0.38099910799663987066763679926508552;\n"); fprintf(outfile, "\n"); fprintf(outfile, "_c[0] = 0.01490902081978461022483617102382552;\n"); fprintf(outfile, "_c[7] =-0.20408044692054151258349120934134791;\n"); fprintf(outfile, "_c[8] = 0.22901438600570447264772469337066476;\n"); fprintf(outfile, "_c[9] = 0.12800558251147375669208211573729202;\n"); fprintf(outfile, "_c[10] = 0.22380626846054143649770066956485937;\n"); fprintf(outfile, "_c[11] = 0.39553165293700054420552389156421651;\n"); fprintf(outfile, "_c[12] = 0.05416646758806981196568364538360743;\n"); fprintf(outfile, "_c[13] = 0.12691439652445903685643385312168037;\n"); fprintf(outfile, "_c[14] =-0.00052539244262118876455834655383035;\n"); fprintf(outfile, "_c[15] = 1.0/31.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "_cs[0] = 0.00653047880643482012034413441159249;\n"); fprintf(outfile, "_cs[7] =-2.31471038197461347517552506241529830;\n"); fprintf(outfile, "_cs[8] = 0.43528227238866280799530900822377013;\n"); fprintf(outfile, "_cs[9] = 0.14907947287101933118545845390618763;\n"); fprintf(outfile, "_cs[10] = 0.17905535442235532311850533252768020;\n"); fprintf(outfile, "_cs[11] = 2.53400872222767706921176214508820825;\n"); fprintf(outfile, "_cs[12] =-0.55430437423209112896721332268159015;\n"); fprintf(outfile, "_cs[13] = 0.56924788787870083224213506297615260;\n"); fprintf(outfile, "_cs[14] =-0.03644749690427461198884026816573513;\n"); fprintf(outfile, "_cs[15] = 1.0/31.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double _var = 1"); for (unsigned long i=0; ifield()->geometry()->nDims(); i++) { fprintf(outfile, "/_%s_dx%li", fieldName, i); } fprintf(outfile, ";\n"); fprintf(outfile, "double *_noise_vector = NULL;\n"); fprintf(outfile, "list<_dtdWstore> _noise_list;\n"); fprintf(outfile, "list<_dtdWstore>::iterator _active_node;\n"); fprintf(outfile, "\n"); } fprintf(outfile, "double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "double _min_step=%s;\n", interval()->c_str()); fprintf(outfile, "double _max_step=0.0;\n"); fprintf(outfile, "double _tolerance=%s;\n", tolerance()->c_str()); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "if (_half_step)\n"); fprintf(outfile, " _tolerance=_tolerance/16.0;\n"); fprintf(outfile, "\n"); } fprintf(outfile, "double _error;\n"); fprintf(outfile, "bool _discard=false;\n"); fprintf(outfile, "bool _break_next=false;\n"); fprintf(outfile, "bool _next_sample_flag[%li];\n", simulation()->output()->nMomentGroups()+2); fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++)\n", simulation()->output()->nMomentGroups()+2); fprintf(outfile, " _next_sample_flag[_i0]=false;\n"); fprintf(outfile, "unsigned long _next_sample_counter[%li];\n", simulation()->output()->nMomentGroups()); fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++)\n", simulation()->output()->nMomentGroups()); fprintf(outfile, " _next_sample_counter[_i0]=1;\n"); fprintf(outfile, "\n"); fprintf(outfile, "const double _%s_ini=%s;\n", propDim, propDim); fprintf(outfile, "\n"); fprintf(outfile, "double _%s_break_next=_segment%li_setup_sampling(_next_sample_flag, _next_sample_counter);\n", propDim, segmentNumber); fprintf(outfile, "if ((%s-_%s_ini+_step)>=_%s_break_next){\n", propDim, propDim, propDim); fprintf(outfile, " _break_next=true;\n"); fprintf(outfile, " _step=_%s_break_next-%s+_%s_ini;\n", propDim, propDim, propDim); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); if (max_iter){ fprintf(outfile, "unsigned long _step_counter=0;\n"); fprintf(outfile, "unsigned long _max_steps;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "if (_half_step)\n"); fprintf(outfile, " _max_steps=%li;\n", 2*myMaxIterations); fprintf(outfile, " else\n"); fprintf(outfile, " _max_steps=%li;\n", myMaxIterations); } else{ fprintf(outfile, "_max_steps=%li;\n", myMaxIterations); } fprintf(outfile, "\n"); } fprintf(outfile, "const double _epsilon = 1e-6; // small number for tolerances on floating-point differences\n"); fprintf(outfile, "do{\n do{\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "if (_noise_list.empty()) { \n"); fprintf(outfile, " //Noise list empty so start afresh \n"); fprintf(outfile, " _noise_vector = new double[_%s_size*_n_noises];\n", fieldName); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else{ fprintf(outfile, " _make_noises(_gen, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, " _noise_list.push_front(_dtdWstore()); \n"); fprintf(outfile, " _active_node = _noise_list.begin(); \n"); fprintf(outfile, " _active_node->_step = _step; \n"); fprintf(outfile, " _active_node->_noise_vector = _noise_vector; \n"); fprintf(outfile, "} \n"); fprintf(outfile, "else { \n"); fprintf(outfile, " if (_step*(1.0+_epsilon) < _noise_list.begin()->_step) { \n"); fprintf(outfile, " _noise_vector = new double[_%s_size*_n_noises];\n", fieldName); fprintf(outfile, " //Create new smallest time step \n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " _make_noises(_gen1, _var*((_noise_list.begin()->_step)-_step)/(_step*_noise_list.begin()->_step), _noise_vector, _main_size*_n_noises);\n"); } else{ fprintf(outfile, " _make_noises(_gen, _var*((_noise_list.begin()->_step)-_step)/(_step*_noise_list.begin()->_step), _noise_vector, _main_size*_n_noises);\n"); } fprintf(outfile, " for (unsigned long _i0=0; _i0<_main_size*_n_noises; _i0+=1) { \n"); fprintf(outfile, " _noise_vector[_i0] += _noise_list.begin()->_noise_vector[_i0]; \n"); fprintf(outfile, " } \n"); fprintf(outfile, " _noise_list.push_front(_dtdWstore()); \n"); fprintf(outfile, " _active_node = _noise_list.begin(); \n"); fprintf(outfile, " _active_node->_step = _step; \n"); fprintf(outfile, " _active_node->_noise_vector = _noise_vector; \n"); fprintf(outfile, " } \n"); fprintf(outfile, " else { \n"); fprintf(outfile, " //Use time step already attempted \n"); fprintf(outfile, " for (_active_node=_noise_list.begin(); (_active_node!=_noise_list.end())&&(_active_node->_step <= _step*(1.0+_epsilon)); _active_node++) ;\n \n"); fprintf(outfile, " _active_node--; \n"); fprintf(outfile, " _step = _active_node->_step; \n"); fprintf(outfile, " _noise_vector = _active_node->_noise_vector; \n"); fprintf(outfile, " if (_break_next && fabs(t -_%s_ini + _step - _t_break_next) > _step*_epsilon)\n",propDim); fprintf(outfile, " _break_next = false;\n"); fprintf(outfile, " } \n"); fprintf(outfile, "} \n"); } writeSingleStepCode(outfile, FULLSTEP); fprintf(outfile, "\n"); // Check if we need to halt before we try the next time-step, // and before we reset the segment. writeHaltCheckingCode(outfile); fprintf(outfile, " _error=_segment%li_timestep_error(_akafield_%s_main);\n", segmentNumber, fieldName); fprintf(outfile, "\n"); fprintf(outfile, " if (_error<_tolerance){;\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " //Trim tree \n"); fprintf(outfile, " _active_node++;\n"); fprintf(outfile, " if (_active_node == _noise_list.end()) {\n"); fprintf(outfile, " _noise_vector = NULL;\n"); fprintf(outfile, " _noise_list.clear();\n"); fprintf(outfile, " }\n"); fprintf(outfile, " else {\n"); fprintf(outfile, " for (list<_dtdWstore>::iterator _temp_iter=_active_node; _temp_iter!=_noise_list.end(); _temp_iter++) {\n"); fprintf(outfile, " _temp_iter->_step -= _step;\n"); fprintf(outfile, " for (unsigned long _i0=0; _i0<_main_size*_n_noises; _i0+=1) \n"); fprintf(outfile, " _temp_iter->_noise_vector[_i0] = (_temp_iter->_noise_vector[_i0]*(_temp_iter->_step+_step) - _noise_vector[_i0]*_step)/(_temp_iter->_step);\n"); fprintf(outfile, " }\n"); fprintf(outfile, " _noise_vector = NULL;\n"); fprintf(outfile, " while (_noise_list.begin()!=_active_node)\n"); fprintf(outfile, " _noise_list.pop_front();\n"); fprintf(outfile, " }\n"); fprintf(outfile, "\n"); } fprintf(outfile, " if (_step>_max_step)\n"); fprintf(outfile, " _max_step=_step;\n"); fprintf(outfile, " if (!_break_next && _step < _min_step)\n"); fprintf(outfile, " _min_step=_step;\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " _step*=0.92*pow(fabs(_tolerance/_error), 0.2);\n"); } else { fprintf(outfile, " _step*=0.92*pow(fabs(_tolerance/_error), 0.111);\n"); } fprintf(outfile, " _discard=false;\n"); fprintf(outfile, " }\n"); fprintf(outfile, " else{\n"); fprintf(outfile, " %s-=_step;\n", propDim); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " _step*=0.5;\n"); } else { fprintf(outfile, " _step*=0.92*pow(fabs(_tolerance/_error), 0.125);\n"); } fprintf(outfile, " _discard=true;\n"); fprintf(outfile, " _break_next=false;\n"); fprintf(outfile, " _segment%li_reset(_%s_init, _step);\n", segmentNumber, fieldName); // We only check step-size when error is intolerable, // so there is no cost when the integration is running successfully. writeStepCheckingCode(outfile); fprintf(outfile, " }\n"); if (max_iter){ fprintf(outfile, "\n"); fprintf(outfile, " _step_counter++;\n"); fprintf(outfile, " if (_step_counter>= _max_steps){\n"); fprintf(outfile, " _discard=false;\n"); fprintf(outfile, " _break_next=true;\n"); fprintf(outfile, " _next_sample_flag[%li]=true;\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, " }\n"); } fprintf(outfile, " }while (_discard);\n"); // We have now accepted the timestep fprintf(outfile, "\n"); fprintf(outfile, " if (_break_next){\n"); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) if (samples(i)!=0){ fprintf(outfile, " if (_next_sample_flag[%li]){\n", i); fprintf(outfile, " _mg%li_sample();\n", i); fprintf(outfile, " _next_sample_counter[%li]++;\n", i); fprintf(outfile, " }\n"); } fprintf(outfile, " if (_next_sample_flag[%li])\n", simulation()->output()->nMomentGroups()); fprintf(outfile, " _next_sample_flag[%li]=true;\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, " else{\n"); fprintf(outfile, " _break_next=false;\n"); fprintf(outfile, " _%s_break_next=_segment%li_setup_sampling(_next_sample_flag, _next_sample_counter);\n", propDim, segmentNumber); fprintf(outfile, " }\n"); fprintf(outfile, " }\n"); fprintf(outfile, " if ((%s-_%s_ini+_step)>_%s_break_next){\n", propDim, propDim, propDim); fprintf(outfile, " _break_next=true;\n"); // calculate the previous timestep which was actually accepted while the current // value of _step is only the guess for the next iteration. if (simulation()->parameters()->nPaths=="1") { if (simulation()->parameters()->usempi) fprintf(outfile, " if (rank==0)\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " printf(\"Current timestep: %%e\\n\", _step/(0.92*pow(fabs(_tolerance/_error), 0.2)));\n"); } else { fprintf(outfile, " printf(\"Current timestep: %%e\\n\", _step/(0.92*pow(fabs(_tolerance/_error), 0.125)));\n"); } } fprintf(outfile, " _step=_%s_break_next-%s+_%s_ini;\n", propDim, propDim, propDim); fprintf(outfile, " }\n"); fprintf(outfile, "}while (!_next_sample_flag[%li]);\n", simulation()->output()->nMomentGroups()+1); fprintf(outfile, "\n"); // This label is used in the halt checking code fprintf(outfile, "_SEGMENT%li_END:\n", segmentNumber); if (simulation()->parameters()->nPaths=="1") { if (simulation()->parameters()->usempi) fprintf(outfile, "if (rank==0)\n"); fprintf(outfile, "printf(\"Segment %li: minimum timestep: %%e maximum timestep: %%e \\n\", _min_step, _max_step);\n", segmentNumber); } fprintf(outfile, "\n"); if (max_iter){ fprintf(outfile, "if (_step_counter>= _max_steps){\n"); fprintf(outfile, " printf(\" \\n \");\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " if (_half_step)\n"); fprintf(outfile, " printf(\"Reached %li iterations, exiting at %s = %%e \\n \", %s);\n", 2*myMaxIterations, propDim, propDim); fprintf(outfile, " else\n"); fprintf(outfile, " printf(\"Reached %li iterations, exiting at %s = %%e \\n \", %s);\n", myMaxIterations, propDim, propDim); } else{ fprintf(outfile, " printf(\"Reached %li iterations, exiting at %s = %%e \\n \", %s);\n", myMaxIterations, propDim, propDim); } fprintf(outfile, " printf(\"Last error: %%e \\n \", _error);\n"); fprintf(outfile, " printf(\"Last planned timestep: %%e \\n \", _step);\n"); fprintf(outfile, " printf(\" \\n \");\n"); fprintf(outfile, "}\n"); }//end max iter if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " _noise_vector=NULL;\n"); fprintf(outfile, " _noise_list.clear();\n"); } fprintf(outfile, " fftw_free(_akafield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akbfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akcfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akdfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akefield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akffield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akgfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akhfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akifield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akjfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_%s_init);\n", fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateARK89::writeCalculateCrossFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89IP::writeCalculateCrossFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ") {\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double* _noises = _noise_vector;\n"); fprintf(outfile, "\n"); } if (crossDimNumber()+1 myMainVectorNamesList; for (list::const_iterator pXMLString = vectorNamesList()->begin(); pXMLString != vectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = crossVectorNamesList()->begin(); while ((pXMLString2 != crossVectorNamesList()->end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myMainVectorNamesList.push_back(*pXMLString); } } const char* typeName; list mainVectorList; for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { const xmdsVector* mainVector; if (!simulation()->field()->getVector(*pXMLString, mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK89::writeCalculateCrossFieldRoutine: cannot find main vector"); } mainVectorList.push_back(mainVector); if (mainVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_old = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, pXMLString->c_str(), typeName, typeName, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } list crossVectorList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { const xmdsVector* crossVector; if (!simulation()->field()->getVector(*pXMLString, crossVector)) { throw xmdsException("Internal error in xmdsIntegrateARK89::writeCalculateCrossFieldRoutine: cannot find cross vector"); } crossVectorList.push_back(crossVector); if (crossVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_K = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_I = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_d = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { fprintf(outfile, "%s d%s_d%s;\n", typeName, crossVector->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str()); } fprintf(outfile, "\n"); } // add cross vectors to total vectors to use list myTotalVectorsList = myMainVectorNamesList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { myTotalVectorsList.push_back(*pXMLString); } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); // open outer loops for (unsigned long i=0; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%sunsigned long _%s_%s_index_pointer_begin=0;\n", indent, fieldName, pXMLString->c_str()); for (unsigned long i=0; ic_str(), i); for (unsigned long j=i+1; jc_str()); } fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy cross vectors into K and I vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++) {\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_I[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); } fprintf(outfile, "%s// store main vectors into old\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_old[_j] = _active_%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 1 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create midpoint main vectors for steps 2 and 3\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = (_active_%s_%s[_j]+_active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j])/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to lattice midpoint for steps 2 and 3\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 2 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 3 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move main vectors to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = _active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 4 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy I cross vector back into old main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy K cross vector into next main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents + _j] = _%s_%s_K[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy old main vectors back into last lattice point\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_old[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // close outer loops fprintf(outfile, "%s}\n", indent); for (unsigned long i=crossDimNumber(); i>0; i--) { fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_old);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "fftw_free(_%s_%s_K);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_I);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_d);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ark89.h0000644000076500000240000000661711033277417015141 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark89.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ark89.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_ARK89_H #define XMDS_INTEGRATE_ARK89_H #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateARK89 // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method class xmdsIntegrateARK89 : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateARK89 object xmdsIntegrateARK89( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateARK89(); //! Processes an element void processElement( const Element *const yourElement); protected : //! returns the tolerance const XMLString* tolerance() const; //! returns the cutoff const XMLString* cutoff() const; //! Writes the function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the routines to outfile void writeRoutines( FILE *const outfile) const; //! Writes the single step code to outfile virtual void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const = 0; private : //! Write the error-finding routine to file void writeTimestepErrorRoutine( FILE *const outfile) const; //! Write the routine that finds who to sample when void writeSetupSamplingRoutine( FILE *const outfile) const; //! Write the main integrate routine to file void writeMainIntegrateRoutine( FILE *const outfile) const; //! Write the routine to calculate the cross field to file void writeCalculateCrossFieldRoutine( FILE *const outfile) const; XMLString myTolerance; // error tolerance for adaptive timestep XMLString myCutoff; // optional function size cutoff for determination of timestep error unsigned long myMaxIterations; // optional safety-device: aborts integration when given number of iterations is reached }; #endif // XMDS_INTEGRATE_ARK89_H xmds-1.6.6/source/xmds_integrate_ark89ex.cc0000644000076500000240000012614011033277417015626 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark89ex.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_ark89ex.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta in the explicit picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89EX public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateARK89EXs=0; //!< The number of integrate ARK89EX objects // ************************************************************************** xmdsIntegrateARK89EX::xmdsIntegrateARK89EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateEX(yourSimulation, yourVerboseMode), xmdsIntegrateARK89(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateARK89EXs++; printf("xmdsIntegrateARK89EX::xmdsIntegrateARK89EX\n"); printf("nxmdsIntegrateARK89EXs=%li\n", nxmdsIntegrateARK89EXs); } } // ************************************************************************** xmdsIntegrateARK89EX::~xmdsIntegrateARK89EX() { if (debugFlag) { nxmdsIntegrateARK89EXs--; printf("xmdsIntegrateARK89EX::~xmdsIntegrateARK89EX\n"); printf("nxmdsIntegrateARK89EXs=%li\n", nxmdsIntegrateARK89EXs); } } // ************************************************************************** void xmdsIntegrateARK89EX::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateARK89EX::processElement\n"); } if (verbose()) { printf("Processing integrate ARK89EX element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateARK89::processElement(yourElement); xmdsIntegrateEX::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89EX private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateARK89EX::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89EX::writePrototypes\n"); } const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARKIP::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK89EX) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateEX::writePrototypes(outfile); fprintf(outfile, "\n"); fprintf(outfile, "// integrate (ARK89EX) prototypes\n"); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step);\n", segmentNumber, typeName); xmdsIntegrateARK89::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateARK89EX::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89EX::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK89EX) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); writeResetRoutine(outfile); xmdsIntegrateEX::writeRoutines(outfile); xmdsIntegrateARK89::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateARK89EX::writeResetRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89EX::writeResetRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK89::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step){\n", segmentNumber, typeName); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i1=0; _i1field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); fprintf(outfile, "%s// Step 1 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[0]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akafield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 2 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[1]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 3 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[2]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 4 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[3]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 5 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[4]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 6 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[5]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 7 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 8 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[7]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 9 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[8]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 10 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[9]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 11 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[10]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 12 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[11]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akffield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 13 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[12]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akgfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 14 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[13]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akhfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 15 and 16 combined to reduce memory use \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[14]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[15]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Take full step\n", indent); fprintf(outfile, "%s\n", indent); fprintf(outfile, "%s// ai = a \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s// a = a + etc \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s// a* = a + etc \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ark89ex.h0000644000076500000240000000514111033277417015465 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark89ex.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ark89ex.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_ARK89EX_H #define XMDS_INTEGRATE_ARK89EX_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateARK89EX // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the adaptive fourth-fifth order Runge-Kutta method in the explicit picture class xmdsIntegrateARK89EX : public xmdsIntegrateEX, public xmdsIntegrateARK89 { public : //! Constructor of an xmdsIntegrateARK89EX object xmdsIntegrateARK89EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateARK89EX(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate ARK89EX prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate ARK89EX routines to file void writeRoutines( FILE *const outfile) const; //! Writes the Routine to "undo" bad timesteps void writeResetRoutine( FILE *const outfile) const; //! Write the integrate ARK89EX single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_ARK89EX_H xmds-1.6.6/source/xmds_integrate_ark89ip.cc0000644000076500000240000015736511033277417015637 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark89ip.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_ark89ip.cc @brief Integrate element parsing classes and methods; ninth order Runge-Kutta in the interaction picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89IP public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateARK89IPs=0; //!< The number of xmds integrate ARK89IP objects // ************************************************************************** xmdsIntegrateARK89IP::xmdsIntegrateARK89IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, true), xmdsIntegrateIP(yourSimulation, yourVerboseMode), xmdsIntegrateARK89(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateARK89IPs++; printf("xmdsIntegrateARK89IP::xmdsIntegrateARK89IP\n"); printf("nxmdsIntegrateARK89IPs=%li\n", nxmdsIntegrateARK89IPs); } } // ************************************************************************** xmdsIntegrateARK89IP::~xmdsIntegrateARK89IP() { if (debugFlag) { nxmdsIntegrateARK89IPs--; printf("xmdsIntegrateARK89IP::~xmdsIntegrateARK89IP\n"); printf("nxmdsIntegrateARK89IPs=%li\n", nxmdsIntegrateARK89IPs); } } // ************************************************************************** void xmdsIntegrateARK89IP::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateARK89IP::processElement\n"); } if (verbose()) { printf("Processing integrate ARK89IP element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateARK89::processElement(yourElement); xmdsIntegrateIP::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89IP protected // ************************************************************************** // ************************************************************************** // ************************************************************************** // xmdsIntegrateARK89IP private // ************************************************************************** // ************************************************************************** void xmdsIntegrateARK89IP::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89IP::writePrototypes\n"); } const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARKIP::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK89IP) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateIP::writePrototypes(outfile); fprintf(outfile, "// integrate (ARK89IP) prototypes\n"); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step);\n", segmentNumber, typeName); xmdsIntegrateARK89::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateARK89IP::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89IP::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (ARK89IP) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateIP::writeRoutines(outfile); writeResetRoutine(outfile); xmdsIntegrateARK89::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateARK89IP::writeResetRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK89IP::writeResetRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARKIP::writeResetRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* **************************************************/\n"); fprintf(outfile, "void _segment%li_reset(%s* _reset_to, double _step){\n", segmentNumber, typeName); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i1=0; _i1field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* kStep=""; if (!constantK()) { kStep="_step/2"; } const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } if (usesKOperators()){ if (!Smallmemory()) fprintf(outfile, "%s_segment%li_calculate_k_operator_field(_step);\n", indent, segmentNumber); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); fprintf(outfile, "%s// Step 1 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[0]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); if (usesKOperators()) { //a = D((1-a[0])dt) a fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-1);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(1.0*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } } fprintf(outfile, "%s_active_%s_main = _akafield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[0])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-1);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(1.0*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 2 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[1]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[1])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(2);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.978260869565217*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[1])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-2);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.978260869565217*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 3 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[2]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[2])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(3);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.903704189521999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[2])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-3);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.903704189521999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 4 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[3]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[3])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(4);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.855556284282999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[3])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-4);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.855556284282999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 5 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[4]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[4])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(5);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.477941176470588*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[4])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-5);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.477941176470588*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 6 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[5]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(6);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.771575563871365*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-6);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.771575563871365*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 7 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(7);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.456396464100663*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-7);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.456396464100663*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 8 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[7]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[7])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(8);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.356643356643357*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[7])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-8);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.356643356643357*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 9 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[8]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[8])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(9);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.517482517482518*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[8])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-9);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.517482517482518*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 10 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[9]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[9])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(10);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.931818181818182*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[9])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-10);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.931818181818182*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 11 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[10]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[10])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(11);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.749391727493917*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[10])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-11);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.749391727493917*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 12 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[11]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akffield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[11])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(12);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.332632840343994*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[11])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-12);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.332632840343994*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 13 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[12]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akgfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[12])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(13);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.144927536231884*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[12])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-13);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.144927536231884*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 14 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[13]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akhfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[13])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(14);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.102040816326531*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[13])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-14);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.102040816326531*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 15 and 16 combined to reduce memory use \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[14]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[15]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Take full step\n", indent); fprintf(outfile, "%s\n", indent); fprintf(outfile, "%s// ai = a \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s// a = a + etc \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s// a* = a + etc \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ark89ip.h0000644000076500000240000000514611033277417015466 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ark89ip.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ark89ip.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_ARK89IP_H #define XMDS_INTEGRATE_ARK89IP_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateARK89IP // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the adaptive fourth-fifth order Runge-Kutta method in the interaction picture class xmdsIntegrateARK89IP : public xmdsIntegrateIP, public xmdsIntegrateARK89{ public : //! Constructor of xmdsIntetrageARK89IP object xmdsIntegrateARK89IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateARK89IP(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate ARK89IP prototypes to file void writePrototypes( FILE *const outfile) const; //! Writes the Routine to "undo" bad timesteps void writeResetRoutine( FILE *const outfile) const; //! Write the integrate ARK89IP routines to file void writeRoutines( FILE *const outfile) const; //! Write the integrate ARK89IP single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_ARK89IP_H xmds-1.6.6/source/xmds_integrate_ex.cc0000644000076500000240000004627111033277417014755 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ex.cc 1924 2008-03-28 02:23:27Z grahamdennis $ */ /*! @file xmds_integrate_ex.cc @brief Integrate element parsing classes and methods; explicit picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateEX public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateEXs=0; //!< Number of xmds integrate EX objects // ************************************************************************** xmdsIntegrateEX::xmdsIntegrateEX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateEXs++; printf("xmdsIntegrateEX::xmdsIntegrateEX\n"); printf("nxmdsIntegrateEXs=%li\n", nxmdsIntegrateEXs); } } // ************************************************************************** xmdsIntegrateEX::~xmdsIntegrateEX() { if (debugFlag) { nxmdsIntegrateEXs--; printf("xmdsIntegrateEX::~xmdsIntegrateEX\n"); printf("nxmdsIntegrateEXs=%li\n", nxmdsIntegrateEXs); } } // ************************************************************************** void xmdsIntegrateEX::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateEX::processElement\n"); } // ************************************ // parse code for operators const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateEX::processElement: cannot find 'main' vector"); } XMLString* theCode = propagationCode(); XMLString nextOperatorName; XMLString nextComponentName; unsigned long start=0; unsigned long end=0; char s[256]; list coVectorComponentNamesList; list coVectorComponentLengthsList; // first need to get all co pairs while (endlength()) { if (findNextcoPair(nextOperatorName, nextComponentName, start, end)) { unsigned long nextComponentNumber; if (!mainVector->getComponent(nextComponentName, nextComponentNumber)) { sprintf(errorMessage(), "[%s] is not a component of the main vector", nextComponentName.c_str()); throw xmdsException(yourElement, errorMessage()); } unsigned long nextOperatorNumber; if (!getKOperator(nextOperatorName, nextOperatorNumber)) { sprintf(errorMessage(), "'%s' was not defined in ", nextOperatorName.c_str()); throw xmdsException(yourElement, errorMessage()); } sprintf(s, "_segment%li_co_term_%s_%s", segmentNumber, nextOperatorName.c_str(), nextComponentName.c_str()); const XMLString nextVectorComponentName = s; unsigned long coKey; if (!getcoKey(nextComponentNumber, nextOperatorNumber, coKey)) { if (verbose()) { printf("adding operator-component pair: %s[%s]\n", nextOperatorName.c_str(), nextComponentName.c_str()); } unsigned long cLength = mainVector->componentLength(nextComponentNumber); coKey = addcoPair(nextComponentNumber, nextOperatorNumber, cLength); coVectorComponentNamesList.push_back(nextVectorComponentName); coVectorComponentLengthsList.push_back(mainVector->componentLength(nextComponentNumber)); } theCode->replaceData(start, end-start, nextVectorComponentName); start = start+nextVectorComponentName.length(); } else { start = end; } } if (coVectorComponentNamesList.size()>0) { xmdsVector* coVector = simulation()->field()->createxmdsVector(); sprintf(s, "segment%li_co_terms", segmentNumber); coVector->setName(s); coVector->setVectorType(COMPLEX); coVector->setComponents(coVectorComponentNamesList); coVector->setLengths(coVectorComponentLengthsList); coVector->setInitialSpace(0); coVector->setNeedsFFTWRoutines(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); tempVectorNamesList.push_back(s); simulation()->field()->processVectors(tempVectorNamesList, simulation()->field()->geometry()->fullSpace()); vectorNamesList()->push_back(s); if (verbose()) { printf("Number of components in %s: %li\n", s, coVectorComponentNamesList.size()); } } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateEX protected // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateEX::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateEX::writePrototypes\n"); } if (usesKOperators()) { fprintf(outfile, "// integrate (EX) prototypes\n"); fprintf(outfile, "\n"); if (constantK()) { fprintf(outfile, "void _segment%li_calculate_k_operator_field();\n", segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "void _segment%li_calculate_co_terms();\n", segmentNumber); } } // ************************************************************************** void xmdsIntegrateEX::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateEX::writeRoutines\n"); } if (usesKOperators()) { if (constantK()) { writeCalculatekOperatorFieldRoutine(outfile); writeCalculateCOTermsConstantKRoutine(outfile); } else writeCalculateCOTermsTimeDepKRoutine(outfile); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateEX private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateEX::writeCalculatekOperatorFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateEX::writeCalculatekOperatorFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); unsigned long i; fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_k_operator_field() {\n", segmentNumber); fprintf(outfile, "\n"); list threadPrivateVariables; for (i=0; ic_str()); threadPrivateVariables.push_back(*KOperator(i)); } fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); fprintf(outfile, "unsigned long _k_operator_index_pointer=0;\n"); simulation()->field()->openLoops(outfile, fullSpace, *KVectorNamesList(), DO_NOT_PARALLELISE_LOOP); char indent[64]; for (i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (i=0; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s_k_operator_index_pointer += _segment%li_nkoperators;\n", indent, segmentNumber); simulation()->field()->closeLoops(outfile, fullSpace, *KVectorNamesList()); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateEX::writeCalculateCOTermsConstantKRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateEX::writeCalculateCOTermsConstantKRoutine\n"); } const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char *const fieldName = simulation()->field()->name()->c_str(); char coVectorName[256]; sprintf(coVectorName, "segment%li_co_terms", segmentNumber); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateEX::writeCalculateCOTermsConstantKRoutine: cannot find 'main' vector"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_co_terms() {\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "double _temp;\n"); fprintf(outfile, "unsigned long _segment%li_kop_index_pointer=0;\n", segmentNumber); fprintf(outfile, "unsigned long _active_%s_index_pointer=0;\n", fieldName); fprintf(outfile, "unsigned long _%s_segment_%li_co_terms_index_pointer=0;\n", fieldName, segmentNumber); fprintf(outfile, "\n"); list tempVectorNamesList; tempVectorNamesList.push_back("main"); simulation()->field()->vectors2space(outfile, fullSpace, tempVectorNamesList, ""); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0nComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { unsigned long previousComponents = 0; for (unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } list::const_iterator pULong1 = thecoStruct->operatorNumbersList.begin(); list::const_iterator pULong2 = thecoStruct->coKeysList.begin(); while (pULong1 != thecoStruct->operatorNumbersList.end()) { if (mainVector->componentLength(i)>1) { fprintf(outfile, "\n"); fprintf(outfile, " for (unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, " _temp = _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _%s_segment%li_co_terms[_%s_segment_%li_co_terms_index_pointer + _j + %li].im =\n", fieldName, segmentNumber, fieldName, segmentNumber, *pULong2); fprintf(outfile, " _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _%s_segment%li_co_terms[_%s_segment_%li_co_terms_index_pointer + _j + %li].re=_temp;\n", fieldName, segmentNumber, fieldName, segmentNumber, *pULong2); fprintf(outfile, " }\n"); } else { fprintf(outfile, "\n"); fprintf(outfile, " _temp = _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _%s_segment%li_co_terms[_%s_segment_%li_co_terms_index_pointer + %li].im =\n", fieldName, segmentNumber, fieldName, segmentNumber, *pULong2); fprintf(outfile, " _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong1); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _%s_segment%li_co_terms[_%s_segment_%li_co_terms_index_pointer + %li].re=_temp;\n", fieldName, segmentNumber, fieldName, segmentNumber, *pULong2); } pULong1++; pULong2++; } } } fprintf(outfile, " _segment%li_kop_index_pointer+=_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " _%s_segment_%li_co_terms_index_pointer+=_%s_segment%li_co_terms_ncomponents;\n", fieldName, segmentNumber, fieldName, segmentNumber); fprintf(outfile, " }\n"); fprintf(outfile, "\n"); fprintf(outfile, "_%s_segment%li_co_terms_space=%li;\n", fieldName, segmentNumber, fullSpace); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateEX::writeCalculateCOTermsTimeDepKRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateIP::writeCalculateCOTermsTimeDepKRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateIP::writeCalculateCOTermsTimeDepKRoutine: cannot find 'main' vector"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_co_terms() {\n", segmentNumber); fprintf(outfile, "\n"); list threadPrivateVariables; for (unsigned long i=0; ic_str()); threadPrivateVariables.push_back(*KOperator(i)); } fprintf(outfile, "\n"); fprintf(outfile, "double _temp;\n"); fprintf(outfile, "\n"); threadPrivateVariables.push_back(XMLString("_temp")); simulation()->field()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); list tempVectorNamesList = *KVectorNamesList(); char coVectorName[256]; sprintf(coVectorName, "segment%li_co_terms", segmentNumber); tempVectorNamesList.push_back(coVectorName); simulation()->field()->openLoops(outfile, fullSpace, tempVectorNamesList, PARALLELISE_LOOP, threadPrivateVariables); char indent[64]; for (unsigned long i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { fprintf(outfile, "%s_temp = %s.re*%s.re - %s.im*%s.im;\n", indent, KOperator(*pULong)->c_str(), mainVector->componentName(i)->c_str(), KOperator(*pULong)->c_str(), mainVector->componentName(i)->c_str()); fprintf(outfile, "%s_segment%li_co_term_%s_%s.im = %s.re*%s.im + %s.im*%s.re;\n", indent, segmentNumber, KOperator(*pULong)->c_str(), mainVector->componentName(i)->c_str(), KOperator(*pULong)->c_str(), mainVector->componentName(i)->c_str(), KOperator(*pULong)->c_str(), mainVector->componentName(i)->c_str()); fprintf(outfile, "%s_segment%li_co_term_%s_%s.re=_temp;\n", indent, segmentNumber, KOperator(*pULong)->c_str(), mainVector->componentName(i)->c_str()); fprintf(outfile, "\n"); } } } simulation()->field()->closeLoops(outfile, fullSpace, tempVectorNamesList); fprintf(outfile, "\n"); fprintf(outfile, "_%s_segment%li_co_terms_space=%li;\n", fieldName, segmentNumber, fullSpace); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ex.h0000644000076500000240000000527511033277417014616 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ex.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ex.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_EX #define XMDS_INTEGRATE_EX #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateEX // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations in explicit picture class xmdsIntegrateEX : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateEX object xmdsIntegrateEX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateEX(); //! Processes the element void processElement( const Element *const yourElement); protected : //! Writes the function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the routines to outfile void writeRoutines( FILE *const outfile) const; private : //! Writes the routine for calculating the k-operator field to file void writeCalculatekOperatorFieldRoutine( FILE *const outfile) const; //! Writes the routine for calculating the component terms for constant k-operators to file void writeCalculateCOTermsConstantKRoutine( FILE *const outfile) const; //! Writes the routine for calculating the component terms for time dependent k-operators to file void writeCalculateCOTermsTimeDepKRoutine( FILE *const outfile) const; }; #endif // XMDS_INTEGRATE_EX xmds-1.6.6/source/xmds_integrate_ip.cc0000644000076500000240000016046011033277417014746 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ip.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_ip.cc @brief Integrate element parsing classes and methods; interaction picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateIP public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateIPs=0; //!< Number of integrate IP objects // ************************************************************************** xmdsIntegrateIP::xmdsIntegrateIP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateIPs++; printf("xmdsIntegrateIP::xmdsIntegrateIP\n"); printf("nxmdsIntegrateIPs=%li\n", nxmdsIntegrateIPs); } } // ************************************************************************** xmdsIntegrateIP::~xmdsIntegrateIP() { if (debugFlag) { nxmdsIntegrateIPs--; printf("xmdsIntegrateIP::~xmdsIntegrateIP\n"); printf("nxmdsIntegrateIPs=%li\n", nxmdsIntegrateIPs); } } // ************************************************************************** void xmdsIntegrateIP::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateIP::processElement\n"); } // ************************************ // parse code for operators const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateIP::processElement: cannot find 'main' vector"); } XMLString* theCode = propagationCode(); XMLString nextOperatorName; XMLString nextComponentName; unsigned long start=0; unsigned long end=0; while (endlength()) { if (findNextcoPair(nextOperatorName, nextComponentName, start, end)) { unsigned long nextComponentNumber; if (!mainVector->getComponent(nextComponentName, nextComponentNumber)) { sprintf(errorMessage(), "[%s] is not a component of the main vector", nextComponentName.c_str()); throw xmdsException(yourElement, errorMessage()); } unsigned long nextOperatorNumber; if (!getKOperator(nextOperatorName, nextOperatorNumber)) { sprintf(errorMessage(), "'%s' was not defined in ", nextOperatorName.c_str()); throw xmdsException(yourElement, errorMessage()); } unsigned long dummycoKey; if (getcoKey(nextComponentNumber, nextOperatorNumber, dummycoKey)) { if (mainVector->componentLength(nextComponentNumber)<2) { sprintf(errorMessage(), "'%s[%s]' used multiply", nextOperatorName.c_str(), nextComponentName.c_str()); throw xmdsException(yourElement, errorMessage()); } } else { if (verbose()) { printf("adding operator-component pair: %s[%s]\n", nextOperatorName.c_str(), nextComponentName.c_str()); } unsigned long dummyLong = mainVector->componentLength(nextComponentNumber); addcoPair(nextComponentNumber, nextOperatorNumber,dummyLong); } if(propagationCode()->data(end)=='(') { theCode->replaceData(start, end-start, "0*"); } else { theCode->replaceData(start, end-start, "0"); } start = start+1; } else { start = end; } } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateIP protected // ************************************************************************** // ***************************************************************************** // ************************************************************************** void xmdsIntegrateIP::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateIP::writePrototypes\n"); } if (usesKOperators()) { if (AdaptiveIP()||Is9thOrderIP()){ if (Smallmemory()){ fprintf(outfile, "void _segment%li_k_propagate(\n", segmentNumber); fprintf(outfile, " const double& _step);\n"); fprintf(outfile, "\n"); } else{ fprintf(outfile, "void _segment%li_calculate_k_operator_field(double _step);\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li_k_propagate(int _exponent);\n", segmentNumber); fprintf(outfile, "\n"); } } else{ if (constantK()) { fprintf(outfile, "void _segment%li_calculate_k_operator_field();\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "void _segment%li_k_propagate();\n", segmentNumber); fprintf(outfile, "\n"); } else { fprintf(outfile, "void _segment%li_k_propagate(\n", segmentNumber); fprintf(outfile, " const double& _step);\n"); fprintf(outfile, "\n"); } } } } // ************************************************************************** void xmdsIntegrateIP::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateIP::writeRoutines\n"); } if (usesKOperators()) { if (Is9thOrderIP()){ if (Smallmemory()) writeTimeDepkPropagateRoutine(outfile); // use conventional routine else{ if (constantK()) // optimized for speed, but needs lots of memory writeRK9CalculatekOperatorFieldRoutine(outfile); else // optimized for speed, but needs even more memory writeRK9TimeDepkCalculatekOperatorFieldRoutine(outfile); writeRK9kPropagateRoutine(outfile); } } else { if (AdaptiveIP()){ if (Smallmemory()) writeTimeDepkPropagateRoutine(outfile); // use conventional routine else{ if (constantK()) // optimized for speed, but needs lots of memory writeARK45CalculatekOperatorFieldRoutine(outfile); else // optimized for speed, but needs even more memory writeARK45TimeDepkCalculatekOperatorFieldRoutine(outfile); writeARK45kPropagateRoutine(outfile); } } else{ if (constantK()) { writeCalculatekOperatorFieldRoutine(outfile); writeConstkPropagateRoutine(outfile); } else writeTimeDepkPropagateRoutine(outfile); } } } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateIP private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateIP::writeCalculatekOperatorFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateIP::writeCalculatekOperatorFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); unsigned long i; fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_k_operator_field() {\n", segmentNumber); fprintf(outfile, "\n"); for (i=0; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double _step=(%s/(double)%li)/2;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "if (_half_step)\n"); fprintf(outfile, " _step=_step/2;\n"); fprintf(outfile, "\n"); } simulation()->field()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); fprintf(outfile, "unsigned long _k_operator_index_pointer=0;\n"); // Strictly, this is parallelisable, however fixing this would require creating a vector simulation()->field()->openLoops(outfile, fullSpace, *KVectorNamesList(), DO_NOT_PARALLELISE_LOOP); char indent[64]; for (i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (i=0; ic_str(), KOperator(i)->c_str()); fprintf(outfile, "%s_segment%li_k_operator_field[_k_operator_index_pointer + %li].im = exp(%s.re*_step)*sin(%s.im*_step);\n", indent, segmentNumber, i, KOperator(i)->c_str(), KOperator(i)->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s_k_operator_index_pointer += _segment%li_nkoperators;\n", indent, segmentNumber); simulation()->field()->closeLoops(outfile, fullSpace, *KVectorNamesList()); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeConstkPropagateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateIP::writeConstkPropagateRoutine\n"); } const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char *const fieldName = simulation()->field()->name()->c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateIP::writeConstkPropagateRoutine: cannot find 'main' vector"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_k_propagate() {\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "double _temp;\n"); fprintf(outfile, "unsigned long _segment%li_kop_index_pointer=0;\n", segmentNumber); fprintf(outfile, "unsigned long _active_%s_index_pointer=0;\n", fieldName); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, fullSpace, tempVectorNamesList, ""); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n" "bool _firstTime = true;\n" "#pragma omp parallel for firstprivate(_firstTime, _temp, _segment%li_kop_index_pointer, _active_%s_index_pointer)\n" "#endif\n", segmentNumber, fieldName); } fprintf(outfile, "for (long _i0=0; _i0<_%s_size; _i0++) {\n", fieldName); if (simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n" "if (_firstTime == true) {\n" "\t _firstTime = false;\n" "\t _segment%1$li_kop_index_pointer += _i0*_segment%1$li_nkoperators;\n" "\t _active_%2$s_index_pointer += _i0*_%2$s_main_ncomponents;\n" "}\n" "#endif // _OPENMP\n\n", segmentNumber, fieldName); } } fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { unsigned long previousComponents = 0; for(unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if(mainVector->componentLength(i)>1) { fprintf(outfile, " for(unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, " _temp = _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li].im =\n", fieldName, fieldName, previousComponents); fprintf(outfile, " _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li].re=_temp;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "}\n"); } else { fprintf(outfile, " _temp = _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li].im =\n", fieldName, fieldName, previousComponents); fprintf(outfile, " _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li].re=_temp;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); } } } } fprintf(outfile, " _segment%li_kop_index_pointer+=_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " };\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeTimeDepkPropagateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateIP::writeTimeDepkPropagateRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateIP::writeTimeDepkPropagateRoutine: cannot find 'main' vector"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_k_propagate(\n", segmentNumber); fprintf(outfile, " const double& _step) {\n"); fprintf(outfile, "\n"); list threadPrivateVariables; for (unsigned long i=0; ic_str()); threadPrivateVariables.push_back(*KOperator(i)); } fprintf(outfile, "\n"); fprintf(outfile, "double _temp;\n"); fprintf(outfile, "double _temp2;\n"); fprintf(outfile, "\n"); threadPrivateVariables.push_back("_temp"); threadPrivateVariables.push_back("_temp2"); simulation()->field()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); simulation()->field()->openLoops(outfile, fullSpace, *KVectorNamesList(), PARALLELISE_LOOP, threadPrivateVariables); char indent[64]; for (unsigned long i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (unsigned long i=0; ic_str()); fprintf(outfile, "%s_temp = _temp2*cos(%s.im*_step);\n", indent, KOperator(i)->c_str()); fprintf(outfile, "%s%s.im = _temp2*sin(%s.im*_step);\n", indent, KOperator(i)->c_str(), KOperator(i)->c_str()); fprintf(outfile, "%s%s.re = _temp;\n", indent, KOperator(i)->c_str()); fprintf(outfile, "\n"); } for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { unsigned long previousComponents = 0; for(unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if(mainVector->componentLength(i)>1) { fprintf(outfile, " for(unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, "%s_temp = %s.re*_active_%s_main[_%s_main_index_pointer + _j + %li].re\n", indent, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "%s - %s.im*_active_%s_main[_%s_main_index_pointer + _j + %li].im;\n", indent, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main[_%s_main_index_pointer + _j + %li].im = %s.re*_active_%s_main[_%s_main_index_pointer + _j + %li].im\n", indent, fieldName, fieldName, previousComponents, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "%s + %s.im*_active_%s_main[_%s_main_index_pointer + _j + %li].re;\n", indent, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main[_%s_main_index_pointer + _j + %li].re=_temp;\n", indent, fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, "%s }\n",indent); } else { fprintf(outfile, "%s_temp = %s.re*_active_%s_main[_%s_main_index_pointer + %li].re\n", indent, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "%s - %s.im*_active_%s_main[_%s_main_index_pointer + %li].im;\n", indent, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main[_%s_main_index_pointer + %li].im = %s.re*_active_%s_main[_%s_main_index_pointer + %li].im\n", indent, fieldName, fieldName, previousComponents, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "%s + %s.im*_active_%s_main[_%s_main_index_pointer + %li].re;\n", indent, KOperator(*pULong)->c_str(), fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main[_%s_main_index_pointer + %li].re=_temp;\n", indent, fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); } } } } simulation()->field()->closeLoops(outfile, fullSpace, *KVectorNamesList()); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeARK45CalculatekOperatorFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writeCalculatekOperatorFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); unsigned long i; fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_k_operator_field(double _step) {\n", segmentNumber); fprintf(outfile, "\n"); for (i=0; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double _factor1=1.0/5; // a_raw[2]\n"); fprintf(outfile, "double _factor2=1.0/10; // a_raw[3]-a_raw[2]\n"); fprintf(outfile, "double _factor3=2.0/5; // a_raw[4]-a_raw[2]\n"); fprintf(outfile, "double _factor4=4.0/5; // a_raw[5]-a_raw[2]\n"); fprintf(outfile, "double _factor5=27.0/40; // a_raw[6]-a_raw[2]\n"); list vectorNames(*KVectorNamesList()); // These are used so that openLoops sets up the k_operator index correctly for OpenMP vectorNames.push_back(XMLString("k_operator")); fprintf(outfile, "unsigned long _%s_k_operator_ncomponents = _segment%li_nkoperators;\n", simulation()->field()->name()->c_str(), segmentNumber); list threadPrivateVariables; for (i=0; ifield()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); // fprintf(outfile, "unsigned long _k_operator_index_pointer=0;\n"); simulation()->field()->openLoops(outfile, fullSpace, vectorNames, PARALLELISE_LOOP, threadPrivateVariables); char indent[64]; for (i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (int n=1; n<6; n++){ for (i=0; ifield()->name()->c_str(), i, KOperator(i)->c_str(), n, KOperator(i)->c_str(), n); fprintf(outfile, "%s_segment%li_k_operator_field_%i[_%s_k_operator_index_pointer + %li].im = exp(%s.re*_factor%i*_step)*sin(%s.im*_factor%i*_step);\n", indent, segmentNumber, n, simulation()->field()->name()->c_str(), i, KOperator(i)->c_str(), n, KOperator(i)->c_str(), n); } fprintf(outfile, "\n"); } fprintf(outfile, "\n"); // fprintf(outfile, "%s_k_operator_index_pointer += _segment%li_nkoperators;\n", indent, segmentNumber); simulation()->field()->closeLoops(outfile, fullSpace, vectorNames); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeARK45kPropagateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writeConstkPropagateRoutine\n"); } const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char *const fieldName = simulation()->field()->name()->c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateARK45IP::writeConstkPropagateRoutine: cannot find 'main' vector"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_k_propagate(int _exponent) {\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "double _temp;\n"); fprintf(outfile, "unsigned long _segment%li_kop_index_pointer=0;\n", segmentNumber); fprintf(outfile, "unsigned long _active_%s_index_pointer=0;\n", fieldName); fprintf(outfile, "bool _firstTime = true;\n"); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, fullSpace, tempVectorNamesList, ""); fprintf(outfile, "if (_exponent>0){\n"); fprintf(outfile, "switch(_exponent){\n"); for (int n=1; n<6; n++){ fprintf(outfile, "case %i:\n", n); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "#pragma omp parallel for firstprivate(_temp, _firstTime, _segment%li_kop_index_pointer, _active_%s_index_pointer)\n", segmentNumber, fieldName); fprintf(outfile, "#endif\n"); } fprintf(outfile, "for (long _i0=0; _i0<_%s_size; _i0++) {\n", fieldName); if (simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "if (_firstTime == true) {\n"); fprintf(outfile, " _firstTime = false;\n"); fprintf(outfile, " _segment%li_kop_index_pointer = _i0*_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer = _i0*_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "#endif\n\n"); } } fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { unsigned long previousComponents = 0; for(unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if(mainVector->componentLength(i)>1) { fprintf(outfile, " for(unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, " _temp = _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li].im =\n", fieldName, fieldName, previousComponents); fprintf(outfile, " _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li].re=_temp;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } else { fprintf(outfile, " _temp = _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li].im =\n", fieldName, fieldName, previousComponents); fprintf(outfile, " _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li].re=_temp;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); } } } } fprintf(outfile, " _segment%li_kop_index_pointer+=_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " };\n"); fprintf(outfile, " break;\n"); } fprintf(outfile, " }\n" "}\n" "else {\n" "_exponent=abs(_exponent);\n" "switch(_exponent){\n"); for (int n=1; n<6; n++){ fprintf(outfile, "case %i:\n", n); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "#pragma omp parallel for firstprivate(_temp, _firstTime, _segment%li_kop_index_pointer, _active_%s_index_pointer)\n", segmentNumber, fieldName); fprintf(outfile, "#endif\n"); } fprintf(outfile, "for (long _i0=0; _i0<_%s_size; _i0++) {\n", fieldName); if (simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "if (_firstTime == true) {\n"); fprintf(outfile, " _firstTime = false;\n"); fprintf(outfile, " _segment%li_kop_index_pointer = _i0*_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer = _i0*_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "#endif\n\n"); } } fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { unsigned long previousComponents = 0; for(unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if(mainVector->componentLength(i)>1) { fprintf(outfile, " for(unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li]/=_segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li];\n", fieldName, fieldName, previousComponents, segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } else { fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li]/=_segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li];\n", fieldName, fieldName, previousComponents, segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, "\n"); } } } } fprintf(outfile, " _segment%li_kop_index_pointer+=_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " };\n"); fprintf(outfile, " break;\n"); } fprintf(outfile, "}\n"); fprintf(outfile, "}\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeARK45TimeDepkCalculatekOperatorFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateARK45IP::writeARK45TimeDepkCalculatekOperatorFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); unsigned long i; fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_k_operator_field(double _step) {\n", segmentNumber); fprintf(outfile, "\n"); for (i=0; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double factor1=1.0/5; // a_raw[2]\n"); fprintf(outfile, "double factor2=1.0/10; // a_raw[3]-a_raw[2]\n"); fprintf(outfile, "double factor3=2.0/5; // a_raw[4]-a_raw[2]\n"); fprintf(outfile, "double factor4=4.0/5; // a_raw[5]-a_raw[2]\n"); fprintf(outfile, "double factor5=27.0/40; // a_raw[6]-a_raw[2]\n"); fprintf(outfile, "double _store_time=t;\n"); fprintf(outfile, "\n"); fprintf(outfile, "double _store_%s=%s; \n", propDim, propDim); fprintf(outfile, "double _d%s1=0.0; \n", propDim); fprintf(outfile, "double _d%s2=3.0/10*_step; \n", propDim); fprintf(outfile, "double _d%s3=3.0/10*_step; \n", propDim); fprintf(outfile, "double _d%s4=2.0/5*_step; \n", propDim); fprintf(outfile, "double _d%s5=-1.0/8*_step; \n", propDim); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); fprintf(outfile, "unsigned long _k_operator_index_pointer;\n"); for (int n=1; n<6; n++){ fprintf(outfile, "_k_operator_index_pointer=0;\n"); fprintf(outfile, "%s+=_d%s%i;\n", propDim, propDim, n); fprintf(outfile, "\n"); fprintf(outfile, "{\n"); //make counters in loops local simulation()->field()->openLoops(outfile, fullSpace, *KVectorNamesList()); char indent[64]; for (i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (i=0; ic_str(), n, KOperator(i)->c_str(), n); fprintf(outfile, "%s_segment%li_k_operator_field_%i[_k_operator_index_pointer + %li].im = exp(%s.re*factor%i*_step)*sin(%s.im*factor%i*_step);\n", indent, segmentNumber, n, i, KOperator(i)->c_str(), n, KOperator(i)->c_str(), n); } fprintf(outfile, "\n"); fprintf(outfile, "%s_k_operator_index_pointer += _segment%li_nkoperators;\n", indent, segmentNumber); simulation()->field()->closeLoops(outfile, fullSpace, *KVectorNamesList()); fprintf(outfile, "}\n"); // end-make counters in loops local fprintf(outfile, "\n"); } fprintf(outfile, "%s=_store_%s;\n", propDim, propDim); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeRK9CalculatekOperatorFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writeCalculatekOperatorFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); unsigned long i; fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_k_operator_field(double _step) {\n", segmentNumber); fprintf(outfile, "\n"); for (i=0; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double factor1=-1.000000000000000; // a_raw[15]-a_raw[1]\n"); fprintf(outfile, "double factor2=-0.978260869565217; // a_raw[15]-a_raw[2]\n"); fprintf(outfile, "double factor3=-0.903704189521999; // a_raw[15]-a_raw[3]\n"); fprintf(outfile, "double factor4=-0.855556284282999; // a_raw[15]-a_raw[4]\n"); fprintf(outfile, "double factor5=-0.477941176470588; // a_raw[15]-a_raw[5]\n"); fprintf(outfile, "double factor6=-0.771575563871365; // a_raw[15]-a_raw[6]\n"); fprintf(outfile, "double factor7=-0.456396464100663; // a_raw[15]-a_raw[7]\n"); fprintf(outfile, "double factor8=-0.356643356643357; // a_raw[15]-a_raw[8]\n"); fprintf(outfile, "double factor9=-0.517482517482518; // a_raw[15]-a_raw[9]\n"); fprintf(outfile, "double factor10=-0.931818181818182; // a_raw[15]-a_raw[10]\n"); fprintf(outfile, "double factor11=-0.749391727493917; // a_raw[15]-a_raw[11]\n"); fprintf(outfile, "double factor12=-0.332632840343994; // a_raw[15]-a_raw[12]\n"); fprintf(outfile, "double factor13=-0.144927536231884; // a_raw[15]-a_raw[13]\n"); fprintf(outfile, "double factor14=-0.102040816326531; // a_raw[15]-a_raw[14]\n"); list vectorNames(*KVectorNamesList()); // These are used so that openLoops sets up the k_operator index correctly for OpenMP vectorNames.push_back(XMLString("k_operator")); fprintf(outfile, "unsigned long _%s_k_operator_ncomponents = _segment%li_nkoperators;\n", simulation()->field()->name()->c_str(), segmentNumber); list threadPrivateVariables; for (i=0; ifield()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); // fprintf(outfile, "unsigned long _k_operator_index_pointer=0;\n"); simulation()->field()->openLoops(outfile, fullSpace, vectorNames, PARALLELISE_LOOP, threadPrivateVariables); char indent[64]; for (i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (int n=1; n<15; n++){ for (i=0; ifield()->name()->c_str(), i, KOperator(i)->c_str(), n, KOperator(i)->c_str(), n); fprintf(outfile, "%s_segment%li_k_operator_field_%i[_%s_k_operator_index_pointer + %li].im = exp(%s.re*factor%i*_step)*sin(%s.im*factor%i*_step);\n", indent, segmentNumber, n, simulation()->field()->name()->c_str(), i, KOperator(i)->c_str(), n, KOperator(i)->c_str(), n); } fprintf(outfile, "\n"); } fprintf(outfile, "\n"); // fprintf(outfile, "%s_k_operator_index_pointer += _segment%li_nkoperators;\n", indent, segmentNumber); simulation()->field()->closeLoops(outfile, fullSpace, vectorNames); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeRK9kPropagateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writeConstkPropagateRoutine\n"); } const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); const char *const fieldName = simulation()->field()->name()->c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateRK9IP::writeConstkPropagateRoutine: cannot find 'main' vector"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_k_propagate(int exponent) {\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "double _temp;\n"); fprintf(outfile, "unsigned long _segment%li_kop_index_pointer=0;\n", segmentNumber); fprintf(outfile, "unsigned long _active_%s_index_pointer=0;\n", fieldName); fprintf(outfile, "bool _firstTime = true;\n"); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, fullSpace, tempVectorNamesList, ""); fprintf(outfile, "if (exponent>0){\n"); fprintf(outfile, "switch(exponent){\n"); for (int n=1; n<15; n++){ fprintf(outfile, "case %i:\n", n); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "#pragma omp parallel for firstprivate(_temp, _firstTime, _segment%li_kop_index_pointer, _active_%s_index_pointer)\n", segmentNumber, fieldName); fprintf(outfile, "#endif\n"); } fprintf(outfile, "for (long _i0=0; _i0<_%s_size; _i0++) {\n", fieldName); if (simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "if (_firstTime == true) {\n"); fprintf(outfile, " _firstTime = false;\n"); fprintf(outfile, " _segment%li_kop_index_pointer = _i0*_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer = _i0*_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "#endif\n\n"); } } fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { unsigned long previousComponents = 0; for(unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if(mainVector->componentLength(i)>1) { fprintf(outfile, " for(unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, " _temp = _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li].im =\n", fieldName, fieldName, previousComponents); fprintf(outfile, " _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + _j + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li].re=_temp;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } else { fprintf(outfile, " _temp = _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re\n", fieldName, fieldName, previousComponents); fprintf(outfile, " - _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li].im =\n", fieldName, fieldName, previousComponents); fprintf(outfile, " _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].re\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].im\n", fieldName, fieldName, previousComponents); fprintf(outfile, " + _segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li].im\n", segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, " *_active_%s_main[_active_%s_index_pointer + %li].re;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li].re=_temp;\n", fieldName, fieldName, previousComponents); fprintf(outfile, "\n"); } } } } fprintf(outfile, " _segment%li_kop_index_pointer+=_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " };\n"); fprintf(outfile, " break;\n"); } fprintf(outfile, " }\n" "}\n" "else {\n" "exponent=abs(exponent);\n" "switch(exponent){\n"); for (int n=1; n<15; n++){ fprintf(outfile, "case %i:\n", n); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "for (long _i0=0; _i0parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "#pragma omp parallel for firstprivate(_temp, _firstTime, _segment%li_kop_index_pointer, _active_%s_index_pointer)\n", segmentNumber, fieldName); fprintf(outfile, "#endif\n"); } fprintf(outfile, "for (long _i0=0; _i0<_%s_size; _i0++) {\n", fieldName); if (simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n"); fprintf(outfile, "if (_firstTime == true) {\n"); fprintf(outfile, " _firstTime = false;\n"); fprintf(outfile, " _segment%li_kop_index_pointer = _i0*_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer = _i0*_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "#endif\n\n"); } } fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { const coStruct* thecoStruct; if (getcoStruct(i, thecoStruct)) { for (list::const_iterator pULong = thecoStruct->operatorNumbersList.begin(); pULong != thecoStruct->operatorNumbersList.end(); pULong++) { unsigned long previousComponents = 0; for(unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if(mainVector->componentLength(i)>1) { fprintf(outfile, " for(unsigned long _j = 0; _j<%li; _j++) {\n",mainVector->componentLength(i)); fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + _j + %li]/=_segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li];\n", fieldName, fieldName, previousComponents, segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } else { fprintf(outfile, " _active_%s_main[_active_%s_index_pointer + %li]/=_segment%li_k_operator_field_%i[_segment%li_kop_index_pointer + %li];\n", fieldName, fieldName, previousComponents, segmentNumber, n, segmentNumber, *pULong); fprintf(outfile, "\n"); } } } } fprintf(outfile, " _segment%li_kop_index_pointer+=_segment%li_nkoperators;\n", segmentNumber, segmentNumber); fprintf(outfile, " _active_%s_index_pointer+=_%s_main_ncomponents;\n", fieldName, fieldName); fprintf(outfile, " };\n"); fprintf(outfile, " break;\n"); } fprintf(outfile, "}\n"); fprintf(outfile, "}\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateIP::writeRK9TimeDepkCalculatekOperatorFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writeARK45TimeDepkCalculatekOperatorFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); const unsigned long fullSpace = simulation()->field()->geometry()->fullSpace(); unsigned long i; fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_k_operator_field(double _step) {\n", segmentNumber); fprintf(outfile, "\n"); for (i=0; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double factor1=-1.000000000000000; // a_raw[15]-a_raw[1]\n"); fprintf(outfile, "double factor2=-0.978260869565217; // a_raw[15]-a_raw[2]\n"); fprintf(outfile, "double factor3=-0.903704189521999; // a_raw[15]-a_raw[3]\n"); fprintf(outfile, "double factor4=-0.855556284282999; // a_raw[15]-a_raw[4]\n"); fprintf(outfile, "double factor5=-0.477941176470588; // a_raw[15]-a_raw[5]\n"); fprintf(outfile, "double factor6=-0.771575563871365; // a_raw[15]-a_raw[6]\n"); fprintf(outfile, "double factor7=-0.456396464100663; // a_raw[15]-a_raw[7]\n"); fprintf(outfile, "double factor8=-0.356643356643357; // a_raw[15]-a_raw[8]\n"); fprintf(outfile, "double factor9=-0.517482517482518; // a_raw[15]-a_raw[9]\n"); fprintf(outfile, "double factor10=-0.931818181818182; // a_raw[15]-a_raw[10]\n"); fprintf(outfile, "double factor11=-0.749391727493917; // a_raw[15]-a_raw[11]\n"); fprintf(outfile, "double factor12=-0.332632840343994; // a_raw[15]-a_raw[12]\n"); fprintf(outfile, "double factor13=-0.144927536231884; // a_raw[15]-a_raw[13]\n"); fprintf(outfile, "double factor14=-0.102040816326531; // a_raw[15]-a_raw[14]\n"); fprintf(outfile, "double _store_time=t;\n"); fprintf(outfile, "\n"); fprintf(outfile, "double _store_%s=%s; \n", propDim, propDim); fprintf(outfile, "double _d%s1=1.000000000000000*_step; \n", propDim); fprintf(outfile, "double _d%s2=0.978260869565217*_step; \n", propDim); fprintf(outfile, "double _d%s3=0.903704189521999*_step; \n", propDim); fprintf(outfile, "double _d%s4=0.855556284282999*_step; \n", propDim); fprintf(outfile, "double _d%s5=0.477941176470588*_step; \n", propDim); fprintf(outfile, "double _d%s6=0.771575563871365*_step; \n", propDim); fprintf(outfile, "double _d%s7=0.456396464100663*_step; \n", propDim); fprintf(outfile, "double _d%s8=0.356643356643357*_step; \n", propDim); fprintf(outfile, "double _d%s9=0.517482517482518*_step; \n", propDim); fprintf(outfile, "double _d%s10=0.931818181818182*_step; \n", propDim); fprintf(outfile, "double _d%s11=0.749391727493917*_step; \n", propDim); fprintf(outfile, "double _d%s12=0.332632840343994*_step; \n", propDim); fprintf(outfile, "double _d%s13=0.144927536231884*_step; \n", propDim); fprintf(outfile, "double _d%s14=0.102040816326531*_step; \n", propDim); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, fullSpace, *KVectorNamesList(), ""); fprintf(outfile, "unsigned long _k_operator_index_pointer;\n"); for (int n=1; n<15; n++){ fprintf(outfile, "_k_operator_index_pointer=0;\n"); fprintf(outfile, "%s+=_d%s%i;\n", propDim, propDim, n); fprintf(outfile, "\n"); fprintf(outfile, "{\n"); //make counters in loops local simulation()->field()->openLoops(outfile, fullSpace, *KVectorNamesList()); char indent[64]; for (i=0; ic_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (i=0; ic_str(), n, KOperator(i)->c_str(), n); fprintf(outfile, "%s_segment%li_k_operator_field_%i[_k_operator_index_pointer + %li].im = exp(%s.re*factor%i*_step)*sin(%s.im*factor%i*_step);\n", indent, segmentNumber, n, i, KOperator(i)->c_str(), n, KOperator(i)->c_str(), n); } fprintf(outfile, "\n"); fprintf(outfile, "%s_k_operator_index_pointer += _segment%li_nkoperators;\n", indent, segmentNumber); simulation()->field()->closeLoops(outfile, fullSpace, *KVectorNamesList()); fprintf(outfile, "}\n"); // end-make counters in loops local fprintf(outfile, "\n"); } fprintf(outfile, "%s=_store_%s;\n", propDim, propDim); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_ip.h0000644000076500000240000000724011033277417014604 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_ip.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_ip.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_IP_H #define XMDS_INTEGRATE_IP_H #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateIP // ***************************************************************************** // ***************************************************************************** //! Class to integrate the equations in the interaction picture class xmdsIntegrateIP : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateIP object xmdsIntegrateIP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateIP(); //! Processes the element void processElement( const Element *const yourElement); protected : //! Writes the function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the routines to outfile void writeRoutines( FILE *const outfile) const; private : //! Write the calculate k-operator field routine to file void writeCalculatekOperatorFieldRoutine( FILE *const outfile) const; //! Write the constant k-operators propagate routine to file void writeConstkPropagateRoutine( FILE *const outfile) const; //! Write the time dependent k-operators propagate routine to file void writeTimeDepkPropagateRoutine( FILE *const outfile) const; //! Write the calculate k-operator field routine for the adaptive algorithm to file void writeARK45CalculatekOperatorFieldRoutine( FILE *const outfile) const; //! Write the calculate k-operator field routine for the adaptive algorithm to file void writeARK45TimeDepkCalculatekOperatorFieldRoutine( FILE *const outfile) const; //! Write the constant k-operators propagate routine for the adaptive algorithm to file void writeARK45kPropagateRoutine( FILE *const outfile) const; //! Write the calculate k-operator field routine for the adaptive algorithm to file void writeRK9CalculatekOperatorFieldRoutine( FILE *const outfile) const; //! Write the calculate k-operator field routine for the adaptive algorithm to file void writeRK9TimeDepkCalculatekOperatorFieldRoutine( FILE *const outfile) const; //! Write the constant k-operators propagate routine for the adaptive algorithm to file void writeRK9kPropagateRoutine ( FILE *const outfile) const; }; #endif // XMDS_INTEGRATE_IP_H xmds-1.6.6/source/xmds_integrate_rk4.cc0000644000076500000240000013124411033277417015034 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk4.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_rk4.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4 public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateRK4s=0; //!< Number of xmds integrate RK4 objects // ************************************************************************** xmdsIntegrateRK4::xmdsIntegrateRK4( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateRK4s++; printf("xmdsIntegrateRK4::xmdsIntegrateRK4\n"); printf("nxmdsIntegrateRK4s=%li\n", nxmdsIntegrateRK4s); } } // ************************************************************************** xmdsIntegrateRK4::~xmdsIntegrateRK4() { if (debugFlag) { nxmdsIntegrateRK4s--; printf("xmdsIntegrateRK4::~xmdsIntegrateRK4\n"); printf("nxmdsIntegrateRK4s=%li\n", nxmdsIntegrateRK4s); } } // ************************************************************************** void xmdsIntegrateRK4::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateRK4::processElement\n"); } if ((simulation()->parameters()->stochastic)&&(!noNoises())) { printf("\n"); printf("WARNING: RK4 methods may not always yield correct stochastic convergence.\n"); printf("\n"); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4 protected // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK4::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4::writePrototypes\n"); } fprintf(outfile, "void _segment%li(unsigned long cycle);\n", segmentNumber); fprintf(outfile, "\n"); if (crossVectorNamesList()->size() > 0) { fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } } // ************************************************************************** void xmdsIntegrateRK4::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4::writeRoutines\n"); } writeMainIntegrateRoutine(outfile); if (crossVectorNamesList()->size() > 0) { writeCalculateCrossFieldRoutine(outfile); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4 private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK4::writeMainIntegrateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4::writeMainIntegrateRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateRK4::writeMainIntegrateRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* ******************************************** */\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); fprintf(outfile, "\n"); if ((simulation()->parameters()->usempi)&!(simulation()->parameters()->stochastic)){ fprintf(outfile, "%s *_akfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_aifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); } else { fprintf(outfile, "%s *_akfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_aifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); } fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double _var = 1"); for (unsigned long i=0; ifield()->geometry()->nDims(); i++) { fprintf(outfile, "/_%s_dx%li", fieldName, i); } fprintf(outfile, ";\n"); fprintf(outfile, "double *_noise_vector = new double[_%s_size*_n_noises];\n", fieldName); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double *_noise_vector2 = new double[_%s_size*_n_noises];\n", fieldName); } fprintf(outfile, "\n"); } fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++) {\n", lattice()); fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " if (_half_step) {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = 0.5*%s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FIRST_HALFSTEP); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen2, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen2, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, SECOND_HALFSTEP); fprintf(outfile, " }\n"); fprintf(outfile, " else {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step/2, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); fprintf(outfile, " _make_noises(_gen2, _var/_step/2, _noiseMeanRate*_step, _noise_vector2, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step/2, _noise_vector, _%s_size*_n_noises);\n", fieldName); fprintf(outfile, " _make_noises(_gen2, _var/_step/2, _noise_vector2, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_size*_n_noises; _i1++)\n", fieldName); fprintf(outfile, " _noise_vector[_i1] += _noise_vector2[_i1];\n"); fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FULLSTEP); fprintf(outfile, " }\n"); } else { fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FULLSTEP); } // Check if we need to halt before we try to take any samples. // This will take any last sample. writeHaltCheckingCode(outfile); //! \todo This code is repeated in other integrate classes for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { if (samples(i)!=0){ fprintf(outfile, "\n"); fprintf(outfile, "\n// Only sample on multiples of lattice()/samples(i).\n"); //! \todo Why not use: if ((i0 + 1) % (lattice()/samples(i)) == 0) ? fprintf(outfile, " if (%li*((_i0+1)/%li)==(_i0+1))\n", lattice()/samples(i), lattice()/samples(i)); fprintf(outfile, " _mg%li_sample();\n", i); } } fprintf(outfile, " }\n"); //! \todo This code is repeated in other integrate classes // This label is used in the halt checking code fprintf(outfile, "_SEGMENT%li_END:\n", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " delete[] _noise_vector;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noise_vector2;\n"); } } fprintf(outfile, " fftw_free(_akfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_aifield_%s_main);\n", fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateRK4::writeCalculateCrossFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4IP::writeCalculateCrossFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ") {\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double* _noises = _noise_vector;\n"); fprintf(outfile, "\n"); } if (crossDimNumber()+1 myMainVectorNamesList; for (list::const_iterator pXMLString = vectorNamesList()->begin(); pXMLString != vectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = crossVectorNamesList()->begin(); while ((pXMLString2 != crossVectorNamesList()->end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myMainVectorNamesList.push_back(*pXMLString); } } const char* typeName; list mainVectorList; for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { const xmdsVector* mainVector; if (!simulation()->field()->getVector(*pXMLString, mainVector)) { throw xmdsException("Internal error in xmdsIntegrateRK4::writeCalculateCrossFieldRoutine: cannot find main vector"); } mainVectorList.push_back(mainVector); if (mainVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_old = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, pXMLString->c_str(), typeName, typeName, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } list crossVectorList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { const xmdsVector* crossVector; if (!simulation()->field()->getVector(*pXMLString, crossVector)) { throw xmdsException("Internal error in xmdsIntegrateRK4::writeCalculateCrossFieldRoutine: cannot find cross vector"); } crossVectorList.push_back(crossVector); if (crossVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_K = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_I = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_d = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { fprintf(outfile, "%s d%s_d%s;\n", typeName, crossVector->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str()); } fprintf(outfile, "\n"); } // add cross vectors to total vectors to use list myTotalVectorsList = myMainVectorNamesList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { myTotalVectorsList.push_back(*pXMLString); } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); // open outer loops for (unsigned long i=0; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%sunsigned long _%s_%s_index_pointer_begin=0;\n", indent, fieldName, pXMLString->c_str()); for (unsigned long i=0; ic_str(), i); for (unsigned long j=i+1; jc_str()); } fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy cross vectors into K and I vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++) {\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_I[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); } fprintf(outfile, "%s// store main vectors into old\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_old[_j] = _active_%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 1 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create midpoint main vectors for steps 2 and 3\n", indent); fprintf(outfile, "\n"); // Only evaluate the midpoint as the average of the surrounding steps when we are at either of the edges fprintf(outfile, "%1$sif (_i%2$lu == 0 || _i%2$lu == (_%3$s_lattice%2$lu-2)) {\n", indent, crossDimNumber(), fieldName); for(list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = (_active_%s_%s[_j]+_active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j])/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s} else {\n", indent); // Evaluate the midpoint using 4 values (i.e. not linear interpolation) for(list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor(unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = (_active_%s_%s[_j]+_active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j])*9.0/16.0 ", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "- (_active_%1$s_%2$s[_j - _%1$s_cross_size*_%1$s_%2$s_ncomponents] + _active_%1$s_%2$s[_j + 2*_%1$s_cross_size*_%1$s_%2$s_ncomponents])/16.0;\n", fieldName, pXMLString->c_str()); fprintf(outfile,"\n"); } fprintf(outfile, "%s}\n", indent); fprintf(outfile, "%s// move cross dim to lattice midpoint for steps 2 and 3\n",indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 2 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 3 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move main vectors to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = _active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 4 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy I cross vector back into old main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy K cross vector into next main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents + _j] = _%s_%s_K[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy old main vectors back into last lattice point\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_old[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // close outer loops fprintf(outfile, "%s}\n", indent); for (unsigned long i=crossDimNumber(); i>0; i--) { fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_old);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "fftw_free(_%s_%s_K);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_I);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_d);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_rk4.h0000644000076500000240000000521511033277417014674 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk4.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_rk4.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_RK4_H #define XMDS_INTEGRATE_RK4_H #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateRK4 // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method class xmdsIntegrateRK4 : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateRK4 object xmdsIntegrateRK4( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateRK4(); //! Processes an element void processElement( const Element *const yourElement); protected : //! Writes the function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the routines to outfile void writeRoutines( FILE *const outfile) const; //! Writes the single step code to outfile virtual void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const = 0; private : //! Write the main integrate routine to file void writeMainIntegrateRoutine( FILE *const outfile) const; //! Write the routine to calculate the cross field to file void writeCalculateCrossFieldRoutine( FILE *const outfile) const; }; #endif // XMDS_INTEGRATE_RK4_H xmds-1.6.6/source/xmds_integrate_rk4ex.cc0000644000076500000240000003637111033277417015376 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk4ex.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_rk4ex.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta in the explicit picture More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4EX public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateRK4EXs=0; //!< The number of integrate RK4EX objects // ************************************************************************** xmdsIntegrateRK4EX::xmdsIntegrateRK4EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateEX(yourSimulation, yourVerboseMode), xmdsIntegrateRK4(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateRK4EXs++; printf("xmdsIntegrateRK4EX::xmdsIntegrateRK4EX\n"); printf("nxmdsIntegrateRK4EXs=%li\n", nxmdsIntegrateRK4EXs); } } // ************************************************************************** xmdsIntegrateRK4EX::~xmdsIntegrateRK4EX() { if (debugFlag) { nxmdsIntegrateRK4EXs--; printf("xmdsIntegrateRK4EX::~xmdsIntegrateRK4EX\n"); printf("nxmdsIntegrateRK4EXs=%li\n", nxmdsIntegrateRK4EXs); } } // ************************************************************************** void xmdsIntegrateRK4EX::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateRK4EX::processElement\n"); } if (verbose()) { printf("Processing integrate RK4EX element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateRK4::processElement(yourElement); xmdsIntegrateEX::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4EX private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK4EX::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4EX::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK4EX) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateEX::writePrototypes(outfile); xmdsIntegrateRK4::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateRK4EX::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4EX::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK4EX) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateEX::writeRoutines(outfile); xmdsIntegrateRK4::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateRK4EX::writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const { if (debugFlag) { printf("xmdsIntegrateRK4EX::writeSingleStepCode\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } fprintf(outfile, "%s// a_k=a\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_i=a\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/6\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + a_k/2\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _step/2;\n", indent, propDim); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t+h/2]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/3\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + a_k/2\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t+h/2]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/3\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + a_k\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _step/2;\n", indent, propDim); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// re-calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t+h]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/6\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1 #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateRK4EX // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method in the explicit picture class xmdsIntegrateRK4EX : public xmdsIntegrateEX, public xmdsIntegrateRK4 { public : //! Constructor of an xmdsIntegrateRK4EX object xmdsIntegrateRK4EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateRK4EX(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate RK4EX prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate RK4EX routines to file void writeRoutines( FILE *const outfile) const; //! Write the integrate RK4EX single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_RK4EX_H xmds-1.6.6/source/xmds_integrate_rk4ip.cc0000644000076500000240000003656111033277417015373 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk4ip.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_rk4ip.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta in the interaction picture More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4IP public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateRK4IPs=0; //!< The number of xmds integrate RK4IP objects // ************************************************************************** xmdsIntegrateRK4IP::xmdsIntegrateRK4IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateIP(yourSimulation, yourVerboseMode), xmdsIntegrateRK4(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateRK4IPs++; printf("xmdsIntegrateRK4IP::xmdsIntegrateRK4IP\n"); printf("nxmdsIntegrateRK4IPs=%li\n", nxmdsIntegrateRK4IPs); } } // ************************************************************************** xmdsIntegrateRK4IP::~xmdsIntegrateRK4IP() { if (debugFlag) { nxmdsIntegrateRK4IPs--; printf("xmdsIntegrateRK4IP::~xmdsIntegrateRK4IP\n"); printf("nxmdsIntegrateRK4IPs=%li\n", nxmdsIntegrateRK4IPs); } } // ************************************************************************** void xmdsIntegrateRK4IP::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateRK4IP::processElement\n"); } if (verbose()) { printf("Processing integrate RK4IP element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateRK4::processElement(yourElement); xmdsIntegrateIP::processElement(yourElement); if (!constantK()&&usesKOperators()) { printf("\n"); printf("WARNING: RK4IP does not work as 4th order algorithm with time dependent k-operators.\n"); printf("\n"); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK4IP private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK4IP::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4IP::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK4IP) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateIP::writePrototypes(outfile); xmdsIntegrateRK4::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateRK4IP::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK4IP::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK4IP) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateIP::writeRoutines(outfile); xmdsIntegrateRK4::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateRK4IP::writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const { if (debugFlag) { printf("xmdsIntegrateRK4IP::writeSingleStepCode\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* kStep=""; if (!constantK()) { kStep="_step/2"; } const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// a_k=a\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// a_i=a\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/6\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + a_k/2\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _step/2;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t+h/2]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/3\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic){ fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + a_k/2\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t+h/2]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/3\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "%s// a_k = a_i + a_k\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// a_k=D[a_k]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(%s);\n", indent, segmentNumber, kStep); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s%s += _step/2;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t+h]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// a=D[a]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(%s);\n", indent, segmentNumber, kStep); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } if (simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, "%s// a=a+a_k/6\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1 #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateRK4IP // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method in the interaction picture class xmdsIntegrateRK4IP : public xmdsIntegrateIP, public xmdsIntegrateRK4{ public : //! Constructor of xmdsIntetrageRK4IP object xmdsIntegrateRK4IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateRK4IP(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate RK4IP prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate RK4IP routines to file void writeRoutines( FILE *const outfile) const; //! Write the integrate RK4IP single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_RK4IP_H xmds-1.6.6/source/xmds_integrate_rk9.cc0000644000076500000240000015465111033277417015050 00000000000000 /* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk9.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_rk9.cc @brief Integrate element parsing classes and methods; ninth order Runge-Kutta More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9 public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateRK9s=0; //!< Number of xmds integrate RK9 objects // ************************************************************************** xmdsIntegrateRK9::xmdsIntegrateRK9( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateRK9s++; printf("xmdsIntegrateRK9::xmdsIntegrateRK9\n"); printf("nxmdsIntegrateRK9s=%li\n", nxmdsIntegrateRK9s); } } // ************************************************************************** xmdsIntegrateRK9::~xmdsIntegrateRK9() { if (debugFlag) { nxmdsIntegrateRK9s--; printf("xmdsIntegrateRK9::~xmdsIntegrateRK9\n"); printf("nxmdsIntegrateRK9s=%li\n", nxmdsIntegrateRK9s); } } // ************************************************************************** void xmdsIntegrateRK9::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateRK9::processElement\n"); } if ((simulation()->parameters()->stochastic)&&(!noNoises())) { printf("\n"); printf("WARNING: RK9 methods may not always yield correct stochastic convergence.\n"); printf("\n"); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9 protected // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK9::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9::writePrototypes\n"); } fprintf(outfile, "void _segment%li(unsigned long cycle);\n", segmentNumber); fprintf(outfile, "\n"); if (crossVectorNamesList()->size() > 0) { fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } } // ************************************************************************** void xmdsIntegrateRK9::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9::writeRoutines\n"); } writeMainIntegrateRoutine(outfile); if (crossVectorNamesList()->size() > 0) { writeCalculateCrossFieldRoutine(outfile); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9 private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK9::writeMainIntegrateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9::writeMainIntegrateRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateRK9::writeMainIntegrateRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* ******************************************** */\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); fprintf(outfile, "\n"); if ((simulation()->parameters()->usempi)&!(simulation()->parameters()->stochastic)){ fprintf(outfile, "%s *_akafield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akbfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akcfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akdfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akefield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akffield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akgfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akhfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); fprintf(outfile, "%s *_akjfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*total_local_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName); } else { fprintf(outfile, "%s *_akafield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akbfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akcfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akdfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akefield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akffield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akgfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akhfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "%s *_akjfield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); } fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double _var = 1"); for (unsigned long i=0; ifield()->geometry()->nDims(); i++) { fprintf(outfile, "/_%s_dx%li", fieldName, i); } fprintf(outfile, ";\n"); fprintf(outfile, "double *_noise_vector = new double[_%s_size*_n_noises];\n", fieldName); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double *_noise_vector2 = new double[_%s_size*_n_noises];\n", fieldName); } fprintf(outfile, "\n"); } fprintf(outfile, "\n"); fprintf(outfile, "// Runge Kutta method constants \n"); fprintf(outfile, "double _a_raw[16];\n"); fprintf(outfile, "double _a[16];\n"); fprintf(outfile, "double _b[16][16];\n"); fprintf(outfile, "double _c[16];\n"); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<16; _i0++) {\n"); fprintf(outfile, " _a_raw[_i0]=0.0;\n"); fprintf(outfile, " _c[_i0]=0.0;\n"); fprintf(outfile, " for (unsigned long _i1=0; _i1<16; _i1++)\n"); fprintf(outfile, " _b[_i0][_i1]=0.0;\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); fprintf(outfile, "_a_raw[1] = 0.02173913043478260869565217391304347;\n"); fprintf(outfile, "_a_raw[2] = 0.09629581047800066670113001679819925;\n"); fprintf(outfile, "_a_raw[3] = 0.14444371571700100005169502519729888;\n"); fprintf(outfile, "_a_raw[4] = 0.52205882352941176470588235294117647;\n"); fprintf(outfile, "_a_raw[5] = 0.22842443612863469578031459099794265;\n"); fprintf(outfile, "_a_raw[6] = 0.54360353589933733219171338103002937;\n"); fprintf(outfile, "_a_raw[7] = 0.64335664335664335664335664335664335;\n"); fprintf(outfile, "_a_raw[8] = 0.48251748251748251748251748251748251;\n"); fprintf(outfile, "_a_raw[9] = 0.06818181818181818181818181818181818;\n"); fprintf(outfile, "_a_raw[10] = 0.25060827250608272506082725060827250;\n"); fprintf(outfile, "_a_raw[11] = 0.66736715965600568968278165443304378;\n"); fprintf(outfile, "_a_raw[12] = 0.85507246376811594202898550724637681;\n"); fprintf(outfile, "_a_raw[13] = 0.89795918367346938775510204081632653;\n"); fprintf(outfile, "_a_raw[14] = 1.0;\n"); fprintf(outfile, "_a_raw[15] = 1.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "_a[0]=0.0;\n"); fprintf(outfile, "for (unsigned long _i0=1; _i0<16; _i0++)\n"); fprintf(outfile, " _a[_i0]=_a_raw[_i0]-_a_raw[_i0-1];\n"); fprintf(outfile, "\n"); fprintf(outfile, "_b[1][0] = 1.0/46.0;\n"); fprintf(outfile, "_b[2][0] =-0.11698050118114486205818241524969622;\n"); fprintf(outfile, "_b[2][1] = 0.21327631165914552875931243204789548;\n"); fprintf(outfile, "_b[3][0] = 0.03611092892925025001292375629932472;\n"); fprintf(outfile, "_b[3][2] = 0.10833278678775075003877126889797416;\n"); fprintf(outfile, "_b[4][0] = 1.57329743908138605107331820072051125;\n"); fprintf(outfile, "_b[4][2] =-5.98400943754042002888532938159655553;\n"); fprintf(outfile, "_b[4][3] = 4.93277082198844574251789353381722074;\n"); fprintf(outfile, "_b[5][0] = 0.05052046351120380909008334360006234;\n"); fprintf(outfile, "_b[5][3] = 0.17686653884807108146683657390397612;\n"); fprintf(outfile, "_b[5][4] = 0.00103743376935980522339467349390418;\n"); fprintf(outfile, "_b[6][0] = 0.10543148021953768958529340893598138;\n"); fprintf(outfile, "_b[6][3] =-0.16042415162569842979496486916719383;\n"); fprintf(outfile, "_b[6][4] = 0.11643956912829316045688724281285250;\n"); fprintf(outfile, "_b[6][5] = 0.48215663817720491194449759844838932;\n"); fprintf(outfile, "_b[7][0] = 0.07148407148407148407148407148407148;\n"); fprintf(outfile, "_b[7][5] = 0.32971116090443908023196389566296464;\n"); fprintf(outfile, "_b[7][6] = 0.24216141096813279233990867620960722;\n"); fprintf(outfile, "_b[8][0] = 0.07162368881118881118881118881118881;\n"); fprintf(outfile, "_b[8][5] = 0.32859867301674234161492268975519694;\n"); fprintf(outfile, "_b[8][6] = 0.11622213117906185418927311444060725;\n"); fprintf(outfile, "_b[8][7] =-0.03392701048951048951048951048951048;\n"); fprintf(outfile, "_b[9][0] = 0.04861540768024729180628870095388582;\n"); fprintf(outfile, "_b[9][5] = 0.03998502200331629058445317782406268;\n"); fprintf(outfile, "_b[9][6] = 0.10715724786209388876739304914053506;\n"); fprintf(outfile, "_b[9][7] =-0.02177735985419485163815426357369818;\n"); fprintf(outfile, "_b[9][8] =-0.10579849950964443770179884616296721;\n"); fprintf(outfile, "_b[10][0] =-0.02540141041535143673515871979014924;\n"); fprintf(outfile, "_b[10][5] = 1.0/30.0;\n"); fprintf(outfile, "_b[10][6] =-0.16404854760069182073503553020238782;\n"); fprintf(outfile, "_b[10][7] = 0.03410548898794737788891414566528526;\n"); fprintf(outfile, "_b[10][8] = 0.15836825014108792658008718465091487;\n"); fprintf(outfile, "_b[10][9] = 0.21425115805975734472868683695127609;\n"); fprintf(outfile, "_b[11][0] = 0.00584833331460742801095934302256470;\n"); fprintf(outfile, "_b[11][5] =-0.53954170547283522916525526480339109;\n"); fprintf(outfile, "_b[11][6] = 0.20128430845560909506500331018201158;\n"); fprintf(outfile, "_b[11][7] = 0.04347222773254789483240207937678906;\n"); fprintf(outfile, "_b[11][8] =-0.00402998571475307250775349983910179;\n"); fprintf(outfile, "_b[11][9] = 0.16541535721570612771420482097898952;\n"); fprintf(outfile, "_b[11][10] = 0.79491862412512344573322086551518180;\n"); fprintf(outfile, "_b[12][0] =-0.39964965968794892497157706711861448;\n"); fprintf(outfile, "_b[12][5] =-3.79096577568393158554742638116249372;\n"); fprintf(outfile, "_b[12][6] =-0.40349325653530103387515807815498044;\n"); fprintf(outfile, "_b[12][7] =-2.82463879530435263378049668286220715;\n"); fprintf(outfile, "_b[12][8] = 1.04226892772185985533374283289821416;\n"); fprintf(outfile, "_b[12][9] = 1.12510956420436603974237036536924078;\n"); fprintf(outfile, "_b[12][10] = 3.32746188718986816186934832571938138;\n"); fprintf(outfile, "_b[12][11] = 2.77897957186355606325818219255783627;\n"); fprintf(outfile, "_b[13][0] = 0.39545306350085237157098218205756922;\n"); fprintf(outfile, "_b[13][5] = 5.82534730759650564865380791881446903;\n"); fprintf(outfile, "_b[13][6] =-0.36527452339161313311889856846974452;\n"); fprintf(outfile, "_b[13][7] = 1.18860324058346533283780076203192232;\n"); fprintf(outfile, "_b[13][8] = 0.57970467638357921347110271762687972;\n"); fprintf(outfile, "_b[13][9] =-0.86824862589087693262676988867897834;\n"); fprintf(outfile, "_b[13][10] =-5.20227677296454721392873650976792184;\n"); fprintf(outfile, "_b[13][11] =-0.79895541420753382543211121058675915;\n"); fprintf(outfile, "_b[13][12] = 0.14360623206363792632792463778889008;\n"); fprintf(outfile, "_b[14][0] = 8.49173149061346398013352206978380938;\n"); fprintf(outfile, "_b[14][5] = 86.32213734729036800877634194386790750;\n"); fprintf(outfile, "_b[14][6] = 1.02560575501091662034511526187393241;\n"); fprintf(outfile, "_b[14][7] = 85.77427969817339941806831550695235092;\n"); fprintf(outfile, "_b[14][8] =-13.98699305104110611795532466113248067;\n"); fprintf(outfile, "_b[14][9] =-20.71537405501426352265946477613161883;\n"); fprintf(outfile, "_b[14][10] =-72.16597156619946800281180102605140463;\n"); fprintf(outfile, "_b[14][11] =-76.71211139107806345587696023064419687;\n"); fprintf(outfile, "_b[14][12] = 4.22319427707298828839851258893735507;\n"); fprintf(outfile, "_b[14][13] =-1.25649850482823521641825667745565428;\n"); fprintf(outfile, "_b[15][0] =-0.42892119881959353241190195318730008;\n"); fprintf(outfile, "_b[15][5] =-9.16865700950084689999297912545025359;\n"); fprintf(outfile, "_b[15][6] = 1.08317616770620939241547721530003920;\n"); fprintf(outfile, "_b[15][7] =-1.23501525358323653198215832293981810;\n"); fprintf(outfile, "_b[15][8] =-1.21438272617593906232943856422371019;\n"); fprintf(outfile, "_b[15][9] = 1.37226168507232166621351243731869914;\n"); fprintf(outfile, "_b[15][10] = 9.15723239697162418155377135344394113;\n"); fprintf(outfile, "_b[15][11] = 1.30616301842220047563298585480401671;\n"); fprintf(outfile, "_b[15][12] =-0.25285618808937955976690569433069974;\n"); fprintf(outfile, "_b[15][13] = 0.38099910799663987066763679926508552;\n"); fprintf(outfile, "\n"); fprintf(outfile, "_c[0] = 0.01490902081978461022483617102382552;\n"); fprintf(outfile, "_c[7] =-0.20408044692054151258349120934134791;\n"); fprintf(outfile, "_c[8] = 0.22901438600570447264772469337066476;\n"); fprintf(outfile, "_c[9] = 0.12800558251147375669208211573729202;\n"); fprintf(outfile, "_c[10] = 0.22380626846054143649770066956485937;\n"); fprintf(outfile, "_c[11] = 0.39553165293700054420552389156421651;\n"); fprintf(outfile, "_c[12] = 0.05416646758806981196568364538360743;\n"); fprintf(outfile, "_c[13] = 0.12691439652445903685643385312168037;\n"); fprintf(outfile, "_c[14] =-0.00052539244262118876455834655383035;\n"); fprintf(outfile, "_c[15] = 1.0/31.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++) {\n", lattice()); fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " if (_half_step) {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = 0.5*%s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FIRST_HALFSTEP); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen2, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen2, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, SECOND_HALFSTEP); fprintf(outfile, " }\n"); fprintf(outfile, " else {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step/2, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); fprintf(outfile, " _make_noises(_gen2, _var/_step/2, _noiseMeanRate*_step, _noise_vector2, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step/2, _noise_vector, _%s_size*_n_noises);\n", fieldName); fprintf(outfile, " _make_noises(_gen2, _var/_step/2, _noise_vector2, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_size*_n_noises; _i1++)\n", fieldName); fprintf(outfile, " _noise_vector[_i1] += _noise_vector2[_i1];\n"); fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FULLSTEP); fprintf(outfile, " }\n"); } else { fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FULLSTEP); } // Check if we need to halt before we try to take any samples. // This will take any last sample. writeHaltCheckingCode(outfile); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { if (samples(i)!=0){ fprintf(outfile, "\n"); fprintf(outfile, " if (%li*((_i0+1)/%li)==(_i0+1))\n", lattice()/samples(i), lattice()/samples(i)); fprintf(outfile, " _mg%li_sample();\n", i); } } fprintf(outfile, " }\n"); // This label is used in the halt checking code fprintf(outfile, "_SEGMENT%li_END:\n", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " delete[] _noise_vector;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noise_vector2;\n"); } } fprintf(outfile, " fftw_free(_akafield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akbfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akcfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akdfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akefield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akffield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akgfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akhfield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akifield_%s_main);\n", fieldName); fprintf(outfile, " fftw_free(_akjfield_%s_main);\n", fieldName); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateRK9::writeCalculateCrossFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writeCalculateCrossFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ") {\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double* _noises = _noise_vector;\n"); fprintf(outfile, "\n"); } if (crossDimNumber()+1 myMainVectorNamesList; for (list::const_iterator pXMLString = vectorNamesList()->begin(); pXMLString != vectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = crossVectorNamesList()->begin(); while ((pXMLString2 != crossVectorNamesList()->end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myMainVectorNamesList.push_back(*pXMLString); } } const char* typeName; list mainVectorList; for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { const xmdsVector* mainVector; if (!simulation()->field()->getVector(*pXMLString, mainVector)) { throw xmdsException("Internal error in xmdsIntegrateRK9::writeCalculateCrossFieldRoutine: cannot find main vector"); } mainVectorList.push_back(mainVector); if (mainVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_old = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, pXMLString->c_str(), typeName, typeName, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } list crossVectorList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { const xmdsVector* crossVector; if (!simulation()->field()->getVector(*pXMLString, crossVector)) { throw xmdsException("Internal error in xmdsIntegrateRK9::writeCalculateCrossFieldRoutine: cannot find cross vector"); } crossVectorList.push_back(crossVector); if (crossVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_K = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_I = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_d = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { fprintf(outfile, "%s d%s_d%s;\n", typeName, crossVector->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str()); } fprintf(outfile, "\n"); } // add cross vectors to total vectors to use list myTotalVectorsList = myMainVectorNamesList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { myTotalVectorsList.push_back(*pXMLString); } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); // open outer loops for (unsigned long i=0; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%sunsigned long _%s_%s_index_pointer_begin=0;\n", indent, fieldName, pXMLString->c_str()); for (unsigned long i=0; ic_str(), i); for (unsigned long j=i+1; jc_str()); } fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy cross vectors into K and I vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++) {\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_I[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); } fprintf(outfile, "%s// store main vectors into old\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_old[_j] = _active_%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 1 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create midpoint main vectors for steps 2 and 3\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = (_active_%s_%s[_j]+_active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j])/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to lattice midpoint for steps 2 and 3\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 2 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // **************************************************************** fprintf(outfile, "%s// ********** step 3 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/3;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create next cross vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j] + _%s_%s_d[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move main vectors to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = _active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to next lattice point for step 4\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); // **************************************************************** fprintf(outfile, "%s// ********** step 4 ***************\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate k1\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_K[_j] += _%s_%s_d[_j]/6;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy I cross vector back into old main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy K cross vector into next main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents + _j] = _%s_%s_K[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy old main vectors back into last lattice point\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_old[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // close outer loops fprintf(outfile, "%s}\n", indent); for (unsigned long i=crossDimNumber(); i>0; i--) { fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_old);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "fftw_free(_%s_%s_K);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_I);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "fftw_free(_%s_%s_d);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_rk9.h0000644000076500000240000000521511033277417014701 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk9.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_rk9.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_RK9_H #define XMDS_INTEGRATE_RK9_H #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateRK9 // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method class xmdsIntegrateRK9 : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateRK9 object xmdsIntegrateRK9( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateRK9(); //! Processes an element void processElement( const Element *const yourElement); protected : //! Writes the function prototypes to outfile void writePrototypes( FILE *const outfile) const; //! Writes the routines to outfile void writeRoutines( FILE *const outfile) const; //! Writes the single step code to outfile virtual void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const = 0; private : //! Write the main integrate routine to file void writeMainIntegrateRoutine( FILE *const outfile) const; //! Write the routine to calculate the cross field to file void writeCalculateCrossFieldRoutine( FILE *const outfile) const; }; #endif // XMDS_INTEGRATE_RK9_H xmds-1.6.6/source/xmds_integrate_rk9ex.cc0000644000076500000240000011423011033277417015372 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk9ex.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_rk9ex.cc @brief Integrate element parsing classes and methods; fourth order Runge-Kutta in the explicit picture More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9EX public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateRK9EXs=0; //!< The number of integrate RK9EX objects // ************************************************************************** xmdsIntegrateRK9EX::xmdsIntegrateRK9EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateEX(yourSimulation, yourVerboseMode), xmdsIntegrateRK9(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateRK9EXs++; printf("xmdsIntegrateRK9EX::xmdsIntegrateRK9EX\n"); printf("nxmdsIntegrateRK9EXs=%li\n", nxmdsIntegrateRK9EXs); } } // ************************************************************************** xmdsIntegrateRK9EX::~xmdsIntegrateRK9EX() { if (debugFlag) { nxmdsIntegrateRK9EXs--; printf("xmdsIntegrateRK9EX::~xmdsIntegrateRK9EX\n"); printf("nxmdsIntegrateRK9EXs=%li\n", nxmdsIntegrateRK9EXs); } } // ************************************************************************** void xmdsIntegrateRK9EX::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateRK9EX::processElement\n"); } if (verbose()) { printf("Processing integrate RK9EX element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateRK9::processElement(yourElement); xmdsIntegrateEX::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9EX private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK9EX::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9EX::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK9EX) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateEX::writePrototypes(outfile); xmdsIntegrateRK9::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateRK9EX::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9EX::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK9EX) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateEX::writeRoutines(outfile); xmdsIntegrateRK9::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateRK9EX::writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const { if (debugFlag) { printf("xmdsIntegrateRK9EX::writeSingleStepCode\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); fprintf(outfile, "%s// Step 1 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[0]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akafield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 2 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[1]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 3 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[2]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 4 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[3]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 5 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[4]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 6 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[5]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 7 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 8 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[7]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 9 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[8]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 10 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[9]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 11 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[10]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 12 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[11]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akffield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 13 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[12]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akgfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 14 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[13]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akhfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Step 15 and 16 combined to reduce memory use \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[14]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[15]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s// calculate the co derivative terms\n", indent); fprintf(outfile, "%s_segment%li_calculate_co_terms();\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Take full step\n", indent); fprintf(outfile, "%s\n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_rk9ex.h0000644000076500000240000000473411033277417015243 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk9ex.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_rk9ex.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_RK9EX_H #define XMDS_INTEGRATE_RK9EX_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateRK9EX // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method in the explicit picture class xmdsIntegrateRK9EX : public xmdsIntegrateEX, public xmdsIntegrateRK9 { public : //! Constructor of an xmdsIntegrateRK9EX object xmdsIntegrateRK9EX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateRK9EX(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate RK4EX prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate RK4EX routines to file void writeRoutines( FILE *const outfile) const; //! Write the integrate RK4EX single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_RK9EX_H xmds-1.6.6/source/xmds_integrate_rk9ip.cc0000644000076500000240000014470211033277417015375 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk9ip.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_rk9ip.cc @brief Integrate element parsing classes and methods; ninth order Runge-Kutta in the interaction picture More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9IP public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateRK9IPs=0; //!< The number of xmds integrate RK9IP objects // ************************************************************************** xmdsIntegrateRK9IP::xmdsIntegrateRK9IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, true), xmdsIntegrateIP(yourSimulation, yourVerboseMode), xmdsIntegrateRK9(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateRK9IPs++; printf("xmdsIntegrateRK9IP::xmdsIntegrateRK9IP\n"); printf("nxmdsIntegrateRK9IPs=%li\n", nxmdsIntegrateRK9IPs); } } // ************************************************************************** xmdsIntegrateRK9IP::~xmdsIntegrateRK9IP() { if (debugFlag) { nxmdsIntegrateRK9IPs--; printf("xmdsIntegrateRK9IP::~xmdsIntegrateRK9IP\n"); printf("nxmdsIntegrateRK9IPs=%li\n", nxmdsIntegrateRK9IPs); } } // ************************************************************************** void xmdsIntegrateRK9IP::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateRK9IP::processElement\n"); } if (verbose()) { printf("Processing integrate RK9IP element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateRK9::processElement(yourElement); xmdsIntegrateIP::processElement(yourElement); if (!constantK()&&usesKOperators()) { printf("\n"); printf("WARNING: RK9IP does not work as 9th order algorithm with time dependent k-operators.\n"); printf("\n"); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateRK9IP private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateRK9IP::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK9IP) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateIP::writePrototypes(outfile); xmdsIntegrateRK9::writePrototypes(outfile); } // ************************************************************************** void xmdsIntegrateRK9IP::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (RK9IP) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateIP::writeRoutines(outfile); xmdsIntegrateRK9::writeRoutines(outfile); } // ************************************************************************** void xmdsIntegrateRK9IP::writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const { if (debugFlag) { printf("xmdsIntegrateRK9IP::writeSingleStepCode\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* kStep=""; if (!constantK()) { kStep="_step/2"; } const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector=", _noise_vector"; } if (usesKOperators()){ if (!Smallmemory()) fprintf(outfile, "%s_segment%li_calculate_k_operator_field(_step);\n", indent, segmentNumber); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); fprintf(outfile, "%s// Step 1 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[0]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[0])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-1);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(1.0*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s_active_%s_main = _akafield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[0])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-1);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(1.0*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 2 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[1]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[1])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(2);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.978260869565217*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[1])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-2);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.978260869565217*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 3 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[2]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[2])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(3);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.903704189521999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[2])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-3);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.903704189521999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 4 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[3]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[3])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(4);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.855556284282999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[3])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-4);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.855556284282999*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 5 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[4]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[4])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(5);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.477941176470588*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[4])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-5);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.477941176470588*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 6 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[5]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(6);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.771575563871365*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-6);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.771575563871365*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 7 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[6]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(7);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.456396464100663*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[6])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-7);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.456396464100663*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 8 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[7]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akbfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[7])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(8);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.356643356643357*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[7])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-8);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.356643356643357*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 9 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[8]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akcfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[8])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(9);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.517482517482518*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[8])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-9);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.517482517482518*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 10 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[9]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akdfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[9])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(10);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.931818181818182*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[9])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-10);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.931818181818182*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 11 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[10]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akefield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[10])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(11);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.749391727493917*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[10])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-11);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.749391727493917*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 12 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[11]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akffield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[11])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(12);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.332632840343994*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[11])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-12);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.332632840343994*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 13 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[12]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akgfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[12])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(13);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.144927536231884*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[12])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-13);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.144927536231884*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 14 \n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[13]*_step;\n", indent, propDim); fprintf(outfile, "\n"); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akhfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); if (usesKOperators()) //a = D(-(1-a[13])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(14);\n", indent, segmentNumber); fprintf(outfile, "\n"); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-0.102040816326531*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); } fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); if (usesKOperators()) //a = D((1-a[13])dt) a if (!Smallmemory()){ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(-14);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } else{ fprintf(outfile, "%s// a_i=D(a_2*dt)[y1]\n", indent); fprintf(outfile, "%s_segment%li_k_propagate(0.102040816326531*_step);\n", indent, segmentNumber); fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); } fprintf(outfile, "%s// Step 15 and 16 combined to reduce memory use \n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // Continuing the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp for\n" "#endif\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[14]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akifield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _a[15]*_step;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _akjfield_%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "%s// a_k=G[a_k, t]\n", indent); fprintf(outfile, "%s_segment%li_calculate_delta_a(_step, cycle%s);\n", indent, segmentNumber, noiseVector); fprintf(outfile, "\n"); fprintf(outfile, "%s// Take full step\n", indent); fprintf(outfile, "%s\n", indent); if (simulation()->parameters()->useOpenMP) { // We begin a parallel region as we have two for loops following each other // This minimises the penalty of creating/destroying threads for silly implementations of OpenMP fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel\n" "{\n" "#pragma omp for nowait\n" // we use nowait as the two loops are entirely independent "#endif\n"); } if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor(long _i1=0; _i1parameters()->useOpenMP) { // End the parallel region fprintf(outfile, "#ifdef _OPENMP\n" "}\n" "#endif\n"); } fprintf(outfile, "\n"); fprintf(outfile, "%s_active_%s_main = _%s_main;\n", indent, fieldName, fieldName); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_rk9ip.h0000644000076500000240000000474511033277417015241 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_rk9ip.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_rk9ip.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_RK9IP_H #define XMDS_INTEGRATE_RK9IP_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateRK9IP // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the fourth order Runge-Kutta method in the interaction picture class xmdsIntegrateRK9IP : public xmdsIntegrateIP, public xmdsIntegrateRK9{ public : //! Constructor of xmdsIntetrageRK4IP object xmdsIntegrateRK9IP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateRK9IP(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate RK4IP prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate RK4IP routines to file void writeRoutines( FILE *const outfile) const; //! Write the integrate RK4IP single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_RK9IP_H xmds-1.6.6/source/xmds_integrate_si.cc0000644000076500000240000000726411033277417014753 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_si.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_si.cc @brief Integrate element parsing classes and methods; semi-implicit method More detailed explanation... */ #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateSI public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateSIs=0; //!< The number of xmds integrate SI objects // ************************************************************************** xmdsIntegrateSI::xmdsIntegrateSI( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false) { if (debugFlag) { nxmdsIntegrateSIs++; printf("xmdsIntegrateSI::xmdsIntegrateSI\n"); printf("nxmdsIntegrateSIs=%li\n", nxmdsIntegrateSIs); } } // ************************************************************************** xmdsIntegrateSI::~xmdsIntegrateSI() { if (debugFlag) { nxmdsIntegrateSIs--; printf("xmdsIntegrateSI::~xmdsIntegrateSI\n"); printf("nxmdsIntegrateSIs=%li\n", nxmdsIntegrateSIs); } } // ************************************************************************** void xmdsIntegrateSI::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateSI::processElement\n"); } list myULongList; // ************************************ // find iterations if present getAssignmentULongs(yourElement, "iterations", 0, 1, myULongList); if (myULongList.size()>0) { mynIterations = *myULongList.begin(); if (verbose()) { printf("Iterations = %li\n", nIterations()); } } else { mynIterations = 3; printf("Iterations defaulting to 3\n"); } } // ************************************************************************** // ************************************************************************** // xmdsIntegrateSI protected // ************************************************************************** // ************************************************************************** // ************************************************************************** unsigned long xmdsIntegrateSI::nIterations() const { if (debugFlag) { printf("xmdsIntegrateSI::nIterations\n"); } return mynIterations; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_si.h0000644000076500000240000000410111033277417014600 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_si.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_si.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_SI_H #define XMDS_INTEGRATE_SI_H #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateSI // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the semi-implicit method class xmdsIntegrateSI : public virtual xmdsIntegrate { public : //! Constructor of xmdsIntegrateSI object xmdsIntegrateSI( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateSI(); //! Processes the element void processElement( const Element *const yourElement); protected : //! Returns the number of iterations unsigned long nIterations() const; private : unsigned long mynIterations; //!< The number of iterations to be performed }; #endif // XMDS_INTEGRATE_SI_H xmds-1.6.6/source/xmds_integrate_siex.cc0000644000076500000240000007446611033277417015320 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_siex.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_siex.cc @brief Integrate element parsing classes and methods; semi-implicit method in the explicit picture More detailed explanation... */ #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateSIEX public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateSIEXs=0; //!< The number of xmds integrate SIEX objects // ************************************************************************** xmdsIntegrateSIEX::xmdsIntegrateSIEX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateEX(yourSimulation, yourVerboseMode), xmdsIntegrateSI(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateSIEXs++; printf("xmdsIntegrateSIEX::xmdsIntegrateSIEX\n"); printf("nxmdsIntegrateSIEXs=%li\n", nxmdsIntegrateSIEXs); } } // ************************************************************************** xmdsIntegrateSIEX::~xmdsIntegrateSIEX() { if (debugFlag) { nxmdsIntegrateSIEXs--; printf("xmdsIntegrateSIEX::~xmdsIntegrateSIEX\n"); printf("nxmdsIntegrateSIEXs=%li\n", nxmdsIntegrateSIEXs); } } // ************************************************************************** void xmdsIntegrateSIEX::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateSIEX::processElement\n"); } if (verbose()) { printf("Processing integrate RK4EX element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateSI::processElement(yourElement); xmdsIntegrateEX::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateSIEX private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateSIEX::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIEX::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (SIEX) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateEX::writePrototypes(outfile); fprintf(outfile, "void _segment%li(unsigned long cycle);\n", segmentNumber); fprintf(outfile, "\n"); if (crossVectorNamesList()->size() > 0) { fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } } // ************************************************************************** void xmdsIntegrateSIEX::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIEX::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (SIEX) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateEX::writeRoutines(outfile); writeMainIntegrateRoutine(outfile); if (crossVectorNamesList()->size() > 0) { writeCalculateCrossFieldRoutine(outfile); } } // ************************************************************************** void xmdsIntegrateSIEX::writeMainIntegrateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIEX::writeMainIntegrateRoutine\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateSIEX::writeMainIntegrateRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "/* ******************************************** */\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "%s *_aifield_%s_main = (%s*)fftw_malloc(sizeof(%s)*_%s_size*_%s_main_ncomponents);\n", typeName, fieldName, typeName, typeName, fieldName, fieldName); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double _var = 1"); for (unsigned long i=0; ifield()->geometry()->nDims(); i++) { fprintf(outfile, "/_%s_dx%li", fieldName, i); } fprintf(outfile, ";\n"); fprintf(outfile, "double *_noise_vector = new double[_%s_size*_n_noises];\n", fieldName); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double *_noise_vector2 = new double[_%s_size*_n_noises];\n", fieldName); } fprintf(outfile, "\n"); } fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++) {\n", lattice()); fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " if (_half_step) {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = 0.5*%s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FIRST_HALFSTEP); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen2, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen2, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, SECOND_HALFSTEP); fprintf(outfile, " }\n"); fprintf(outfile, " else {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen1, _var/_step/2, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); fprintf(outfile, " _make_noises(_gen2, _var/_step/2, _noiseMeanRate*_step, _noise_vector2, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen1, _var/_step/2, _noise_vector, _%s_size*_n_noises);\n", fieldName); fprintf(outfile, " _make_noises(_gen2, _var/_step/2, _noise_vector2, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_size*_n_noises; _i1++)\n", fieldName); fprintf(outfile, " _noise_vector[_i1] += _noise_vector2[_i1];\n"); fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FULLSTEP); fprintf(outfile, " }\n"); } else { fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, " _make_noises(_gen, _var/_step, _noiseMeanRate*_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } else { fprintf(outfile, " _make_noises(_gen, _var/_step, _noise_vector, _%s_size*_n_noises);\n", fieldName); } fprintf(outfile, "\n"); } writeSingleStepCode(outfile, FULLSTEP); } // Check if we need to halt before we try to take any samples. // This will take any last sample. writeHaltCheckingCode(outfile); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { if (samples(i)!=0){ fprintf(outfile, "\n"); fprintf(outfile, " if (%li*((_i0+1)/%li)==(_i0+1))\n", lattice()/samples(i), lattice()/samples(i)); fprintf(outfile, " _mg%li_sample();\n", i); } } fprintf(outfile, " }\n"); // This label is used in the halt checking code fprintf(outfile, "_SEGMENT%li_END:\n", segmentNumber); fprintf(outfile, " fftw_free(_aifield_%s_main);\n", fieldName); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " delete[] _noise_vector;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noise_vector2;\n"); } fprintf(outfile, "\n"); } fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateSIEX::writeCalculateCrossFieldRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIEX::writeCalculateCrossFieldRoutine\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_calculate_cross_field(", segmentNumber); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double *const _noise_vector"); } fprintf(outfile, ") {\n"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "const double* _noises = _noise_vector;\n"); fprintf(outfile, "\n"); } if (crossDimNumber()+1 myMainVectorNamesList; for (list::const_iterator pXMLString = vectorNamesList()->begin(); pXMLString != vectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = crossVectorNamesList()->begin(); while ((pXMLString2 != crossVectorNamesList()->end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myMainVectorNamesList.push_back(*pXMLString); } } const char* typeName; list mainVectorList; for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { const xmdsVector* mainVector; if (!simulation()->field()->getVector(*pXMLString, mainVector)) { throw xmdsException("Internal error in xmdsIntegrateSIEX::writeCalculateCrossFieldRoutine: cannot find main vector"); } mainVectorList.push_back(mainVector); if (mainVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_old = (%s*)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, pXMLString->c_str(), typeName, typeName, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } list crossVectorList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { const xmdsVector* crossVector; if (!simulation()->field()->getVector(*pXMLString, crossVector)) { throw xmdsException("Internal error in xmdsIntegrateSIEX::writeCalculateCrossFieldRoutine: cannot find cross vector"); } crossVectorList.push_back(crossVector); if (crossVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "%s *_%s_%s_I = (%s *)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "%s *_%s_%s_d = (%s *)fftw_malloc(sizeof(%s)*_%s_cross_size*_%s_%s_ncomponents);\n", typeName, fieldName, crossVector->name()->c_str(), typeName, typeName, fieldName, fieldName, crossVector->name()->c_str()); fprintf(outfile, "\n"); for (unsigned long i=0; inComponents(); i++) { fprintf(outfile, "%s d%s_d%s;\n", typeName, crossVector->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str()); } fprintf(outfile, "\n"); } // add cross vectors to total vectors to use list myTotalVectorsList = myMainVectorNamesList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { myTotalVectorsList.push_back(*pXMLString); } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); // open outer loops for (unsigned long i=0; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jfield()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%sunsigned long _%s_%s_index_pointer_begin=0;\n", indent, fieldName, pXMLString->c_str()); for (unsigned long i=0; ic_str(), i); for (unsigned long j=i+1; jc_str()); } fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy cross vectors into I vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_I[_j] = _%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// store main vectors into old\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s_old[_j] = _active_%s_%s[_%s_%s_index_pointer_begin + _j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// create midpoint main vectors\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=_%s_%s_index_pointer_begin; _j < _%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_j] = (_active_%s_%s[_j]+_active_%s_%s[_%s_cross_size*_%s_%s_ncomponents + _j])/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// move cross dim to lattice midpoint\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s%s += _%s_dx%li/2;\n", indent, simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); fprintf(outfile, "\n"); fprintf(outfile, "%sfor (unsigned long _j=0; _j<%li; _j++) {\n", indent, nIterations()); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer=_%s_%s_index_pointer_begin;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "%s // calculate delta a\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s unsigned long _%s_%s_index_pointer_local=0;\n", indent, fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); // open inner loops for (unsigned long i=crossDimNumber()+1; ifield()->geometry()->dimension(i)->name.c_str(), fieldName, i); fprintf(outfile, "\n"); for (unsigned long j=0; jc_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); for (list::const_iterator pxmdsVector = crossVectorList.begin(); pxmdsVector != crossVectorList.end(); pxmdsVector++) { for (unsigned long i=0; i<(*pxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _%s_%s_d[_%s_%s_index_pointer_local + %li] = d%s_d%s*_%s_dx%li;\n", indent2, fieldName, (*pxmdsVector)->name()->c_str(), fieldName, (*pxmdsVector)->name()->c_str(), i, (*pxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } fprintf(outfile, "\n"); } //close inner loops if (crossDimNumber()+1::const_iterator pXMLString = myTotalVectorsList.begin(); pXMLString != myTotalVectorsList.end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s _%s_%s_index_pointer_local += _%s_%s_ncomponents;\n", indent2, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long i=nDims; i>crossDimNumber()+1; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s for (unsigned long _k=0; _k<_%s_cross_size*_%s_%s_ncomponents; _k++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _k] = _%s_%s_I[_k] + _%s_%s_d[_k]/2;\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s }\n", indent); fprintf(outfile, "%s else {\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%s for (unsigned long _k=0; _k<_%s_cross_size*_%s_%s_ncomponents; _k++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _%s_cross_size*_%s_%s_ncomponents + _k] = _%s_%s_I[_k] + _%s_%s_d[_k];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); fprintf(outfile, "%s// copy I cross vector back into old main cross vector\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_I[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "%s// copy old main vectors back into last lattice point\n", indent); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, "%sfor (unsigned long _j=0; _j<_%s_cross_size*_%s_%s_ncomponents; _j++)\n", indent, fieldName, fieldName, pXMLString->c_str()); fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer_begin + _j] = _%s_%s_old[_j];\n", indent, fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } // close outer loops fprintf(outfile, "%s}\n", indent); fprintf(outfile, "\n"); for (unsigned long i=crossDimNumber(); i>0; i--) { for (unsigned long j=0; jfield()->geometry()->dimension(i-1)->name.c_str(), fieldName, i-1); fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = myMainVectorNamesList.begin(); pXMLString != myMainVectorNamesList.end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_old);\n", fieldName, pXMLString->c_str()); } for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_I);\n", fieldName, pXMLString->c_str()); fprintf(outfile, " fftw_free(_%s_%s_d);\n", fieldName, pXMLString->c_str()); fprintf(outfile, "\n"); } fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateSIEX::writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const { if (debugFlag) { printf("xmdsIntegrateSIEX::writeSingleStepCode\n"); } const char *const fieldName = simulation()->field()->name()->c_str(); const char *const propDim = simulation()->parameters()->propDimName.c_str(); list tempVectorNamesList; tempVectorNamesList.push_back("main"); const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } const char* noiseVector = ""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { noiseVector = ", _noise_vector"; } simulation()->field()->vectors2space(outfile, 0, tempVectorNamesList, indent); fprintf(outfile, "%s// a_i=a\n", indent); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%sfor (long _i1=0; _i1parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%s for (long _i2=0; _i2parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "%s for (long _i2=0; _i2 #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateSIEX // ***************************************************************************** // ***************************************************************************** //! Class to integrate the equations using the semi-implicit method in the explicit picture class xmdsIntegrateSIEX : public xmdsIntegrateEX, public xmdsIntegrateSI { public : //! Constructor of xmdsIntegrateSIEX object xmdsIntegrateSIEX( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateSIEX(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate SIEX prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate SIEX routines to file void writeRoutines( FILE *const outfile) const; //! Write the main SIEX integrate routine to file void writeMainIntegrateRoutine( FILE *const outfile) const; //! Write the integrate SIEX cross-field calculating routine to file void writeCalculateCrossFieldRoutine( FILE *const outfile) const; //! Write the integrate SIEX single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_SIEX_H xmds-1.6.6/source/xmds_integrate_siip.cc0000644000076500000240000012134211033277417015276 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_siip.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_integrate_siip.cc @brief Integrate element parsing classes and methods; semi-implicit method in the interaction picture More detailed explanation... */ #include #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsIntegrateSIIP public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsIntegrateSIIPs=0; //!< Number of xmds integrate SIIP objects // ************************************************************************** xmdsIntegrateSIIP::xmdsIntegrateSIIP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsIntegrate(yourSimulation, yourVerboseMode, false, false), xmdsIntegrateIP(yourSimulation, yourVerboseMode), xmdsIntegrateSI(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsIntegrateSIIPs++; printf("xmdsIntegrateSIIP::xmdsIntegrateSIIP\n"); printf("nxmdsIntegrateSIIPs=%li\n", nxmdsIntegrateSIIPs); } } // ************************************************************************** xmdsIntegrateSIIP::~xmdsIntegrateSIIP() { if (debugFlag) { nxmdsIntegrateSIIPs--; printf("xmdsIntegrateSIIP::~xmdsIntegrateSIIP\n"); printf("nxmdsIntegrateSIIPs=%li\n", nxmdsIntegrateSIIPs); } } // ************************************************************************** void xmdsIntegrateSIIP::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsIntegrateSIIP::processElement\n"); } if (verbose()) { printf("Processing integrate SIIP element ...\n"); } xmdsIntegrate::processElement(yourElement); xmdsIntegrateIP::processElement(yourElement); xmdsIntegrateSI::processElement(yourElement); } // ************************************************************************** // ************************************************************************** // xmdsIntegrateSIIP private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsIntegrateSIIP::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIIP::writePrototypes\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (SIIP) prototypes\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writePrototypes(outfile); xmdsIntegrateIP::writePrototypes(outfile); fprintf(outfile, "void _segment%li(unsigned long cycle);\n", segmentNumber); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateSIIP::writexSpacePrototype( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIIP::writexSpacePrototype\n"); } fprintf(outfile, "void _segment%li_x_propagate(\n", segmentNumber); fprintf(outfile, " const double& _step"); fprintf(outfile, ", \n const unsigned long cycle"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, ", \n const unsigned long& _generator_flag"); } fprintf(outfile, ");\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateSIIP::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIIP::writeRoutines\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (SIIP) routines\n", segmentNumber); fprintf(outfile, "\n"); xmdsIntegrate::writeRoutines(outfile); xmdsIntegrateIP::writeRoutines(outfile); writeMainIntegrateRoutine(outfile); } // ************************************************************************** void xmdsIntegrateSIIP::writeMainIntegrateRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIIP::writeMainIntegrateRoutine\n"); } fprintf(outfile, "/* ******************************************** */\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<%li; _i0++) {\n", lattice()); fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " if (_half_step) {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = 0.5*%s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); writeSingleStepCode(outfile, FIRST_HALFSTEP); fprintf(outfile, "\n"); writeSingleStepCode(outfile, SECOND_HALFSTEP); fprintf(outfile, " }\n"); fprintf(outfile, " else {\n"); fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); writeSingleStepCode(outfile, FULLSTEP); fprintf(outfile, " }\n"); } else { fprintf(outfile, "\n"); fprintf(outfile, " const double _step = %s/(double)%li;\n", interval()->c_str(), lattice()); fprintf(outfile, "\n"); writeSingleStepCode(outfile, FULLSTEP); } // Check if we need to halt before we try to take any samples. // This will take any last sample. writeHaltCheckingCode(outfile); for (long unsigned int i=0; ioutput()->nMomentGroups(); i++) { if (samples(i)!=0){ fprintf(outfile, "\n"); fprintf(outfile, " if (%li*((_i0+1)/%li)==(_i0+1))\n", lattice()/samples(i), lattice()/samples(i)); fprintf(outfile, " _mg%li_sample();\n", i); } } fprintf(outfile, " }\n"); // This label is used in the halt checking code fprintf(outfile, "_SEGMENT%li_END:\n", segmentNumber); // We need this empty statement for the label above // C requires a statement after every label fprintf(outfile, ";\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateSIIP::writexSpaceRoutine( FILE *const outfile) const { if (debugFlag) { printf("xmdsIntegrateSIIP::writexSpaceRoutine\n"); } const long unsigned int nDims = simulation()->field()->geometry()->nDims(); const char *const fieldName = simulation()->field()->name()->c_str(); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li_x_propagate(\n", segmentNumber); fprintf(outfile, " const double& _step"); fprintf(outfile, ", \n const unsigned long cycle"); if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, ", \n const unsigned long& _generator_flag"); } fprintf(outfile, ") {\n"); fprintf(outfile, "\n"); const xmdsVector* mainVector; if (!simulation()->field()->getVector("main", mainVector)) { throw xmdsException("Internal error in xmdsIntegrateSIIP::writexSpaceRoutine: cannot find 'main' vector"); } const char* typeName=""; if (mainVector->vectorType()==COMPLEX) { typeName="complex"; } else if (mainVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "%s *_%s_main_old = (%s*)fftw_malloc(_%s_main_ncomponents*sizeof(%s));\n", typeName, fieldName, typeName, fieldName, typeName); fprintf(outfile, "\n"); for (long unsigned int i=0; inComponents(); i++) { if (mainVector->componentLength(i)>1) { fprintf(outfile, "%s *d%s_d%s = new %s[%li];\n", typeName, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str(),typeName,mainVector->componentLength(i)); } else { fprintf(outfile, "%s d%s_d%s;\n", typeName, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); } } fprintf(outfile, "\n"); list crossVectorList; for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { const xmdsVector* crossVector; if (!simulation()->field()->getVector(*pXMLString, crossVector)) { throw xmdsException("Internal error in xmdsIntegrateSI::writeDefines: cannot find cross vector"); } crossVectorList.push_back(crossVector); if (crossVector->vectorType()==COMPLEX) { typeName="complex"; } else if (crossVector->vectorType()==DOUBLE) { typeName="double"; } fprintf(outfile, "%s *_%s_%s_old = (%s*)fftw_malloc(_%s_%s_ncomponents*sizeof(%s));\n", typeName, fieldName, crossVector->name()->c_str(), typeName, fieldName, crossVector->name()->c_str(), typeName); fprintf(outfile, "\n"); for (long unsigned int i=0; inComponents(); i++) { fprintf(outfile, "%s d%s_d%s;\n", typeName, crossVector->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str()); } fprintf(outfile, "\n"); } if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, "double *_noises = new double[_n_noises];\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double *_noises2 = new double[_n_noises];\n"); } fprintf(outfile, "const double _var = 1/_step"); for (long unsigned int i=0; i myTotalVectorsList = *vectorNamesList(); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { list::const_iterator pXMLString2 = myTotalVectorsList.begin(); while ((pXMLString2 != myTotalVectorsList.end()) && (*pXMLString2 != *pXMLString)) { pXMLString2++; } if (*pXMLString2 != *pXMLString) { myTotalVectorsList.push_back(*pXMLString); } } simulation()->field()->vectors2space(outfile, 0, myTotalVectorsList, ""); list myNonLoopPropagationCodeList=*nonLoopPropagationCodeList(); list myIntegrateMomentGroupList=*integrateMomentGroupList(); list::const_iterator nextNLPElement = myNonLoopPropagationCodeList.begin(); list::const_iterator nextMGElement = myIntegrateMomentGroupList.begin(); list theCodeList = *codeElementList(); if (!(theCodeList.size()==1+numIntegrateMomentGroups()+numNonLoopPropagation())) { throw xmdsException("The list of code elements is the wrong length!"); } long unsigned int whichMG = 0; list deleteMGArrayList; for (list::const_iterator codeElement = theCodeList.begin(); codeElement != theCodeList.end(); codeElement++) { if (!strcmp(codeElement->c_str(), "vectors")) { simulation()->field()->openLoops(outfile, 0, myTotalVectorsList); fprintf(outfile, "\n"); // integrate moment group pointer definition long unsigned int tempWhichMG = 0; for (list::const_iterator tempNextMGElement = myIntegrateMomentGroupList.begin(); tempNextMGElement != myIntegrateMomentGroupList.end(); tempNextMGElement++) { long unsigned int nDimsRemaining = simulation()->field()->geometry()->nDims(); tempWhichMG++; for (list::const_iterator nextIntegrateDimension = tempNextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != tempNextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { nDimsRemaining--; } } if (nDimsRemaining>0) { fprintf(outfile, " long _img%li_pointer = ", tempWhichMG); for (long unsigned int j=0; j::const_iterator nextIntegrateDimension = tempNextMGElement->integrateDimensionList.begin(); while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "_i%li", whichMoment); nextIntegrateDimension++; whichMoment++; for (long unsigned int k=0; kmomentNameList.size()); } } fprintf(outfile, "\n"); char indent[64]; for (long unsigned int i=0; iparameters()->stochastic)&&(!noNoises())) { if (simulation()->parameters()->errorCheck) { fprintf(outfile, "%sif (_generator_flag==1)\n", indent); if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s _make_noises(_gen1, _var, _noiseMeanRate*_step, _noises, _n_noises);\n", indent); } else { fprintf(outfile, "%s _make_noises(_gen1, _var, _noises, _n_noises);\n", indent); } fprintf(outfile, "%selse if (_generator_flag==2)\n", indent); if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s _make_noises(_gen2, _var, _noiseMeanRate*_step, _noises, _n_noises);\n", indent); } else { fprintf(outfile, "%s _make_noises(_gen2, _var, _noises, _n_noises);\n", indent); } fprintf(outfile, "%selse {\n", indent); fprintf(outfile, "\n"); if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s _make_noises(_gen1, _var/2, _noiseMeanRate*_step, _noises, _n_noises);\n", indent); fprintf(outfile, "%s _make_noises(_gen2, _var/2, _noiseMeanRate*_step, _noises2, _n_noises);\n", indent); } else { fprintf(outfile, "%s _make_noises(_gen1, _var/2, _noises, _n_noises);\n", indent); fprintf(outfile, "%s _make_noises(_gen2, _var/2, _noises2, _n_noises);\n", indent); } fprintf(outfile, "\n"); fprintf(outfile, "%s for (unsigned long _s0=0; _s0<_n_noises; _s0++)\n", indent); fprintf(outfile, "%s _noises[_s0] += _noises2[_s0];\n", indent); fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); } else { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s_make_noises(_gen, _var, _noiseMeanRate*_step, _noises, _n_noises);\n", indent); } else { fprintf(outfile, "%s_make_noises(_gen, _var, _noises, _n_noises);\n", indent); } fprintf(outfile, "\n"); } } fprintf(outfile, "%sfor (unsigned long _i%li=0; _i%li<_%s_main_ncomponents; _i%li++)\n", indent, nDims+1, nDims+1, fieldName, nDims+1); fprintf(outfile, "%s _%s_main_old[_i%li] = _active_%s_main[_%s_main_index_pointer + _i%li];\n", indent, fieldName, nDims+1, fieldName, fieldName, nDims+1); fprintf(outfile, "\n"); if (crossVectorList.size() > 0) { for (list::const_iterator ppxmdsVector = crossVectorList.begin(); ppxmdsVector != crossVectorList.end(); ppxmdsVector++) { const char* cvName = (*ppxmdsVector)->name()->c_str(); fprintf(outfile, "%sfor (unsigned long _i%li=0; _i%li<_%s_%s_ncomponents; _i%li++)\n", indent, nDims+1, nDims+1, fieldName, cvName, nDims+1); fprintf(outfile, "%s _%s_%s_old[_i%li] = _active_%s_%s[_%s_%s_index_pointer + _i%li];\n" , indent, fieldName, cvName, nDims+1, fieldName, cvName, fieldName, cvName, nDims+1); fprintf(outfile, "\n"); } } if (nIterations()>1) { fprintf(outfile, "%sfor (unsigned long _i%li=0; _i%li<%li; _i%li++) {\n", indent, nDims+1, nDims+1, nIterations()-1, nDims+1); fprintf(outfile, "\n"); fprintf(outfile, "// *** propagation (and cross_propagation code) ***\n"); fprintf(outfile, "%s\n", propagationCode()->c_str()); if (crossVectorList.size() > 0) { fprintf(outfile, "%s\n", crossPropagationCode()->c_str()); } fprintf(outfile, "// ************************************************\n"); fprintf(outfile, "\n"); for (long unsigned int i=0; inComponents(); i++) { unsigned long previousComponents = 0; for (unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if (mainVector->componentLength(i)>1) { fprintf(outfile, "%s for (unsigned long _j = 0; _j<%li; _j++) {\n",indent,mainVector->componentLength(i)); fprintf(outfile, "%s _active_%s_main[_%s_main_index_pointer + _j + %li] = _%s_main_old[_j+%li] + d%s_d%s[_j]*(_step/2);\n", indent, fieldName, fieldName, previousComponents, fieldName, previousComponents, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); fprintf(outfile, "%s }\n",indent); } else { fprintf(outfile, "%s _active_%s_main[_%s_main_index_pointer + %li] = _%s_main_old[%li] + d%s_d%s*(_step/2);\n", indent, fieldName, fieldName, previousComponents, fieldName, previousComponents, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); } } for (list::const_iterator ppxmdsVector = crossVectorList.begin(); ppxmdsVector != crossVectorList.end(); ppxmdsVector++) { const char* cvName = (*ppxmdsVector)->name()->c_str(); fprintf(outfile, "\n"); for (long unsigned int i=0; i<(*ppxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer + %li] = _%s_%s_old[%li] + d%s_d%s*(_%s_dx%li/2);\n", indent, fieldName, cvName, fieldName, cvName, i, fieldName, cvName, i, (*ppxmdsVector)->componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } } fprintf(outfile, "%s }\n", indent); fprintf(outfile, "\n"); } fprintf(outfile, "// *** propagation (and cross_propagation code) ***\n"); fprintf(outfile, "%s\n", propagationCode()->c_str()); if (crossVectorList.size() > 0) { fprintf(outfile, "%s\n", crossPropagationCode()->c_str()); } fprintf(outfile, "// ************************************************\n"); fprintf(outfile, "\n"); for (long unsigned int i=0; inComponents(); i++) { unsigned long previousComponents = 0; for (unsigned long componentCounter = 0; componentCountercomponentLength(componentCounter); } if (mainVector->componentLength(i)>1) { fprintf(outfile, "%s for (unsigned long _j = 0; _j<%li; _j++) {\n",indent,mainVector->componentLength(i)); fprintf(outfile, "%s _active_%s_main[_%s_main_index_pointer + _j + %li] = _%s_main_old[_j+%li] + d%s_d%s[_j]*_step;\n", indent, fieldName, fieldName, previousComponents, fieldName, previousComponents, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); fprintf(outfile, "%s }\n",indent); } else { fprintf(outfile, "%s _active_%s_main[_%s_main_index_pointer + %li] = _%s_main_old[%li] + d%s_d%s*_step;\n", indent, fieldName, fieldName, previousComponents, fieldName, previousComponents, mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); } } if (crossVectorList.size() > 0) { fprintf(outfile, "\n"); fprintf(outfile, "%sif (_i%li<_main_lattice%li-1) {", indent, crossDimNumber(), crossDimNumber()); } for (list::const_iterator ppxmdsVector = crossVectorList.begin(); ppxmdsVector != crossVectorList.end(); ppxmdsVector++) { const char* cvName = (*ppxmdsVector)->name()->c_str(); fprintf(outfile, "\n"); for (long unsigned int i=0; i<(*ppxmdsVector)->nComponents(); i++) { fprintf(outfile, "%s_active_%s_%s[_%s_%s_index_pointer + %li + _%s_%s_ncomponents", indent, fieldName, cvName, fieldName, cvName, i, fieldName, cvName); for (long unsigned int i2=crossDimNumber()+1; i2componentName(i)->c_str(), simulation()->field()->geometry()->dimension(crossDimNumber())->name.c_str(), fieldName, crossDimNumber()); } } if (crossVectorList.size() > 0) { fprintf(outfile, "%s }\n\n", indent); for (list::const_iterator ppxmdsVector = crossVectorList.begin(); ppxmdsVector != crossVectorList.end(); ppxmdsVector++) { const char* cvName = (*ppxmdsVector)->name()->c_str(); fprintf(outfile, "\n"); fprintf(outfile, "%s for (unsigned long _i%li=0; _i%li<_%s_%s_ncomponents; _i%li++) {\n", indent, nDims+1, nDims+1, fieldName, cvName, nDims+1); fprintf(outfile, "%s _active_%s_%s[_%s_%s_index_pointer + _i%li] = _%s_%s_old[_i%li];\n", indent, fieldName, cvName, fieldName, cvName, nDims+1, fieldName, cvName, nDims+1); } fprintf(outfile, "%s }\n", indent); } simulation()->field()->closeLoops(outfile, 0, myTotalVectorsList); } else if (!strcmp(codeElement->c_str(), "functions")) { fprintf(outfile, "// ************** propagation code **************\n"); fprintf(outfile, "%s\n", nextNLPElement->c_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); nextNLPElement++; } else if (!strcmp(codeElement->c_str(), "moment_group")) { whichMG++; long unsigned int nDimsRemaining = simulation()->field()->geometry()->nDims(); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { nDimsRemaining--; } } if (nDimsRemaining>0) { deleteMGArrayList.push_back(whichMG); } fprintf(outfile, "// ************** integrate moment group code **************\n"); //setup defines for the integrate_moment_groups if they are arrays long unsigned int whichMoment=0; if (nDimsRemaining>0) { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++){ fprintf(outfile, "#define %s _img%li_array[_img%li_pointer+%li]\n", nextMomentName->c_str(), whichMG, whichMG, whichMoment); whichMoment++; } } fprintf(outfile, "\n"); //setup actual arrays for the integrate_moment_groups (MPI and non-MPI) if (nDimsRemaining>0) { fprintf(outfile, "complex *_img%li_array = (complex*)fftw_malloc(sizeof(complex)*%zi", whichMG, nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment==0){ fprintf(outfile, "*local_nx"); } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } fprintf(outfile, ");\n"); } else { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, "complex %s = rcomplex(0, 0);\n", nextMomentName->c_str()); } } fprintf(outfile, "\n"); //zero the arrays and setup a local environment for the sum if (nDimsRemaining>0) { fprintf(outfile, "for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment==0){ fprintf(outfile, "*local_nx"); } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } fprintf(outfile, "; _i0++) {\n"); fprintf(outfile, " _img%li_array[_i0] = rcomplex(0, 0);\n", whichMG); fprintf(outfile, "}\n"); } fprintf(outfile, "{\n"); // open loops simulation()->field()->openLoops(outfile, 0, myTotalVectorsList); // pointer definition if (nDimsRemaining>0) { fprintf(outfile, " long _img%li_pointer = ", whichMG); for (long unsigned int j=0; j::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); while (*nextIntegrateDimension) { nextIntegrateDimension++; whichMoment++; } fprintf(outfile, "_i%li", whichMoment); nextIntegrateDimension++; whichMoment++; for (long unsigned int k=0; kmomentNameList.size()); } // code fprintf(outfile, "%s\n", nextMGElement->integrateMomentGroupCode.c_str()); // close loops simulation()->field()->closeLoops(outfile, 0, myTotalVectorsList); fprintf(outfile, "}\n"); // if there was any integration, multiply by the relevant volume element if (nDimsRemaining < simulation()->field()->geometry()->nDims()) { if (nDimsRemaining > 0) { fprintf(outfile, "for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { if (whichMoment==0){ fprintf(outfile, "*local_nx"); } else { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } } whichMoment++; } } else { whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } } whichMoment=0; fprintf(outfile, "; _i0++) {\n"); fprintf(outfile, " _img%li_array[_i0] = _img%li_array[_i0]", whichMG, whichMG); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { fprintf(outfile, "*_%s_dx%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ";\n"); fprintf(outfile, " }\n"); } else { for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { whichMoment = 0; fprintf(outfile, " %s = %s", nextMomentName->c_str(), nextMomentName->c_str()); for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++){ if (*nextIntegrateDimension) { fprintf(outfile, "*_%s_dx%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ";\n"); } } } // if mpi and first variable integrated then mpireduce if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { if (* nextMGElement->integrateDimensionList.begin()) { if (nDimsRemaining>0) { fprintf(outfile, "\n complex *_temp_img%li_array = new complex[%zi", whichMG, nextMGElement->momentNameList.size()); whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "];\n"); fprintf(outfile, " MPI_Allreduce(_img%li_array, _temp_img%li_array, 2*%zi", whichMG, whichMG, nextMGElement->momentNameList.size()); whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, ", MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n"); fprintf(outfile, " for (long _i0=0; _i0<%zi", nextMGElement->momentNameList.size()); whichMoment=0; for (list::const_iterator nextIntegrateDimension = nextMGElement->integrateDimensionList.begin(); nextIntegrateDimension != nextMGElement->integrateDimensionList.end(); nextIntegrateDimension++) { if (!*nextIntegrateDimension) { fprintf(outfile, "*_%s_lattice%li", fieldName, whichMoment); } whichMoment++; } fprintf(outfile, "; _i0++) {\n"); fprintf(outfile, " _img%li_array[_i0] = _temp_img%li_array[_i0];\n }\n", whichMG, whichMG); fprintf(outfile, " delete[] _temp_img%li_array;\n", whichMG); } else { fprintf(outfile, "\n complex *_temp%li_mpireduce = new complex;\n", whichMG); for (list::const_iterator nextMomentName = nextMGElement->momentNameList.begin(); nextMomentName != nextMGElement->momentNameList.end(); nextMomentName++) { fprintf(outfile, " MPI_Allreduce(&%s, _temp%li_mpireduce, 2, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);\n", nextMomentName->c_str(), whichMG); fprintf(outfile, " %s = *_temp%li_mpireduce;\n", nextMomentName->c_str(), whichMG); } fprintf(outfile, "\n delete _temp%li_mpireduce;\n", whichMG); } } } fprintf(outfile, "\n"); fprintf(outfile, "// *********************************************************\n"); fprintf(outfile, "\n"); nextMGElement++; } else { throw xmdsException("Unknown code element in the integrate block!"); } } // delete any arrays that were generated for (list::const_iterator deleteMGArray = deleteMGArrayList.begin(); deleteMGArray != deleteMGArrayList.end(); deleteMGArray++) { fprintf(outfile, "fftw_free(_img%li_array);\n", *deleteMGArray); } // clean up mallocs fprintf(outfile, " fftw_free(_%s_main_old);\n", fieldName); for (list::const_iterator pXMLString = crossVectorNamesList()->begin(); pXMLString != crossVectorNamesList()->end(); pXMLString++) { fprintf(outfile, " fftw_free(_%s_%s_old);\n", fieldName, pXMLString->c_str()); } for (long unsigned int i=0; inComponents(); i++) { if (mainVector->componentLength(i)>1) { fprintf(outfile, "delete[] d%s_d%s;\n",mainVector->componentName(i)->c_str(), simulation()->parameters()->propDimName.c_str()); } } if ((simulation()->parameters()->stochastic)&&(!noNoises())) { fprintf(outfile, " delete[] _noises;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noises2;\n"); } fprintf(outfile, "\n"); } fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsIntegrateSIIP::writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const { if (debugFlag) { printf("xmdsIntegrateSIIP::writeSingleStepCode\n"); } const char *const propDim = simulation()->parameters()->propDimName.c_str(); const char* kStep=""; if (!constantK()) { kStep="_step/2"; } const char* generatorFlag=""; if ((simulation()->parameters()->stochastic)&&(!noNoises())) { if (stepCase==FULLSTEP) { generatorFlag=", 0"; } else if (stepCase==FIRST_HALFSTEP) { generatorFlag=", 1"; } else if (stepCase==SECOND_HALFSTEP) { generatorFlag=", 2"; } } const char* indent = " "; if (simulation()->parameters()->errorCheck) { indent = " "; } if (usesKOperators()) { fprintf(outfile, "%s_segment%li_k_propagate(%s);\n", indent, segmentNumber, kStep); fprintf(outfile, "\n"); } fprintf(outfile, "%s%s += _step/2;\n", indent, propDim); fprintf(outfile, "\n"); fprintf(outfile, "%s_segment%li_x_propagate(_step, cycle%s);\n", indent, segmentNumber, generatorFlag); fprintf(outfile, "\n"); if (usesKOperators()) { fprintf(outfile, "%s_segment%li_k_propagate(%s);\n", indent, segmentNumber, kStep); fprintf(outfile, "\n"); } fprintf(outfile, "%s%s += _step/2;\n", indent, propDim); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_integrate_siip.h0000644000076500000240000000556711033277417015152 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_integrate_siip.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_integrate_siip.h @brief More detailed explanation... */ #ifndef XMDS_INTEGRATE_SIIP_H #define XMDS_INTEGRATE_SIIP_H #include #include // ***************************************************************************** // ***************************************************************************** // xmdsIntegrateSIIP // ***************************************************************************** // ***************************************************************************** //! Class to integrate equations using the semi-implicit method in the interaction picture class xmdsIntegrateSIIP : public xmdsIntegrateIP, public xmdsIntegrateSI{ public : //! Constructor of xmdsIntegrateSIIP object xmdsIntegrateSIIP( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsIntegrateSIIP(); //! Processes an element void processElement( const Element *const yourElement); private : //! Write the integrate SIIP prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the integrate SIIP x-space prototypes to file void writexSpacePrototype( FILE *const outfile) const; //! Write the integrate SIIP routines to file void writeRoutines( FILE *const outfile) const; //! Write the main SIIP integrate routine to file void writeMainIntegrateRoutine( FILE *const outfile) const; //! Write the integrate SIIP x-space routine to file void writexSpaceRoutine( FILE *const outfile) const; //! Write the integrate SIIP single step code to file void writeSingleStepCode( FILE *const outfile, const stepCaseEnum& stepCase) const; }; #endif // XMDS_INTEGRATE_SIIP_H xmds-1.6.6/source/xmds_moment_group.cc0000644000076500000240000030533411033277417015010 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_moment_group.cc 1998 2008-04-22 03:49:50Z andyferris $ */ /*! @file xmds_moment_group.cc @brief Moment group handling classes and methods More detailed explanation... */ #include #include #include #include #include #include // ************************************************************************** // ************************************************************************** // xmdsMomentGroup public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsMomentGroups=0; //!< Number of xmds moment group objects // ************************************************************************** xmdsMomentGroup::xmdsMomentGroup( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const unsigned long& yourGroupNumber) : xmdsField(yourSimulation, yourVerboseMode), myGroupNumber(yourGroupNumber) { if (debugFlag) { nxmdsMomentGroups++; printf("xmdsMomentGroup::xmdsMomentGroup\n"); printf("nxmdsMomentGroups=%li\n", nxmdsMomentGroups); } nSamples=0; } // ************************************************************************** xmdsMomentGroup::~xmdsMomentGroup() { if (debugFlag) { nxmdsMomentGroups--; printf("xmdsMomentGroup::~xmdsMomentGroup\n"); printf("nxmdsMomentGroups=%li\n", nxmdsMomentGroups); } } // ************************************************************************** void xmdsMomentGroup::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsMomentGroup::processElement\n"); } if (verbose()) { printf("Processing moment group %li ...\n", myGroupNumber); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); unsigned long i; const NodeList* candidateElements; myPost2MainDimList.clear(); myMain2PostDimList.clear(); myRequiresIntegrations=0; myRequiresInitialisation=0; myPost2MainDimList.push_back(0); list rawSpaceList; rawSpaceList.push_back(0); dimensionStruct nextDimension; tempGeometry.addDimension(nextDimension); // ************************************ // find sampling element candidateElements = yourElement->getElementsByTagName("sampling", 0); if (candidateElements->length()==0) { throw xmdsException(yourElement, " element required"); } if (candidateElements->length()>1) { throw xmdsException(yourElement, "Multiple elements defined"); } const Element* samplingElement = dynamic_cast (candidateElements->item(0)); if (verbose()) { printf("Processing sampling element ...\n"); } // ************************************ // get sampling field geometery if (nDims>0) { // ************************************ // find sampling space list samplingSpaceList; getAssignmentBools(samplingElement, "fourier_space", 0, simulation()->field()->geometry()->nDims(), samplingSpaceList); if (samplingSpaceList.size() == 0) { printf("Sampling space for moment group #%li defaulting to x-space.\n", myGroupNumber+1); mySamplingSpace = 0; } else { mySamplingSpace = spaceList2ULong(samplingSpaceList); if (verbose()) { for (i=0; i::const_iterator pULong = mySamplingLatticeList.begin(); for (i=0; ifield()->geometry()->dimension(i)->lattice; const unsigned long latticeI=*pULong; if (verbose()) { printf("sampling lattice dimension #%li has N points = %li\n", i+1, *pULong); } if (latticeI>1) { nextDimension.name = simulation()->field()->geometry()->dimension(i)->name; nextDimension.lattice = latticeI; nextDimension.domain = simulation()->field()->geometry()->dimension(i)->domain; tempGeometry.addDimension(nextDimension); myPost2MainDimList.push_back(i); rawSpaceList.push_back(samplingSpace(i)); if (fieldLatticeI - latticeI*(fieldLatticeI/latticeI)) { sprintf(errorMessage(), "moments group sampling lattice dimension[%li] does not divide evenly into same field lattice", i+1); throw xmdsException(samplingElement, errorMessage()); } if (verbose()) { printf("sampling lattice dimension #%li divides same field lattice by %li\n", i+1, fieldLatticeI/latticeI); } } else if (latticeI==1) { // cross section if (verbose()) { printf("transverse dimension #%li will be cross-sectioned at ", i+1); if (samplingSpace(i)) { printf("k = 0\n"); } else { printf("x = domain centre\n"); } } } else { // integrate myRequiresIntegrations = 1; if (verbose()) { printf("transverse dimension #%li will be integrated in ", i+1); if (samplingSpace(i)) { printf(" fourier space\n"); } else { printf(" normal space\n"); } } } myMain2PostDimList.push_back(myPost2MainDimList.size()-1); pULong++; } } else {// No transverse dimensions, set sampling space to something safe mySamplingSpace=0; } myRawSpace=spaceList2ULong(rawSpaceList); // ************************************ // find vectors getAssignmentStrings(samplingElement, "vectors", 0, 0, myVectorNamesList); if (myVectorNamesList.size()==0) { // no vectors specified, therefore assume using only main vector myVectorNamesList.push_back("main"); } simulation()->field()->processVectors(myVectorNamesList, mySamplingSpace); // ************************************ // find sampling moments getAssignmentStrings(samplingElement, "moments", 1, 0, mySamplingMomentsList); if (mySamplingMomentsList.size()==0) { throw xmdsException(samplingElement, "No sampling moments defined!"); } if (verbose()) { for (list::const_iterator pXMLString = mySamplingMomentsList.begin(); pXMLString != mySamplingMomentsList.end(); pXMLString++) { printf("adding sampling moment '%s'\n", pXMLString->c_str()); } } // ************************************ // find type of output moments list outputType; bool outputForcedToTypeDouble = false; getAssignmentStrings(samplingElement, "type", false, 1, outputType); if (outputType.size()==1) { if (strcasecmp(outputType.front().c_str(), "double")==0) { outputForcedToTypeDouble = true; } else if (strcasecmp(outputType.front().c_str(), "complex")!=0) { sprintf(errorMessage(), "Type '%s' in type element is not a valid type. The valid types are 'double' or 'complex'", outputType.front().c_str()); throw xmdsException(samplingElement, errorMessage()); } } // ************************************ // find sampling code mySamplingCode=*samplingElement->textContent(0); // check for non-white space charaters in code: if (mySamplingCode.isAllWhiteSpace()) { throw xmdsException(samplingElement, "No sampling code defined!"); } if (verbose()) { printf("moment group sampling code loaded\n"); } // ************************************ // find post_propagation element candidateElements = yourElement->getElementsByTagName("post_propagation", 0); if (candidateElements->length()>1) { throw xmdsException(yourElement, "Multiple elements defined"); } else if (candidateElements->length()==1) { if (outputForcedToTypeDouble) { throw xmdsException(samplingElement, "You cannot use both double in the element and use a element in the same output group."); } // there is a post_propagation element myRequiresInitialisation=1; const Element* postPropagationElement = dynamic_cast (candidateElements->item(0)); if (verbose()) { printf("Processing post_propagation element ...\n"); } // ************************************ // find post space list aSpaceList; getAssignmentBools(postPropagationElement, "fourier_space", 0, myPost2MainDimList.size(), aSpaceList); if (aSpaceList.size() == 0) { printf("In moment group #%li, using sampling space for space of remaining post propagation dimensions.\n", myGroupNumber+1); for (i=0; i> i)&1) { printf("post propagation will be performed with remaining dimension #%li in fourier space\n", i+1); } else { printf("post propagation will be performed with remaining dimension #%li in normal space\n", i+1); } } } // ************************************ // find post moments getAssignmentStrings(postPropagationElement, "moments", 1, 0, myPostMomentsList); if (myPostMomentsList.size()==0) { throw xmdsException(postPropagationElement, "No post propagation moments defined!"); } if (verbose()) { for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { printf("post propagation moment '%s' added\n", pXMLString->c_str()); } } // ************************************ // find post code myPostCode=*postPropagationElement->textContent(0); // check for non-white space charaters in code: if (myPostCode.isAllWhiteSpace()) { throw xmdsException(postPropagationElement, "No post propagation code defined!"); } if (verbose()) { printf("moment group post propagation code loaded\n"); } } else { // no post_propagation element // need to assign across raw space and moments myPostSpace = myRawSpace; myPostMomentsList=mySamplingMomentsList; } char tempName[256]; sprintf(tempName, "mg%li", myGroupNumber); setName((XMLString) tempName); // add moment group vectors // determine if raw sample vector needs to be complex complexRawVector = 0; for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { const xmdsVector* nextVector; simulation()->field()->getVector(*pXMLString, nextVector); complexRawVector |= (nextVector->vectorType()==COMPLEX); } complexRawVector |= (myPostSpace != myRawSpace); if (outputForcedToTypeDouble) complexRawVector = false; xmdsVector* nextVector = createxmdsVector(); nextVector->setName("raw"); myPostProcessingVectorNamesList.push_back("raw"); if (complexRawVector) { nextVector->setVectorType(COMPLEX); } else { nextVector->setVectorType(DOUBLE); } nextVector->setInitialSpace(myRawSpace); nextVector->setComponents(mySamplingMomentsList); nextVector = createxmdsVector(); nextVector->setName("fullstep"); myPostProcessingVectorNamesList.push_back("fullstep"); nextVector->setVectorType(DOUBLE); nextVector->setInitialSpace(myPostSpace); nextVector->setComponents(myPostMomentsList); if (simulation()->parameters()->stochastic) { nextVector = createxmdsVector(); nextVector->setName("fullstep_sd"); myPostProcessingVectorNamesList.push_back("fullstep_sd"); nextVector->setVectorType(DOUBLE); nextVector->setInitialSpace(myPostSpace); nextVector->setComponents(myPostMomentsList); } if (simulation()->parameters()->errorCheck) { nextVector = createxmdsVector(); nextVector->setName("halfstep"); myPostProcessingVectorNamesList.push_back("halfstep"); nextVector->setVectorType(DOUBLE); nextVector->setInitialSpace(myPostSpace); nextVector->setComponents(myPostMomentsList); if (simulation()->parameters()->stochastic) { nextVector = createxmdsVector(); nextVector->setName("halfstep_sd"); myPostProcessingVectorNamesList.push_back("halfstep_sd"); nextVector->setVectorType(DOUBLE); nextVector->setInitialSpace(myPostSpace); nextVector->setComponents(myPostMomentsList); } } processVectors(myPostProcessingVectorNamesList, myPostSpace); } // ************************************************************************** void xmdsMomentGroup::addSamples( const unsigned long& n2add) const { if (debugFlag) { printf("xmdsMomentGroup::addSamples\n"); } if (verbose()) printf("Adding %li samples to moment group %li\n", n2add, myGroupNumber+1); nSamples += n2add; } // ************************************************************************** void xmdsMomentGroup::finaliseGeometry() { if (debugFlag) { printf("xmdsMomentGroup::finaliseGeometry\n"); } dimensionStruct firstDimension; firstDimension.name = simulation()->parameters()->propDimName; firstDimension.lattice = nSamples; firstDimension.domain.begin = "0"; firstDimension.domain.end = "1"; tempGeometry.setDimension(0, firstDimension); setGeometry(tempGeometry); } // ************************************************************************** bool xmdsMomentGroup::requiresIntegrations() const { if (debugFlag) { printf("xmdsMomentGroup::requiresIntegrations\n"); } return myRequiresIntegrations; } // ************************************************************************** bool xmdsMomentGroup::requiresInitialisation() const { if (debugFlag) { printf("xmdsMomentGroup::requiresInitialisation\n"); } return myRequiresInitialisation; } // ************************************************************************** bool xmdsMomentGroup::needscomplexRawVector() const { if (debugFlag) { printf("xmdsMomentGroup::needscomplexRawVector\n"); } return complexRawVector; } // ************************************************************************** // ************************************************************************** // xmdsMomentGroup private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsMomentGroup::writeDefines( FILE *const outfile) const { if (debugFlag) { printf("xmdsMomentGroup::writeDefines\n"); } if (verbose()) { printf("Writing moment group %li defines ...\n", myGroupNumber); } const char* mgFieldName = name()->c_str(); fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// moment group %li defines\n", myGroupNumber); fprintf(outfile, "\n"); fprintf(outfile, "#define _%s_ndims %li\n", mgFieldName, geometry()->nDims()); fprintf(outfile, "#define _%s_lattice0 %li\n", mgFieldName, geometry()->dimension(0)->lattice); fprintf(outfile, "#define _%s_dx0 ((_%s_x0[_%s_lattice0-1] - _%s_x0[0])/(double)%li)\n", mgFieldName, mgFieldName, mgFieldName, mgFieldName, geometry()->dimension(0)->lattice); fprintf(outfile, "#define _%s_dk0 (2*M_PI/(_%s_x0[_%s_lattice0-1] - _%s_x0[0]))\n", mgFieldName, mgFieldName, mgFieldName, mgFieldName); for (unsigned long i=1; inDims(); i++) { const dimensionStruct* dimI = geometry()->dimension(i); fprintf(outfile, "#define _%s_lattice%li %li\n", mgFieldName, i, dimI->lattice); fprintf(outfile, "#define _%s_xmin%li static_cast(%s)\n", mgFieldName, i, dimI->domain.begin.c_str()); fprintf(outfile, "#define _%s_dx%li ((static_cast(%s) - static_cast(%s))/(double)%li)\n", mgFieldName, i, dimI->domain.end.c_str(), dimI->domain.begin.c_str(), dimI->lattice); fprintf(outfile, "#define _%s_dk%li (2*M_PI/(static_cast(%s) - static_cast(%s)))\n", mgFieldName, i, dimI->domain.end.c_str(), dimI->domain.begin.c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "#define _%s_raw_ncomponents %li\n", mgFieldName, (long)mySamplingMomentsList.size()); fprintf(outfile, "#define _%s_fullstep_ncomponents %li\n", mgFieldName, (long)myPostMomentsList.size()); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "#define _%s_halfstep_ncomponents %li\n", mgFieldName, (long)myPostMomentsList.size()); } if (simulation()->parameters()->stochastic) { fprintf(outfile, "#define _%s_fullstep_sd_ncomponents %li\n", mgFieldName, (long)myPostMomentsList.size()); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "#define _%s_halfstep_sd_ncomponents %li\n", mgFieldName, (long)myPostMomentsList.size()); } } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsMomentGroup::writeGlobals( FILE *const outfile) const { if (debugFlag) { printf("xmdsMomentGroup::writeGlobals\n"); } if (verbose()) { printf("Writing moment group %li globals ...\n", myGroupNumber); } const char* mgFieldName = name()->c_str(); fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// moment group %li globals\n", myGroupNumber); fprintf(outfile, "\n"); xmdsField::writeGlobals(outfile); fprintf(outfile, "long _%s_sample_pointer;\n", mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, "double *_%s_x0 = new double[_%s_lattice0];\n", mgFieldName, mgFieldName); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsMomentGroup::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsMomentGroup::writePrototypes\n"); } if (verbose()) { printf("Writing moment group %li prototypes ...\n", myGroupNumber); } const char* mgFieldName = name()->c_str(); fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// moment group %li prototypes\n", myGroupNumber); fprintf(outfile, "\n"); xmdsField::writePrototypes(outfile); fprintf(outfile, "void _%s_sample();\n", mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, "void _%s_process();\n", mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, "void _%s_write_out(\n", mgFieldName); fprintf(outfile, " FILE*);\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsMomentGroup::writeRoutines(FILE *const outfile) const { if (debugFlag) { printf("xmdsMomentGroup::writeRoutines\n"); } const unsigned long nDims = simulation()->field()->geometry()->nDims(); const unsigned long myNDims = geometry()->nDims(); const char* fieldName = simulation()->field()->name()->c_str(); const char* mgFieldName = name()->c_str(); unsigned long i; unsigned long j; if (verbose()) { printf("Writing moment group %s routines ...\n", mgFieldName); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// moment group %li routines\n", myGroupNumber); fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "\n"); xmdsField::writeRoutines(outfile); // *************************************** // ******** sample routine ************* // *************************************** fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _%s_sample() {\n", mgFieldName); fprintf(outfile, "\n"); for (list::const_iterator pXMLString = mySamplingMomentsList.begin(); pXMLString != mySamplingMomentsList.end(); pXMLString++) { if (complexRawVector) { fprintf(outfile, "complex %s;\n", pXMLString->c_str()); } else { fprintf(outfile, "double %s;\n", pXMLString->c_str()); } } fprintf(outfile, "\n"); simulation()->field()->vectors2space(outfile, mySamplingSpace, myVectorNamesList, ""); list::const_iterator psamplingLatticeI = mySamplingLatticeList.begin(); bool swapped=false; if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic){ if (samplingSpace(0)&samplingSpace(1)) { swapped=true; } } if (!myRequiresIntegrations&(simulation()->parameters()->stochastic|(!simulation()->parameters()->usempi))) { { fprintf(outfile, "unsigned long _%s_raw_index_pointer=_%s_sample_pointer", mgFieldName, mgFieldName); for (i=1; iparameters()->usempi&!simulation()->parameters()->stochastic) { if (swapped) { int firstlattice = *psamplingLatticeI; psamplingLatticeI++; int secondlattice = *psamplingLatticeI; psamplingLatticeI++; if (secondlattice==0) { // integration over this dimension for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "unsigned long _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double k%s = local_y_start_after_transpose*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName); fprintf(outfile, "if (k%s>((_%s_lattice1-1)/2 + 0.1)*_%s_dk1)\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName, fieldName); fprintf(outfile, " k%s -= _%s_lattice1*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName, fieldName); fprintf(outfile, "\n"); fprintf(outfile, "for (long _i1=0; _i1::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "long _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double k%s = 0;\n", simulation()->field()->geometry()->dimension(1)->name.c_str()); fprintf(outfile, "unsigned long _i1 = 0;\n"); fprintf(outfile, "if (local_y_start_after_transpose==0) {\n"); } else { // normal sampling fprintf(outfile, "long first_x_pointer, last_x_pointer;\n"); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "long _%s_%s_index_pointer;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, "double k%s;\n\n", simulation()->field()->geometry()->dimension(1)->name.c_str()); fprintf(outfile, "if (local_y_start_after_transpose<(_%s_lattice%li-1)/2+1) {\n", mgFieldName, main2PostDim(1)); fprintf(outfile, " first_x_pointer=local_y_start_after_transpose;\n"); fprintf(outfile, " k%s=local_y_start_after_transpose*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, " }\n"); fprintf(outfile, "else if (local_y_start_after_transpose>(_%s_lattice%li-1)/2+_%s_lattice1-_%s_lattice%li) {\n" , mgFieldName, main2PostDim(1), fieldName, mgFieldName, main2PostDim(1)); fprintf(outfile, " first_x_pointer=local_y_start_after_transpose-_%s_lattice1+_%s_lattice%li;\n", fieldName, mgFieldName, main2PostDim(1)); fprintf(outfile, " k%s=(local_y_start_after_transpose-_%s_lattice1)*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName, fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, " }\n"); fprintf(outfile, "else {\n"); fprintf(outfile, " first_x_pointer=(_%s_lattice%li-1)/2+1;\n", mgFieldName, main2PostDim(1)); fprintf(outfile, " k%s=((_%s_lattice%li-1)/2-_%s_lattice%li+1)*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), mgFieldName, main2PostDim(1), mgFieldName, main2PostDim(1), fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer=(first_x_pointer+_%s_lattice1-_%s_lattice%li-local_y_start_after_transpose)", fieldName, pXMLString->c_str(), fieldName, mgFieldName, main2PostDim(1)); fprintf(outfile, "*_%s_lattice0", fieldName); for (i=2; ic_str()); } fprintf(outfile, " }\n\n"); fprintf(outfile, "if (local_y_start_after_transpose+local_ny_after_transpose-1<(_%s_lattice%li-1)/2+1)\n", mgFieldName, main2PostDim(1)); fprintf(outfile, " last_x_pointer=local_y_start_after_transpose+local_ny_after_transpose-1;\n"); fprintf(outfile, "else if (local_y_start_after_transpose+local_ny_after_transpose-1>(_%s_lattice%li-1)/2+_%s_lattice1-_%s_lattice%li)\n" , mgFieldName, main2PostDim(1), fieldName, mgFieldName, main2PostDim(1)); fprintf(outfile, " last_x_pointer=local_y_start_after_transpose+local_ny_after_transpose-1-_%s_lattice1+_%s_lattice%li;\n", fieldName, mgFieldName, main2PostDim(1)); fprintf(outfile, "else \n"); fprintf(outfile, " last_x_pointer=(_%s_lattice%li-1)/2;\n\n", mgFieldName, main2PostDim(1)); fprintf(outfile, "for (long _i1=first_x_pointer; _i1field()->geometry()->dimension(0)->name.c_str(); fprintf(outfile, " "); fprintf(outfile, "double k%s = 0;\n", dimName); fprintf(outfile, "\n"); if (firstlattice==0) { // integration over this dimension fprintf(outfile, " "); fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_lattice0; _i0++) {\n", fieldName); fprintf(outfile, "\n"); } else if (firstlattice==1) { // cross-section in this dimension fprintf(outfile, " "); fprintf(outfile, "unsigned long _i0 = 0;\n"); } else { // normal sampling fprintf(outfile, " "); fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_lattice%li; _i0++) {\n", mgFieldName, main2PostDim(0)); fprintf(outfile, "\n"); } for (i=2; ifield()->geometry()->dimension(i)->name.c_str(); for (j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), i, fieldName, pXMLString->c_str()); for (j=i+1; jfield()->geometry()->dimension(0)->name.c_str(); if (*psamplingLatticeI==0) { // integration over this dimension for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "unsigned long _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); if (samplingSpace(0)) { fprintf(outfile, "double k%s = local_x_start*_%s_dk0;\n", dimName, fieldName); fprintf(outfile, "if (k%s>((_%s_lattice0-1)/2 + 0.1)*_%s_dk0)\n", dimName, fieldName, fieldName); fprintf(outfile, " k%s -= _%s_lattice0*_%s_dk0;\n", dimName, fieldName, fieldName); } else { fprintf(outfile, "double %s = _%s_xmin0 + local_x_start*_%s_dx0;\n", dimName, fieldName, fieldName); } fprintf(outfile, "\n"); fprintf(outfile, "for (long _i0=0; _i0::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "long _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } if (!myRequiresIntegrations) { fprintf(outfile, "unsigned long _%s_raw_index_pointer=_%s_sample_pointer", mgFieldName, mgFieldName); for (i=1; i0)&(_i0::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer += _i0*_%s_%s_ncomponents", fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); for (j=1; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "long _%s_%s_index_pointer;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, "double k%s;\n\n", dimName); fprintf(outfile, "if (local_x_start<(_%s_lattice%li-1)/2+1) {\n", mgFieldName, main2PostDim(0)); fprintf(outfile, " first_x_pointer=local_x_start;\n"); fprintf(outfile, " k%s=local_x_start*_%s_dk0;\n", dimName, fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, " }\n"); fprintf(outfile, "else if (local_x_start>(_%s_lattice%li-1)/2+_%s_lattice0-_%s_lattice%li) {\n" , mgFieldName, main2PostDim(0), fieldName, mgFieldName, main2PostDim(0)); fprintf(outfile, " first_x_pointer=local_x_start-_%s_lattice0+_%s_lattice%li;\n", fieldName, mgFieldName, main2PostDim(0)); fprintf(outfile, " k%s=(local_x_start-_%s_lattice0)*_%s_dk0;\n", dimName, fieldName, fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, " }\n"); fprintf(outfile, "else {\n"); fprintf(outfile, " first_x_pointer=(_%s_lattice%li-1)/2+1;\n", mgFieldName, main2PostDim(0)); fprintf(outfile, " k%s=((_%s_lattice%li-1)/2-_%s_lattice%li+1)*_%s_dk0;\n", dimName, mgFieldName, main2PostDim(0), mgFieldName, main2PostDim(0), fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " _%s_%s_index_pointer=(first_x_pointer+_%s_lattice0-_%s_lattice%li-local_x_start)", fieldName, pXMLString->c_str(), fieldName, mgFieldName, main2PostDim(0)); for (i=1; ic_str()); } fprintf(outfile, " }\n\n"); fprintf(outfile, "if (local_x_start+local_nx-1<(_%s_lattice%li-1)/2+1)\n", mgFieldName, main2PostDim(0)); fprintf(outfile, " last_x_pointer=local_x_start+local_nx-1;\n"); fprintf(outfile, "else if (local_x_start+local_nx-1>(_%s_lattice%li-1)/2+_%s_lattice0-_%s_lattice%li)\n" , mgFieldName, main2PostDim(0), fieldName, mgFieldName, main2PostDim(0)); fprintf(outfile, " last_x_pointer=local_x_start+local_nx-1-_%s_lattice0+_%s_lattice%li;\n", fieldName, mgFieldName, main2PostDim(0)); fprintf(outfile, "else \n"); fprintf(outfile, " last_x_pointer=(_%s_lattice%li-1)/2;\n\n", mgFieldName, main2PostDim(0)); if (!myRequiresIntegrations) { fprintf(outfile, "unsigned long _%s_raw_index_pointer=_%s_sample_pointer", mgFieldName, mgFieldName); for (i=1; i::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "unsigned long _%s_%s_index_pointer=(first_x_pointer*(_%s_lattice0/_%s_lattice1)-local_x_start)" , fieldName, pXMLString->c_str(), fieldName, mgFieldName); for (i=1; ic_str()); } fprintf(outfile, "\n"); fprintf(outfile, "double %s = _%s_xmin0 + first_x_pointer*_%s_dx1;\n", dimName, fieldName, mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, "for (long _i0=first_x_pointer; _i0field()->geometry()->dimension(i)->name.c_str(); for (j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), i, fieldName, pXMLString->c_str()); for (j=i+1; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, "unsigned long _%s_%s_index_pointer=0;\n", fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); for (i=0; ifield()->geometry()->dimension(i)->name.c_str(); for (j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), i, fieldName, pXMLString->c_str()); for (j=i+1; j::const_iterator pXMLString = mySamplingMomentsList.begin(); pXMLString != mySamplingMomentsList.end(); pXMLString++) { for (j=0; jc_str()); j=0; psamplingLatticeI = mySamplingLatticeList.begin(); while (jc_str()); i++; } // close nested loops if (!myRequiresIntegrations&!swapped) { if (nDims>0) { for (i=0; i::const_reverse_iterator psamplingLatticeIr = mySamplingLatticeList.rbegin(); if (nDims>0) { if (swapped) { for (i=nDims; i>2; i--) { const char* dimName = simulation()->field()->geometry()->dimension(i-1)->name.c_str(); fprintf(outfile, "\n"); if (*psamplingLatticeIr==0) { // integration if (i==nDims) { for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } if (samplingSpace(i-1)) { for (unsigned long j=0; j((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li)\n", dimName, fieldName, i-1, fieldName, i-1); for (unsigned long j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, i-1); if (!samplingSpace(i-1)) { fprintf(outfile, "-_i%li", i-1); } if (!(i==nDims)) { fprintf(outfile, "-1"); } fprintf(outfile, ")"); for (j=i; jc_str()); } } else { // normal sampling if (samplingSpace(i-1)) { // narrow k-space window if (i==nDims) { for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (j=0; j((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li) {\n", dimName, mgFieldName, main2PostDim(i-1), fieldName, i-1); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, i-1, mgFieldName, main2PostDim(i-1)); for (j=i; jc_str()); } for (j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, i-1, mgFieldName, main2PostDim(i-1)); if (!(i==nDims)) { fprintf(outfile, "-1"); } fprintf(outfile, ")"); for (j=i; jc_str()); } fprintf(outfile, "\n"); for (j=0; jfield()->geometry()->dimension(0)->name.c_str(); fprintf(outfile, "\n"); if (*psamplingLatticeIr==0) { // integration if (2==nDims) { for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "_%s_%s_index_pointer += _%s_%s_ncomponents;\n", fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (unsigned long j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "k%s += _%s_dk0;\n", dimName, fieldName); for (unsigned long j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "if (k%s>((_%s_lattice0-1)/2 + 0.1)*_%s_dk0)\n", dimName, fieldName, fieldName); for (unsigned long j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, " k%s -= _%s_lattice0*_%s_dk0;\n", dimName, fieldName, fieldName); } else if (*psamplingLatticeIr==1) { // cross-section for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "_%s_%s_index_pointer += (_%s_lattice0", fieldName, pXMLString->c_str(), fieldName); if (!(2==nDims)) { fprintf(outfile, "-1"); } fprintf(outfile, ")"); for (j=2; jc_str()); } } else { // normal sampling // narrow k-space window if (2==nDims) { for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "_%s_%s_index_pointer += _%s_%s_ncomponents;\n", fieldName, pXMLString->c_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "k%s += _%s_dk0;\n", dimName, fieldName); for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "if (k%s>((_%s_lattice%li-1)/2 + 0.1)*_%s_dk0) {\n", dimName, mgFieldName, main2PostDim(0), fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, " _%s_%s_index_pointer += (_%s_lattice0-_%s_lattice%li)", fieldName, pXMLString->c_str(), fieldName, mgFieldName, main2PostDim(0)); for (j=2; jc_str()); } for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, " k%s -= _%s_lattice%li*_%s_dk0;\n", dimName, mgFieldName, main2PostDim(0), fieldName); for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, " }\n"); } if (!(*psamplingLatticeIr==1)) { // if not cross-section for (j=0; j<2; j++) { fprintf(outfile, " "); } fprintf(outfile, "}\n"); } psamplingLatticeIr--; fprintf(outfile, "\n"); if (*psamplingLatticeIr==0) { // integration for (unsigned long j=0; j<1; j++) { fprintf(outfile, " "); } fprintf(outfile, "k%s += _%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName); for (unsigned long j=0; j<1; j++) { fprintf(outfile, " "); } fprintf(outfile, "if (k%s>((_%s_lattice1-1)/2 + 0.1)*_%s_dk1)\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName, fieldName); for (unsigned long j=0; j<1; j++) { fprintf(outfile, " "); } fprintf(outfile, " k%s -= _%s_lattice1*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName, fieldName); } else if (*psamplingLatticeIr==1) { // cross-section for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " "); fprintf(outfile, "_%s_%s_index_pointer += (_%s_lattice1", fieldName, pXMLString->c_str(), fieldName); fprintf(outfile, "-1)"); fprintf(outfile, "*_%s_lattice0", fieldName); for (j=2; jc_str()); } } else { // normal sampling // narrow k-space window fprintf(outfile, " "); fprintf(outfile, "k%s += _%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), fieldName); fprintf(outfile, " "); fprintf(outfile, "if (k%s>((_%s_lattice%li-1)/2 + 0.1)*_%s_dk1) {\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), mgFieldName, main2PostDim(1), fieldName); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { fprintf(outfile, " "); fprintf(outfile, " _%s_%s_index_pointer += (_%s_lattice1-_%s_lattice%li)", fieldName, pXMLString->c_str(), fieldName, mgFieldName, main2PostDim(1)); fprintf(outfile, "*_%s_lattice0", fieldName); for (j=2; jc_str()); } fprintf(outfile, " "); fprintf(outfile, " k%s -= _%s_lattice%li*_%s_dk1;\n", simulation()->field()->geometry()->dimension(1)->name.c_str(), mgFieldName, main2PostDim(1), fieldName); fprintf(outfile, " "); fprintf(outfile, " }\n"); } // even if cross-section fprintf(outfile, " "); fprintf(outfile, "}\n"); } else { for (i=nDims; i>0; i--) { const char* dimName = simulation()->field()->geometry()->dimension(i-1)->name.c_str(); fprintf(outfile, "\n"); if (*psamplingLatticeIr==0) { // integration if (i==nDims) { for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } if (samplingSpace(i-1)) { for (unsigned long j=0; j((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li)\n", dimName, fieldName, i-1, fieldName, i-1); for (unsigned long j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, i-1); if (!samplingSpace(i-1)) { fprintf(outfile, "-_i%li", i-1); } if (!(i==nDims)) { fprintf(outfile, "-1"); } fprintf(outfile, ")"); for (j=i; jc_str()); } } else { // normal sampling if (samplingSpace(i-1)) { // narrow k-space window if (i==nDims) { for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, pXMLString->c_str()); } fprintf(outfile, "\n"); } for (j=0; j((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li) {\n", dimName, mgFieldName, main2PostDim(i-1), fieldName, i-1); for (list::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, i-1, mgFieldName, main2PostDim(i-1)); for (j=i; jc_str()); } for (j=0; j::const_iterator pXMLString = myVectorNamesList.begin(); pXMLString != myVectorNamesList.end(); pXMLString++) { for (j=0; jc_str(), fieldName, i-1, mgFieldName, main2PostDim(i-1)); if (!(i==nDims)) { fprintf(outfile, "-1"); } fprintf(outfile, ")"); for (j=i; jc_str()); } fprintf(outfile, "\n"); for (j=0; jparameters()->usempi&!simulation()->parameters()->stochastic) { // even if cross-section fprintf(outfile, " "); fprintf(outfile, "}\n"); } else if (!(*psamplingLatticeIr==1)) { // if not cross-section for (j=0; jparameters()->propDimName.c_str()); fprintf(outfile, "\n"); if (simulation()->parameters()->nPaths=="1") { if (simulation()->parameters()->usempi) { fprintf(outfile, "printf(\"Rank[%%i] Sampled field (for moment group #%li) at %s = %%e\\n\", rank, %s);\n", myGroupNumber+1, simulation()->parameters()->propDimName.c_str(), simulation()->parameters()->propDimName.c_str()); } else { fprintf(outfile, "printf(\"Sampled field (for moment group #%li) at %s = %%e\\n\", %s);\n", myGroupNumber+1, simulation()->parameters()->propDimName.c_str(), simulation()->parameters()->propDimName.c_str()); } fprintf(outfile, "fflush(stdout);\n"); fprintf(outfile, "\n"); } fprintf(outfile, "_%s_sample_pointer++;\n", mgFieldName); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); // *************************************** // ******** process routine ************* // *************************************** fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _%s_process() {\n", mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, "double *_to_field;\n"); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "double *_to_field_sd;\n"); } for (list::const_iterator pXMLString = mySamplingMomentsList.begin(); pXMLString != mySamplingMomentsList.end(); pXMLString++) { if (complexRawVector) { fprintf(outfile, "complex %s;\n", pXMLString->c_str()); } else { fprintf(outfile, "double %s;\n", pXMLString->c_str()); } } if (myPostCode.length()>0) { for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { fprintf(outfile, "double %s;\n", pXMLString->c_str()); } } if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { if (complexRawVector) { fprintf(outfile, "complex* _temp_vector;\n"); } else { fprintf(outfile, "double* _temp_vector;\n"); } fprintf(outfile, "unsigned long _length;\n\n"); fprintf(outfile, "_length = _%1$s_size/_%1$s_lattice0*_%1$s_raw_ncomponents*_%1$s_sample_pointer;\n", mgFieldName); fprintf(outfile, "if (rank==0)\n"); if (complexRawVector) { fprintf(outfile, " _temp_vector = new complex[_length];\n"); } else { fprintf(outfile, " _temp_vector = new double[_length];\n"); } fprintf(outfile, "else\n" " _temp_vector = NULL;\n"); if (complexRawVector) { fprintf(outfile, "MPI_Reduce(_%s_raw, _temp_vector, 2*_length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n\n", mgFieldName); } else { fprintf(outfile, "MPI_Reduce(_%s_raw, _temp_vector, _length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n\n", mgFieldName); } fprintf(outfile, "if (rank == 0) {\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<_length; _i0++)\n"); fprintf(outfile, " _%s_raw[_i0]=_temp_vector[_i0];\n", mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, "delete[] _temp_vector;\n\n"); fprintf(outfile, "}\n"); } fprintf(outfile, "\n"); /* if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "if (rank==0) {\n"); } */ // assign pointers if (simulation()->parameters()->errorCheck) { fprintf(outfile, "if (_half_step) {\n"); fprintf(outfile, " _to_field = _%s_halfstep;\n", mgFieldName); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, " _to_field_sd = _%s_halfstep_sd;\n", mgFieldName); } fprintf(outfile, " }\n"); fprintf(outfile, "else {\n"); fprintf(outfile, " _to_field = _%s_fullstep;\n", mgFieldName); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, " _to_field_sd = _%s_fullstep_sd;\n", mgFieldName); } fprintf(outfile, " }\n"); } else { fprintf(outfile, "_to_field = _%s_fullstep;\n", mgFieldName); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "_to_field_sd = _%s_fullstep_sd;\n", mgFieldName); } } fprintf(outfile, "\n"); vectors2space(outfile, myPostSpace, myPostProcessingVectorNamesList, ""); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) fprintf(outfile, "if (rank != 0) return;\n"); fprintf(outfile, "unsigned long _%s_raw_index_pointer=0;\n", mgFieldName); fprintf(outfile, "unsigned long _%s_processed_index_pointer=0;\n", mgFieldName); fprintf(outfile, "\n"); if (postSpace(0)) { fprintf(outfile, "double k%s = 0;\n", geometry()->dimension(0)->name.c_str()); } fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_sample_pointer; _i0++) {\n", mgFieldName); fprintf(outfile, "\n"); if (!postSpace(0)) { fprintf(outfile, "%s = _%s_x0[_i0];\n", geometry()->dimension(0)->name.c_str(), mgFieldName); } fprintf(outfile, "\n"); for (i=1; idimension(i)->name.c_str()); } else { fprintf(outfile, "double %s = _%s_xmin%li;\n", geometry()->dimension(i)->name.c_str(), mgFieldName, i); } fprintf(outfile, "\n"); for (unsigned long j=0; j::const_iterator pXMLString = mySamplingMomentsList.begin(); pXMLString != mySamplingMomentsList.end(); pXMLString++) { for (j=0; jc_str(), mgFieldName, mgFieldName, i); i++; } fprintf(outfile, "\n"); char indent[64]; for (i=0; i::const_iterator pXMLString = mySamplingMomentsList.begin(); pXMLString != mySamplingMomentsList.end(); pXMLString++) { if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "%s_to_field[_%s_processed_index_pointer + %li] += %s%s;\n", indent, mgFieldName, i, pXMLString->c_str(), dotre); fprintf(outfile, "%s_to_field_sd[_%s_processed_index_pointer + %li] += %s%s*%s%s;\n", indent, mgFieldName, i, pXMLString->c_str(), dotre, pXMLString->c_str(), dotre); } else { fprintf(outfile, "%s_to_field[_%s_processed_index_pointer + %li] = %s%s;\n", indent, mgFieldName, i, pXMLString->c_str(), dotre); } i++; } } else { fprintf(outfile, "// ********** Post propagation code *************\n"); fprintf(outfile, "%s\n", myPostCode.c_str()); fprintf(outfile, "// **********************************************\n"); for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "%s_to_field[_%s_processed_index_pointer + %li] += %s;\n", indent, mgFieldName, i, pXMLString->c_str()); fprintf(outfile, "%s_to_field_sd[_%s_processed_index_pointer + %li] += %s*%s;\n", indent, mgFieldName, i, pXMLString->c_str(), pXMLString->c_str()); } else fprintf(outfile, "%s_to_field[_%s_processed_index_pointer + %li] = %s;\n", indent, mgFieldName, i, pXMLString->c_str()); i++; } } fprintf(outfile, "\n"); fprintf(outfile, "%s_%s_raw_index_pointer += _%s_raw_ncomponents;\n", indent, mgFieldName, mgFieldName); fprintf(outfile, "%s_%s_processed_index_pointer += _%s_fullstep_ncomponents;\n", indent, mgFieldName, mgFieldName); for (i=myNDims; i>1; i--) { fprintf(outfile, "\n"); if (postSpace(i-1)) { for (unsigned long j=0; jdimension(i-1)->name.c_str(), mgFieldName, i-1); for (unsigned long j=0; j((_%s_lattice%li-1)/2 + 0.1)*_%s_dk%li)\n", geometry()->dimension(i-1)->name.c_str(), mgFieldName, i-1, mgFieldName, i-1); for (unsigned long j=0; jdimension(i-1)->name.c_str(), mgFieldName, i-1, mgFieldName, i-1); } else { for (unsigned long j=0; jdimension(i-1)->name.c_str(), mgFieldName, i-1); } for (unsigned long j=0; jdimension(0)->name.c_str(), mgFieldName); fprintf(outfile, " if (k%s>((_%s_lattice0-1)/2 + 0.1)*_%s_dk0)\n", geometry()->dimension(0)->name.c_str(), mgFieldName, mgFieldName); fprintf(outfile, " k%s -= _%s_lattice0*_%s_dk0;\n", geometry()->dimension(0)->name.c_str(), mgFieldName, mgFieldName); } fprintf(outfile, " }\n"); /* if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) fprintf(outfile, " }\n"); */ fprintf(outfile, "}\n"); fprintf(outfile, "\n"); // *************************************** // ******** write_out routine ********** // *************************************** fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _%s_write_out(\n", mgFieldName); fprintf(outfile, " FILE *_outfile) {\n"); fprintf(outfile, "\n"); fprintf(outfile, "if (_%s_sample_pointer == 0)\n return;\n\n", mgFieldName); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "double _max_step_error=0;\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->nPaths != "1" || simulation()->parameters()->errorCheck) { fprintf(outfile, "for (unsigned long _i0=0; _i0<_%1$s_size/_%1$s_lattice0*_%1$s_fullstep_ncomponents*_%1$s_sample_pointer; _i0++) {\n", mgFieldName); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, " _%s_fullstep[_i0] *= 1/(double)_n_paths;\n", mgFieldName); fprintf(outfile, " _%s_fullstep_sd[_i0] *= 1/(double)_n_paths;\n", mgFieldName); fprintf(outfile, " _%s_fullstep_sd[_i0] -= _%s_fullstep[_i0]*_%s_fullstep[_i0];\n", mgFieldName, mgFieldName, mgFieldName); fprintf(outfile, " if (_%s_fullstep_sd[_i0]>0)\n", mgFieldName); fprintf(outfile, " _%s_fullstep_sd[_i0]=sqrt(_%s_fullstep_sd[_i0]/_n_paths);\n", mgFieldName, mgFieldName); fprintf(outfile, " else\n"); fprintf(outfile, " _%s_fullstep_sd[_i0]=0;\n", mgFieldName); fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " _%s_halfstep[_i0] *= 1/(double)_n_paths;\n", mgFieldName); fprintf(outfile, " _%s_halfstep_sd[_i0] *= 1/(double)_n_paths;\n", mgFieldName); fprintf(outfile, " _%s_halfstep_sd[_i0] -= _%s_halfstep[_i0]*_%s_halfstep[_i0];\n", mgFieldName, mgFieldName, mgFieldName); fprintf(outfile, " if (_%s_halfstep_sd[_i0]>0)\n", mgFieldName); fprintf(outfile, " _%s_halfstep_sd[_i0]=sqrt(_%s_halfstep_sd[_i0]/_n_paths);\n", mgFieldName, mgFieldName); fprintf(outfile, " else\n"); fprintf(outfile, " _%s_halfstep_sd[_i0]=0;\n", mgFieldName); fprintf(outfile, "\n"); } } if (simulation()->parameters()->errorCheck) { fprintf(outfile, " double _step_error=_%s_fullstep[_i0] - _%s_halfstep[_i0];\n", mgFieldName, mgFieldName); fprintf(outfile, " if (fabs(_step_error)>_max_step_error)\n"); fprintf(outfile, " _max_step_error=fabs(_step_error);\n"); } fprintf(outfile, " }\n"); fprintf(outfile, "\n"); } if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "printf(\"maximum step error in moment group %li means was %%e\\n\", _max_step_error);\n", myGroupNumber+1); } else { fprintf(outfile, "printf(\"maximum step error in moment group %li was %%e\\n\", _max_step_error);\n", myGroupNumber+1); } fprintf(outfile, "\n"); } // this is where the moment groups are written fprintf(outfile, "fprintf(_outfile, \"\\n\");\n"); fprintf(outfile, "fprintf(_outfile, \"\\n\");\n", myGroupNumber+1); unsigned long nVariables = myNDims-1; if (nSamples>1) { nVariables++; } fprintf(outfile, "fprintf(_outfile, \" %li\\n\");\n", nVariables); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); nVariables += myPostMomentsList.size(); if (simulation()->parameters()->errorCheck) { nVariables += myPostMomentsList.size(); } if (simulation()->parameters()->nPaths != "1") { nVariables += myPostMomentsList.size(); } fprintf(outfile, "fprintf(_outfile, \" %li\\n\");\n", nVariables); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, \""); if (nSamples>1) { if (postSpace(0)) { fprintf(outfile, "k"); } fprintf(outfile, "%s ", simulation()->parameters()->propDimName.c_str()); } for (i=1; idimension(i)->name.c_str()); } if (simulation()->parameters()->nPaths != "1") { for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { fprintf(outfile, "mean_%s ", pXMLString->c_str()); } for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { fprintf(outfile, "sd_%s ", pXMLString->c_str()); } } else { for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { fprintf(outfile, "%s ", pXMLString->c_str()); } } if (simulation()->parameters()->errorCheck) { for (list::const_iterator pXMLString = myPostMomentsList.begin(); pXMLString != myPostMomentsList.end(); pXMLString++) { fprintf(outfile, "error_%s ", pXMLString->c_str()); } } fprintf(outfile, "\\n\");\n"); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); if (nSamples>1) { fprintf(outfile, "fprintf(_outfile, \" %%li\\n\", _%s_sample_pointer);\n", mgFieldName); } for (i=1; i%li\\n\");\n", geometry()->dimension(i)->lattice); } fprintf(outfile, "fprintf(_outfile, \" %li\\n\");\n", nVariables); // Should the output to the .xsil file be binary or ascii? if (simulation()->parameters()->binaryOutput) { // Are we using single or double precision output? string precisionString, precision; // the "precision" variable is for the xsil output, and for matlab string castString; if (simulation()->parameters()->useDouble) { precisionString = "double"; precision = "double"; castString = ""; } else { precisionString = "float"; precision = "single"; castString = "(float)"; } fprintf(outfile, "\nstring encodingStr;\n" "if (CPU_IS_BIG_ENDIAN) {\n" " // big endian\n" " encodingStr = \"BigEndian\";\n" "}\n" "else if (CPU_IS_LITTLE_ENDIAN) {\n" " // little endian\n" " encodingStr = \"LittleEndian\";\n" "}\n" "else {\n" " // dunno what the byte order is\n" " cout << \"I don't know what kind of byte ordering you're using\\n\";\n" " cout << \"Using \\\"Binary\\\" as encoding\\n\";\n" " encodingStr = \"Binary\";\n" "}\n" "\nstring ulongTypeStr;\n" "if (SIZEOF_UNSIGNED_LONG==4) {\n" " // 32 bit\n" " ulongTypeStr = \"uint32\";\n" "}\n" "else if (SIZEOF_UNSIGNED_LONG==8) {\n" " // 64 bit\n" " ulongTypeStr = \"uint64\";\n" "}\n" "else {\n" " // dunno what the default size of the unsigned long is\n" " ulongTypeStr = \"ulong\";\n" "}\n" "fprintf(_outfile, \" \", encodingStr.c_str());\n", precision.c_str()); // The program needs to mangle the filename in case the user used the -o switch... // get the xsil filename, rip off the extension if it equals '.xsil' // otherwise, leave it alone fprintf(outfile, "std::string BinDatFnameStr = _output_filename;\n"); fprintf(outfile, "if (BinDatFnameStr.length() > 4) {\n"); fprintf(outfile, " std::string myTempStr = BinDatFnameStr.substr(BinDatFnameStr.length() - 5, 5);\n"); fprintf(outfile, " if (myTempStr == \".xsil\") { // note: it's case sensitive! \n"); fprintf(outfile, " BinDatFnameStr = BinDatFnameStr.substr(0,BinDatFnameStr.length() - 5);\n"); fprintf(outfile, " }\n"); fprintf(outfile, "}\n"); fprintf(outfile, "char BinDatFnameCstr[BinDatFnameStr.length() + 12];\n"); fprintf(outfile, "sprintf(BinDatFnameCstr, \"%%s_mg%li.dat\",BinDatFnameStr.c_str());\n", myGroupNumber+1); fprintf(outfile, "fprintf(_outfile, \"\\n%%s\\n\",BinDatFnameCstr);\n"); fprintf(outfile, "FILE *fpBinary;\n"); fprintf(outfile, "if ((fpBinary = fopen(BinDatFnameCstr, \"wb\")) == NULL) {\n"); fprintf(outfile, " printf(\"Unable to open output file %%s\\n\",BinDatFnameCstr);\n"); fprintf(outfile, " printf(\"Chucking a spack....\\n\");\n"); fprintf(outfile, " exit(255);\n}\n"); //fprintf(outfile, "delete BinDatFnameCstr;\n"); fprintf(outfile, "vector<%s> ", precisionString.c_str()); for (i=0; i1) { fprintf(outfile, "_outVar0.resize(_%s_sample_pointer, 0);\n", mgFieldName); for (i=1; i1) { fprintf(outfile, "_outVar%li[_i0] = ", dimsCount); dimsCount++; if (postSpace(0)) { fprintf(outfile, "_k0"); } else { fprintf(outfile, "%s_%s_x0[_i0]", castString.c_str(), mgFieldName); } fprintf(outfile, ";\n"); } for (i=1; iparameters()->errorCheck) { for (i=0; iparameters()->nPaths != "1") { for (i=0; iparameters()->nPaths != "1") { for (i=0; i1; i--) { fprintf(outfile, "\n"); if (!postSpace(i-1)) { for (j=0; jfield()->name()->c_str(), post2MainDim(i-1), simulation()->field()->name()->c_str(), post2MainDim(i-1), mgFieldName, i-1); } for (j=0; j\\n\");\n"); } else { // use this bit if not using binary output fprintf(outfile, "fprintf(_outfile, \" \\n\");\n"); fprintf(outfile, "\n"); if (postSpace(0)) { fprintf(outfile, "for (long _j0=-(_%s_sample_pointer)/2; _j0<(_%s_sample_pointer + 1)/2; _j0++) {\n", mgFieldName, mgFieldName); fprintf(outfile, "\n"); fprintf(outfile, " long _i0 = _j0;\n"); fprintf(outfile, " if (_i0<0)\n"); fprintf(outfile, " _i0 += _%s_sample_pointer;\n", mgFieldName); fprintf(outfile, " double _k0 = _j0*_%s_dk0;\n", mgFieldName); fprintf(outfile, "\n"); } else { fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_sample_pointer; _i0++) {\n", mgFieldName); fprintf(outfile, "\n"); } for (i=1; iparameters()->useDouble) fprintf(outfile, "fprintf(_outfile, \"%%.12e"); else fprintf(outfile, "fprintf(_outfile, \"%%e"); for (i=0; iparameters()->useDouble) fprintf(outfile, " %%.12e"); else fprintf(outfile, " %%e"); } fprintf(outfile, "\\n\""); if (nSamples>1) { if (postSpace(0)) { fprintf(outfile, ", _k0"); } else { fprintf(outfile, ", _%s_x0[_i0]", mgFieldName); } } for (i=1; iparameters()->errorCheck) { for (i=0; iparameters()->nPaths != "1") { for (i=0; iparameters()->nPaths != "1") { for (i=0; i1; i--) { fprintf(outfile, "\n"); if (!postSpace(i-1)) { for (j=0; jfield()->name()->c_str(), post2MainDim(i-1), simulation()->field()->name()->c_str(), post2MainDim(i-1), mgFieldName, i-1); } for (j=0; j\\n\");\n"); } // end of stuff distinguishing between binary and ascii output fprintf(outfile, "fprintf(_outfile, \" \\n\");\n" "fprintf(_outfile, \" \\n\");\n" "}\n" "\n"); } // ************************************************************************** bool xmdsMomentGroup::samplingSpace( const unsigned long& index) const { if (debugFlag) { printf("xmdsMomentGroup::samplingSpace\n"); } if (index>=simulation()->field()->geometry()->nDims()) { throw xmdsException("Internal range error in xmdsMomentGroup::samplingSpace()"); } return (mySamplingSpace >> index)&1; } // ************************************************************************** bool xmdsMomentGroup::postSpace( const unsigned long& index) const { if (debugFlag) { printf("xmdsMomentGroup::postSpace\n"); } if (index>=geometry()->nDims()) { throw xmdsException("Internal range error in xmdsMomentGroup::postSpace()"); } return (myPostSpace >> index)&1; } // ************************************************************************** unsigned long xmdsMomentGroup::main2PostDim( const unsigned long& index) const { if (debugFlag) { printf("xmdsMomentGroup::main2PostDim\n"); } if (index>=myMain2PostDimList.size()) { throw xmdsException("Internal range error in xmdsMomentGroup::main2PostDim()"); } list::const_iterator pULong = myMain2PostDimList.begin(); for (unsigned long i=0; i=myPost2MainDimList.size()) { throw xmdsException("Internal range error in xmdsMomentGroup::post2MainDim()"); } list::const_iterator pULong = myPost2MainDimList.begin(); for (unsigned long i=0; i // ***************************************************************************** // ***************************************************************************** // xmdsMomentGroup // ***************************************************************************** // ***************************************************************************** //! xmds moment group class class xmdsMomentGroup : public xmdsField { public : //! Constructor for the xmdsMomentGroup class /*! @param yourSimulation an xmdsSimulation object @param yourVerboseMode a boolean @param yourGroupNumber an unsigned long */ xmdsMomentGroup( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const unsigned long& yourGroupNumber); //! Destructor ~xmdsMomentGroup(); //! Process elements within a moment group void processElement( const Element *const yourElement); //! Adds the specified number of samples to the moment group void addSamples( const unsigned long& n2add) const; //! Sets up the final geometry of the moment group void finaliseGeometry(); //! Function to determine if simulation requires integrations bool requiresIntegrations() const; //! Function to determine if moment group has post-propogation ,and should force initialisation bool requiresInitialisation() const; //! Function to determine if simulation requires a complex raw vector bool needscomplexRawVector() const; private : const unsigned long myGroupNumber; //!< The group number (of the current object?) list myVectorNamesList; //!< The list of vector names unsigned long mySamplingSpace; //!< The sampling space (x-space or k-space) list mySamplingLatticeList; //!< The sampling lattice list list mySamplingMomentsList; //!< The sampling moments list XMLString mySamplingCode; //!< String containing the sampling code unsigned long myRawSpace; //!< Integer representing the raw space (before post-processing) unsigned long myPostSpace; //!< Integer representing the post space list myPostMomentsList; //!< List of moments in the post space XMLString myPostCode; //!< Code for post-propagation list myPostProcessingVectorNamesList; //!< List of vector names in post-propagation list myMain2PostDimList; //!< List of dimensions from main space to post space (I think) list myPost2MainDimList; //!< List of dimensions from post space to main space (I think) xmdsFieldGeometry tempGeometry; //!< Temporary field geometry bool complexRawVector; //!< Whether or not we have a complex raw vector bool myRequiresIntegrations; //!< Whether or not integrations are required bool myRequiresInitialisation; //!< Whether or not initialisation is required mutable unsigned long nSamples; //!< The number of samples to take //! Write the moment group defines to file void writeDefines( FILE *const outfile) const; //! Write the moment group globals to file void writeGlobals( FILE *const outfile) const; //! Write the moment group prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the moment group routines to file void writeRoutines( FILE *const outfile) const; //! Determine the sampling space at index bool samplingSpace( const unsigned long& index) const; //! Determin the post space at index bool postSpace( const unsigned long& index) const; //! Return the main to post-propagation dimension unsigned long main2PostDim( const unsigned long& index) const; //! Return the post-propagation to main dimension unsigned long post2MainDim( const unsigned long& index) const; }; #endif // XMDS_MOMENT_GROUP_H xmds-1.6.6/source/xmds_output.cc0000644000076500000240000003342511033277417013634 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_output.cc 1998 2008-04-22 03:49:50Z andyferris $ */ /*! @file xmds_output.cc @brief Output element parsing classes and methods More detailed explanation... */ #include #include #include #include #include #include "version.h" // ************************************************************************** // ************************************************************************** // xmdsOutput public // ************************************************************************** // ************************************************************************** extern bool debugFlag; extern vector simHeaderText, simBodyText, simFooterText; long nxmdsOutputs=0; //!< Number of xmds output objects // ************************************************************************** xmdsOutput::xmdsOutput( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsElement(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsOutputs++; printf("xmdsOutput::xmdsOutput\n"); printf("nxmdsOutputs=%li\n", nxmdsOutputs); } myInFileSplitPoint = 0; } // ************************************************************************** xmdsOutput::~xmdsOutput() { if (debugFlag) { nxmdsOutputs--; printf("xmdsOutput::~xmdsOutput\n"); printf("nxmdsOutputs=%li\n", nxmdsOutputs); } } // ************************************************************************** void xmdsOutput::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsOutput::processElement\n"); } if (verbose()) { printf("Processing output element ...\n"); } list myXMLStringList; list myBoolList; // ************************************ // find output file name getAssignmentStrings(yourElement, "filename", 0, 1, myXMLStringList); if (myXMLStringList.size()==1) { myOutputFileName=*myXMLStringList.begin(); if (verbose()) { printf("Output file is '%s'\n", myOutputFileName.c_str()); } } else { // Create default output file name myOutputFileName = simulation()->parameters()->simulationName; myOutputFileName += ".xsil"; printf("Output file name defaulting to '%s'\n", myOutputFileName.c_str()); } // ************************************ // find and process moment groups // ************************************ const NodeList* candidateElements; // find constants element and process if present candidateElements = yourElement->getElementsByTagName("group", NOT_DEEP); if (candidateElements->length()==0) { throw xmdsException(yourElement, "No moment s defined!"); } for (unsigned long i=0; ilength(); i++) { xmdsMomentGroup* newxmdsMomentGroup = createxmdsMomentGroup(); const Element* yourElement = dynamic_cast (candidateElements->item(i)); newxmdsMomentGroup->processElement(yourElement); } } // ************************************************************************** void xmdsOutput::setInFileSplitPoint( const unsigned long& inFileSplitPoint) { if (debugFlag) { printf("xmdsOutput::setInFileSplitPoint\n"); } myInFileSplitPoint = inFileSplitPoint; } // ************************************************************************** unsigned long xmdsOutput::nMomentGroups() const { if (debugFlag) { printf("xmdsOutput::nMomentGroups\n"); } return myMomentGroupsList.size(); } // ************************************************************************** XMLString xmdsOutput::getOutputFileName() const { if (debugFlag) { printf("xmdsOutput::getOutputFileName\n"); } return myOutputFileName; } // ************************************************************************** const xmdsMomentGroup* xmdsOutput::momentGroup( const unsigned long& index) const { if (debugFlag) { printf("xmdsOutput::momentGroup\n"); } if (index>=myMomentGroupsList.size()) { throw xmdsException("Internal range error in xmdsOutput::momentGroup"); } list::const_iterator ppxmdsMomentGroup = myMomentGroupsList.begin(); for (unsigned long i=0; i& samplesList) const { if (debugFlag) { printf("xmdsOutput::addSamples\n"); } if (samplesList.size() != myMomentGroupsList.size()) { throw xmdsException("Internal error in xmdsOutput::addSamples: wrong number of samples."); } list::const_iterator pLong = samplesList.begin(); for (list::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->addSamples(*pLong); pLong++; } } // ************************************************************************** void xmdsOutput::finaliseGeometry() { if (debugFlag) { printf("xmdsOutput::finaliseGeometry\n"); } for (list::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->finaliseGeometry(); } } // ************************************************************************** void xmdsOutput::assignActiveVectorPointers( FILE *const outfile, const char *const tempVectorName) const { if (debugFlag) { printf("xmdsOutput::assignActiveVectorPointers\n"); } for (list::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->assignActiveVectorPointers(outfile, tempVectorName); } } // ************************************************************************** void xmdsOutput::writePlanCreationCalls( FILE *const outfile, const bool& useFFTWMeasure, const bool& useWisdom) const { if (debugFlag) { printf("xmdsOutput::writePlanCreationCalls\n"); } for (list::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->writePlanCreationCalls(outfile, useFFTWMeasure, useWisdom); } } // ************************************************************************** void xmdsOutput::writePlanDeletionCalls( FILE *const outfile) const { if (debugFlag) { printf("xmdsOutput::writePlanDeletionCalls\n"); } for (list::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->writePlanDeletionCalls(outfile); } } // ************************************************************************** // ************************************************************************** // xmdsOutput private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsOutput::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsOutput::writePrototypes\n"); } if (verbose()) { printf("Writing output prototypes ...\n"); } fprintf(outfile, "// ********************************************************\n" "// output prototypes\n" "\n" "void _write_output(string _output_filename);\n" "\n"); xmdsElement::writePrototypes(outfile); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsOutput::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsOutput::writeRoutines\n"); } if (verbose()) { printf("Writing output routines ...\n"); } // write out code to handle original simulation script fprintf(outfile, "// ********************************************************\n" "// output routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _write_output(string _output_filename) {\n" "\n" " printf(\"Generating output for %%s\\n\", _output_filename.c_str());\n"); fprintf(outfile, "\n" " FILE* _outfile=fopen(_output_filename.c_str(), \"w\");\n" "\n" " if (_outfile==0) {\n" " printf(\"Unable to open output file %%s\\n\", _output_filename.c_str());\n" " printf(\"Exiting.\\n\");\n" " return;\n" " }\n" "\n"); // put the header text into the output from the xmds script fprintf(outfile, "\n"); for (unsigned int i=0; i\\n\");\n"); fprintf(outfile, " fprintf(_outfile, \"Output generated with xmds version %s (%s).\\n\");\n", simulation()->parameters()->version.c_str(), simulation()->parameters()->revision.c_str()); fprintf(outfile, " fprintf(_outfile, \"See http://www.xmds.org for more information.\\n\");\n"); if (simulation()->argStruct()->nameList.size() != 0) { fprintf(outfile, " fprintf(_outfile, \" Variables that can be specified on the command line: \\n\");\n"); list::const_iterator inameList = simulation()->argStruct()->nameList.begin(); list::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); for (long unsigned int i=0; iargStruct()->nameList.size(); i++) { string theType=itypeList->c_str(); if (theType == "double ") { fprintf(outfile, " fprintf(_outfile, \" Command line argument '%s' = %%e \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else if (theType == "long ") { fprintf(outfile, " fprintf(_outfile, \" Command line argument '%s' = %%li \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else if (theType == "float ") { fprintf(outfile, " fprintf(_outfile, \" Command line argument '%s' = %%e \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else if (theType == "int ") { fprintf(outfile, " fprintf(_outfile, \" Command line argument '%s' = %%i \\n\", %s);\n", inameList->c_str(), inameList->c_str()); } else { fprintf(outfile, " fprintf(_outfile, \" Command line argument '%s' is an unimplemented output type '%s'\\n\");\n", inameList->c_str(), itypeList->c_str()); } itypeList++; inameList++; } fprintf(outfile, "\n"); } fprintf(outfile, " fprintf(_outfile, \"
\\n\");\n"); // end of informative text // now put the data into the file for (unsigned long i=0; i #include // ***************************************************************************** // ***************************************************************************** // xmdsOutput // ***************************************************************************** // ***************************************************************************** //! Class which organises data output of simulation class xmdsOutput : public xmdsElement { public : //! Constructor of xmdsOutput object xmdsOutput( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsOutput(); //! Process elements defined in output section of xmds file void processElement( const Element *const yourElement); //! Sets the point in the input file to split void setInFileSplitPoint( const unsigned long& inFileSplitPoint); //! Determines the number of moment groups for output unsigned long nMomentGroups() const; //! Return the output file name XMLString getOutputFileName() const; //! Creates an xmdsMomentGroup object const xmdsMomentGroup* momentGroup( const unsigned long& index) const; //! Adds samples to the output samples list void addSamples( const list& samplesList) const; //! Sets up the final geometry to use for output void finaliseGeometry(); //! Assigns the active vector pointers in the list of moment groups void assignActiveVectorPointers( FILE *const outfile, const char *const tempVectorName) const; //! Writes the FFTW plan creation calls to file void writePlanCreationCalls( FILE *const outfile, const bool& useFFTWMeasure, const bool& useWisdom) const; //! Writes the FFTW plan deletion calls to file void writePlanDeletionCalls( FILE *const outfile) const; private : XMLString myOutputFileName; //!< The output filename list myMomentGroupsList; //!< The list of output moment groups unsigned long myInFileSplitPoint; //!< The point at which to split the input file bool bpEnabledFlag; //!< Whether or not breakpoints are enabled //! Write the output prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the output routines to file void writeRoutines( FILE *const outfile) const; //! Create an xmds moment group object xmdsMomentGroup* createxmdsMomentGroup(); }; #endif // XMDS_OUTPUT_H xmds-1.6.6/source/xmds_segment.cc0000644000076500000240000000574311033277417013740 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_segment.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_segment.cc @brief Segment element parsing classes and methods More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsSegment public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsSegments=0; //!< Number of xmds segment objects // ************************************************************************** xmdsSegment::xmdsSegment( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsElement(yourSimulation, yourVerboseMode), segmentNumber(yourSimulation->nextSegmentNumber()) { if (debugFlag) { nxmdsSegments++; printf("xmdsSegment::xmdsSegment\n"); printf("nxmdsSegments=%li\n", nxmdsSegments); } } // ************************************************************************** xmdsSegment::~xmdsSegment() { if (debugFlag) { nxmdsSegments--; printf("xmdsSegment::~xmdsSegment\n"); printf("nxmdsSegments=%li\n", nxmdsSegments); } } // ************************************************************************** void xmdsSegment::outputSampleCount() const { if (debugFlag) { printf("xmdsSegment::outputSampleCount\n"); } } // ************************************************************************** void xmdsSegment::writeInitialisationCalls( FILE *const outfile) const { if (debugFlag) { printf("xmdsSegment::writeInitialisationCalls\n"); } } void xmdsSegment::writeDestructionCalls(FILE *const outfile) const { if (debugFlag) { printf("xmdsSegment::writeDestructionCalls\n"); } } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_segment.h0000644000076500000240000000430611033277417013574 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_segment.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_segment.h @brief More detailed explanation... */ #ifndef XMDS_SEGMENT_H #define XMDS_SEGMENT_H #include // ***************************************************************************** // ***************************************************************************** // xmdsSegment // ***************************************************************************** // ***************************************************************************** //! xmds segment class class xmdsSegment : public xmdsElement { public : //! Number of segments or current segment number (buh?) const unsigned long segmentNumber; //! Constructor of xmdsSegment object xmdsSegment( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsSegment(); //! Returns the output sample count virtual void outputSampleCount() const; //! Writes initialisation calls to file virtual void writeInitialisationCalls(FILE *const outfile) const; //! Writes destruction calls to file virtual void writeDestructionCalls(FILE *const outfile) const; //! Whether or not the segment needs to run when the simulation is in overtime virtual bool runsInOvertime() const = 0; }; #endif // XMDS_SEGMENT_H xmds-1.6.6/source/xmds_sequence.cc0000644000076500000240000035540411033277417014110 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_sequence.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_sequence.cc @brief Sequence element parsing classes and methods More detailed explanation... */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // ************************************************************************** // ***************************************************************************** // xmdsSequence public // ***************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsSequences=0; //!< Number of xmds sequence objects // ************************************************************************** xmdsSequence::xmdsSequence( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode) : xmdsSegment(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsSequences++; printf("xmdsSequence::xmdsSequence\n"); printf("nxmdsSequences=%li\n", nxmdsSequences); } nCycles=1; } // ************************************************************************** xmdsSequence::~xmdsSequence() { if (debugFlag) { nxmdsSequences--; printf("xmdsSequence::~xmdsSequence\n"); printf("nxmdsSequences=%li\n", nxmdsSequences); } } // ************************************************************************** void xmdsSequence::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsSequence::processElement\n"); } unsigned long i; const NodeList* myElements; const Element* nextElement; xmdsSegment* newSegment; if (verbose()) { printf("Processing sequence element ...\n"); } // ************************************ // process elements in order myElements = yourElement->getElementsByTagName("*", 0); i=0; nextElement = dynamic_cast (myElements->item(0)); if (*nextElement->nodeName() == "cycles") { if (segmentNumber==0) { throw xmdsException(nextElement, "Cannot have cycles in top level sequence"); } if (!nextElement->textContent(0)->asULong(nCycles)) { throw xmdsException(nextElement, "invalid positive integer format"); } i++; } else // default number of cycles nCycles=1; while (ilength()) { nextElement = dynamic_cast (myElements->item(i)); if (*nextElement->nodeName() == "sequence") { newSegment = createxmdsSequence(); } else if (*nextElement->nodeName() == "integrate") { // ************************************ // find 'algorithm' so that we can create the appropriate // type of xmdsIntegrate class list tempXMLStringList; getAssignmentStrings(nextElement, "algorithm", 0, 1, tempXMLStringList); if (tempXMLStringList.size()==0) { // need default algorithm if (simulation()->parameters()->stochastic) { printf("Algorithm defaulting to RK9EX.\n"); tempXMLStringList.push_back("RK9EX"); } else { printf("Algorithm defaulting to RK4EX.\n"); tempXMLStringList.push_back("RK4EX"); } } if (*tempXMLStringList.begin()=="RK4EX") { newSegment = createxmdsIntegrateRK4EX(); } else if (*tempXMLStringList.begin()=="RK4IP") { newSegment = createxmdsIntegrateRK4IP(); } else if (*tempXMLStringList.begin()=="RK9IP") { newSegment = createxmdsIntegrateRK9IP(); } else if (*tempXMLStringList.begin()=="RK9EX") { newSegment = createxmdsIntegrateRK9EX(); } else if (*tempXMLStringList.begin()=="ARK45IP") { newSegment = createxmdsIntegrateARK45IP(); } else if (*tempXMLStringList.begin()=="ARK45EX") { newSegment = createxmdsIntegrateARK45EX(); } else if (*tempXMLStringList.begin()=="ARK89IP") { newSegment = createxmdsIntegrateARK89IP(); } else if (*tempXMLStringList.begin()=="ARK89EX") { newSegment = createxmdsIntegrateARK89EX(); } else if (*tempXMLStringList.begin()=="SIEX") { newSegment = createxmdsIntegrateSIEX(); } else if (*tempXMLStringList.begin()=="SIIP") { newSegment = createxmdsIntegrateSIIP(); } else { sprintf(errorMessage(), "Integrate algorithm '%s' unknown.\nCurrent algorithms are SIEX, SIIP, ARK45IP, ARK45EX, ARK89IP, ARK89EX, RK9IP, RK9EX, RK4EX, and RK4IP.", tempXMLStringList.begin()->c_str()); throw xmdsException(yourElement, errorMessage()); } } else if (*nextElement->nodeName() == "filter") { newSegment = createxmdsFilter(); } else if (*nextElement->nodeName() == "breakpoint") { newSegment = createxmdsBreakpoint(); } else { sprintf(errorMessage(), "segment <%s> unknown", nextElement->nodeName()->c_str()); throw xmdsException(yourElement, errorMessage()); } newSegment->processElement(nextElement); i++; } } // ************************************************************************** void xmdsSequence::outputSampleCount() const { if (debugFlag) { printf("xmdsSequence::outputSampleCount\n"); } for (unsigned long i=0; i:: const_iterator ppxmdsSegment = mySegmentList.begin(); ppxmdsSegment != mySegmentList.end(); ppxmdsSegment++) { (*ppxmdsSegment)->outputSampleCount(); } } } // ************************************************************************** // ************************************************************************** // xmdsSequence private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsSequence::writeDefines( FILE *const outfile) const { if (debugFlag) { printf("xmdsSequence::writeDefines\n"); } if (verbose()) { printf("Writing sequence defines ...\n"); } if (segmentNumber==0) { fprintf(outfile, "// ********************************************************\n" "// segment defines\n" "\n"); } xmdsElement::writeDefines(outfile); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsSequence::writeGlobals( FILE *const outfile) const { if (debugFlag) { printf("xmdsSequence::writeGlobals\n"); } if (verbose()) { printf("Writing sequence globals ...\n"); } if (segmentNumber==0) { fprintf(outfile, "// ********************************************************\n" "// segment globals\n" "\n"); } xmdsElement::writeGlobals(outfile); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsSequence::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsSequence::writePrototypes\n"); } if (verbose()) { printf("Writing sequence prototypes ...\n"); } if (segmentNumber==0) { fprintf(outfile, "// ********************************************************\n" "// segment prototypes\n" "\n"); if (!simulation()->parameters()->usempi) fprintf(outfile, "void _segment0(); // top level sequence\n"); else if (simulation()->parameters()->mpiMethod=="Scheduling") fprintf(outfile, "void _segment0(const int); /*top level sequence*/\n"); else fprintf(outfile, "void _segment0(const int& size); // top level sequence\n"); fprintf(outfile, "\n"); } else fprintf(outfile, "void _segment%li(unsigned long cycle); // sequence\n", segmentNumber); xmdsElement::writePrototypes(outfile); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsSequence::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsSequence::writeRoutines\n"); } if (segmentNumber==0) { // I am the main routine if (verbose()) { printf("Writing main routine ...\n"); } fprintf(outfile, "// ********************************************************\n" "// main routine\n" "// ********************************************************\n" "\n" "// *************************\n"); if (verbose()) { printf("argStruct()->nameList.size() = %zi\n", simulation()->argStruct()->nameList.size()); printf("argStruct()->typeList.size() = %zi\n", simulation()->argStruct()->typeList.size()); printf("argStruct()->defaultValueList.size() = %zi\n", simulation()->argStruct()->defaultValueList.size()); printf("argStruct()->nameList.size() = %zi\n", simulation()->argStruct()->shortOptionList.size()); printf("argStruct()->typeConversionList.size() = %zi\n", simulation()->argStruct()->typeConversionList.size()); list::const_iterator inameList = simulation()->argStruct()->nameList.begin(); list::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); list::const_iterator idefaultValueList = simulation()->argStruct()->defaultValueList.begin(); list::const_iterator ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); list::const_iterator itypeConversionList = simulation()->argStruct()->typeConversionList.begin(); printf("argvStruct()->nameList = \n"); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { printf("\t%s\n", inameList->c_str()); inameList++; } printf("argvStruct()->typeList = \n"); for (unsigned long int i=0; iargStruct()->typeList.size(); i++) { printf("\t%s\n", itypeList->c_str()); itypeList++; } printf("argvStruct()->defaultValueList = \n"); for (unsigned long int i=0; iargStruct()->defaultValueList.size(); i++) { printf("\t%s\n", idefaultValueList->c_str()); idefaultValueList++; } printf("argvStruct()->shortOptionList = \n"); for (unsigned long int i=0; iargStruct()->shortOptionList.size(); i++) { printf("\t%s\n", ishortOptionList->c_str()); ishortOptionList++; } printf("argvStruct()->typeConversionList = \n"); for (unsigned long int i=0; iargStruct()->typeConversionList.size(); i++) { printf("\t%s\n", itypeConversionList->c_str()); itypeConversionList++; } } // if (simulation()->parameters()->usempi) { if (simulation()->argStruct()->nameList.size() == 0) { fprintf(outfile, "int main(int argc, char *argv[]) {\n"); } else if (simulation()->argStruct()->nameList.size() != 0) { fprintf(outfile, "int main(int argc, char **argv) {\n" "int resp;\n" "while (1) {\n" "\tstatic struct option long_options[] = \n" "\t\t{\n"); list::const_iterator inameList = simulation()->argStruct()->nameList.begin(); // list::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); // list::const_iterator idefaultValueList = simulation()->argStruct()->defaultValueList.begin(); list::const_iterator ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); list::const_iterator itypeConversionList = simulation()->argStruct()->typeConversionList.begin(); fprintf(outfile, "\t\t\t{\"help\", no_argument, 0, 'h'}, \n"); fprintf(outfile, "\t\t\t{\"outfilename\", required_argument, 0, 'o'}, \n"); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { fprintf(outfile, "\t\t\t{\"%s\", required_argument, 0, '%s'}, \n", inameList->c_str(), ishortOptionList->c_str()); inameList++; ishortOptionList++; } fprintf(outfile, "\t\t\t{0, 0, 0, 0}\n" "\t\t};\n" "\tint option_index = 0;\n" "\tresp = getopt_xmds_long(argc, argv, \""); ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); for (unsigned long int i=0; iargStruct()->shortOptionList.size(); i++) { fprintf(outfile, "%s:", ishortOptionList->c_str()); ishortOptionList++; } // also need the output filename option so that -l works fprintf(outfile, "o:"); // also need to output the short option version of "help" so that // '-h' works fprintf(outfile, "h"); fprintf(outfile, "\", long_options, &option_index);\n" "\tif (resp == -1) {\n" "\t\tbreak;\n" "\t}\n" "\tswitch (resp) {\n" "\t\tcase 'h':\n" "\t\t\tprintf(\"Usage: %s", simulation()->parameters()->simulationName.c_str()); ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); list::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { fprintf(outfile, " -%s < %s>", ishortOptionList->c_str(), itypeList->c_str()); ishortOptionList++; itypeList++; } fprintf(outfile, "\\n\\n\");\n" "\t\t\tprintf(\"Details:\\n\");\n" "\t\t\tprintf(\"Option\\t\\tType\\t\\tDefault value\\n\");\n"); inameList = simulation()->argStruct()->nameList.begin(); ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); itypeList = simulation()->argStruct()->typeList.begin(); list::const_iterator idefaultValueList = simulation()->argStruct()->defaultValueList.begin(); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { fprintf(outfile, "\t\t\tprintf(\"-%s, --%s\\t%s\\t\\t%s\\n\");\n", ishortOptionList->c_str(), inameList->c_str(), itypeList->c_str(), idefaultValueList->c_str()); inameList++; ishortOptionList++; itypeList++; idefaultValueList++; } fprintf(outfile, "\t\t\texit(0);\n"); inameList = simulation()->argStruct()->nameList.begin(); ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); itypeConversionList = simulation()->argStruct()->typeConversionList.begin(); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { fprintf(outfile, "\t\tcase '%s':\n", ishortOptionList->c_str()); if (*itypeConversionList == "atof") { fprintf(outfile, "\t\t\t%s = atof(optarg);\n", inameList->c_str()); fprintf(outfile, "\t\t\tbreak;\n"); } else if (*itypeConversionList == "atoi") { fprintf(outfile, "\t\t\t%s = atoi(optarg);\n", inameList->c_str()); fprintf(outfile, "\t\t\tbreak;\n"); } else if (*itypeConversionList == "") { fprintf(outfile, "\t\t\t%s = optarg;\n", inameList->c_str()); fprintf(outfile, "\t\t\tbreak;\n"); } inameList++; ishortOptionList++; itypeConversionList++; } fprintf(outfile, "\t\tcase 'o':\n" "\t\t\t_output_filename = optarg;\n" "\t\t\tbreak;\n" "\t\tdefault:\n" "\t\t\texit(10);\n" "\t\t}\n" "\t}\n" "\tif (optind_xmds < argc) {\n" "\t\tprintf(\"Sorry, I didn't understand some (or all) of your arguments\\n\");\n" "\t\t\tprintf(\"Usage: %s", simulation()->parameters()->simulationName.c_str()); ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); itypeList = simulation()->argStruct()->typeList.begin(); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { fprintf(outfile, " -%s < %s>", ishortOptionList->c_str(), itypeList->c_str()); ishortOptionList++; itypeList++; } fprintf(outfile, "\\n\\n\");\n" "\t\t\tprintf(\"Details:\\n\");\n" "\t\t\tprintf(\"Option\\t\\tType\\t\\tDefault value\\n\");\n"); inameList = simulation()->argStruct()->nameList.begin(); ishortOptionList = simulation()->argStruct()->shortOptionList.begin(); itypeList = simulation()->argStruct()->typeList.begin(); idefaultValueList = simulation()->argStruct()->defaultValueList.begin(); for (unsigned long int i=0; iargStruct()->nameList.size(); i++) { fprintf(outfile, "\t\t\tprintf(\"-%s, --%s\\t%s\\t\\t%s\\n\");\n", ishortOptionList->c_str(), inameList->c_str(), itypeList->c_str(), idefaultValueList->c_str()); inameList++; ishortOptionList++; itypeList++; idefaultValueList++; } fprintf(outfile, "\t\t\texit(0);\n" "\t}\n\n"); } else { fprintf(outfile, "int main() {\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->binaryOutput) { fprintf(outfile, "#ifndef CPU_IS_BIG_ENDIAN\n" " #ifndef CPU_IS_LITTLE_ENDIAN\n" " cout << \"Byte ordering isn't defined for this system!\\n\";\n" " cout << \"Please define CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in config.h\\n\";\n" " exit(255);\n" " #endif\n" "#endif\n"); } if (simulation()->parameters()->usempi) { fprintf(outfile, "MPI_Init(&argc, &argv);\n" "MPI_Comm_size(MPI_COMM_WORLD, &size);\n" "MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n" "\n"); } // if (simulation()->field()->needsFFTWPlans()) { // It's possible to need FFTW plans in output but not the main field through post-propagation fprintf(outfile, "/* set up fftw plans */\n"); if (simulation()->parameters()->nThreads>1) { if (simulation()->parameters()->fftwVersion == 2) fprintf(outfile, "int fftw_threads_init(void);\n"); else if (simulation()->parameters()->fftwVersion == 3) fprintf(outfile, "fftw_init_threads();\nfftw_plan_with_nthreads(_num_threads);\n"); } fprintf(outfile, "int _fftw_lattice[64];\n"); fprintf(outfile, "\n"); simulation()->field()->writePlanCreationCalls(outfile, 1, simulation()->parameters()->useWisdom); simulation()->output()->writePlanCreationCalls(outfile, 0, simulation()->parameters()->useWisdom); // } if (simulation()->parameters()->benchmark) { if (simulation()->parameters()->usempi){ fprintf(outfile, "_startTime = MPI_Wtime();\n"); } else{ fprintf(outfile, "timeval tim; \n"); fprintf(outfile, "gettimeofday(&tim, NULL);\n"); fprintf(outfile, "_startTime = tim.tv_sec+(tim.tv_usec/1000000.0);\n"); } } if ((simulation()->parameters()->usempi)&!(simulation()->parameters()->stochastic)) { fprintf(outfile, "fftwnd_mpi_local_sizes(_main_forward_plan, &local_nx, &local_x_start, &local_ny_after_transpose, &local_y_start_after_transpose, &total_local_size);\n\n"); fprintf(outfile, "unswapped_local_size = local_nx*_main_size/_main_lattice0;\n" "swapped_local_size = local_ny_after_transpose*_main_size/_main_lattice1;\n"); list vectorNamesList; const xmdsVector* tempVector; const char *typeName; simulation()->field()->vectorNames(vectorNamesList); for (list::const_iterator pXMLString = vectorNamesList.begin(); pXMLString != vectorNamesList.end(); pXMLString++) { if (!simulation()->field()->getVector(*pXMLString, tempVector)) { throw xmdsException("Lost one of the vectors in xmdssequence::writeRoutines. Bad! Bad dog!\n\n"); } if (tempVector->vectorType()==DOUBLE) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "_%s_%s = new %s[total_local_size*_%s_%s_ncomponents];\n", simulation()->field()->name()->c_str(), tempVector->name()->c_str(), typeName, simulation()->field()->name()->c_str(), tempVector->name()->c_str()); fprintf(outfile, "_%s_%s_work = new %s[total_local_size*_%s_%s_ncomponents];\n", simulation()->field()->name()->c_str(), tempVector->name()->c_str(), typeName, simulation()->field()->name()->c_str(), tempVector->name()->c_str()); } fprintf(outfile, "\n"); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { if (!simulation()->output()->momentGroup(i)->needscomplexRawVector()) { typeName="double"; } else { typeName="complex"; } fprintf(outfile, "_mg%li_raw = new %s[_mg%li_size*_mg%li_raw_ncomponents];\n", i, typeName, i, i); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) fprintf(outfile, "if (rank==0) {\n"); fprintf(outfile, "_mg%li_fullstep = new double[_mg%li_size*_mg%li_fullstep_ncomponents];\n", i, i, i); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "_mg%li_halfstep = new double[_mg%li_size*_mg%li_halfstep_ncomponents];\n", i, i, i); } if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) fprintf(outfile, "}\n"); } fprintf(outfile, "\n"); } simulation()->field()->assignActiveVectorPointers(outfile, ""); simulation()->output()->assignActiveVectorPointers(outfile, ""); if (simulation()->parameters()->stochastic) { for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { fprintf(outfile, "_mg%li_fullstep_initialise();\n", i); fprintf(outfile, "_mg%li_fullstep_sd_initialise();\n", i); if (simulation()->parameters()->errorCheck) { fprintf(outfile, "_mg%li_halfstep_initialise();\n", i); fprintf(outfile, "_mg%li_halfstep_sd_initialise();\n", i); } fprintf(outfile, "\n"); } } if ((simulation()->parameters()->mpiMethod=="Scheduling")&&(simulation()->parameters()->usempi)&&(simulation()->parameters()->stochastic)) { if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "printf(\"Rank[%%i] beginning full step paths\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning full step integration ...\\n\");\n"); } fprintf(outfile, "fflush(stdout);\n"); fprintf(outfile, "\n"); fprintf(outfile, "_half_step=0;\n"); fprintf(outfile, "\n"); } else { if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "printf(\"Rank[%%i] beginning paths\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning integration ...\\n\");\n"); } fprintf(outfile, "fflush(stdout);\n"); fprintf(outfile, "\n"); } if (!simulation()->parameters()->useIntelMKL) { if (simulation()->parameters()->errorCheck) { fprintf(outfile, "_gen1[0] = %s+rank;\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, "_gen2[0] = %s+rank;\n", simulation()->parameters()->seed[1].c_str()); fprintf(outfile, "_gen1[1] = 0;\n"); fprintf(outfile, "_gen2[1] = 0;\n"); fprintf(outfile, "_gen1[2] = 0;\n"); fprintf(outfile, "_gen2[2] = 0;\n"); fprintf(outfile, "erand48(_gen1);\n"); fprintf(outfile, "erand48(_gen2);\n"); } else { fprintf(outfile, "_gen[0] = %s+rank;\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, "_gen[1] = 0;\n"); fprintf(outfile, "_gen[2] = 0;\n"); fprintf(outfile, "erand48(_gen);\n"); } } else { if (simulation()->parameters()->errorCheck) { fprintf(outfile, "vslNewStream(&_gen1, VSL_BRNG_MCG31, %s + rank);\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, "vslNewStream(&_gen2, VSL_BRNG_MCG31, %s + rank);\n", simulation()->parameters()->seed[1].c_str()); } else { fprintf(outfile, "vslNewStream(&_gen, VSL_BRNG_MCG31, %s + rank);\n", simulation()->parameters()->seed[0].c_str()); } } if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "\ntotal_paths = _n_paths;\n\n"); } else { fprintf(outfile, "\ntotal_paths = 1;\n\n"); } fprintf(outfile, "//Rank 0 becomes master, other processes become slaves\n" "if (size > 1){\n" " if (rank==0)\n" " master();\n" " else {\n" " slave((void *) NULL);\n" " }\n" "}\n" "//Run the simulation using the following if only one processor used\n" "else {\n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " _half_step = 0;\n"); fprintf(outfile, " _segment0(total_paths);\n\n"); if (simulation()->parameters()->errorCheck) { if (!simulation()->parameters()->useIntelMKL) { fprintf(outfile, " _gen1[0] = %s+rank;\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, " _gen2[0] = %s+rank;\n", simulation()->parameters()->seed[1].c_str()); fprintf(outfile, " _gen1[1] = 0;\n"); fprintf(outfile, " _gen2[1] = 0;\n"); fprintf(outfile, " _gen1[2] = 0;\n"); fprintf(outfile, " _gen2[2] = 0;\n"); fprintf(outfile, " erand48(_gen1);\n"); fprintf(outfile, " erand48(_gen2);\n"); } else { fprintf(outfile, "vslDeleteStream(&_gen1);\nvslDeleteStream(&_gen2);\n"); fprintf(outfile, "vslNewStream(&_gen1, VSL_BRNG_MCG31, %s + rank);\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, "vslNewStream(&_gen2, VSL_BRNG_MCG31, %s + rank);\n", simulation()->parameters()->seed[1].c_str()); } fprintf(outfile, "\n" " _half_step = 1;\n"); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, " printf(\"Rank[%%i] beginning half step paths\\n\", rank);\n"); } else { fprintf(outfile, " printf(\"Beginning half step integration ...\\n\");\n"); } fprintf(outfile, " fflush(stdout);\n"); fprintf(outfile, " _segment0(total_paths);\n\n"); } fprintf(outfile, "goto write_output;\n" "}\n\n"); } else { if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->nPaths != "1") { if (simulation()->parameters()->usempi) { fprintf(outfile, "printf(\"Rank[%%i] beginning full step paths\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning full step paths\\n\");\n"); } } else { if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "printf(\"Rank[%%i] beginning full step integration ...\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning full step integration ...\\n\");\n"); } } fprintf(outfile, "fflush(stdout);\n"); fprintf(outfile, "\n"); fprintf(outfile, "_half_step=0;\n"); fprintf(outfile, "\n"); } else { if (simulation()->parameters()->nPaths != "1") { if (simulation()->parameters()->usempi) { fprintf(outfile, "printf(\"Rank[%%i] beginning paths\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning paths\\n\");\n"); } } else { if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "printf(\"Rank[%%i] beginning integration ...\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning integration ...\\n\");\n"); } } fprintf(outfile, "fflush(stdout);\n"); fprintf(outfile, "\n"); } if (simulation()->parameters()->usempi) { fprintf(outfile, "_segment0(size);\n"); } else { fprintf(outfile, "_segment0();\n"); } fprintf(outfile, "\n"); if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->nPaths != "1") { if (simulation()->parameters()->usempi) { fprintf(outfile, "printf(\"Rank[%%i] beginning half step paths\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning half step paths\\n\");\n"); } } else { if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { fprintf(outfile, "printf(\"Rank[%%i] beginning half step integration ...\\n\", rank);\n"); } else { fprintf(outfile, "printf(\"Beginning half step integration ...\\n\");\n"); } } fprintf(outfile, "fflush(stdout);\n"); fprintf(outfile, "\n"); fprintf(outfile, "_half_step=1;\n"); fprintf(outfile, "\n"); if (simulation()->parameters()->usempi) { fprintf(outfile, "_segment0(size);\n"); } else { fprintf(outfile, "_segment0();\n"); } fprintf(outfile, "\n"); } } if (simulation()->parameters()->usempi&simulation()->parameters()->stochastic) { fprintf(outfile, "double* _temp_vector;\n"); fprintf(outfile, "unsigned long _length;\n"); fprintf(outfile, "\n"); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { fprintf(outfile, "_length = _mg%li_size*_mg%li_fullstep_ncomponents;\n", i, i); fprintf(outfile, "_temp_vector = new double[_length];\n"); fprintf(outfile, "\n"); fprintf(outfile, "MPI_Reduce(_mg%li_fullstep, _temp_vector, _length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n", i); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<_length; _i0++)\n"); fprintf(outfile, " _mg%li_fullstep[_i0]=_temp_vector[_i0];\n", i); fprintf(outfile, "\n"); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "MPI_Reduce(_mg%li_fullstep_sd, _temp_vector, _length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n", i); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<_length; _i0++)\n"); fprintf(outfile, " _mg%li_fullstep_sd[_i0]=_temp_vector[_i0];\n", i); fprintf(outfile, "\n"); } if (simulation()->parameters()->errorCheck) { fprintf(outfile, "MPI_Reduce(_mg%li_halfstep, _temp_vector, _length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n", i); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<_length; _i0++)\n"); fprintf(outfile, " _mg%li_halfstep[_i0]=_temp_vector[_i0];\n", i); fprintf(outfile, "\n"); if (simulation()->parameters()->nPaths != "1") { fprintf(outfile, "MPI_Reduce(_mg%li_halfstep_sd, _temp_vector, _length, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);\n", i); fprintf(outfile, "\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<_length; _i0++)\n"); fprintf(outfile, " _mg%li_halfstep_sd[_i0]=_temp_vector[_i0];\n", i); fprintf(outfile, "\n"); } } fprintf(outfile, "delete[] _temp_vector;\n"); fprintf(outfile, "\n"); } if (simulation()->parameters()->mpiMethod=="Scheduling") { fprintf(outfile, " /* Adaptive Scheduler single processor break point */\n" "write_output:\n\n"); } fprintf(outfile, "if (rank==0)\n"); fprintf(outfile, " _write_output(_output_filename);\n"); fprintf(outfile, "\n"); } else if (simulation()->parameters()->usempi){ fprintf(outfile, "if (rank==0)\n"); fprintf(outfile, " _write_output(_output_filename);\n"); fprintf(outfile, "\n"); } else { fprintf(outfile, "_write_output(_output_filename);\n"); fprintf(outfile, "\n"); } if (simulation()->parameters()->benchmark) { if (simulation()->parameters()->usempi){ fprintf(outfile, "double endTime = MPI_Wtime();\n"); fprintf(outfile, "if (rank==0)\n "); fprintf(outfile, "printf(\"Time elapsed for simulation is: %%5.5f seconds\\n\", endTime-_startTime);\n"); } else{ fprintf(outfile, "gettimeofday(&tim, NULL);\n"); fprintf(outfile, "double endTime = tim.tv_sec+(tim.tv_usec/1000000.0);\n"); fprintf(outfile, "printf(\"Time elapsed for simulation is: %%.2f seconds\\n\", endTime-_startTime);\n"); } } simulation()->field()->writePlanDeletionCalls(outfile); simulation()->output()->writePlanDeletionCalls(outfile); if (simulation()->parameters()->usempi) { fprintf(outfile, "MPI_Finalize();\n"); fprintf(outfile, "\n"); } if (simulation()->parameters()->useIntelMKL && simulation()->parameters()->stochastic) { if (simulation()->parameters()->errorCheck) fprintf(outfile, "vslDeleteStream(&_gen1);\nvslDeleteStream(&_gen2);\n"); else fprintf(outfile, "vslDeleteStream(&_gen);\n"); } if (simulation()->parameters()->bing) { // this should be the last statement in the main() routine fprintf(outfile, "printf(\"\\a\");\n"); } fprintf(outfile, "return 0 ;\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->mpiMethod=="Scheduling")&&(simulation()->parameters()->usempi)&&(simulation()->parameters()->stochastic)) { fprintf(outfile, "int master(){ \n" " \n" " int outstanding = 0; /*number of slaves that are still processing tasks*/ \n" " int schedule[size]; /*Batch size scheduled for each slave [reset every iteration]*/ \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " int sendtag; /*MPI Tag value, fullstep -> 1, halfstep -> 2*/ \n"); else fprintf(outfile, " int sendtag = 1; \n"); fprintf(outfile, " \n" " double timing[size]; /*Timing function to determine computation to communication ratio*/ \n" " int partitions[size]; /*Batch size scheduled for each slave [resetted after completion]*/ \n" " \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " double *active_throughput; /*Active pointers, used for clarity*/ \n" " double *active_commave; \n" " int *active_assigned; \n" " \n"); fprintf(outfile, " int i, j, k; /*indexes, and size of MPI_COMM_WORLD*/ \n" " double bufs[size]; /*MPI Input buffer*/ \n" " int idle = size-1; /*Number of idle processors not including master (size - outstanding -1)*/ \n" " \n" " MPI_Status stats[size]; /*MPI Structures*/ \n" " MPI_Request reqs[size]; \n" " int indices[size]; \n" " int ndone; \n" " \n" " double schedtime=0.0; /*time spent deciding and dispatching schedules*/ \n" " double commtime=0.0; /*index for communication latency*/ \n" " double totaltime=0.0; /*index for seconds per schedule*/ \n" " double totalcommtime=0.0; /*total communication latency*/ \n" " double paratime=0.0; /*total parallel walltime for slaves excluding mslave*/ \n" " \n" " /************* Scheduling Parameters **************/ \n" " double calpha = 0.1; /*weighting for communication average*/ \n" " double talpha = 0.1; /*weighting for throughput average*/ \n" " double rcalpha = 1- calpha; \n" " double rtalpha = 1- talpha; \n" " \n" " double epsilon = 0.005; /*maximum tolerated communication overhead*/ \n" " double lower = 2.0; /*minimum tolerated resolution in seconds*/ \n" " double upper = 10.0; /*maximum tolerated resolution seconds*/ \n" " /***************************************************/ \n" " \n" " pthread_t helper; /*handle for slave thread*/ \n" " \n" " double tp1, tp2; \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " int master_half_step; /*This indicates whether the master is sending*/ \n" " /*out half step paths or not - redundant to the index k*/ \n" " \n"); fprintf(outfile, " //Allocate memories for global data structures \n" " slave_stat = new int[size]; //(int *)malloc(sizeof(int)*size); \n" " fschedcount = new int[size]; //(int *)malloc(sizeof(int)*size); \n" " fthroughput = new double[size]; \n" " fcommave = new double[size]; \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " hschedcount = new int[size]; \n" " hthroughput = new double[size]; \n" " hcommave = new double[size]; \n"); fprintf(outfile, " \n" " //Initialise slave status arrays \n" " for (i=0; iparameters()->errorCheck) fprintf(outfile, " \n" " hschedcount[i]=0; \n" " hcommave[i]=0.0; \n" " hthroughput[i]=0.0; \n"); fprintf(outfile, " } \n" " \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " //Initially set to full step paths \n" " _half_step = 0; \n" " master_half_step = _half_step; \n" " sendtag = 1; \n"); fprintf(outfile, " \n" " //Pthreads are always busy doing something \n" " slave_stat[0] = 1; \n" " \n" " //Initialise mutual exclusion mechanism \n" " pthread_mutex_init(&tasklock, NULL); \n" " pthread_mutex_init(&finlock, NULL); \n" " pthread_mutex_lock(&finlock); \n" " \n" " //Create a thread to act as a slave \n" " if (pthread_create(&helper, NULL, mslave, NULL)!=0) \n" " printf(\"Thread creation failed\\n\"); \n" " \n" " //Listen for messages from all slaves, including the master for some reason \n" " for (i=0; iparameters()->errorCheck) fprintf(outfile, " //Loop until all paths are finished, and all results recieved \n" " // -repeat \n" " // -Test for messages from slaves if \n" " // -Determine path schedule for idle slaves \n" " // -Send schedule to slaves \n" " \n" " /* The first iteration of this for loop allocates full paths \n" " The second iteration allocates half paths - master_half_step is a redundant \n" " indicator for this too. We could use k interchangeably with it.*/ \n" " \n" " for (k=0; k<2; k++){ \n" " \n" " if (master_half_step == 0){ \n" " active_throughput = fthroughput; \n" " active_commave = fcommave; \n" " active_assigned = &fullpaths_assigned; \n" " } \n" " else if (master_half_step == 1){ \n" " active_throughput = hthroughput; \n" " active_commave = hcommave; \n" " active_assigned = &halfpaths_assigned; \n" " } \n" " \n" " \n" " /**************LISTEN FOR \"TASKS COMPLETED\" MESSAGES FROM SLAVES*******************/ \n" " \n" " /*Loop until all fullpaths or, if during the second iteration, halfpaths are assigned \n" " the outstanding > 0 condition makes the master poll for \"complete\" messages when \n" " it has actually allocated all its full paths and half paths already.*/ \n" " \n" " while ((master_half_step == 0 && fullpaths_assigned < total_paths)|| \n" " (master_half_step == 1 && (halfpaths_assigned < total_paths || outstanding > 0))){ \n" " \n" " /*Test whether there is an incoming message from slaves \n" " the idle == 0 condition is for the situation when SOME slaves \n" " have not finished their full paths whilst the master is ready to \n" " allocate half paths - this allows the master to allocate half paths \n" " in the meantime, instead of waiting for completion of all full paths*/ \n" " \n" " if (outstanding > 0 && (idle == 0 || (fullpaths_assigned + halfpaths_assigned >= 2*total_paths))){ \n"); else fprintf(outfile, " //Loop until all tasks are finished, and all results recieved \n" " // -Check for requests from slaves for more tasks \n" " // -Cyclically allocate a task to idle slaves to thread \n" " \n" " while (fullpaths_assigned < total_paths || outstanding > 0){ \n" " \n" " if (outstanding > 0){ \n"); fprintf(outfile, " //Wait for messages from slaves \n" " \n" " Testsome: \n" " MPI_Testsome(size, reqs, &ndone, indices, stats); \n" " \n" " if (ndone == 0){ \n" " /*If no messages, sleep for x secs before checking again*/ \n" " usleep(10000); \n" " goto Testsome; \n" " } \n" " \n" " \n" " for (i=0; iparameters()->errorCheck) fprintf(outfile, " //MPI_TAG == 1 means fullpaths completed \n" " //MPI_TAG == 2 means halfpaths completed \n" " \n" " if (stats[i].MPI_TAG == 1){ \n"); fprintf(outfile, " if (fcommave[j] == 0.0){ \n" " fcommave[j] = commtime; \n" " fthroughput[j] = partitions[j]/totaltime; \n" " } \n" " else { \n" " fcommave[j] = fcommave[j]*rcalpha + (commtime * calpha); \n" " fthroughput[j] = fthroughput[j]*rtalpha + (partitions[j]/totaltime)*talpha; \n" " } \n" " \n" "#ifdef DEBUG_MPI_Scheduling \n" " fschedcount[j]+=partitions[j]; \n" " printf(\"%%d: Rank %%d, Completed %%d tasks in %%5.5f seconds ::\", stats[i].MPI_TAG, j, partitions[j], commtime+bufs[j]);\n" " printf(\" T %%5.5f : C %%5.5f : R %%5.5f %%%%\\n\", fthroughput[j], fcommave[j], commtime/(bufs[j]+commtime)*100.0); \n" "#endif \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " } \n" " else if (stats[i].MPI_TAG == 2){ \n" " if (hcommave[j] == 0.0){ \n" " hcommave[j] = commtime; \n" " hthroughput[j] = partitions[j]/totaltime; \n" " } \n" " else { \n" " hcommave[j] = hcommave[j]*rcalpha + (commtime * calpha); \n" " hthroughput[j] = hthroughput[j]*rtalpha + (partitions[j]/totaltime)*talpha; \n" " } \n" "#ifdef DEBUG_MPI_Scheduling \n" " hschedcount[j]+=partitions[j]; \n" " printf(\"%%d: Rank %%d, Completed %%d tasks in %%5.5f seconds ::\", stats[i].MPI_TAG, j, partitions[j], commtime+bufs[j]);\n" " printf(\" T %%5.5f : C %%5.5f : R %%5.5f %%%%\\n\", hthroughput[j], hcommave[j], commtime/(bufs[j]+commtime)*100.0); \n" "#endif \n" " } \n"); fprintf(outfile, " \n" " totalcommtime += commtime; \n" " paratime += totaltime; \n" " slave_stat[j] = 0; \n" " idle++; \n" " outstanding--; \n" " MPI_Irecv(&bufs[j], 1, MPI_DOUBLE, j, MPI_ANY_TAG, MPI_COMM_WORLD, &reqs[j]); \n" " } \n" " } \n" " \n" " //Continue to listen for \"completed\" messages from slaves, if no more tasks need to be assigned \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " if (halfpaths_assigned + fullpaths_assigned >= 2*total_paths) \n"); else fprintf(outfile, " if (fullpaths_assigned >= total_paths) \n"); fprintf(outfile, " continue; \n" " \n" " /********************SCHEDULE MORE TASKS FOR IDLE SLAVES***********************/ \n" " \n" " for (i=0; iparameters()->errorCheck) fprintf(outfile, " if (*active_assigned >= total_paths) \n"); else fprintf(outfile, " if (fullpaths_assigned >= total_paths) \n"); fprintf(outfile, " break; \n" " \n" " //only allocate more tasks to slaves that are idle \n" " if (slave_stat[i] == 0){ \n" " //printf(\"allocating tasks to rank %%d\\n\", i); \n" " slave_stat[i]=1; \n" " idle--; \n" " \n" " //Determine partition size based on slave throughput and \n" " //communication overhead. Preferable estimated computing times \n" " //for each schedule is high enough to reduce comm overhead \n" " //and between upper and lower \n" " \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " partitions[i] = (int) (MAX((active_commave[i]*active_throughput[i])/epsilon, active_throughput[i]*lower)); \n" " partitions[i] = (int) (MIN(partitions[i], active_throughput[i]*upper)); \n" " partitions[i] = (int) (MAX(partitions[i], 1)); \n" " \n" " if (*active_assigned + partitions[i] <= total_paths){ \n" " schedule[i] = partitions[i]; \n" " *active_assigned += partitions[i]; \n" " } \n" " else { \n" " schedule[i] = total_paths-*active_assigned; \n" " partitions[i] = schedule[i]; \n" " *active_assigned += schedule[i]; \n"); else fprintf(outfile, " partitions[i] = (int) (MAX((fcommave[i]*fthroughput[i])/epsilon, fthroughput[i]*lower)); \n" " partitions[i] = (int) (MIN(partitions[i], fthroughput[i]*upper)); \n" " partitions[i] = (int) (MAX(partitions[i], 1)); \n" " \n" " if (fullpaths_assigned + partitions[i] <= total_paths){ \n" " schedule[i] = partitions[i]; \n" " fullpaths_assigned += partitions[i]; \n" " } \n" " else { \n" " schedule[i] = total_paths-fullpaths_assigned; \n" " partitions[i] = schedule[i]; \n" " fullpaths_assigned += schedule[i]; \n"); fprintf(outfile, " } \n" " } \n" " } \n" " \n" " pthread_mutex_unlock(&tasklock); \n" " \n" " /**************************SEND SCHEDULE TO SLAVE(S)********************/ \n" " //send instructions via MPI to slaves that have been shcheduled \n" " for (i=1; i0){ \n" " timing[i] = MPI_Wtime(); \n" " MPI_Send(&schedule[i], 1, MPI_INT, i, sendtag, MPI_COMM_WORLD); \n" " outstanding++; \n" " } \n" " } \n" " tp2 = MPI_Wtime() - tp1; \n" " schedtime += tp2; \n" " } \n" " \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " //Initialise variables to do half steps \n" " master_half_step = 1; \n" " sendtag = 2; \n" " } \n" " \n"); fprintf(outfile, " //Block until the thread slave has completed processing \n" " pthread_mutex_lock(&finlock); \n" " \n" " //Tell slave processes to Reduce then exit \n" " for (i=0; iparameters()->errorCheck) fprintf(outfile, " printf(\"\\nHalfpaths returned by each process:\\n\"); \n" " print_array2(hschedcount, size); \n"); fprintf(outfile, " \n" " printf(\"\\nEstimated fullpath throughput and commtime\\n\"); \n" " print_array(fthroughput, size); printf(\"\\n\"); \n" " print_array(fcommave, size); \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " printf(\"\\nEstimated halfpath throughput and commtime\\n\"); \n" " print_array(hthroughput, size); printf(\"\\n\"); \n" " print_array(hcommave, size); \n"); fprintf(outfile, " \n" " printf(\"\\n\"); \n" " printf(\"Scheduling time = %%5.5f sec\\n\", schedtime); \n" " printf(\"Communication time = %%5.5f sec\\n\", totalcommtime); \n" " printf(\"Total parallel time (excl thread) = %%5.5f sec\\n\", paratime); \n" " printf(\"**************************************\\n\\n\"); \n" " fflush(stdout); \n" "#endif \n" " \n" " /*Free memory*/ \n" " delete[] slave_stat; \n" " delete[] fschedcount; \n" " delete[] fthroughput; \n" " delete[] fcommave; \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " delete[] hschedcount; \n" " delete[] hthroughput; \n" " delete[] hcommave; \n" " \n"); fprintf(outfile, " return 0; \n" "} \n" " \n" " \n" " \n" "void *mslave(void *ptr){ \n" " //This is the threaded slave, which is spawned by the master to do tasks in parallel \n" " //it self schedules itself more task batches. It takes in one argument, which is \n" " //the size of the solution array. \n" " \n" " int thr_batchsize; \n" " double thr_throughput=0.0; \n" " double thr_time_per_batch=2.0; \n" " double thr_talpha=0.1; \n" " \n" " int i; \n" " struct timeval *tp1, *tp2; \n" " double tp3; \n" " \n" " \n" " //Initialise timing structure \n" " tp1 = new struct timeval; //(struct timeval *)malloc(sizeof(struct timeval)); \n" " tp2 = new struct timeval; //(struct timeval *)malloc(sizeof(struct timeval)); \n" " \n" " thr_batchsize = 1; \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " _half_step = 0; \n" " \n" " while(fullpaths_assigned + halfpaths_assigned < 2*total_paths){ \n"); else fprintf(outfile, " while(fullpaths_assigned < total_paths){ \n"); fprintf(outfile, " //Self schedule more tasks to process \n" " gettimeofday(tp1, NULL); \n" " \n" " /********************SCHEDULE MORE TASKS*************************/ \n" " pthread_mutex_lock(&tasklock); \n" " \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " if (halfpaths_assigned + fullpaths_assigned >= 2*total_paths) \n"); else fprintf(outfile, " if (fullpaths_assigned >= total_paths) \n"); fprintf(outfile, " break; \n" " \n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " //Set to half step (once), if all full step paths are assigned \n" " if (fullpaths_assigned >= total_paths && _half_step == 0){ \n" " printf(\"Rank[%%i] beginning half step paths\\n\", rank); \n" " fthroughput[0]=thr_throughput; \n" " _half_step = 1; \n" " thr_batchsize = 1; \n" " thr_throughput = 0.0; \n" " } \n" " if (_half_step==0){ \n"); }; fprintf(outfile, " if (fullpaths_assigned + thr_batchsize <= total_paths) \n" " fullpaths_assigned += thr_batchsize; \n" " else { \n" " thr_batchsize = (total_paths - fullpaths_assigned); \n" " fullpaths_assigned += thr_batchsize; \n" " } \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " } \n" " else if (_half_step == 1){ \n" " if (halfpaths_assigned+thr_batchsize <= total_paths) \n" " halfpaths_assigned += thr_batchsize; \n" " else { \n" " thr_batchsize = (total_paths - halfpaths_assigned); \n" " halfpaths_assigned += thr_batchsize; \n" " } \n" " } \n"); fprintf(outfile, " \n" " pthread_mutex_unlock(&tasklock); \n" " \n" " /*****************************************************************/ \n" " \n" " _segment0(thr_batchsize); \n" " \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, "#ifdef DEBUG_MPI_Scheduling \n" " if (_half_step == 0) \n"); fprintf(outfile, " fschedcount[0]+=thr_batchsize; \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " else \n" " hschedcount[0]+=thr_batchsize; \n" "#endif \n"); fprintf(outfile, " \n" " gettimeofday(tp2, NULL); \n" " \n" " /********************CALCULATE NEW BATCH SIZE*********************/ \n" " \n" " tp3 = ((tp2->tv_sec - tp1->tv_sec)+((tp2->tv_usec-tp1->tv_usec)/1000000.0)); \n" " \n" " if (thr_throughput == 0.0) \n" " thr_throughput = thr_batchsize/tp3; \n" " else \n" " thr_throughput = (1-thr_talpha)*thr_throughput + thr_talpha * (thr_batchsize/tp3); \n" " \n" "#ifdef DEBUG_MPI_Scheduling \n" " printf(\"Rank 0, Completed %%d tasks in %%5.5f secs, T %%5.5f\\n\", thr_batchsize, tp3, thr_throughput); \n" "#endif \n" " \n" " thr_batchsize = MAX(1, (int) (thr_throughput * thr_time_per_batch)); \n" " /*****************************************************************/ \n" " } \n" " \n" " //Unlocking indicates that the thread slave has finished processing \n" " //and allows the master to gather results it has produced \n"); if (simulation()->parameters()->errorCheck) fprintf(outfile, " hthroughput[0] = thr_throughput; \n" " delete tp1; \n" " delete tp2; \n"); else fprintf(outfile, " fthroughput[0] = thr_throughput; \n"); fprintf(outfile, " pthread_mutex_unlock(&finlock); \n" " return 0; \n" "} \n" " \n" "void *slave(void *ptr){ \n" " //This is a slave that runs on another process, it requests more tasks from the master \n" " //when it finishes its current task. It takes the length of the solution array as \n" " //argument. \n" " \n" " MPI_Status stat; \n" " int count; /*batch size*/ \n" " int i; \n" " double tp1, tp2; \n" " unsigned long _length; \n" " \n" " while(1){ \n" " //Wait for task from master \n" " MPI_Recv(&count, 1, MPI_INT, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &stat); \n" " \n" " tp1 = MPI_Wtime(); \n" " \n" " //Check message type \n" " if (stat.MPI_TAG == 0) { \n" " break; \n" " } \n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " else if (stat.MPI_TAG == 1){ \n" " _half_step = 0; \n" " } \n" " else if (stat.MPI_TAG == 2 && _half_step == 0){ \n" " printf(\"Rank[%%i] beginning half step paths\\n\", rank); \n" " _half_step = 1; \n" " }\n"); }; fprintf(outfile, " \n" " _segment0(count); \n" " \n" " tp2 = MPI_Wtime() - tp1; \n" " \n" " //Send completion notice to the master \n" " MPI_Send(&tp2, 1, MPI_DOUBLE, 0, stat.MPI_TAG, MPI_COMM_WORLD); \n" " } \n" " //Tell master that slave is done \n" " MPI_Send(NULL, 0, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD); \n" " return 0; \n" "} \n" " \n" "//Debugging functions \n" " \n" "int print_array(double *array, int size){ \n" " int i, j; \n" " for (i=0, j=0 ; iparameters()->usempi) fprintf(outfile, "void _segment0() {\n"); else if (simulation()->parameters()->mpiMethod=="Scheduling") fprintf(outfile, "void _segment0(int count) {\n"); else fprintf(outfile, "void _segment0(const int& size) {\n"); fprintf(outfile, "\n"); if ((simulation()->parameters()->stochastic)&&(!(simulation()->parameters()->mpiMethod=="Scheduling")||(!simulation()->parameters()->usempi))) { if (simulation()->parameters()->errorCheck) { if (!simulation()->parameters()->useIntelMKL) { if (simulation()->parameters()->usempi) { fprintf(outfile, "_gen1[0] = %s+rank;\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, "_gen2[0] = %s+rank;\n", simulation()->parameters()->seed[1].c_str()); } else { fprintf(outfile, "_gen1[0] = %s;\n", simulation()->parameters()->seed[0].c_str()); fprintf(outfile, "_gen2[0] = %s;\n", simulation()->parameters()->seed[1].c_str()); } fprintf(outfile, "_gen1[1] = 0;\n"); fprintf(outfile, "_gen2[1] = 0;\n"); fprintf(outfile, "_gen1[2] = 0;\n"); fprintf(outfile, "_gen2[2] = 0;\n"); fprintf(outfile, "erand48(_gen1);\n"); fprintf(outfile, "erand48(_gen2);\n"); } else { fprintf(outfile, "vslNewStream(&_gen1, VSL_BRNG_MCG31, %s%s);\n", simulation()->parameters()->seed[0].c_str(), simulation()->parameters()->usempi ? " + rank" : ""); fprintf(outfile, "vslNewStream(&_gen2, VSL_BRNG_MCG31, %s%s);\n", simulation()->parameters()->seed[1].c_str(), simulation()->parameters()->usempi ? " + rank" : ""); } } else { if (!simulation()->parameters()->useIntelMKL) { if (simulation()->parameters()->usempi) { fprintf(outfile, "_gen[0] = %s+rank;\n", simulation()->parameters()->seed[0].c_str()); } else { fprintf(outfile, "_gen[0] = %s;\n", simulation()->parameters()->seed[0].c_str()); } fprintf(outfile, "_gen[1] = 0;\n"); fprintf(outfile, "_gen[2] = 0;\n"); fprintf(outfile, "erand48(_gen);\n"); } else { fprintf(outfile, "vslNewStream(&_gen, VSL_BRNG_MCG31, %s%s);\n", simulation()->parameters()->seed[0].c_str(), simulation()->parameters()->usempi ? " + rank" : ""); } } } const char* indent = ""; if ((simulation()->parameters()->mpiMethod=="Scheduling")&&(simulation()->parameters()->stochastic)&&(simulation()->parameters()->usempi)) { fprintf(outfile, " for (long _i0=0; _i0parameters()->stochastic){ if (simulation()->parameters()->usempi) { fprintf(outfile, " for (long _i0=rank; _i0<_n_paths; _i0+=size)"); } else { fprintf(outfile, " for (long _i0=0; _i0<_n_paths; _i0++)"); } indent=" "; fprintf(outfile, " {\n"); fprintf(outfile, "\n"); } fprintf(outfile, "%s%s=0;\n", indent, simulation()->parameters()->propDimName.c_str()); fprintf(outfile, "\n"); simulation()->field()->writeInitialisationCalls(outfile, indent); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { fprintf(outfile, "%s_mg%li_sample_pointer=0;\n", indent, i); if (simulation()->output()->momentGroup(i)->requiresIntegrations()|simulation()->output()->momentGroup(i)->requiresInitialisation()|(simulation()->parameters()->usempi&!simulation()->parameters()->stochastic)) { fprintf(outfile, "%s_mg%li_raw_initialise();\n", indent, i); } } fprintf(outfile, "\n"); simulation()->field()->writeSampleCalls(outfile, indent); if ((simulation()->parameters()->mpiMethod=="Scheduling")&&(simulation()->parameters()->stochastic)&&(simulation()->parameters()->usempi)) { //Write nothing } else if (simulation()->parameters()->nPaths != "1") { if (simulation()->parameters()->usempi) { fprintf(outfile, "%sprintf(\"Rank[%%i]: Starting path %%li\\n\", rank, _i0+1);\n", indent); } else { fprintf(outfile, "%sprintf(\"Starting path %%li\\n\", _i0+1);\n", indent); } fprintf(outfile, "%sfflush(stdout);\n", indent); } for (list::const_iterator ppxmdsSegment = mySegmentList.begin(); ppxmdsSegment != mySegmentList.end(); ppxmdsSegment++) { if ((simulation()->parameters()->runTimeLimit > 0.0) && !(*ppxmdsSegment)->runsInOvertime()) { fprintf(outfile, "if (!_overtime) {\n"); } fprintf(outfile, "// Segment %li\n", (*ppxmdsSegment)->segmentNumber); (*ppxmdsSegment)->writeInitialisationCalls(outfile); fprintf(outfile, "%s_segment%li(1);\n", indent, (*ppxmdsSegment)->segmentNumber); (*ppxmdsSegment)->writeDestructionCalls(outfile); fprintf(outfile, "\n"); if (simulation()->parameters()->runTimeLimit > 0.0 && !(*ppxmdsSegment)->runsInOvertime()) { fprintf(outfile, "}\n"); } } fprintf(outfile, "\n"); for (unsigned long i=0; ioutput()->nMomentGroups(); i++) { fprintf(outfile, "%s_mg%li_process();\n", indent, i); } if (simulation()->parameters()->stochastic) fprintf(outfile, " }\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } else { // I am a sub-sequence if (verbose()) { printf("Writing sequence routine ...\n"); } fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// segment %li (sequence) routines\n", segmentNumber); fprintf(outfile, "\n"); fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _segment%li(unsigned long cycle) {\n", segmentNumber); for (list:: const_iterator ppxmdsSegment = mySegmentList.begin(); ppxmdsSegment != mySegmentList.end(); ppxmdsSegment++) { (*ppxmdsSegment)->writeInitialisationCalls(outfile); } fprintf(outfile, "for (unsigned long i=0; i<%li; i++) {\n", nCycles); for (list::const_iterator ppxmdsSegment = mySegmentList.begin(); ppxmdsSegment != mySegmentList.end(); ppxmdsSegment++) { if ((simulation()->parameters()->runTimeLimit > 0.0) && !(*ppxmdsSegment)->runsInOvertime()) { fprintf(outfile, "if (!_overtime)"); } fprintf(outfile, " _segment%li(i+1);\n", (*ppxmdsSegment)->segmentNumber); } fprintf(outfile, " }\n"); for (list::const_iterator ppxmdsSegment = mySegmentList.begin(); ppxmdsSegment != mySegmentList.end(); ppxmdsSegment++) { (*ppxmdsSegment)->writeDestructionCalls(outfile); } fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } xmdsElement::writeRoutines(outfile); fprintf(outfile, "\n"); } // ************************************************************************** bool xmdsSequence::runsInOvertime() const { return true; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsSequence() { if (debugFlag) { printf("xmdsSequence::createxmdsSequence\n"); } xmdsSegment* newxmdsSegment = new xmdsSequence(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateRK4EX() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateRK4EX\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateRK4EX(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateRK4IP() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateRK4IP\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateRK4IP(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateRK9EX() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateRK9EX\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateRK9EX(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateRK9IP() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateRK9IP\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateRK9IP(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateARK45EX() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateARK45EX\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateARK45EX(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateARK45IP() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateARK45IP\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateARK45IP(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateARK89EX() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateARK89EX\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateARK89EX(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateARK89IP() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateARK89IP\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateARK89IP(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateSIEX() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateSIEX\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateSIEX(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsIntegrateSIIP() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateSIIP\n"); } xmdsSegment* newxmdsSegment = new xmdsIntegrateSIIP(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsFilter() { if (debugFlag) { printf("xmdsSequence::createxmdsIntegrateFilter\n"); } xmdsSegment* newxmdsSegment = new xmdsFilter(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } // ************************************************************************** xmdsSegment* xmdsSequence::createxmdsBreakpoint() { if (debugFlag) { printf("xmdsSequence::createxmdsBreakpoint\n"); } xmdsSegment* newxmdsSegment = new xmdsBreakpoint(simulation(), verbose()); addChild((xmdsElement*) newxmdsSegment); mySegmentList.push_back(newxmdsSegment); return newxmdsSegment; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_sequence.h0000644000076500000240000001064011033277417013740 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_sequence.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_sequence.h @brief More detailed explanation... */ #ifndef XMDS_SEQUENCE_H #define XMDS_SEQUENCE_H #include // ***************************************************************************** // ***************************************************************************** // xmdsSequence // ***************************************************************************** // ***************************************************************************** //! I think this organises the sequence in which elements of the simulation are processed. class xmdsSequence : public xmdsSegment { public : //! Constructor for xmdsSequence object xmdsSequence( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode); //! Destructor ~xmdsSequence(); //! Processes elements within an xmds sequence void processElement( const Element *const yourElement); //! Returns the output sample count of the sequence void outputSampleCount() const; //! Whether or not the segment needs to run when the simulation is in overtime bool runsInOvertime() const; private : unsigned long nCycles; //!< The number of cycles in the sequence list mySegmentList; //!< The list of segments //! Write the sequence defines to file void writeDefines( FILE *const outfile) const; //! Write the sequence globals to file void writeGlobals( FILE *const outfile) const; //! Write the sequence prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the sequence routines to file void writeRoutines( FILE *const outfile) const; //! Create an xmds sequence object xmdsSegment* createxmdsSequence(); //! Create an xmds integrate RK4 EX object xmdsSegment* createxmdsIntegrateRK4EX(); //! Create an xmds integrate RK4 IP object xmdsSegment* createxmdsIntegrateRK4IP(); //! Create an xmds integrate RK9 EX object xmdsSegment* createxmdsIntegrateRK9EX(); //! Create an xmds integrate RK9 IP object xmdsSegment* createxmdsIntegrateRK9IP(); //! Create an xmds integrate ARK45 EX object xmdsSegment* createxmdsIntegrateARK45EX(); //! Create an xmds integrate ARK45 IP object xmdsSegment* createxmdsIntegrateARK45IP(); //! Create an xmds integrate ARK89 EX object xmdsSegment* createxmdsIntegrateARK89EX(); //! Create an xmds integrate ARK89 IP object xmdsSegment* createxmdsIntegrateARK89IP(); //! Create an xmds integrate SI EX object xmdsSegment* createxmdsIntegrateSIEX(); //! Create an xmds integrate SI IP object xmdsSegment* createxmdsIntegrateSIIP(); //! Create an xmds filte object xmdsSegment* createxmdsFilter(); //! Create an xmds breakpoint object xmdsSegment* createxmdsBreakpoint(); }; //! Structure containing components of an xmdsSequence struct coStruct { unsigned long componentNumber; //!< The component number list operatorNumbersList; //!< The operator numbers list list coKeysList; //!< The component keys list }; //! Structure containing components of an integrate moment group struct integrateMomentGroup { list momentNameList; //!< The list of moment names list integrateDimensionList; //!< List of whether dimensions are integrated XMLString integrateMomentGroupCode; //!< The integrate moment group code }; #endif // XMDS_SEQUENCE_H xmds-1.6.6/source/xmds_simulation.cc0000644000076500000240000016127111033277417014461 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_simulation.cc 1923 2008-03-27 03:15:55Z grahamdennis $ */ /*! @file xmds_simulation.cc @brief Simulation element parsing classes and methods More detailed explanation... */ #include #include #include #include "version.h" #include #include #include // ************************************************************************** // ************************************************************************** // xmdsSimulation public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsSimulations = 0; //!< The number of xmds simulation objects // ************************************************************************** xmdsSimulation::xmdsSimulation( const char *const yourRawFileName, const bool& yourVerboseMode, const bool& mpiAvailable) : xmdsElement(this, yourVerboseMode) { if (debugFlag) { nxmdsSimulations++; printf("xmdsSimulation::xmdsSimulation\n"); printf("nxmdsSimulations=%li\n", nxmdsSimulations); } myParameters.rawFileName = yourRawFileName; myParameters.stochastic = 0; myParameters.nThreads = 1; myParameters.nPaths = "1"; myParameters.mpiAvailable = mpiAvailable; myParameters.usempi = 0; myParameters.bing = 0; myParameters.seed[0] = "1"; myParameters.seed[1] = "2"; myParameters.nNoises = 0; myParameters.noiseKind = "gaussian"; myParameters.noiseMean = 5.0; myParameters.errorCheck = 1; myParameters.useWisdom = 0; myParameters.binaryOutput = 0; myParameters.useDouble = 1; myParameters.benchmark = 0; #if FFTW_THREE_ONLY // if we *only* have fftw3, use it myParameters.fftwVersion = 3; #else myParameters.fftwVersion = 2; // Default to using fftw2 #endif myParameters.version = VERSION; myParameters.revision = REVISION; myCurrentSegmentNumber = 0; myArgv = 0; } // ************************************************************************** xmdsSimulation::~xmdsSimulation() { if (debugFlag) { nxmdsSimulations--; printf("xmdsSimulation::~xmdsSimulation\n"); printf("nxmdsSimulations=%li\n", nxmdsSimulations); } } // ************************************************************************** void xmdsSimulation::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsSimulation::processElement\n"); } // ************************************ // process parameters // ************************************ list myXMLStringList; list myBoolList; list myULongList; // ************************************ // First we note that tags may want to // want to take an input arguement, so // we should process those early... // ************************************ const NodeList* candidateElements; // ************************************ // find argv element and process candidateElements = yourElement->getElementsByTagName("argv", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Multiple elements!"); } else if (candidateElements->length() == 1) { myArgv = createxmdsArgv(); const Element* yourElement = dynamic_cast (candidateElements->item(0)); myArgv->processElement(yourElement); } // ************************************ // find 'name' getAssignmentStrings(yourElement, "name", 0, 1, myXMLStringList); if (myXMLStringList.size() == 1) { myParameters.simulationName = *myXMLStringList.begin(); if (verbose()) { printf("simulation name = '%s'\n", myParameters.simulationName.c_str()); } } else { // Create default simulation file name unsigned long lastdot = 0; const XMLString tempName = myParameters.rawFileName; unsigned long i = 0; while (i 0) { tempName.subString(myParameters.simulationName, 0, lastdot); } else { myParameters.simulationName = tempName; } if (verbose()) { printf("simulation name defaulting to '%s'\n", myParameters.simulationName.c_str()); } } // ************************************ // find 'prop_dim' getAssignmentStrings(yourElement, "prop_dim", 1, 1, myXMLStringList); myParameters.propDimName = *myXMLStringList.begin(); if (verbose()) { printf("simulation prop_dim = '%s'\n", myParameters.propDimName.c_str()); } // ************************************ // find 'author' getAssignmentStrings(yourElement, "author", NOT_REQD, 0, myXMLStringList); if (myXMLStringList.size() > 0) { myParameters.authorName = *myXMLStringList.begin(); myXMLStringList.pop_front(); for (list::const_iterator pXMLString = myXMLStringList.begin(); pXMLString != myXMLStringList.end(); pXMLString++) { myParameters.authorName += " "; myParameters.authorName += *pXMLString; } if (verbose()) { printf("simulation author = '%s'\n", myParameters.authorName.c_str()); } } else { // this warning may need to be taken out somehow, but I sort of want people // to be nice little coders and document their code nicely, and this is // one way to do it... (PTC) printf("No tag found. It's not required, but it's a Good Idea.\n"); } // ************************************ // find 'description' const NodeList* descriptionElements = yourElement->getElementsByTagName("description", 0); if (descriptionElements->length() == 0) { // this warning may need to be taken out somehow, but I sort of want people // to be nice little coders and document their code nicely, and this is // one way to do it... (PTC) printf("No tag found. It's not required, but it's a Good Idea.\n"); } else if (descriptionElements->length() > 1) { printf("More than one tag found... That's a little odd.\n"); } else { myParameters.description = *descriptionElements->item(0)->textContent(0); if (verbose()) { printf("simulation description = '%s'\n", myParameters.description.c_str()); } } // ************************************ // find 'error_check' getAssignmentBools(yourElement, "error_check", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.errorCheck = *myBoolList.begin(); if (verbose()) { if (myParameters.errorCheck) { printf("simulation error_check is 'yes'\n"); } else { printf("simulation error_check is 'no'\n"); } } } else { if (verbose()) { printf("simulation error_check defaulting to 'yes'\n"); } myParameters.errorCheck = 1; } // ************************************ // find 'use_wisdom' getAssignmentBools(yourElement, "use_wisdom", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.useWisdom = *myBoolList.begin(); if (verbose()) { if (myParameters.useWisdom) { printf("simulation use_wisdom is 'yes'\n"); } else { printf("simulation use_wisdom is 'no'\n"); } } } else { if (verbose()) { printf("simulation use_wisdom defaulting to 'no'\n"); } myParameters.useWisdom = 0; } // ************************************ // find 'use_prefs' getAssignmentBools(yourElement, "use_prefs", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.usePrefs = *myBoolList.begin(); if (verbose()) { if (myParameters.usePrefs) { printf("simulation use_prefs is 'yes'\n"); } else { printf("simulation use_prefs is 'no'\n"); } } } else { if (verbose()) { printf("simulation use_prefs defaulting to 'yes'\n"); } myParameters.usePrefs = 1; } // *********************************** // find binary output flag getAssignmentBools(yourElement, "binary_output", 0, 1, myBoolList); if (myBoolList.size() == 1) { // now we need to print a warning and tell the user what they can do to fix the problem sprintf(errorMessage(), "Using the tag is obsolete.\n" " Please replace this tag and use the format=\"ascii|binary\"\n" " attribute of the tag instead."); throw xmdsException(errorMessage()); } else { if (verbose()) { printf("simulation binary_output defaulting to 'no'\n"); } myParameters.binaryOutput = 0; } // *********************************** // find use_double element getAssignmentBools(yourElement, "use_double", 0, 1, myBoolList); if (myBoolList.size() == 1) { // now we need to print a warning and tell the user what they can do to fix the problem sprintf(errorMessage(), "Using the tag is obsolete.\n" " Please replace this tag and use the precision=\"double|single\"\n" " attribute of the tag instead."); throw xmdsException(errorMessage()); } else { if (verbose()) { printf("simulation use_double defaulting to 'yes'\n"); } myParameters.useDouble = 1; } // *********************************** // find benchmark element getAssignmentBools(yourElement, "benchmark", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.benchmark = *myBoolList.begin(); if (verbose()) { if (myParameters.benchmark) { printf("simulation benchmark is 'yes'\n"); } else { printf("simulation benchmark is 'no'\n"); } } } else { if (verbose()) { printf("simulation benchmark defaulting to 'no'\n"); } myParameters.benchmark = 0; } // ************************************ // find 'threads' getAssignmentULongs(yourElement, "threads", 0, 1, myULongList); if (myULongList.size() == 1) { myParameters.nThreads = *myULongList.begin(); if (myParameters.nThreads < 1) { throw xmdsException(yourElement, "number of threads must be > 0"); } if (verbose()) { printf("number of threads = %li\n", myParameters.nThreads); } } else { if (verbose()) { printf("number of threads defaulting to 1\n"); } myParameters.nThreads = 1; } // ************************************ // find 'stochastic' getAssignmentBools(yourElement, "stochastic", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.stochastic = *myBoolList.begin(); if (verbose()) { if (myParameters.stochastic) { printf("simulation stochastic is 'yes'\n"); } else { printf("simulation stochastic is 'no'\n"); } } } else { if (verbose()) { printf("simulation stochastic defaulting to 'no'\n"); } myParameters.stochastic = 0; } // ************************************ // find 'use_mpi' assignment getAssignmentBools(yourElement, "use_mpi", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.usempi = *myBoolList.begin(); if (myParameters.usempi & !myParameters.mpiAvailable) { throw xmdsException(yourElement, "MPI was not available when xmds was installed"); } if (verbose()) { if (myParameters.usempi) { printf("use_mpi is 'yes'\n"); } else { printf("use_mpi is 'no'\n"); } } } else { if (verbose()) { printf("use_mpi defaulting to 'no'\n"); } myParameters.usempi = 0; } if ((myParameters.usempi) & (myParameters.nThreads > 1) & (!myParameters.stochastic)) { throw xmdsException(yourElement, "Non-determinstic MPI and threaded FFTs are not compatible"); } // ************************************ // find 'fftw_version' getAssignmentULongs(yourElement, "fftw_version", false, 1, myULongList); if (myULongList.size() == 1) { myParameters.fftwVersion = *myULongList.begin(); #if FFTW_THREE_ONLY if (myParameters.fftwVersion != 3) { throw xmdsException(yourElement, "xmds was built with only fftw version 3 enabled.\n" "You cannot specify the use of a different fftw version."); } #endif if (myParameters.fftwVersion < 2 || myParameters.fftwVersion > 3) { throw xmdsException(yourElement, "fftw version must be either 2 or 3"); } if (verbose()) { printf("using fftw version %li\n", myParameters.fftwVersion); } if (myParameters.fftwVersion == 3) { if (myParameters.usempi == true && myParameters.stochastic == false) { throw xmdsException(yourElement, "MPI for deterministic simulations is not yet supported for fftw version 3"); } } } else { // default #if FFTW_THREE_ONLY myParameters.fftwVersion = 3; #else myParameters.fftwVersion = 2; #endif if (verbose()) { printf("defaulting to using fftw version %li\n", myParameters.fftwVersion); } } // ************************************ // find 'bing' assignment getAssignmentBools(yourElement, "bing", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.bing = *myBoolList.begin(); if (verbose()) { if (myParameters.bing) { printf("bing is 'yes'\n"); } else { printf("bing is 'no'\n"); } } } else { if (verbose()) { printf("bing defaulting to 'no'\n"); } myParameters.bing = 0; } // ************************************ // find 'use_openmp' assignment getAssignmentBools(yourElement, "use_openmp", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.useOpenMP = *myBoolList.begin(); if (myParameters.usempi == true && myParameters.stochastic == false && myParameters.useOpenMP == true) { throw xmdsException(yourElement, "It is not possible to use both OpenMP and MPI for deterministic simulations"); } if (verbose()) { if (myParameters.useOpenMP) { printf("Using OpenMP\n"); } else { printf("Not using OpenMP\n"); } } } else { if (verbose()) { printf("Defaulting to OpenMP disabled"); } myParameters.useOpenMP = false; } // ************************************ // if stochastic get paths, and seed assignments if (myParameters.stochastic) { // ************************************ // get paths getAssignmentStrings(yourElement, "paths", 1, 1, myXMLStringList); myParameters.nPaths = *myXMLStringList.begin(); unsigned long temp_ulong; if (myParameters.nPaths.asULong(temp_ulong)) { // If the user specified a number... if (temp_ulong < 1) { throw xmdsException(yourElement, "number of paths must be > 0"); } } if (verbose()) { printf("number of paths = %s\n", myParameters.nPaths.c_str()); } // ************************************ // get seeds - updated to allow command-line args and/or positive integers getAssignmentStrings(yourElement, "seed", 1, 2, myXMLStringList); list::const_iterator pXMLString = myXMLStringList.begin(); myParameters.seed[0] = *pXMLString; pXMLString++; myParameters.seed[1] = *pXMLString; unsigned long myULong; list theArgXMLStringList; if (myArgv) { myArgv->argNames(theArgXMLStringList); // acquire the list of arg names from myArgv } // We need to test whether the seeds are valid // If it is not a simple unsigned integer, then is it a command-line arguement? if (myParameters.seed[0].asULong(myULong) == 0) { // Deal with seed1 if (verbose()) { printf("Remark: First seed is not a positive integer.\n"); } // I've made it not have to barf... if the user doesn't want to use a positive integer // then they can deal with the any problems during compilation... (Andy F) /* // Now we want to search the list of command-line argument lines for a match. Otherwise barf. bool myBool = 0; for (list::const_iterator myXMLString_iterator = theArgXMLStringList.begin(); myXMLString_iterator != theArgXMLStringList.end(); myXMLString_iterator++) { if (!strcmp(myParameters.seed[0].c_str(), myXMLString_iterator->c_str())) { myBool = 1; if (verbose()) { printf("Found command-line argument match for first seed %s. \n", myParameters.seed[0].c_str()); } } else { if (verbose()) { printf("Seed %s doesn't match arg %s.\n", myParameters.seed[0].c_str(), myXMLString_iterator->c_str()); } } } if (myBool == 0) { throw xmdsException(yourElement, "Found non-positive integer for first seed. Seed must be a valid " "command-line argument or positive integer.\n"); } */ } if (myParameters.seed[1].asULong(myULong) == 0) { // Deal with seed2 if (verbose()) { printf("Remark: Second seed is not a positive integer.\n"); } /* // Now we want to search the list of command-line argument lines for a match. Otherwise barf. bool myBool = 0; for (list::const_iterator myXMLString_iterator = theArgXMLStringList.begin(); myXMLString_iterator != theArgXMLStringList.end(); myXMLString_iterator++) { if (strcmp(myParameters.seed[0].c_str(), myXMLString_iterator->c_str())) { myBool = 1; if (verbose()) { printf("Found command-line argument match for second seed %s. \n", myParameters.seed[0].c_str()); } } else { if (verbose()) { printf("Seed %s doesn't match arg %s.\n", myParameters.seed[0].c_str(), myXMLString_iterator->c_str()); } } } if (myBool == 0) { throw xmdsException(yourElement, "Found non-positive integer for second seed. Seed must be a " "valid command-line argument or positive integer."); } */ } // We don't want identical seeds, for some reason. Andy F asks "why??" if (myParameters.seed[0] == myParameters.seed[1]) { throw xmdsException(yourElement, "seeds are indentical"); } if (verbose()) { printf("seeds are %s and %s\n", myParameters.seed[0].c_str(), myParameters.seed[1].c_str()); } // ************************************ // get noises getAssignmentULongs(yourElement, "noises", 1, 1, myULongList); myParameters.nNoises = 2*((*myULongList.begin()+1)/2); if (myParameters.nNoises < 2) { throw xmdsException(yourElement, "number of noises must be > 0"); } if (verbose()) { printf("number of noises = %li\n", myParameters.nNoises); } // find out what kind of noise is specified, if any getAttributeStrings(yourElement, "noises", "kind", NOT_REQD, myParameters.noiseKind); // the kind has several values, current possible values are: // (this list may be augmented in time) // "gaussian" // "gaussFast" // "poissonian" // "uniform" if (debugFlag) { printf("After getAttributeStrings(), noiseKind = %s\n", myParameters.noiseKind.c_str()); } if (myParameters.noiseKind == "") { if (verbose()) { printf("Setting the default noise kind (i.e. \"gaussian\")\n"); } myParameters.noiseKind = "gaussian"; // this is the default option } else if (myParameters.noiseKind == "gaussian") { if (verbose()) { printf("Noise kind set to \"gaussian\"\n"); } } else if (myParameters.noiseKind == "gaussFast") { if (verbose()) { printf("Noise kind set to \"gaussFast\"\n"); } } else if (myParameters.noiseKind == "poissonian") { if (verbose()) { printf("Noise kind set to \"poissonian\"\n"); } // if we have poissonian specified, we must have a (nonzero) mean rate for the // distribution specified as well XMLString noiseMeanString; getAttributeStrings(yourElement, "noises", "mean_rate", REQD, noiseMeanString); if (debugFlag) { printf("After getAttributeStrings(), noiseMeanRate = %s\n", noiseMeanString.c_str()); } // now convert the string to its relevant floating point value myParameters.noiseMean = atof(noiseMeanString.c_str()); if (verbose()) { printf("Mean rate for Poissonian noise set to %g\n", myParameters.noiseMean); } } else if (myParameters.noiseKind == "uniform") { if (verbose()) { printf("Noise kind set to \"uniform\"\n"); } } else { throw xmdsException(yourElement, "You must specify a correct noise kind. Current choices are:\n" " gaussian\n gaussFast\n poissonian\n uniform"); } // find out which scheduling method to use if (myParameters.usempi) { getAssignmentStrings(yourElement, "MPI_Method", 0, 1, myXMLStringList); if (myXMLStringList.size() == 0) { // Default mpi method is "scheduling" myXMLStringList.push_back("Scheduling"); myParameters.mpiMethod = *myXMLStringList.begin(); if (verbose()) { printf("MPI method defaulting to '%s'\n", myParameters.mpiMethod.c_str()); } } else if (myParameters.nPaths == "1") { // Go to "uniform" if only one path to guarantee error checking is done with the same seed. myParameters.mpiMethod = "Uniform"; if (verbose()) { printf("MPI method defaulting to '%s' for single path calculation.\n", myParameters.mpiMethod.c_str()); } } else { if (!((*myXMLStringList.begin() == "Scheduling")|| (*myXMLStringList.begin() == "Uniform"))) { sprintf(errorMessage(), "MPI method '%s' unknown.\n" "Current methods are 'Scheduling' and 'Uniform'.", myXMLStringList.begin()->c_str()); throw xmdsException(yourElement, errorMessage()); } myParameters.mpiMethod = *myXMLStringList.begin(); if (verbose()) { printf("MPI method = '%s'\n", myParameters.mpiMethod.c_str()); } } } } // ************************************ // find 'use_intel_mkl' assignment getAssignmentBools(yourElement, "use_intel_mkl", 0, 1, myBoolList); if (myBoolList.size() == 1) { myParameters.useIntelMKL = *myBoolList.begin(); if (!myParameters.stochastic && myParameters.useIntelMKL) { printf("Warning: The Intel MKL libraries aren't (currently) used " "for anything other than random numbers\n"); } if (myParameters.useIntelMKL && myParameters.stochastic && myParameters.noiseKind == "poissonian") { printf("Warning: Intel MKL can't be used for Poissonian-distributed " "noises. Reverting to the standard method\n"); myParameters.useIntelMKL = false; } if (verbose()) { if (myParameters.useIntelMKL) { printf("Using Intel MKL libraries\n"); } else { printf("Not using Intel MKL libraries\n"); } } } else { if (verbose()) { printf("Defaulting to not using the Intel MKL libraries"); } myParameters.useIntelMKL = false; } // Find out if we have a runtime limit getAssignmentStrings(yourElement, "runtime_limit", 0, 1, myXMLStringList); if (myXMLStringList.size() == 0) { myParameters.runTimeLimit = -1.0; } else if (myParameters.stochastic) { throw xmdsException(yourElement, "Runtime limit cannot be used with stochastic simulations"); } else { int hours, minutes, seconds; if (sscanf(myXMLStringList.begin()->c_str(), "%i:%i:%i", &hours, &minutes, &seconds) == 3) { myParameters.runTimeLimit = hours*3600.0 + minutes*60.0 + seconds; } else if (sscanf(myXMLStringList.begin()->c_str(), "%i:%i", &hours, &minutes) == 2) { myParameters.runTimeLimit = hours*3600.0 + minutes*60.0; } else if (sscanf(myXMLStringList.begin()->c_str(), "%le", &myParameters.runTimeLimit) != 1) { sprintf(errorMessage(), "Cannot understand runtime_limit string '%s'", myXMLStringList.begin()->c_str()); throw xmdsException(yourElement, errorMessage()); } } // ************************************ // find and process children // ************************************ // ************************************ // find globals element and process if present candidateElements = yourElement->getElementsByTagName("globals", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Multiple elements!"); } else if (candidateElements->length() == 1) { xmdsElement* newGlobals = createxmdsGlobals(); const Element* yourElement = dynamic_cast (candidateElements->item(0)); newGlobals->processElement(yourElement); } // ************************************ // find field element and process candidateElements = yourElement->getElementsByTagName("field", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Multiple elements!"); } else if (candidateElements->length() == 1) { myField = createxmdsField(); const Element* yourElement = dynamic_cast (candidateElements->item(0)); myField->processElement(yourElement); } else throw xmdsException(yourElement, "Cannot find element"); // ************************************ // find output element and process candidateElements = yourElement->getElementsByTagName("output", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Multiple elements!"); } else if (candidateElements->length() == 1) { // now grab the format attribute if available XMLString outputFormat = "ascii"; // set it to the default while declaring it const Node *thisElement = candidateElements->item(0); getAttributeStrings(yourElement, "output", "format", NOT_REQD, outputFormat); if (outputFormat == "") { outputFormat = "ascii"; // the default option } else { if (outputFormat == "ascii") { myParameters.binaryOutput = false; if (verbose()) { printf("Output format set to 'ascii' in output element\n"); } } else if (outputFormat == "binary") { myParameters.binaryOutput = true; if (verbose()) { printf("Output format set to 'binary' in output element\n"); } } else { throw xmdsException(thisElement, "Output format should be either 'ascii' or 'binary'"); } } // now grab the precision attribute if available XMLString outputPrecision = "double"; // set it to the default while declaring it getAttributeStrings(yourElement, "output", "precision", NOT_REQD, outputPrecision); if (outputPrecision == "") { outputPrecision = "double"; // the default option } else { if (outputPrecision == "double") { myParameters.useDouble = true; if (verbose()) { printf("Output precision set to 'double' in output element\n"); } } else if (outputPrecision == "single") { myParameters.useDouble = false; if (verbose()) { printf("Output precision set to 'single' in output element\n"); } } else { throw xmdsException(thisElement, "Output precision should be either 'double' or 'single'"); } } // now process the output element myOutput = createxmdsOutput(); const Element* yourElement = dynamic_cast (candidateElements->item(0)); myOutput->processElement(yourElement); } else throw xmdsException(yourElement, "Cannot find element"); // ************************************ // find sequence element and process candidateElements = yourElement->getElementsByTagName("sequence", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Multiple elements at top level"); } else if (candidateElements->length() == 1) { mySequence = createxmdsSequence(); const Element* yourElement = dynamic_cast (candidateElements->item(0)); mySequence->processElement(yourElement); } else throw xmdsException(yourElement, "Cannot find element"); myField->outputSampleCount(); mySequence->outputSampleCount(); myOutput->finaliseGeometry(); // ************************************ // Allow non-stochastic mpi? if (myParameters.usempi) { if ((myField->geometry()->nDims() < 2)&(!myParameters.stochastic)) { myParameters.usempi = 0; printf("MPI disabled. MPI cannot be used for deterministic problems " "with transverse dimensions < 2\n"); } if ((myField->geometry()->nDims() > 1) & (!myParameters.stochastic)) { printf("MPI used for a deterministic problem. Ain't life great? \n"); } } } // ************************************************************************** const xmdsSimulation::simulationParametersStruct* xmdsSimulation::parameters() const { return &myParameters; } // ************************************************************************** xmdsField* xmdsSimulation::field() const { return myField; } // ************************************************************************** xmdsSimulation::argvStruct* xmdsSimulation::argStruct() const { return &myArgStruct; } // ************************************************************************** const xmdsOutput* xmdsSimulation::output() const { return myOutput; } // ************************************************************************** const xmdsSequence* xmdsSimulation::sequence() const { return mySequence; } // ************************************************************************** unsigned long xmdsSimulation::nextSegmentNumber() const { if (debugFlag) { printf("xmdsSimulation::nextSegmentNumber\n"); } myCurrentSegmentNumber++; return myCurrentSegmentNumber-1; } // ************************************************************************** void xmdsSimulation::makeCode(const unsigned long& inFileSplitPoint) const { if (debugFlag) { printf("xmdsSimulation::makeCode\n"); } if (myOutput != 0) { myOutput->setInFileSplitPoint(inFileSplitPoint); } XMLString fileName = myParameters.simulationName; fileName += ".cc"; FILE* outfile = fopen(fileName.c_str(), "w"); if (outfile == 0) { sprintf(errorMessage(), "Unable to open file '%s' for write access", fileName.c_str()); throw xmdsException(errorMessage()); } if (verbose()) { printf("Beginning to write code ...\n"); } try { writeIncludes(outfile); writeDefines(outfile); writeGlobals(outfile); writePrototypes(outfile); writeRoutines(outfile); } catch(xmdsException xmdsExceptionErr) { printf("Error: simulation failed to write output code\n"); printf("due to the following xmdsException:\n"); printf("%s", xmdsExceptionErr.getError()); fclose(outfile); throw xmdsException("Internal Error"); } fclose(outfile); } // ************************************************************************** // ************************************************************************** // xmdsSimulation private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsSimulation::writeIncludes( FILE *const outfile) const { if (debugFlag) { printf("xmdsSimulation::writeIncludes\n"); } if (verbose()) { printf("Writing simulation includes ...\n"); } fprintf(outfile, "// ********************************************************\n" "// simulation includes\n" "\n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n" "#include \n"); if (simulation()->argStruct()->nameList.size() != 0) { fprintf(outfile, "#include \n"); } fprintf(outfile, "#include \n"); if (myParameters.usempi) { fprintf(outfile, "#include \n"); } if (myParameters.nThreads > 1 && myParameters.fftwVersion == 2) { fprintf(outfile, "#include \n"); } else if (!myParameters.stochastic && myParameters.usempi && myParameters.fftwVersion == 2) { fprintf(outfile, "#include \n"); } else if (myParameters.fftwVersion == 2) { fprintf(outfile, "#include \n"); } else if (myParameters.fftwVersion == 3) { fprintf(outfile, "#include \n"); } if (myParameters.useIntelMKL) { fprintf(outfile, "#include \n"); } fprintf(outfile, "#include \n"); fprintf(outfile, "#include \n"); fprintf(outfile, "using namespace std;\n" "\n"); } // ************************************************************************** void xmdsSimulation::writeDefines(FILE *const outfile) const { if (debugFlag) { printf("xmdsSimulation::writeDefines\n"); } if (verbose()) { printf("Writing simulation defines ...\n"); } if (myParameters.mpiMethod == "Scheduling") { fprintf(outfile, "// ********************************************************\n" "//Adaptive Scheduler defines\n" "\n" "#define MIN(a, b) (((a)<(b))?(a):(b))\n" "#define MAX(a, b) (((a)<(b))?(b):(a))\n" "#define DEBUG_MPI_Scheduling 1\n\n"); } fprintf(outfile, "// ********************************************************\n" "// simulation defines\n" "#ifndef INFINITY\n" "#define INFINITY HUGE_VAL\n" "#endif\n" "\n"); if (myParameters.nThreads > 1) { fprintf(outfile, "#define _num_threads %li\n\n", myParameters.nThreads); } if (myParameters.stochastic) { fprintf(outfile, "#define _n_noises %li\n", myParameters.nNoises); for (long i=0; igetOutputFileName().c_str()); xmdsElement::writeGlobals(outfile); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsSimulation::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsSimulation::writePrototypes\n"); } if (verbose()) { printf("Writing simulation prototypes ...\n"); } if (myParameters.stochastic) { if (myParameters.mpiMethod == "Scheduling") { fprintf(outfile, "// ********************************************************\n" "//Adaptive Scheduler prototypes\n" "\n" "int print_array2(int *array, int size); /*prints int arrays*/\n" "int print_array(double *array, int size); /*prints double arrays*/\n" "void *slave(void *ptr); /*slave routine*/\n" "int master(); /*master routine*/\n" "void *mslave(void *ptr); /*thread slave*/\n\n"); } if (debugFlag) { printf("xmdsSimulation::writePrototypes noiseKind = %s\n", myParameters.noiseKind.c_str()); } if (myParameters.useIntelMKL || myParameters.noiseKind != "poissonian") { if (!myParameters.useIntelMKL) { fprintf(outfile, "// ********************************************************\n" "// simulation prototypes\n" "\n" "void _make_noises(\n" " unsigned short *const _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n);\n" "\n"); } else { fprintf(outfile, "// ********************************************************\n" "// simulation prototypes\n" "\n" "void _make_noises(\n" " VSLStreamStatePtr _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n);\n" "\n"); } } else { // Poissonian noise and no Intel MKL fprintf(outfile, "// ********************************************************\n" "// simulation prototypes\n" "\n" "void _make_noises(\n" " unsigned short *const _generator,\n" " const double& _var,\n" " const double& _noiseMean,\n" " double *const _noise_vector,\n" " const unsigned long& _n);\n" "\n" "double gammln(double _xx);\n" "\n" "double poidev(double xm, unsigned short *const _generator);\n" "\n"); } } fprintf(outfile, "// ********************************************************\n" "// struct used to store step size and noise vector to ensure\n" "// stochastic convergence\n" "struct _dtdWstore {\n" " double _step;\n" " double *_noise_vector;\n" " _dtdWstore() {\n" " _step=0;\n" " _noise_vector=NULL;\n" " }\n" " ~_dtdWstore() {\n" " delete[] _noise_vector;\n" " }\n" "};\n" "\n"); xmdsElement::writePrototypes(outfile); } // ************************************************************************** void xmdsSimulation::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsSimulation::writeRoutines\n"); } if (verbose()) { printf("Writing simulation routines ...\n"); } // NOTE: it turns out the erand48() is more likely to be thread safe, // and to generate decent random numbers. rand() isn't necessarily // thread safe, and the thread safe version (rand_r()) isn't as good a // random number generator. if (myParameters.stochastic && !myParameters.useIntelMKL) { if (debugFlag) { printf("xmdsSimulation::writeRoutines noiseKind = %s\n", myParameters.noiseKind.c_str()); } if (myParameters.noiseKind == "gaussian") { fprintf(outfile, "// ********************************************************\n" "// simulation routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _make_noises(\n" " unsigned short *const _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n) {\n" "\n" "for(unsigned long _i0=0; _i0<_n; _i0+=2) {\n" " const double _mag = sqrt(-2*log(erand48(_generator))*_var);\n" " const double _arg = 2*M_PI*erand48(_generator);\n" " _noise_vector[_i0 + 0] = _mag*cos(_arg);\n" " _noise_vector[_i0 + 1] = _mag*sin(_arg);\n" " }\n" "}\n" "\n"); } else if (myParameters.noiseKind == "gaussFast") { fprintf(outfile, "// ********************************************************\n" "// simulation routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _make_noises(\n" " unsigned short *const _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n) {\n" "\n" "for(unsigned long _i0=0; _i0<_n; _i0+=2) {\n" " double _v1, _v2, _rsq;\n" " do {\n" " _v1 = 2.0*erand48(_generator)-1.0;\n" " _v2 = 2.0*erand48(_generator)-1.0;\n" " _rsq = _v1*_v1 + _v2*_v2;\n" " } while(_rsq >= 1.0 || _rsq == 0.0);\n" " const double _fac = sqrt(-2.0*_var*log(_rsq)/_rsq);\n" " _noise_vector[_i0 + 0] = _v1*_fac;\n" " _noise_vector[_i0 + 1] = _v2*_fac;\n" " }\n" "}\n" "\n"); } else if (myParameters.noiseKind == "uniform") { fprintf(outfile, "// ********************************************************\n" "// simulation routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _make_noises(\n" " unsigned short *const _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n) {\n" "\n" "for(unsigned long _i0=0; _i0<_n; _i0+=2) {\n" " _noise_vector[_i0 + 0] = erand48(_generator);\n" " _noise_vector[_i0 + 1] = erand48(_generator);\n" " }\n" "}\n" "\n"); } else if (myParameters.noiseKind == "poissonian") { fprintf(outfile, "// ********************************************************\n" "// simulation routines\n" "// ********************************************************\n" "\n" "// *************************\n" "double gammln(double _xx) {\n" " double _x, _y, _tmp, _ser;\n" " const double _cof[6] = {76.18009172947146, -86.50532032941677,\n" " 24.01409824083091, -1.231739572450155,\n" " 0.1208650973866179e-2, -0.5395239384953e-5};\n" " int _j;\n" " _y = _x = _xx;\n" " _tmp = _x + 5.5;\n" " _tmp -= (_x+0.5)*log(_tmp);\n" " _ser = 1.000000000190015;\n" " for (_j=0; _j<=5; _j++) _ser += _cof[_j]/++_y;\n" " return -_tmp+log(2.5066282746310005*_ser/_x);\n" "}\n" "\n" "double poidev(double xm, unsigned short *const _generator) {\n" " static double sq, alxm, g;\n" " double em, t, y;\n" " if (xm < 12.0) { // Use direct method \n" " g=exp(-xm);\n" " em = -1;\n" " t=1.0;\n" " // Instead of adding exponential deviates it is equivalent\n" " // to multiply uniform deviates. We never actually have to\n" " // take the log, merely compare to the pre-computed exponential\n" " do {\n" " ++em;\n" " t *= erand48(_generator);\n" " } while (t > g);\n" " }\n" " else { // Use rejection method\n" " sq=sqrt(2.0*xm);\n" " alxm=log(xm);\n" " g=xm*alxm-gammln(xm+1.0);\n" " do {\n" " do { // y is a deviate from a Lorenzian comparison function\n" " y=tan(M_PI*erand48(_generator));\n" " em=sq*y+xm; // em is y, shifted and scaled\n" " } while (em < 0.0); // Reject if in regime of zero probability\n" " em=floor(em); // The trick for integer-valued distributions\n" " t=0.9*(1.0+y*y)*exp(em*alxm-gammln(em+1.0)-g);\n" " // The ratio of the desired distribution to the comparison\n" " // function; we reject by comparing it to another uniform\n" " // deviate. The factor 0.9 so that t never exceeds 1.\n" " } while (erand48(_generator) > t);\n" " }\n" " return em;\n" " }\n" "\n" "void _make_noises(\n" " unsigned short *const _generator,\n" " const double& _var,\n" " const double& _noiseMean,\n" " double *const _noise_vector,\n" " const unsigned long& _n) {\n" "\n" "for(unsigned long _i0=0; _i0<_n; _i0+=2) {\n" " _noise_vector[_i0 + 0] = _var*poidev(_noiseMean, _generator);\n" " _noise_vector[_i0 + 1] = _var*poidev(_noiseMean, _generator);\n" " }\n" "}\n" "\n"); } } else if (myParameters.stochastic && myParameters.useIntelMKL) { if (debugFlag) { printf("xmdsSimulation::writeRoutines noiseKind = %s\n", myParameters.noiseKind.c_str()); } if (myParameters.noiseKind == "gaussian" || myParameters.noiseKind == "gaussFast") { fprintf(outfile, "// ********************************************************\n" "// simulation routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _make_noises(\n" " VSLStreamStatePtr _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n) {\n" " vdRngGaussian(VSL_METHOD_DGAUSSIAN_BOXMULLER2, _generator, _n, _noise_vector, 0.0, sqrt(_var));\n" "}\n" "\n"); } else if (myParameters.noiseKind == "uniform") { fprintf(outfile, "// ********************************************************\n" "// simulation routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _make_noises(\n" " VSLStreamStatePtr _generator,\n" " const double& _var,\n" " double *const _noise_vector,\n" " const unsigned long& _n) {\n" " vdRngUniform(VSL_METHOD_DUNIFORM_STD, _generator, _n, _noise_vector, 0.0, 1.0);\n" "}\n" "\n"); } } // 32-bit byte-swapper fprintf(outfile, "// The following code is imported from CFByteOrder.h, and is used subject to the APSL v2\n" "// The license is at: http://www.opensource.apple.com/apsl\n\n" "// These functions have been renamed to avoid conflicts with the actual functions if an XMDS simulation\n" "// is ever linked against the CoreFoundation framework\n" "inline uint32_t XMDSSwapInt32(uint32_t __arg) {\n" "#if defined(__i386__) && defined(__GNUC__)\n" "\t __asm__(\"bswap %%0\" : \"+r\" (__arg));\n" "\t return __arg;\n" "#elif defined(__ppc__) && defined(__GNUC__)\n" "\t uint32_t __result;\n" "\t __asm__(\"lwbrx %%0, 0, %%1\" : \"=r\" (__result) : \"r\" (&__arg), \"m\" (__arg));\n" "\t return __result;\n" "#else\n" "\t uint32_t __result;\n" "\t __result = ((__arg & 0xFF) << 24) | ((__arg & 0xFF00) << 8) | ((__arg >> 8) & 0xFF00) | ((__arg >> 24) & 0xFF);\n" "\t return __result;\n" "#endif\n" "}\n\n"); // 64-bit byte-swapper fprintf(outfile, "inline uint64_t XMDSSwapInt64(uint64_t __arg) {\n" "\t union CFSwap {\n" "\t\t uint64_t __sv;\n" "\t\t uint32_t __ul[2];\n" "\t } __tmp, __result;\n" "\t __tmp.__sv = __arg;\n" "\t __result.__ul[0] = XMDSSwapInt32(__tmp.__ul[1]);\n" "\t __result.__ul[1] = XMDSSwapInt32(__tmp.__ul[0]);\n" "\t return __result.__sv;\n" "}\n\n"); fprintf(outfile, "typedef struct { uint32_t __v; } XMDSSwappedFloat;\n" "typedef struct { uint64_t __v; } XMDSSwappedDouble;\n\n" "inline float XMDSSwapFloat(float __in) {\n" "\t XMDSSwappedFloat __x = *reinterpret_cast(&__in);\n" "\t __x.__v = XMDSSwapInt32(__x.__v);\n" "\t return *reinterpret_cast(&__x);\n" "}\n\n" "inline double XMDSSwapDouble(double __in) {\n" "\t XMDSSwappedDouble __x = *reinterpret_cast(&__in);\n" "\t __x.__v = XMDSSwapInt64(__x.__v);\n" "\t return *reinterpret_cast(&__x);\n" "}\n\n"); fprintf(outfile, "// Define an isfinite that should work on systems that don't have isfinite\n" "#ifndef isfinite\n" "#define isfinite(x) ((x) - (x) == 0)\n" "#endif\n\n"); if (myParameters.runTimeLimit > 0.0) { fprintf(outfile, "bool _running_overtime()\n" "{\n"); if (!myParameters.usempi) { fprintf(outfile, " timeval tim;\n" " gettimeofday(&tim, NULL);\n" " double currentTime = tim.tv_sec+(tim.tv_usec/1000000.0);\n"); fprintf(outfile, " if (currentTime - _startTime < %f)\n" " return false;\n\n" " _overtime = true;\n" " return true;\n" "}\n\n", myParameters.runTimeLimit); } else if (!myParameters.stochastic) { fprintf(outfile, " int _isRunningOvertime = 0;\n" " if (rank==0) {\n" " double currentTime = MPI_Wtime();\n" " if (currentTime - _startTime > %f)\n" " _isRunningOvertime = 1;\n" " }\n" " MPI_Bcast(&_isRunningOvertime, 1, MPI_INT, 0, MPI_COMM_WORLD);\n" " _overtime = _isRunningOvertime;\n" " return _overtime;\n" "}\n\n", myParameters.runTimeLimit); } // Will need a different version for stochastic MPI simulations } xmdsElement::writeRoutines(outfile); } // ************************************************************************** xmdsGlobals* xmdsSimulation::createxmdsGlobals() { if (debugFlag) { printf("xmdsSimulation::createxmdsGlobals\n"); } xmdsGlobals* newxmdsGlobals = new xmdsGlobals(this, verbose()); addChild((xmdsElement*) newxmdsGlobals); return newxmdsGlobals; } // ************************************************************************** xmdsField* xmdsSimulation::createxmdsField() { if (debugFlag) { printf("xmdsSimulation::createxmdsField\n"); } xmdsField* newxmdsField = new xmdsField(this, verbose()); addChild((xmdsElement*) newxmdsField); return newxmdsField; } // ************************************************************************** xmdsArgv* xmdsSimulation::createxmdsArgv() { if (debugFlag) { printf("xmdsSimulation::createxmdsArgv\n"); } xmdsArgv* newxmdsArgv = new xmdsArgv(this, verbose()); addChild((xmdsElement*) newxmdsArgv); return newxmdsArgv; } // ************************************************************************** xmdsOutput* xmdsSimulation::createxmdsOutput() { if (debugFlag) { printf("xmdsSimulation::createxmdsOutput\n"); } xmdsOutput* newxmdsOutput = new xmdsOutput(this, verbose()); addChild((xmdsElement*) newxmdsOutput); return newxmdsOutput; } // ************************************************************************** xmdsSequence* xmdsSimulation::createxmdsSequence() { if (debugFlag) { printf("xmdsSimulation::createxmdsSequence\n"); } xmdsSequence* newxmdsSequence = new xmdsSequence(this, verbose()); addChild((xmdsElement*) newxmdsSequence); return newxmdsSequence; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_simulation.h0000644000076500000240000001600511033277417014315 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_simulation.h 1964 2008-04-09 00:42:11Z paultcochrane $ */ /*! @file xmds_simulation.h @brief More detailed explanation... */ #ifndef XMDS_SIMULATION_H #define XMDS_SIMULATION_H #include #include #include #include #include #include #include // ***************************************************************************** // ***************************************************************************** // xmdsSimulation // ***************************************************************************** // ***************************************************************************** //! Class to organise a simulation in xmds class xmdsSimulation : public xmdsElement { public : //! Structure of parameters used in an xmds simulation struct simulationParametersStruct { XMLString rawFileName; //!< Raw simulation file name XMLString simulationName; //!< Simulation name XMLString propDimName; //!< Propagation dimension name XMLString authorName; //!< Name of the author the xmds script XMLString description; //!< Description of what the script is supposed to do long nThreads; //!< Number of threads bool stochastic; //!< Is this a stochastic simulation? XMLString nPaths; //!< Number of paths bool mpiAvailable; //!< Is mpi available? bool usempi; //!< Use mpi? bool bing; //!< Play sound when simulation is finished? XMLString seed[2]; //!< Random number seed long nNoises; //!< Number of noise terms XMLString noiseKind; //!< The kind of noise to be generated XMLString mpiMethod; //!< The method of dividing paths amongst nodes double noiseMean; //!< The mean of the noise distribution; only used for Poissonian distributions bool errorCheck; //!< Should I error check? bool useWisdom; //!< Should wisdom be used? bool usePrefs; //!< Should the values in the preferences file be used? bool binaryOutput; //!< Is binary output required? bool useDouble; //!< Should double precision be used? bool benchmark; //!< Time the main loop? long fftwVersion; //!< Which version of fftw shall we use? bool useOpenMP; //!< Shall we use OpenMP for parallelisation? bool useIntelMKL; //!< Use Intel MKL libraries for faster random numbers double runTimeLimit; //!< Maximum running time for integrate elements XMLString version; //!< The current xmds version number XMLString revision; //!< The subversion revision of xmds }; //! Structure of arguments on command line to simulation struct argvStruct { mutable list nameList; //!< List storing the argument names mutable list typeList; //!< List storing the argument types mutable list defaultValueList; //!< List storing the argument default values mutable list shortOptionList; //!< List storing the short option names mutable list typeConversionList; //!< List storing how to perform the type conversion }; //! Constructor of xmdsSimulation object xmdsSimulation( const char *const yourRawFileName, const bool& yourVerboseMode, const bool& mpiAvailable); //! Destructor ~xmdsSimulation(); //! Process element within xmds simulation void processElement( const Element *const yourElement); //! Returns structure holding parameters controlling the simulation const simulationParametersStruct* parameters() const; //! Returns the structure containing the command line argument information argvStruct* argStruct() const; //! Returns an xmdsArgv object xmdsArgv* argv() const; //! Returns an xmdsField object xmdsField* field() const; //! Returns an xmdsOutput object to manage output to file const xmdsOutput* output() const; //! Returns an xmdsSequence object const xmdsSequence* sequence() const; //! Returns the next segment number in the simulation sequence unsigned long nextSegmentNumber() const; //! Inserts relevant code at relevant point in output C++ file void makeCode( const unsigned long& inFileSplitPoint) const; private : simulationParametersStruct myParameters; //!< Structure of parameters of simulation mutable argvStruct myArgStruct; //!< Structure of command line arguments to simulation mutable list myArgvNameList; //!< List of names of command line arguments xmdsArgv* myArgv; //!< The command line argument "vector" object xmdsField* myField; //!< The xmdsField object xmdsOutput* myOutput; //!< The xmdsOutput object xmdsSequence* mySequence; //!< The xmdsSequence object mutable unsigned long myCurrentSegmentNumber; //!< The current segment number //! Write the simulation include statements to file void writeIncludes( FILE *const outfile) const; //! Write the simulation define statements to file void writeDefines( FILE *const outfile) const; //! Write the simulation global variables to file void writeGlobals( FILE *const outfile) const; //! Write the simulation prototypes to file void writePrototypes( FILE *const outfile) const; //! Write the simulation routines to file void writeRoutines( FILE *const outfile) const; //! Create an xmdsGlobals object xmdsGlobals* createxmdsGlobals(); //! Create an xmdsField object xmdsField* createxmdsField(); //! Create an xmdsArgv object xmdsArgv* createxmdsArgv(); //! Create an xmdsOutput object xmdsOutput* createxmdsOutput(); //! Create an xmdsSequence object xmdsSequence* createxmdsSequence(); }; #endif // XMDS_SIMULATION_H xmds-1.6.6/source/xmds_utils.cc0000644000076500000240000006543711033277417013444 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_utils.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_utils.cc @brief Utility classes and methods More detailed explanation... */ #include #include #include extern bool debugFlag; // ************************************************************************** // ************************************************************************** // xmdsException // ************************************************************************** // ************************************************************************** // ************************************************************************** xmdsException::xmdsException() : myNode(0), myErrorMessage("") { } // ************************************************************************** xmdsException::xmdsException( const char *const yourErrorMessage) : myNode(0), myErrorMessage(yourErrorMessage) { } // ************************************************************************** xmdsException::xmdsException( const Node *const yourNode, const char *const yourErrorMessage) : myNode(yourNode), myErrorMessage(yourErrorMessage) { } // ************************************************************************** const char* xmdsException::getError() { char s2[256]; s[0] = 0; // myNode and its parent's always happen to be elements const Element* nextElement = dynamic_cast(myNode); if (nextElement != 0) { sprintf(s2, "In element <%s> on line %s, \n", nextElement->tagName()->c_str(), nextElement->getAttribute("xmdsLineNumber")->c_str()); strcat(s, s2); nextElement = dynamic_cast(nextElement->parentNode()); } while (nextElement != 0) { sprintf(s2, " which is within element <%s> on line %s, \n", nextElement->tagName()->c_str(), nextElement->getAttribute("xmdsLineNumber")->c_str()); strcat(s, s2); nextElement = dynamic_cast(nextElement->parentNode()); } sprintf(s2, "\nthe following error occurred:\n %s\n", myErrorMessage); strcat(s, s2); return s; } // ************************************************************************** // ************************************************************************** // xmdsUtility public // ************************************************************************** // ************************************************************************** long nxmdsUtilitys = 0; //!< Number of xmds utility objects // ************************************************************************** xmdsUtility::xmdsUtility() { if (debugFlag) { nxmdsUtilitys++; printf("xmdsUtility::xmdsUtility\n"); printf("nxmdsUtilitys=%li\n", nxmdsUtilitys); } } // ************************************************************************** xmdsUtility::~xmdsUtility() { if (debugFlag) { nxmdsUtilitys--; printf("xmdsUtility::~xmdsUtility\n"); printf("nxmdsUtilitys=%li\n", nxmdsUtilitys); } } // ************************************************************************** // ************************************************************************** // xmdsUtility protected // ************************************************************************** // ************************************************************************** // ************************************************************************** char* xmdsUtility::errorMessage() const { return myErrorMessage; } // ************************************************************************** void xmdsUtility::getAssignmentStrings( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList) { if (debugFlag) { printf("xmdsUtility::getAssignmentStrings\n"); } outList.clear(); // note that if an element is found, then the routine will throw an exception // if n2get items aren't found within, except that passing n2get=0 will escape // this behaviour const NodeList* candidateElements = inElement->getElementsByTagName(ofName, 0); if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { const Node* nextNode = candidateElements->item(0); parseXMLString(nextNode, candidateElements->item(0)->textContent(0), outList); if (n2get != 0) { // check that numbers of requested items match if (outList.size() != n2get) { sprintf(myErrorMessage, "%li strings wanted but %li found", n2get, (long)outList.size()); throw xmdsException(nextNode, myErrorMessage); } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAssignmentVectorStrings( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList, list& outLengthList) { if (debugFlag) { printf("xmdsUtility::getAssignmentStrings\n"); } outList.clear(); outLengthList.clear(); // note that if an element is found, then the routine will throw an exception // if n2get items aren't found within, except that passing n2get=0 will escape // this behaviour const NodeList* candidateElements = inElement->getElementsByTagName(ofName, 0); if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { const Node* nextNode = candidateElements->item(0); parseXMLVectorString(nextNode, candidateElements->item(0)->textContent(0), outList, outLengthList); if (n2get != 0) { // check that numbers of requested items match if (outList.size() != n2get) { sprintf(myErrorMessage, "%li strings wanted but %li found", n2get, (long)outList.size()); throw xmdsException(nextNode, myErrorMessage); } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAssignmentBools( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList) { if (debugFlag) { printf("xmdsUtility::getAssignmentBools\n"); } // note that if an element is found, then the routine will throw an exception // if n2get items aren't found withn, except that passing n2get=0 will escape // this behaviour outList.clear(); const NodeList* candidateElements = inElement->getElementsByTagName(ofName, 0); if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { list myOutList; const Node* nextNode = candidateElements->item(0); parseXMLString(nextNode, candidateElements->item(0)->textContent(0), myOutList); for (list::const_iterator pXMLString = myOutList.begin(); pXMLString != myOutList.end(); pXMLString++) { if (*pXMLString == "yes") { outList.push_back(1); } else if (*pXMLString == "no") { outList.push_back(0); } else { throw xmdsException(nextNode, "'yes' or 'no' expected"); } } if (n2get != 0) { // check that numbers of requested items match if (outList.size() != n2get) { sprintf(myErrorMessage, "%li 'yes'/'no' wanted but %li found", n2get, (long)outList.size()); throw xmdsException(nextNode, myErrorMessage); } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAssignmentULongs( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList) { if (debugFlag) { printf("xmdsUtility::getAssignmentLongs\n"); } // note that if an element is found, then the routine will throw an exception // if n2get items aren't found withn, except that passing n2get=0 will escape // this behaviour outList.clear(); const NodeList* candidateElements = inElement->getElementsByTagName(ofName, 0); if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { list myOutList; const Node* nextNode = candidateElements->item(0); parseXMLString(nextNode, candidateElements->item(0)->textContent(0), myOutList); for (list::const_iterator pXMLString = myOutList.begin(); pXMLString != myOutList.end(); pXMLString++) { unsigned long nextULong; if (pXMLString->asULong(nextULong)) { outList.push_back(nextULong); } else { throw xmdsException(nextNode, "invalid positive integer"); } } if (n2get != 0) { // check that numbers of requested items match if (outList.size() != n2get) { sprintf(myErrorMessage, "%li integers wanted but %li found", n2get, (long)outList.size()); throw xmdsException(nextNode, myErrorMessage); } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAssignmentDoubles( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList) { if (debugFlag) { printf("xmdsUtility::getAssignmentDoubles\n"); } // note that if an element is found, then the routine will throw an exception // if n2get items aren't found withn, except that passing n2get=0 will escape // this behaviour outList.clear(); const NodeList* candidateElements = inElement->getElementsByTagName(ofName, 0); if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { list myOutList; const Node* nextNode = candidateElements->item(0); parseXMLString(nextNode, candidateElements->item(0)->textContent(0), myOutList); for (list::const_iterator pXMLString = myOutList.begin(); pXMLString != myOutList.end(); pXMLString++) { double nextdouble; if (pXMLString->asDouble(nextdouble)) { outList.push_back(nextdouble); } else { throw xmdsException(nextNode, "invalid floating point format"); } } if (n2get != 0) { // check that numbers of requested items match if (outList.size() != n2get) { sprintf(myErrorMessage, "%li reals wanted but %li found", n2get, (long)outList.size()); throw xmdsException(nextNode, myErrorMessage); } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAssignmentDomains( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList) { if (debugFlag) { printf("xmdsUtility::getAssignmentDomains\n"); } // note that if an element is found, then the routine will throw an exception // if n2get items aren't found withn, except that passing n2get=0 will escape // this behaviour outList.clear(); const NodeList* candidateElements = inElement->getElementsByTagName(ofName, 0); if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { list myPairsList; const Node* nextNode = candidateElements->item(0); parseXMLString(nextNode, candidateElements->item(0)->textContent(0), myPairsList); if (n2get != 0) { // check that numbers of requested items match if (myPairsList.size() != n2get) { sprintf(myErrorMessage, "%li domain pairs wanted but %li found", n2get, (long)myPairsList.size()); throw xmdsException(nextNode, myErrorMessage); } } for (list::const_iterator pXMLString = myPairsList.begin(); pXMLString != myPairsList.end(); pXMLString++) { list myDoublesList; parseXMLString(nextNode, &*pXMLString, myDoublesList); if (myDoublesList.size() != 2) { throw xmdsException(nextNode, "bracketed pairs of reals expected"); } domainStruct nextDomain; list::const_iterator pXMLString2; double myBegin; double myEnd; pXMLString2 = myDoublesList.begin(); nextDomain.begin = *pXMLString2; pXMLString2++; nextDomain.end = *pXMLString2; // Check if given as strings or doubles, and if doubles check they are in correct order if (nextDomain.begin.asDouble(myBegin) && nextDomain.end.asDouble(myEnd)) { if (myEnd <= myBegin) { throw xmdsException(nextNode, "domain ends must be > begins"); } } else if (debugFlag) { // I really wanted verbose here but can't get it to work... printf("Remark: Domain is not specified in a floating point format"); } outList.push_back(nextDomain); } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAttributeStrings( const Element *const inElement, const XMLString& ofElementName, const XMLString& ofAttrName, const bool& required, XMLString& outString) { if (debugFlag) { printf("xmdsUtility::getAttributeStrings\n"); } outString = EMPTY_STRING; const NodeList* candidateElements = inElement->getElementsByTagName(ofElementName, 0); // this code is a bit weird as it was grabbed from getAssignmentStrings, and so // don't really need this next test // @todo Need to clean up this function so that required boolean means the right thing // Namely that the attribute is required, atm we're checking if the element (tag) // is required // Really not happy with how the attribute parsing code is going // this looks like it needs a bit of work to knock it into some proper shape, // what we've got here is too much of a hack on top of getAssignmentStrings and // a decent amount of thought needs to go into the implementation if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofElementName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { const Node* nextNode = candidateElements->item(0); const NamedNodeMap* attrNodeMap = nextNode->attributes(); if (attrNodeMap->length() > 0) { const Node* attrNode = attrNodeMap->getNamedItem(ofAttrName); if (attrNode != 0) { outString = attrNode->nodeValue()->c_str(); } // if the attribute isn't found, and it's required, barf else if ((attrNode == 0) && required) { sprintf(myErrorMessage, "Attribute '%s' not found", ofAttrName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { outString = EMPTY_STRING; } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofElementName.c_str()); throw xmdsException(inElement, myErrorMessage); } } // ************************************************************************** void xmdsUtility::getAttributeBools( const Element *const inElement, const XMLString& ofElementName, const XMLString& ofAttrName, const bool& required, bool& outBool) { if (debugFlag) { printf("xmdsUtility::getAttributeBools\n"); } outBool = false; const NodeList* candidateElements = inElement->getElementsByTagName(ofElementName, 0); if (debugFlag) { printf("xmdsUtility::getAttributeBools : candidateElements->length = %ld\n", candidateElements->length()); } if (candidateElements->length() == 0) { if (required) { sprintf(myErrorMessage, "Element '%s' not found", ofElementName.c_str()); throw xmdsException(inElement, myErrorMessage); } else { return; } } if (candidateElements->length() == 1) { // we only want one such tag const Node* nextNode = candidateElements->item(0); // grab the tag's node const NamedNodeMap* attrNodeMap = nextNode->attributes(); // grab the attributes of the tag as a map if (debugFlag) { printf("xmdsUtility::getAttributeBools : attrNodeMap->length = %ld\n", attrNodeMap->length()); } if (attrNodeMap->length() > 0) { const Node* attrNode = attrNodeMap->getNamedItem(ofAttrName); // get the node with the name ofAttrName if (attrNode != 0) { // then compare the value with 'yes' and 'no' const string boolString = static_cast (attrNode->nodeValue()->c_str()); if (debugFlag) { printf("xmdsUtility::getAttributeBools : boolString = %s\n", boolString.c_str()); } if (boolString == "yes") { outBool = true; } else if (boolString == "no") { outBool = false; } else { throw xmdsException(nextNode, "'yes' or 'no' expected"); } } } } else { sprintf(myErrorMessage, "Multiple Elements '%s' found", ofElementName.c_str()); throw xmdsException(inElement, myErrorMessage); } if (debugFlag) { printf("xmdsUtility::getAttributeBools : outBool = %d\n", outBool); } } // ************************************************************************** unsigned long xmdsUtility::spaceList2ULong( const list& spaceList) const { if (debugFlag) { printf("xmdsUtility::spaceList2ULong\n"); } unsigned long space = 0; unsigned long two2n = 1; for (list::const_iterator pBool = spaceList.begin(); pBool != spaceList.end(); pBool++) { if (*pBool) { space += two2n; } two2n *= 2; } return space; } // ************************************************************************** // ************************************************************************** // xmdsUtility private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsUtility::parseXMLString( const Node *const inNode, const XMLString *const inString, list& outXMLStringList) { if (debugFlag) { printf("xmdsUtility::parseXMLString\n"); } outXMLStringList.clear(); if (inString->length()==0) { return; } XMLString copyInString = *inString; // begin by replacing all commas and semicolons with spaces unsigned long i = 0; while (i < copyInString.length()) { if ((copyInString.data(i) == ',') | (copyInString.data(i) == ';')) { copyInString.replaceData(i, 1, " "); } i++; } // now mark all begins and ends list begins; list ends; long bracketLevel = 0; i = 0; char lastChar = 0x20; while (i < copyInString.length()) { if (copyInString.data(i) == '(') { if (bracketLevel == 0) { begins.push_back(i+1); } bracketLevel++; } else if (copyInString.data(i) == ')') { bracketLevel--; if (bracketLevel == 0) { ends.push_back(i); } } else if (bracketLevel == 0) { if (!XMLChar::isWhiteSpace(copyInString.data(i)) && (XMLChar::isWhiteSpace(lastChar) || lastChar == ')')) { begins.push_back(i); } else if (XMLChar::isWhiteSpace(copyInString.data(i)) && !(XMLChar::isWhiteSpace(lastChar) || lastChar == ')')) { ends.push_back(i); } } lastChar=copyInString.data(i); i++; } if (bracketLevel != 0) { throw xmdsException(inNode, "Imbalanced bracketing"); } if (!(XMLChar::isWhiteSpace(lastChar) | (lastChar == ')'))) { ends.push_back(i); } list::const_iterator pbegin = begins.begin(); list::const_iterator pend = ends.begin(); while (pbegin != begins.end()) { XMLString subString; copyInString.subString(subString, *pbegin, *pend); outXMLStringList.push_back(subString); pbegin++; pend++; } } // ************************************************************************** void xmdsUtility::parseXMLVectorString( const Node *const inNode, const XMLString *const inString, list& outXMLStringList, list& outLongList) { if (debugFlag) { printf("xmdsUtility::parseXMLString\n"); } outXMLStringList.clear(); outLongList.clear(); if (inString->length()==0) { return; } XMLString copyInString = *inString; // begin by replacing all commas and semicolons with spaces unsigned long i = 0; while (i < copyInString.length()) { if ((copyInString.data(i) == ',') | (copyInString.data(i) == ';')) { copyInString.replaceData(i, 1, " "); } i++; } // I have no idea why the careful bracket counting exists in parseXMLString, so I'm going to barbarise it. unsigned long begin=0; long bracketLevel = 0; XMLString subString; i = 0; char lastChar = 0x20; while (i < copyInString.length()) { if (bracketLevel == 0) { if (!XMLChar::isWhiteSpace(copyInString.data(i)) && (XMLChar::isWhiteSpace(lastChar)|| lastChar == ')')) { begin = i; } else if ((XMLChar::isWhiteSpace(copyInString.data(i))||copyInString.data(i)=='(') && !(XMLChar::isWhiteSpace(lastChar) || lastChar == ')')) { copyInString.subString(subString, begin, i); outXMLStringList.push_back(subString); if (copyInString.data(i)=='(') { if (i0) { outLongList.push_back((long) arrayLength); } else { throw xmdsException(inNode, "Length of component array must be a strictly positive integer."); } } } else throw xmdsException(inNode, "Surprising number of brackets in component specification"); lastChar=copyInString.data(i); i++; } if (!(XMLChar::isWhiteSpace(lastChar))&&!(lastChar==')')) { copyInString.subString(subString, begin, i); outXMLStringList.push_back(subString); outLongList.push_back((long) 1); } if (bracketLevel != 0) { throw xmdsException(inNode, "Imbalanced bracketing"); } } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_utils.h0000644000076500000240000001431211033277417013270 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_utils.h 1658 2008-01-19 16:11:28Z paultcochrane $ */ /*! @file xmds_utils.h @brief Header for various xmds utility classes */ #ifndef XMDS_UTILS_H #define XMDS_UTILS_H #ifndef LIST #include #define LIST #endif // ****************************************************************************** // ****************************************************************************** // xmdsException // ****************************************************************************** // ****************************************************************************** //! xmdsException class class xmdsException { public : //! Constructor of xmdsException object xmdsException(); //! Constructor of xmdsException object xmdsException( const char *const yourErrorMessage); //! Constructor of xmdsException object xmdsException( const Node *const yourNode, const char *const yourErrorMessage); //! Gets xmds error const char* getError(); private : char s[2048]; //!< Character array to hold a temporary string, probably some version of the error text const Node *const myNode; //!< The current node const char *const myErrorMessage; //!< The error message to print }; // ****************************************************************************** // ****************************************************************************** // domain // ****************************************************************************** // ****************************************************************************** //! Structure defining the beginning and the end points of a transverse dimension struct domainStruct { XMLString begin; //!< Beginning of domain XMLString end; //!< End of domain }; // ****************************************************************************** // ****************************************************************************** // xmdsUtility // ****************************************************************************** // ****************************************************************************** //! xmdsUtility class class xmdsUtility { public : //! Constructor of xmdsUtility object xmdsUtility(); //! Destructor virtual ~xmdsUtility(); //! Processes the element yourElement virtual void processElement( const Element *const yourElement) = 0; enum { REQD = 1, NOT_REQD = 0, DEEP = 1, NOT_DEEP = 0 }; protected : //! Returns the error message char* errorMessage() const; //! Gets the assignment strings void getAssignmentStrings( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList); //! Gets the assignment strings void getAssignmentVectorStrings( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList, list& outLengthList); //! Gets the assignment booleans void getAssignmentBools( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList); //! Gets the assignment unsigned longs void getAssignmentULongs( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList); //! Gets the assignment doubles void getAssignmentDoubles( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList); //! Gets the assignment domains void getAssignmentDomains( const Element *const inElement, const XMLString& ofName, const bool& required, const unsigned long& n2get, list& outList); //! Gets the attribute strings void getAttributeStrings( const Element *const inElement, const XMLString& ofElementName, const XMLString& ofAttrName, const bool& required, XMLString& outString); //! Gets the attribute booleans void getAttributeBools( const Element *const inElement, const XMLString& ofElementName, const XMLString& ofAttrName, const bool& required, bool& outBool); //! Converts a space list to unsigned long unsigned long spaceList2ULong( const list& spaceList) const; private : mutable char myErrorMessage[2048]; //!< Error message string //! Parse an XML string inString at node inNode generating the output XML string list outXMLStringList void parseXMLString( const Node *const inNode, const XMLString *const inString, list& outXMLStringList); void parseXMLVectorString( const Node *const inNode, const XMLString *const inString, list& outXMLStringList, list& outLongList); }; #endif // XMDS_UTILS_H /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_vector.cc0000644000076500000240000014156711033277417013605 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_vector.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_vector.cc @brief Vector object classes and methods More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsVector public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsVectors=0; //!< The number of xmds vectors // ************************************************************************** xmdsVector::xmdsVector( const xmdsField *const yourField) : myField(yourField) { if (debugFlag) { nxmdsVectors++; printf("xmdsVector::xmdsVector\n"); printf("nxmdsVectors=%li\n", nxmdsVectors); } myNeedsFFTWRoutines=0; } // ************************************************************************** xmdsVector::~xmdsVector() { if (debugFlag) { nxmdsVectors--; printf("xmdsVector::~xmdsVector\n"); printf("nxmdsVectors=%li\n", nxmdsVectors); } } // ************************************************************************** void xmdsVector::writeDefines( FILE *const outfile) const { if (debugFlag) { printf("xmdsVector::writeDefines\n"); } fprintf(outfile, "// vector %s defines\n", myName.c_str()); if (myComponentsLengthsList.size()>0) { long totalComponents = 0; for (list::const_iterator pLong = myComponentsLengthsList.begin(); pLong != myComponentsLengthsList.end(); pLong++) { totalComponents += *pLong; } fprintf(outfile, "#define _%s_%s_ncomponents %li\n", field()->name()->c_str(), myName.c_str(), totalComponents); } else { fprintf(outfile, "#define _%s_%s_ncomponents %li\n", field()->name()->c_str(), myName.c_str(), (long)myComponentsNamesList.size()); } if (myComponentsLengthsList.size()>0) { if (myComponentsLengthsList.size()!=myComponentsNamesList.size()) { throw xmdsException("List of component lengths has a different size than the list of components"); } else { unsigned long totalComponents = 0; list::const_iterator pLong = myComponentsLengthsList.begin(); list::const_iterator pXMLString = myComponentsNamesList.begin(); if (*pLong==1) { fprintf(outfile, "#define %s _active_%s_%s[_%s_%s_index_pointer]\n", pXMLString->c_str(), field()->name()->c_str(), myName.c_str(), field()->name()->c_str(), myName.c_str()); } else if (*pLong>1) { fprintf(outfile, "#define %s(j) _active_%s_%s[_%s_%s_index_pointer + j - 1]\n", pXMLString->c_str(), field()->name()->c_str(), myName.c_str(), field()->name()->c_str(), myName.c_str()); // Moved this next line into the integrate blocks themselves // fprintf(outfile, "#define d%s_d%s(j) d%s_d%s[j-1]\n", // pXMLString->c_str(),field()->simulation()->parameters()->propDimName.c_str(),pXMLString->c_str(),field()->simulation()->parameters()->propDimName.c_str()); } else throw xmdsException("Component lengths has a nonpositive integer."); totalComponents+=*pLong; pLong++; pXMLString++; while (pXMLString != myComponentsNamesList.end()) { if (*pLong==1) { fprintf(outfile, "#define %s _active_%s_%s[_%s_%s_index_pointer + %li]\n", pXMLString->c_str(), field()->name()->c_str(), myName.c_str(), field()->name()->c_str(), myName.c_str(),totalComponents); } else if (*pLong>1) { fprintf(outfile, "#define %s(j) _active_%s_%s[_%s_%s_index_pointer + j + %li]\n", pXMLString->c_str(), field()->name()->c_str(), myName.c_str(), field()->name()->c_str(), myName.c_str(),totalComponents-1); // Moved this next line into the integrate blocks themselves // fprintf(outfile, "#define d%s_d%s(j) d%s_d%s[j-1]\n", // pXMLString->c_str(),field()->simulation()->parameters()->propDimName.c_str(),pXMLString->c_str(),field()->simulation()->parameters()->propDimName.c_str()); } else throw xmdsException("Component lengths has a nonpositive integer."); totalComponents+=*pLong; pLong++; pXMLString++; } } } else { unsigned long i=0; for (list::const_iterator pXMLString = myComponentsNamesList.begin(); pXMLString != myComponentsNamesList.end(); pXMLString++) { fprintf(outfile, "#define %s _active_%s_%s[_%s_%s_index_pointer + %li]\n", pXMLString->c_str(), field()->name()->c_str(), myName.c_str(), field()->name()->c_str(), myName.c_str(), i); i++; } } fprintf(outfile, "\n"); } // ************************************************************************** void xmdsVector::writeGlobals( FILE *const outfile) const { if (debugFlag) { printf("xmdsVector::writeGlobals\n"); } fprintf(outfile, "// vector %s globals \n", myName.c_str()); fprintf(outfile, "\n"); const char* typeName=""; if (myType==COMPLEX) { typeName="complex"; } else if (myType==DOUBLE) { typeName="double"; } if ((field()->simulation()->parameters()->usempi)&!(field()->simulation()->parameters()->stochastic)){ fprintf(outfile, "%s *_%s_%s;\n", typeName, field()->name()->c_str(), myName.c_str()); fprintf(outfile, "%s* _active_%s_%s;\n", typeName, field()->name()->c_str(), myName.c_str()); fprintf(outfile, "%s *_%s_%s_work;\n", typeName, field()->name()->c_str(), myName.c_str()); fprintf(outfile, "\n"); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, "%s *_%s_%s = new %s[_%s_size*_%s_%s_ncomponents];\n", typeName, field()->name()->c_str(), myName.c_str(), typeName, field()->name()->c_str(), field()->name()->c_str(), myName.c_str()); fprintf(outfile, "%s* _active_%s_%s;\n", typeName, field()->name()->c_str(), myName.c_str()); fprintf(outfile, "\n"); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, "%s *_%s_%s = (%s*) fftw_malloc(_%s_size*_%s_%s_ncomponents*sizeof(%s));\n", typeName, field()->name()->c_str(), myName.c_str(), typeName, field()->name()->c_str(), field()->name()->c_str(), myName.c_str(), typeName); fprintf(outfile, "%s* _active_%s_%s;\n", typeName, field()->name()->c_str(), myName.c_str()); fprintf(outfile, "\n"); } if (!myNeedsFFTWRoutines) { return; } fprintf(outfile, "unsigned long _%s_%s_space;\n", field()->name()->c_str(), myName.c_str()); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsVector::writePrototypes( FILE *const outfile) const { if (debugFlag) { printf("xmdsVector::writePrototypes\n"); } fprintf(outfile, "// vector %s prototypes \n", myName.c_str()); fprintf(outfile, "\n"); fprintf(outfile, "void _%s_%s_initialise();\n", field()->name()->c_str(), name()->c_str()); fprintf(outfile, "\n"); if (!myNeedsFFTWRoutines) { return; } fprintf(outfile, "void _%s_%s_go_space(\n", field()->name()->c_str(), myName.c_str()); fprintf(outfile, " const unsigned long& _space);\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsVector::writeRoutines( FILE *const outfile) const { if (debugFlag) { printf("xmdsVector::writeRoutines\n"); } const char *const fieldName = field()->name()->c_str(); fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "// field %s vector %s routines\n", fieldName, myName.c_str()); fprintf(outfile, "// ********************************************************\n"); fprintf(outfile, "\n"); this->writeInitialiseRoutine(outfile); if (!myNeedsFFTWRoutines) { return; } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _%s_%s_go_space(\n", fieldName, myName.c_str()); fprintf(outfile, " const unsigned long& _newspace) {\n"); fprintf(outfile, "\n"); fprintf(outfile, "if (_%s_%s_space==_newspace)\n", fieldName, myName.c_str()); fprintf(outfile, " return;\n"); fprintf(outfile, "\n"); unsigned long fullSpace = myField->geometry()->fullSpace(); fprintf(outfile, "double _c=1.0;\n"); fprintf(outfile, "\n"); fprintf(outfile, "if ((_%s_%s_space==0)&(_newspace==%li)) {\n", fieldName, myName.c_str(), fullSpace); fprintf(outfile, "\n"); if (field()->simulation()->parameters()->nThreads>1 && field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_threads(_num_threads, _%s_forward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_ncomponents, 1, 0, 0, 0);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } else if ((field()->simulation()->parameters()->usempi) && !(field()->simulation()->parameters()->stochastic)) { fprintf(outfile, " fftwnd_mpi(_%s_forward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_work, FFTW_TRANSPOSED_ORDER);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd(_%s_forward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_ncomponents, 1, 0, 0, 0);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_execute_dft(_%s_%s_forward_plan, reinterpret_cast(_active_%s_%s), reinterpret_cast(_active_%s_%s));\n", fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } fprintf(outfile, "\n"); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dx%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, "\n"); fprintf(outfile, " _%s_%s_space=_newspace;\n", fieldName, myName.c_str()); fprintf(outfile, " }\n"); fprintf(outfile, "else if ((_%s_%s_space==%li)&(_newspace==0)) {\n", fieldName, myName.c_str(), fullSpace); fprintf(outfile, "\n"); if (field()->simulation()->parameters()->nThreads>1 && field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_threads(_num_threads, _%s_backward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_ncomponents, 1, 0, 0, 0);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } else if ((field()->simulation()->parameters()->usempi)&!(field()->simulation()->parameters()->stochastic)) { fprintf(outfile, " fftwnd_mpi(_%s_backward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_work, FFTW_TRANSPOSED_ORDER);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd(_%s_backward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_ncomponents, 1, 0, 0, 0);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_execute_dft(_%s_%s_backward_plan, reinterpret_cast(_active_%s_%s), reinterpret_cast(_active_%s_%s));\n", fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); } fprintf(outfile, "\n"); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dk%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, "\n"); fprintf(outfile, " _%s_%s_space=_newspace;\n", fieldName, myName.c_str()); fprintf(outfile, " }\n"); if (myField->geometry()->nDims()>1) { if ((field()->simulation()->parameters()->usempi) && !(field()->simulation()->parameters()->stochastic)) { // mixed transforms stuff // note this does not need to be ultra efficient since it is probably only // ever used in filters, moment stuff, and after initialisation // For mixed space situations, we need to arbitrarily define when we will be transposed, and when we shall not. // This has efficiency effects, as transposing can only be done safely with a full transform. // We shall declare that the first two dimensions will only be swapped if both of them are in Fourier space // There are three cases. In order of complexity: // 1. Swapped -> swapped // 2. Unswapped -> unswapped // 3. Change of swappedness fprintf(outfile, "else {\n"); fprintf(outfile, " long _howmany;\n"); fprintf(outfile, " int _lattice;\n"); fprintf(outfile, "\n"); // 1. swapped -> swapped // Only need to transform the lower levels normally fprintf(outfile, " if ((_newspace&1)&&(_newspace&2)&&(_%s_%s_space&1)&&(_%s_%s_space&2)) { // swapped -> swapped \n", fieldName, myName.c_str(), fieldName, myName.c_str()); fprintf(outfile, " // no preparation before doing the lower levels needs to be done in this case \n\n"); fprintf(outfile, " } // end of swapped -> swapped case \n\n"); // 2. unswapped -> unswapped // If first transverse dimension is unchanged, then we only need to change the lower levels. // Otherwise, we homogenise the space (all to real or all to Fourier), transform keeping order, and then change the lower levels. fprintf(outfile, " else if (!((_newspace&1)&&(_newspace&2))&&!((_%s_%s_space&1)&&(_%s_%s_space&2))) { // unswapped -> unswapped \n", fieldName, myName.c_str(), fieldName, myName.c_str()); fprintf(outfile, " if ((_%s_%s_space&1)&&!(_newspace&1)) { // first dimension goes from Fourier space to normal space \n", fieldName, myName.c_str()); { // change all the lower levels to Fourier space unsigned long two2n=2; for (unsigned long i=1; igeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, " if (!(_%s_%s_space&%li)) {\n", fieldName, myName.c_str(), two2n); fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_FORWARD, FFTW_IN_PLACE);\n"); fprintf(outfile, " for (unsigned long _i0=0; _i0geometry()->nDims()); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _fftw_latt[%li] = _%s_lattice%li;\n", i, fieldName, i); } fprintf(outfile, " fftwnd_mpi_plan _plan = fftwnd_mpi_create_plan(MPI_COMM_WORLD, %li, _fftw_latt, FFTW_BACKWARD, FFTW_IN_PLACE|FFTW_ESTIMATE|FFTW_USE_WISDOM);\n", myField->geometry()->nDims()); fprintf(outfile, " fftwnd_mpi(_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_work, FFTW_NORMAL_ORDER);\n", fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); fprintf(outfile, " fftwnd_mpi_destroy_plan(_plan);\n"); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dk%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " _%s_%s_space=0;\n", fieldName, myName.c_str()); fprintf(outfile, " } \n"); fprintf(outfile, " else if (!(_%s_%s_space&1)&&(_newspace&1)) { // first dimension goes from normal space to Fourier space \n", fieldName, myName.c_str()); { // change all the lower levels to normal space unsigned long two2n=2; for (unsigned long i=1; igeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, " if (_%s_%s_space&%li) {\n", fieldName, myName.c_str(), two2n); fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_BACKWARD, FFTW_IN_PLACE);\n"); fprintf(outfile, " for (unsigned long _i0=0; _i0geometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dx%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " _%s_%s_space=%li;\n", fieldName, myName.c_str(), fullSpace); fprintf(outfile, " } \n"); fprintf(outfile, " } // end of unswapped -> unswapped case \n\n"); // 3. changing swappedness // First we change all lower dimensions to be the same as the first, then we do a full transposed transform // If the first transverse dimension needs changing, then we do a full in order transform // Then we change the lower levels. fprintf(outfile, " else { // changing swappedness \n\n"); fprintf(outfile, " if ((_%s_%s_space&1)&&(_%s_%s_space&2)) { // initially swapped \n", fieldName, myName.c_str(), fieldName, myName.c_str()); { // Put all lower dimensions to Fourier space and Fourier transform (transposed) unsigned long two2n=4; for (unsigned long i=2; igeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, "\n"); fprintf(outfile, " if (!(_%s_%s_space&%li)) {\n", fieldName, myName.c_str(), two2n); fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_FORWARD, FFTW_IN_PLACE);\n"); fprintf(outfile, " for (unsigned long _i0=0; _i0geometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dk%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " _%s_%s_space=0;\n", fieldName, myName.c_str()); // to get from 0 to unswapped, could do with a recursive call // but really it's a very small step to do it straight... fprintf(outfile, " if (_newspace&1) { // first dimension needs switching to Fourier again \n"); fprintf(outfile, " fftwnd_mpi(_%s_forward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_work, FFTW_NORMAL_ORDER);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dx%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " _%s_%s_space=%li;\n", fieldName, myName.c_str(), fullSpace); fprintf(outfile, " } \n"); fprintf(outfile, " } // end initially swapped case \n"); fprintf(outfile, " else { // initially unswapped \n"); fprintf(outfile, " if (_%s_%s_space&1) { // put all lower dimensions to Fourier space and Fourier transform (transposed) \n", fieldName, myName.c_str()); { // change all the lower levels (brackets largely for cut and paste convenience) unsigned long two2n=2; for (unsigned long i=1; igeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, "\n"); fprintf(outfile, " if (!(_%s_%s_space&%li)) {\n", fieldName, myName.c_str(), two2n); fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_FORWARD, FFTW_IN_PLACE);\n"); fprintf(outfile, " for (unsigned long _i0=0; _i0geometry()->nDims()); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _fftw_latt[%li] = _%s_lattice%li;\n", i, fieldName, i); } fprintf(outfile, " fftwnd_mpi_plan _plan = fftwnd_mpi_create_plan(MPI_COMM_WORLD, %li, _fftw_latt, FFTW_BACKWARD, FFTW_IN_PLACE|FFTW_ESTIMATE|FFTW_USE_WISDOM);\n", myField->geometry()->nDims()); fprintf(outfile, " fftwnd_mpi(_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_work, FFTW_NORMAL_ORDER);\n", fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); fprintf(outfile, " fftwnd_mpi_destroy_plan(_plan);\n"); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dk%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " fftwnd_mpi(_%s_forward_plan, _%s_%s_ncomponents, _active_%s_%s, _%s_%s_work, FFTW_TRANSPOSED_ORDER);\n", fieldName, fieldName, myName.c_str(), fieldName, myName.c_str(), fieldName, myName.c_str()); for (unsigned long i=0; igeometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dx%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " _%s_%s_space=%li;\n", fieldName, myName.c_str(), fullSpace); fprintf(outfile, " }\n"); fprintf(outfile, " else { // put all lower dimensions to normal space and Fourier transform (transposed) \n"); { // change all the lower levels (brackets largely for cut and paste convenience) unsigned long two2n=2; for (unsigned long i=1; igeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, "\n"); fprintf(outfile, " if (_%s_%s_space&%li) {\n", fieldName, myName.c_str(), two2n); fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_BACKWARD, FFTW_IN_PLACE);\n"); fprintf(outfile, " for (unsigned long _i0=0; _i0geometry()->nDims(); i++) { fprintf(outfile, " _c *= _%s_dx%li/sqrt(2*M_PI);\n", fieldName, i); } fprintf(outfile, " _%s_%s_space=%li;\n", fieldName, myName.c_str(), fullSpace); fprintf(outfile, " }\n"); fprintf(outfile, " } // end initially unswapped case \n"); fprintf(outfile, " } // end of changing swappedness case \n\n"); // By this point, the vector's space must be set to its actual space if it has changed fprintf(outfile, " // Now the lower transverse dimensions need changing to the correct state \n\n"); { // change all the lower levels (brackets largely for cut and paste convenience) unsigned long two2n=2; for (unsigned long i=1; igeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } if (i==1) { fprintf(outfile, " if ((_newspace&1)&&(_newspace&2)) \n"); fprintf(outfile, " _lattice = _%s_lattice0;\n", fieldName); fprintf(outfile, " else\n"); fprintf(outfile, " _lattice = _%s_lattice1;\n", fieldName); } else fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, "\n"); fprintf(outfile, " if ((!(_%s_%s_space&%li))&&(_newspace&%li)) {\n", fieldName, myName.c_str(), two2n, two2n); fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_FORWARD, FFTW_IN_PLACE);\n"); fprintf(outfile, " if ((_newspace&1)&&(_newspace&2)) {\n"); fprintf(outfile, " for (unsigned long _i0=0; _i01) fprintf(outfile, "*_%s_lattice0", fieldName); for (unsigned long j=2; j1) fprintf(outfile, "*_%s_lattice0", fieldName); for (unsigned long j=2; jgeometry()->nDims(); i++) { fprintf(outfile, " _howmany = _%s_%s_ncomponents;\n", fieldName, myName.c_str()); for (unsigned long j=myField->geometry()->nDims(); j>i+1; j--) { fprintf(outfile, " _howmany *= _%s_lattice%li;\n", fieldName, j-1); } fprintf(outfile, "\n"); fprintf(outfile, " _lattice = _%s_lattice%li;\n", fieldName, i); fprintf(outfile, "\n"); fprintf(outfile, " if ((!(_%s_%s_space&%li))&&(_newspace&%li)) {\n", fieldName, myName.c_str(), two2n, two2n); fprintf(outfile, "\n"); if (field()->simulation()->parameters()->fftwVersion == 2) fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_FORWARD, FFTW_IN_PLACE);\n"); else fprintf(outfile, " fftw_plan _plan = fftw_plan_many_dft(1, &_lattice, _howmany, \n" " reinterpret_cast(_active_%s_%s), NULL, _howmany, 1, \n" " reinterpret_cast(_active_%s_%s), NULL, _howmany, 1, \n" " FFTW_FORWARD, FFTW_ESTIMATE);\n", fieldName, myName.c_str(), fieldName, myName.c_str()); // We need estimate planning as measure planning would overwrite the field, and that would be bad, right? fprintf(outfile, "\n"); if (i>0) { fprintf(outfile, " for (unsigned long _i0=0; _i0<_%s_lattice0", fieldName); for (unsigned long j=1; jsimulation()->parameters()->nThreads>1 && field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_threads(_num_threads, _plan, _howmany, _active_%s_%s + _i0*_lattice*_howmany, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd(_plan, _howmany, _active_%s_%s + _i0*_lattice*_howmany, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_execute_dft(_plan, reinterpret_cast(_active_%s_%s) + _i0*_lattice*_howmany, \n" " reinterpret_cast(_active_%s_%s) + _i0*_lattice*_howmany);\n", fieldName, myName.c_str(), fieldName, myName.c_str()); } } else { if (field()->simulation()->parameters()->nThreads>1 && field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_threads(_num_threads, _plan, _howmany, _active_%s_%s, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd(_plan, _howmany, _active_%s_%s, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_execute(_plan);\n"); } } fprintf(outfile, "\n"); fprintf(outfile, " _c *= _%s_dx%li/sqrt(2*M_PI);\n", fieldName, i); fprintf(outfile, "\n"); if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_destroy_plan(_plan);\n"); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_destroy_plan(_plan);\n"); } fprintf(outfile, " }\n"); fprintf(outfile, " else if ((_%s_%s_space&%li)&&!(_newspace&%li)) {\n", fieldName, myName.c_str(), two2n, two2n); fprintf(outfile, "\n"); if (field()->simulation()->parameters()->fftwVersion == 2) fprintf(outfile, " fftwnd_plan _plan = fftwnd_create_plan(1, &_lattice, FFTW_BACKWARD, FFTW_IN_PLACE);\n"); else // We need estimate planning as measure planning in fftw3 overwrites the field, and that would be bad, right? fprintf(outfile, " fftw_plan _plan = fftw_plan_many_dft(1, &_lattice, _howmany, \n" " reinterpret_cast(_active_%s_%s), NULL, _howmany, 1, \n" " reinterpret_cast(_active_%s_%s), NULL, _howmany, 1, \n" " FFTW_BACKWARD, FFTW_ESTIMATE);\n", fieldName, myName.c_str(), fieldName, myName.c_str()); fprintf(outfile, "\n"); if (i>0) { fprintf(outfile, " for (unsigned long _i0=0; _i0<_%s_lattice0", fieldName); for (unsigned long j=1; jsimulation()->parameters()->nThreads>1 && field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_threads(_num_threads, _plan, _howmany, _active_%s_%s + _i0*_lattice*_howmany, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd(_plan, _howmany, _active_%s_%s + _i0*_lattice*_howmany, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_execute_dft(_plan, reinterpret_cast(_active_%s_%s) + _i0*_lattice*_howmany, \n" " reinterpret_cast(_active_%s_%s) + _i0*_lattice*_howmany);\n", fieldName, myName.c_str(), fieldName, myName.c_str()); } } else { if (field()->simulation()->parameters()->nThreads>1 && field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_threads(_num_threads, _plan, _howmany, _active_%s_%s, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd(_plan, _howmany, _active_%s_%s, _howmany, 1, 0, 0, 0);\n", fieldName, myName.c_str()); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_execute(_plan);\n"); } } fprintf(outfile, "\n"); fprintf(outfile, " _c *= _%s_dk%li/sqrt(2*M_PI);\n", fieldName, i); fprintf(outfile, "\n"); if (field()->simulation()->parameters()->fftwVersion == 2) { fprintf(outfile, " fftwnd_destroy_plan(_plan);\n"); } else if (field()->simulation()->parameters()->fftwVersion == 3) { fprintf(outfile, " fftw_destroy_plan(_plan);\n"); } fprintf(outfile, " }\n"); fprintf(outfile, "\n"); two2n *= 2; } fprintf(outfile, " _%s_%s_space=_newspace;\n", fieldName, myName.c_str()); fprintf(outfile, " }\n\n"); } } if ((field()->simulation()->parameters()->usempi) && !(field()->simulation()->parameters()->stochastic)) { fprintf(outfile, " for (long _i0=0; _i0simulation()->parameters()->useOpenMP) { // loop iterations are independent, so parallelise! fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } fprintf(outfile, " for (long _i0=0; _i0<_%s_size*_%s_%s_ncomponents; _i0++) {\n", fieldName, fieldName, myName.c_str()); } fprintf(outfile, " _active_%s_%s[_i0].re *= _c;\n", fieldName, myName.c_str()); fprintf(outfile, " _active_%s_%s[_i0].im *= _c;\n", fieldName, myName.c_str()); fprintf(outfile, " }\n"); fprintf(outfile, "\n"); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** void xmdsVector::writeInitialisationCall( FILE *const outfile, const char *const indent) const { if (debugFlag) { printf("xmdsVector::writeInitialisationCall\n"); } fprintf(outfile, "%s_%s_%s_initialise();\n", indent, field()->name()->c_str(), name()->c_str()); } // ************************************************************************** const XMLString* xmdsVector::name() const { if (debugFlag) { printf("xmdsVector::name\n"); } return &myName; } // ************************************************************************** void xmdsVector::setName( const XMLString& yourName) { if (debugFlag) { printf("xmdsVector::setName\n"); } myName = yourName; } // ************************************************************************** xmdsVectorType xmdsVector::vectorType() const { if (debugFlag) { printf("xmdsVector::vectorType\n"); } return myType; } // ************************************************************************** void xmdsVector::setVectorType( const xmdsVectorType& yourType) { if (debugFlag) { printf("xmdsVector::setVectorType\n"); } myType = yourType; } // ************************************************************************** unsigned long xmdsVector::nComponents() const { if (debugFlag) { printf("xmdsVector::nComponents\n"); } return myComponentsNamesList.size(); } // ************************************************************************** const XMLString* xmdsVector::componentName( const unsigned long& index) const { if (debugFlag) { printf("xmdsVector::componentName\n"); } if (index>=myComponentsNamesList.size()) { return 0; } list::const_iterator pXMLString = myComponentsNamesList.begin(); for (unsigned long i=0; i=myComponentsLengthsList.size()) { return 0; } list::const_iterator pLong = myComponentsLengthsList.begin(); for (unsigned long i=0; i::const_iterator pXMLString = myComponentsNamesList.begin(); pXMLString != myComponentsNamesList.end(); pXMLString++) { if (*pXMLString==ofName) { return 1; } index++; } return 0; } // ************************************************************************** void xmdsVector::setComponents( const list& yourComponentsNamesList) { if (debugFlag) { printf("xmdsVector::setComponents\n"); } myComponentsNamesList = yourComponentsNamesList; } // ************************************************************************** void xmdsVector::setLengths( const list& yourComponentsLengthsList) { if (debugFlag) { printf("xmdsVector::setComponents\n"); } myComponentsLengthsList = yourComponentsLengthsList; } // ************************************************************************** bool xmdsVector::needsFFTWRoutines() const { if (debugFlag) { printf("xmdsVector::needsFFTWRoutines\n"); } return myNeedsFFTWRoutines; } // ************************************************************************** void xmdsVector::setNeedsFFTWRoutines() const { if (debugFlag) { printf("xmdsVector::setNeedsFFTWRoutines\n"); } myNeedsFFTWRoutines=1; } // ************************************************************************** unsigned long xmdsVector::initialSpace() const { if (debugFlag) { printf("xmdsVector::initialSpace\n"); } return myInitialSpace; } // ************************************************************************** void xmdsVector::setInitialSpace( const unsigned long& yourInitialSpace) { if (debugFlag) { printf("xmdsVector::setInitialSpace\n"); } myInitialSpace=yourInitialSpace; } // ************************************************************************** // ************************************************************************** // xmdsVector protected // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsVector::writeInitialiseRoutine(FILE *const outfile) const { if (debugFlag) { printf("xmdsVector::writeInitialise\n"); } fprintf(outfile, "// *************************\n"); fprintf(outfile, "void _%s_%s_initialise() {\n", field()->name()->c_str(), myName.c_str()); fprintf(outfile, "\n"); // This is so silly that we need to ask the field for the simulation object. if (field()->simulation()->parameters()->useOpenMP) { fprintf(outfile, "#ifdef _OPENMP\n" "#pragma omp parallel for\n" "#endif\n"); } if (field()->simulation()->parameters()->usempi && !field()->simulation()->parameters()->stochastic && *field()->name() == "main") { fprintf(outfile, "for (long _i0=0; _i0name()->c_str(), myName.c_str()); } else { fprintf(outfile, "for (long _i0=0; _i0<_%s_size*_%s_%s_ncomponents; _i0++)\n", field()->name()->c_str(), field()->name()->c_str(), myName.c_str()); } fprintf(outfile, " _%s_%s[_i0] = 0;\n", field()->name()->c_str(), myName.c_str()); if (myNeedsFFTWRoutines) { fprintf(outfile, "\n"); fprintf(outfile, "_%s_%s_space=%li;\n", field()->name()->c_str(), myName.c_str(), myInitialSpace); } fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } // ************************************************************************** const xmdsField* xmdsVector::field() const { if (debugFlag) { printf("xmdsVector::field\n"); } return myField; } // ************************************************************************** bool xmdsVector::space( const long unsigned int& index) const { if (debugFlag) { printf("xmdsVector::space\n"); } if (index>=field()->geometry()->nDims()) { throw xmdsException("Internal range error in xmdsVector::space()"); } return (myInitialSpace >> index)&1; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_vector.h0000644000076500000240000001152111033277417013431 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_vector.h 1637 2007-12-31 04:00:26Z joehope $ */ /*! @file xmds_vector.h @brief More detailed explanation... */ #ifndef XMDS_VECTOR_H #define XMDS_VECTOR_H #include // ***************************************************************************** // ***************************************************************************** // xmdsVector // ***************************************************************************** // ***************************************************************************** //! xmds vector class class xmdsVector { public : //! Constructor for xmdsVector object xmdsVector( const xmdsField *const yourField); //! Destructor virtual ~xmdsVector(); //! Writes relevant \#defines out to file void writeDefines( FILE *const outfile) const; //! Writes relevant global variable declarations to file void writeGlobals( FILE *const outfile) const; //! Writes function prototypes to file void writePrototypes( FILE *const outfile) const; //! Writes the function routines to file void writeRoutines( FILE *const outfile) const; //! Writes the initialisation call void writeInitialisationCall( FILE *const outfile, const char *const indent) const; //! I think this grabs the xmds simulation name const XMLString* name() const; //! Sets the name of something, possibly the xmds simulation name void setName( const XMLString& yourName); //! Returns the vector type of an xmds vector xmdsVectorType vectorType() const; //! Sets the vector type (duh!) void setVectorType( const xmdsVectorType& yourType); //! Obtains the number of components (possibly in the xmds simulation) unsigned long nComponents() const; //! Obtains the name of the component const XMLString* componentName( const unsigned long& index) const; //! Obtains the length of the component const long componentLength( const unsigned long& index) const; //! Gets the component bool getComponent( const XMLString& ofName, unsigned long& index) const; //! Sets a component void setComponents( const list& yourComponentsNamesList); //! Sets a component void setLengths( const list& yourComponentsLengthsList); //! Determines if the FFTW routines are needed bool needsFFTWRoutines() const; //! Sets whether the FFTW routines are needed void setNeedsFFTWRoutines() const; //! Determines the initial space for the xmds vector (x-space or k-space) unsigned long initialSpace() const; //! Sets the initial space to x-space or k-space void setInitialSpace( const unsigned long& yourInitialSpace); protected: //! Writes the initialise routine virtual void writeInitialiseRoutine( FILE *const outfile) const; //! Obtains an instance of the xmdsField object const xmdsField* field() const; //! Returns true if the space at index is the initial space (I think...) bool space( const long unsigned int& index) const; private : const xmdsField *const myField; //!< The field object XMLString myName; //!< The name of the field xmdsVectorType myType; //!< The data type of the field (double or complex) unsigned long myInitialSpace; //!< The initial space of the simulation (x-space or k-space) list myComponentsNamesList; //!< The list of the names of the components list myComponentsLengthsList; //!< The list of the lengths of the components mutable bool myNeedsFFTWRoutines; //!< Whether or not the fftw routines are needed }; #endif // XMDS_VECTOR_H xmds-1.6.6/source/xmds_vector_element.cc0000644000076500000240000012173211033277417015306 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_vector_element.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xmds_vector_element.cc @brief Vector element parsing classes and methods More detailed explanation... */ #include #include #include // ************************************************************************** // ************************************************************************** // xmdsVectorElement public // ************************************************************************** // ************************************************************************** extern bool debugFlag; long nxmdsVectorElements=0; //!< The number of xmds vector elements enum { ASCII = 1, BINARY = 2, XSIL = 3 }; // ************************************************************************** xmdsVectorElement::xmdsVectorElement( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const xmdsField *const yourField) : xmdsVector(yourField), xmdsElement(yourSimulation, yourVerboseMode) { if (debugFlag) { nxmdsVectorElements++; printf("xmdsVectorElement::xmdsVectorElement\n"); printf("nxmdsVectorElements=%li\n", nxmdsVectorElements); } } // ************************************************************************** xmdsVectorElement::~xmdsVectorElement() { if (debugFlag) { nxmdsVectorElements--; printf("xmdsVectorElement::~xmdsVectorElement\n"); printf("nxmdsVectorElements=%li\n", nxmdsVectorElements); } } // ************************************************************************** void xmdsVectorElement::processElement( const Element *const yourElement) { if (debugFlag) { printf("xmdsVectorElement::processElement\n"); } list anXMLStringList; list aLongList; XMLString anXMLString; if (verbose()) { printf("Processing vector element ...\n"); } // ************************************ // find name getAssignmentStrings(yourElement, "name", 1, 1, anXMLStringList); const xmdsVector* possibleTwin; if (field()->getVector(*anXMLStringList.begin(), possibleTwin)) { sprintf(errorMessage(), "a vector of name '%s' already exists in this field", anXMLStringList.begin()->c_str()); throw xmdsException(yourElement, errorMessage()); } setName(*anXMLStringList.begin()); if (verbose()) { printf("vector name is '%s'\n", name()->c_str()); } // ************************************ // find type getAssignmentStrings(yourElement, "type", 0, 1, anXMLStringList); if (anXMLStringList.size()==1) { if (*anXMLStringList.begin()=="complex") { setVectorType(COMPLEX); if (verbose()) { printf("vector type is 'complex'\n"); } } else if (*anXMLStringList.begin()=="double") { setVectorType(DOUBLE); if (verbose()) { printf("vector type is 'double'\n"); } } else { } } else { setVectorType(COMPLEX); printf("vector type defaulting to 'complex'\n"); } // ************************************ // find components getAssignmentVectorStrings(yourElement, "components", 1, 0, anXMLStringList, aLongList); if (anXMLStringList.size()==0) { throw xmdsException(yourElement, "No vector components specified!"); } setComponents(anXMLStringList); setLengths(aLongList); if (verbose()) { for (unsigned long i=0; ic_str()); } } // ************************************ // find 'filename' getAssignmentStrings(yourElement, "filename", NOT_REQD, 1, anXMLStringList); if (anXMLStringList.size()==1) { // we have a filename assignent getAttributeStrings(yourElement, "filename", "format", NOT_REQD, anXMLString); myInputFileFormat = ASCII; // the default value setInitialSpace(0); if (anXMLString != EMPTY_STRING) { // a format attribute has been set if (anXMLString == "binary") { myInputFileFormat = BINARY; } else if (anXMLString == "bin") { myInputFileFormat = BINARY; } else if (anXMLString == "ascii") { myInputFileFormat = ASCII; } else if (anXMLString == "text") { myInputFileFormat = ASCII; } else if (anXMLString == "txt") { myInputFileFormat = ASCII; } else if (anXMLString == "xsil") { myInputFileFormat = XSIL; // find the moment group that we are initialising from XMLString momentGroupName; getAttributeStrings(yourElement, "filename", "moment_group", NOT_REQD, momentGroupName); if (momentGroupName == EMPTY_STRING) myInitialisationMomentGroupName = "NULL"; else myInitialisationMomentGroupName = string("moment_group_") + momentGroupName.c_str(); // find the geometry matching mode XMLString geometryMatchMode; getAttributeStrings(yourElement, "filename", "geometry_matching_mode", NOT_REQD, geometryMatchMode); if (geometryMatchMode != EMPTY_STRING) { if (geometryMatchMode == "strict") isGeometryMatchingModeStrict = true; else if (geometryMatchMode == "loose") isGeometryMatchingModeStrict = false; else throw xmdsException(yourElement, "The geometry matching mode must be either 'strict' or 'loose'"); } else isGeometryMatchingModeStrict = true; if (field()->geometry()->nDims()>0) { // ************************************ // find space list aSpaceList; getAssignmentBools(yourElement, "fourier_space", 0, field()->geometry()->nDims(), aSpaceList); if (aSpaceList.size() == 0) { printf("Initialisation space for vector '%s' defaulting to x-space.\n", name()->c_str()); } else { list::const_iterator pBool = aSpaceList.begin(); for (unsigned long i=0; igeometry()->nDims(); i++) { if (verbose()) { if (*pBool) { printf("initialisation will be performed with dimension #%li in fourier space\n", i+1); } else { printf("initialisation will be performed with dimension #%li in normal space\n", i+1); } } pBool++; } setInitialSpace(spaceList2ULong(aSpaceList)); } } // ************************************ // find vectors getAssignmentStrings(yourElement, "vectors", 0, 0, myVectorNamesList); field()->processVectors(myVectorNamesList, initialSpace()); // ************************************ // find code myCode=*yourElement->textContent(0); } else { throw xmdsException(yourElement, "Warning: Unknown file format attribute value in 'filename' tag\nI expected either 'binary', 'ascii' or 'xsil'."); } } myFileName=*anXMLStringList.begin(); if (verbose()) { printf("vector initialisation from file '%s'\n", myFileName.c_str()); } } else { // initialisation from code if (verbose()) { printf("initialisation from user code\n"); } setInitialSpace(0); if (field()->geometry()->nDims()>0) { // ************************************ // find space list aSpaceList; getAssignmentBools(yourElement, "fourier_space", 0, field()->geometry()->nDims(), aSpaceList); if (aSpaceList.size() == 0) { printf("Initialisation space for vector '%s' defaulting to x-space.\n", name()->c_str()); } else { list::const_iterator pBool = aSpaceList.begin(); for (unsigned long i=0; igeometry()->nDims(); i++) { if (verbose()) { if (*pBool) { printf("initialisation will be performed with dimension #%li in fourier space\n", i+1); } else { printf("initialisation will be performed with dimension #%li in normal space\n", i+1); } } pBool++; } setInitialSpace(spaceList2ULong(aSpaceList)); } } // ************************************ // find vectors getAssignmentStrings(yourElement, "vectors", 0, 0, myVectorNamesList); field()->processVectors(myVectorNamesList, initialSpace()); // ************************************ // find code myCode=*yourElement->textContent(0); // check for non-white space charaters in code: if (myCode.isAllWhiteSpace()) { throw xmdsException(yourElement, "No initialisation code defined!"); } if (verbose()) { printf("initialisation code loaded\n"); } } } // ************************************************************************** // ************************************************************************** // xmdsVectorElement private // ************************************************************************** // ************************************************************************** // ************************************************************************** void xmdsVectorElement::writeInitialiseRoutine(FILE *const outfile) const { if (debugFlag) { printf("xmdsVectorElement::writeInitialise\n"); } const unsigned long nDims = field()->geometry()->nDims(); const char *const fieldName = field()->name()->c_str(); const char *const vectorName = name()->c_str(); fprintf(outfile, "// *************************\n" "void _%s_%s_initialise() {\n\n", fieldName, vectorName); if (simulation()->parameters()->useOpenMP) { // This may seem a little bizarre, but this is important for supercomputers that use a NUMA // (non-uniform memory addressing) architecture (e.g. ANU's ac supercomputer) // Memory is assigned to the process that first accesses it, so if we initialise the whole field to zero // in a parallel fashion, then memory should be assigned to the thread that will use it in future. If we just // did this with a single thread, then all the memory would be 'local' on the first thread, and any time any other // thread tries to access this memory, it will need to talk to the node on which this memory is stored. fprintf(outfile, "#ifdef _OPENMP\n" // this code is unnecessary if OpenMP isn't actually available "{\n"); // ensure that loop variables are all local // Begin loop over the grid (for this vector) list vectorNameList; vectorNameList.push_back(*name()); field()->openLoops(outfile, initialSpace(), vectorNameList, PARALLELISE_LOOP); for (long unsigned int i=0; ic_str()); } field()->closeLoops(outfile, initialSpace(), vectorNameList); fprintf(outfile, "}\n" "#endif // _OPENMP\n\n"); } if (myFileName.length()>0) { // initialisation from file if (myInputFileFormat == ASCII) { fprintf(outfile, "FILE* infile = fopen(\"%s\", \"r\");\n" "\n" "if (infile==0) {\n" "\t printf(\"Error opening file '%s' for initialisation of vector '%s'\\n\");\n" "\t exit(255);\n" "\t }\n" "\n" "unsigned long _i0=0;\n" "\n", myFileName.c_str(), myFileName.c_str(), vectorName); if (simulation()->parameters()->usempi&!simulation()->parameters()->stochastic) { //forwarding to "ranks' point in file. Slow but safe fprintf(outfile, "double _garbage=0.0;\n"); fprintf(outfile, "for (unsigned long _i0=0; _i0<(_%s_size/_%s_lattice0)*_%s_%s_ncomponents*local_x_start; _i0++){\n", fieldName, fieldName, fieldName, vectorName); if (vectorType()==COMPLEX) { fprintf(outfile, "\t if (fscanf(infile, \"%%lf %%lf\", &_garbage, &_garbage) != 2) \n"); } else if (vectorType()==DOUBLE) { fprintf(outfile, "\t if (fscanf(infile, \"%%lf\", &_garbage) != 1) \n"); } fprintf(outfile, "\t\t printf(\"Rank %%i Error forwarding '%s' from file '%s': either bad float format or insufficient data\\n\", rank);\n", vectorName, myFileName.c_str()); fprintf(outfile, "}\n"); fprintf(outfile, "\n"); fprintf(outfile, "while(_i0parameters()->usempi&!simulation()->parameters()->stochastic) fprintf(outfile, "\t\t _i0=total_local_size*_%s_%s_ncomponents;\n", fieldName, vectorName); else fprintf(outfile, "\t\t _i0=_%s_size*_%s_%s_ncomponents;\n", fieldName, fieldName, vectorName); /* This next line kills the program at this point. We may or may not want to do this, although I just had a user request that the program not continue past this error. (Wasted time) Reverting is as simple as deleting the next line. (JJH) */ fprintf(outfile, "\t\t exit(255);\n" "\t }\n" "\t _i0++;\n" "}\n" "\n" "fclose(infile);\n"); } else if (myInputFileFormat == BINARY) { fprintf(outfile, "FILE* infile = fopen(\"%s\", \"rb\");\n" "\n" "if (infile==0) {\n" "\t printf(\"Error opening file '%s' for initialisation of vector '%s'\\n\");\n" "\t return;\n" "\t }\n" "\n", myFileName.c_str(), myFileName.c_str(), vectorName); // Begin loop over the grid (for this vector) list vectorNameList; vectorNameList.push_back(*name()); // This loop isn't parallelisable due to the use of fseek/fread field()->openLoops(outfile, initialSpace(), vectorNameList, DO_NOT_PARALLELISE_LOOP); // Index pointer into the input array fprintf(outfile, "unsigned long _inputfield_index_pointer=0;\n"); for (long unsigned int i=0; igeometry()->nDims(); i++) { string dimName; if (!((initialSpace()>>i)&1)) { // x space dimName = field()->geometry()->dimension(i)->name.c_str(); fprintf(outfile, "long _inputfield_i%1$li = lround((%2$s - _%3$s_xmin%1$li)/_%3$s_dx%1$li);\n\n", i, dimName.c_str(), fieldName); } else { // k space dimName = string("k") + field()->geometry()->dimension(i)->name.c_str(); fprintf(outfile, "long _inputfield_i%1$li = lround(%2$s/_%3$s_dk%1$li) + (_%3$s_lattice%1$li/2);\n" , i, dimName.c_str(), fieldName); } // Calculate the input field index pointer fprintf(outfile, "_inputfield_index_pointer += _inputfield_i%li", i); for (long unsigned int j=i+1; jgeometry()->nDims(); j++) { fprintf(outfile, "*_%s_lattice%li", fieldName, j); } fprintf(outfile, ";\n\n"); } fprintf(outfile, "fseek(infile, _inputfield_index_pointer*sizeof(%s)*_%s_%s_ncomponents, SEEK_SET);\n", vectorType()==COMPLEX ? "complex" : "double", fieldName, vectorName); fprintf(outfile, "fread(_%1$s_%2$s + _%1$s_%2$s_index_pointer, sizeof(%3$s), _%1$s_%2$s_ncomponents, infile);\n", fieldName, vectorName, vectorType()==COMPLEX ? "complex" : "double"); field()->closeLoops(outfile, initialSpace(), vectorNameList); /* if (vectorType()==COMPLEX) { // We are cutting the temporary variable due to stack overflow. Why was this done this way originally? // fprintf(outfile, "\t complex _tempInput[_%s_size*_%s_%s_ncomponents];\n", // fieldName, fieldName, vectorName); // fprintf(outfile, "\t fread(&_tempInput, sizeof(complex), _%s_size*_%s_%s_ncomponents, infile);\n", // fieldName, fieldName, vectorName); fprintf(outfile, "\t fread(_%s_%s, sizeof(complex), _%s_size*_%s_%s_ncomponents, infile);\n", fieldName, vectorName, fieldName, fieldName, vectorName); // fprintf(outfile, "\t _%s_%s = _tempInput;\n", fieldName, vectorName); } else if (vectorType()==DOUBLE) { // fprintf(outfile, "\t double _tempInput[_%s_size*_%s_%s_ncomponents];\n", // fieldName, fieldName, vectorName); // fprintf(outfile, "\t fread(&_tempInput, sizeof(double), _%s_size*_%s_%s_ncomponents, infile);\n", // fieldName, fieldName, vectorName); fprintf(outfile, "\t fread(_%s_%s, sizeof(double), _%s_size*_%s_%s_ncomponents, infile);\n", fieldName, vectorName, fieldName, fieldName, vectorName); // fprintf(outfile, "\t _%s_%s = _tempInput;\n", fieldName, vectorName); }*/ fprintf(outfile, "\n" "fclose(infile);\n"); } else if (myInputFileFormat == XSIL) { // Create noises if needed if (simulation()->parameters()->stochastic) { fprintf(outfile, "const double _var = 1.0"); for (unsigned long i=0; iparameters()->errorCheck) { fprintf(outfile, "double *_noises2 = new double[_n_noises];\n"); } fprintf(outfile, "\n"); } // Write variables for this routine fprintf(outfile, "\t char **dimNames = new char* [_%1$s_ndims];\n" "\t double *dimDelta = new double[_%1$s_ndims];\n" // use the first argument. Saves writing it out half a dozen times "\t double *dimMin = new double[_%1$s_ndims];\n" "\t unsigned long *dimLattice = new unsigned long[_%1$s_ndims];\n\n", fieldName); for (long unsigned int i=0; igeometry()->nDims(); i++) { fprintf(outfile, "\t dimNames[%1$li] = \"%2$s%3$s\";\n" "\t dimDelta[%1$li] = _%4$s_d%5$s%1$li;\n", i, (initialSpace()>>i)&1 ? "k" : "", field()->geometry()->dimension(i)->name.c_str(), fieldName, (initialSpace()>>i)&1 ? "k" : "x"); if ((initialSpace()>>i)&1) fprintf(outfile, "\t dimMin[%1$li] = (-(_%2$s_lattice%1$li)/2)*_%2$s_dk%1$li;\n", i, fieldName); else fprintf(outfile, "\t dimMin[%1$li] = _%2$s_xmin%1$li;\n", i, fieldName); fprintf(outfile, "\t dimLattice[%1$li] = _main_lattice%1$li;\n\n", i); } int vectorComponents = nComponents(); fprintf(outfile, "\t char **componentNames = new char*[%1$i+1];\n" "\t int *componentFieldIndices = new int[%1$i];\n\n", vectorType()==DOUBLE ? vectorComponents : 2*vectorComponents); int index=0; for (int naturalIndex=0; naturalIndexc_str()); index++; if (vectorType()==COMPLEX) { fprintf(outfile, "\t componentNames[%i] = \"%sI\";\n", index, componentName(naturalIndex)->c_str()); index++; } fprintf(outfile, "\n"); } fprintf(outfile, "\t componentNames[%i] = NULL;\n\n", index); // This are the output variables for initialiseFieldFromXSILFile fprintf(outfile, "\t char *binaryDataFilename;\n" "\t int unsignedLongSize;\n" "\t bool dataEncodingIsNative;\n" "\t bool isPrecisionDouble;\n" "\t unsigned long nDataComponents;\n" "\t unsigned long *inputLattice;\n" "\t int *componentInputIndices;\n\n" "\t if (!initialiseFieldFromXSILFile(\"%s\", \"%s\", _%s_ndims, dimNames, componentNames, \n" //file, moment group and field "// output variables\n" "\t\t\t &binaryDataFilename, &unsignedLongSize, &dataEncodingIsNative, &isPrecisionDouble, &nDataComponents, &inputLattice, &componentInputIndices)) {\n", myFileName.c_str(), myInitialisationMomentGroupName.c_str(), fieldName); if (simulation()->parameters()->usempi && !simulation()->parameters()->stochastic) { fprintf(outfile, "\t\t printf(\"Rank [%%i]: Unable to load data from XSIL file.\\nExiting.\\n\", rank);\n" "\t\t MPI_Abort(MPI_COMM_WORLD, 1);\n" "\t\t exit(1);\n"); } else { fprintf(outfile, "\t\t printf(\"Unable to load data from XSIL file.\\nExiting.\\n\");\n" "\t\t exit(1);\n"); } fprintf(outfile, "\t }\n\n"); // Open the binary data file fprintf(outfile, "\t FILE *inputFile = fopen(binaryDataFilename, \"rb\");\n" "\t if (inputFile == NULL) {\n" "\t\t printf(\"Unable to open binary input file %%s\\n\", binaryDataFilename);\n" "\t\t exit(1);\n" "\t }\n" "// I would like to point out that the binary data described by the XSIL file does *NOT* follow the file format described in the spec.\n\n" "typedef union {\n" "\t float *floatPtr;\n" "\t double *doublePtr;\n" "} GenericRealNumberPtr;\n\n" "typedef union {\n" "\t unsigned long ulong;\n" "\t uint32_t uint32;\n" "\t uint64_t uint64;\n" "} GenericUnsignedLong;\n\n" "\t GenericUnsignedLong size;\n" "\t GenericRealNumberPtr *inputData = new GenericRealNumberPtr[_%s_ndims];\n" "\t for (int __i=0; __i<_%s_ndims; __i++) {\n" // loop over the dimension elements in the binary file "\t\t uint64_t sizeValue;\n" "\t\t switch(unsignedLongSize) {\n", fieldName, fieldName); // deal with the different possible sizes for the unsigned long size const char *string1[] = {"0", "4", "8"}; const char *string2[] = {"ulong", "uint32", "uint64"}; const char *string3[] = {"unsigned long", "uint32_t", "uint64_t"}; const char *string4[] = {"XMDSSwapInt32", "XMDSSwapInt32", "XMDSSwapInt64"}; for (int i=0; i<3; i++) { fprintf(outfile, "\t\t\t case %s:\n" "\t\t\t\t fread(&size.%s, sizeof(%s), 1, inputFile);\n" "\t\t\t\t if (dataEncodingIsNative)\n" "\t\t\t\t\t sizeValue = size.%s;\n" "\t\t\t\t else\n" "\t\t\t\t\t sizeValue = %s(size.%s);\n" "\t\t\t\t unsignedLongSize = sizeof(%s);\n" "\t\t\t\t break;\n\n", string1[i], string2[i], string3[i], string2[i], string4[i], string2[i], string3[i]); } fprintf(outfile, "\t\t }\n"); // Read in the data (in either double or single precision) fprintf(outfile, "\t\t if (isPrecisionDouble) {\n" "\t\t\t inputData[__i].doublePtr = new double[sizeValue];\n" "\t\t\t fread(inputData[__i].doublePtr, sizeof(double), sizeValue, inputFile);\n" "\t\t\t if (!dataEncodingIsNative) {\n" "\t\t\t\t for (int j=0; j 0.01*dimDelta[__i]) {\n" "\t\t\t printf(\"The step size in the '%%s' dimension of the input data and the simulation grid do not match\\n\", dimNames[__i]);\n" "\t\t\t printf(\"The step size in the '%%s' dimension was %%e, while the input data had a step size of %%e\\n\", dimNames[__i], dimDelta[__i], difference);\n" "\t\t\t exit(1);\n" "\t\t }\n" "\t\t else {\n" // "\t\t\t printf(\"Step requirement succeeded. Field delta: %%e, input delta: %%e\\n\", dimDelta[__i], difference);\n" "\t\t }\n" "\t }\n", fieldName); // In strict mode we require that the grid be exactly the same if (isGeometryMatchingModeStrict) { fprintf(outfile, "// STRICT MODE: assert that the start point is the same to within 10%% of one delta, and that the number of lattice points is the same\n" "\t for (int __i=0; __i<_%s_ndims; __i++) {\n" // field name "\t\t double start;\n" "\t\t if (isPrecisionDouble)\n" "\t\t\t start = inputData[__i].doublePtr[0];\n" "\t\t else\n" "\t\t\t start = inputData[__i].floatPtr[0];\n\n" "\t\t if (fabs(dimMin[__i] - start) > dimDelta[__i]/10) {\n" "\t\t\t printf(\"Geometry matching mode is strict, so the starting coordinate of each dimension in the field must be the same as in the input grid\\n\");\n" "\t\t\t printf(\"The problem is with dimension '%%s'\\n\", dimNames[__i]);\n" "\t\t\t exit(1);\n" "\t\t }\n" "\t\t if (dimLattice[__i] != inputLattice[__i]) {\n" "\t\t\t printf(\"Geometry matching mode is strict, so the number of lattice points in each dimension of the field must be the same as in the input grid\\n\");\n" "\t\t\t printf(\"The problem is with dimension '%%s'\\n\", dimNames[__i]);\n" "\t\t\t exit(1);\n" "\t\t }\n" "\t }\n\n", fieldName); } fprintf(outfile, "long binaryFileBaseOffset = ftell(inputFile);\n"); fprintf(outfile, "long realNumberSize = isPrecisionDouble ? sizeof(double) : sizeof(float);\n"); fprintf(outfile, "off_t vectorFieldSize = unsignedLongSize + realNumberSize"); for (long unsigned int i=0; igeometry()->nDims(); i++) { fprintf(outfile, " * inputLattice[%li]", i); } fprintf(outfile, ";\n"); // Transform vectors to appropriate space field()->vectors2space(outfile, initialSpace(), myVectorNamesList, ""); // I'm honestly not sure why this code is here list vectorNameList = myVectorNamesList; vectorNameList.push_back(*name()); // Create minimum variables for x-space dimensions for (long unsigned int i=0; igeometry()->nDims(); i++) { if ((initialSpace()>>i)&1) continue; fprintf(outfile, "double _inputfield_min%1$li;\n" "if (isPrecisionDouble)\n" "\t _inputfield_min%1$li = inputData[%1$li].doublePtr[0];\n" "else\n" "\t _inputfield_min%1$li = inputData[%1$li].floatPtr[0];\n\n", i); } fprintf(outfile, "{ // Put the loop in a block\n"); field()->openLoops(outfile, initialSpace(), vectorNameList, PARALLELISE_LOOP); if (simulation()->parameters()->stochastic) { if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "_make_noises(_gen1, _var/2, 0, _noises, _n_noises);\n"); fprintf(outfile, "_make_noises(_gen2, _var/2, 0, _noises2, _n_noises);\n"); } else { fprintf(outfile, "_make_noises(_gen1, _var/2, _noises, _n_noises);\n"); fprintf(outfile, "_make_noises(_gen2, _var/2, _noises2, _n_noises);\n"); } fprintf(outfile, "for (unsigned long _s0=0; _s0<_n_noises; _s0++)\n"); fprintf(outfile, " _noises[_s0] += _noises2[_s0];\n"); fprintf(outfile, "\n"); } else { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "_make_noises(_gen, _var, 0, _noises, _n_noises);\n"); } else { fprintf(outfile, "_make_noises(_gen, _var, _noises, _n_noises);\n"); } fprintf(outfile, "\n"); } } // Set the input field index pointer from the grid coordinates // Initialise the components to zero fprintf(outfile, "for (unsigned int _component=0; _component<_%1$s_%2$s_ncomponents; _component++)\n" "\t _%1$s_%2$s[_%1$s_%2$s_index_pointer+_component] = 0.0;\n\n", fieldName, vectorName); // Include any initialisation code, if it exists if (!myCode.isAllWhiteSpace()) { fprintf(outfile, "// ********** Code from vector element***********\n"); fprintf(outfile, "%s\n", myCode.c_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); } // Of course, initialisation code is only used if the input grid doesn't specify a value there. // This is so, if for some bizarre reason, a vector needs to be set to '1' (or something else) outside the input grid... // If you want to do something where you override the input data, then that can be done easily enough with a filter element // at the start of the simulation. field()->closeLoops(outfile, initialSpace(), vectorNameList); fprintf(outfile, "} // End block for loop\n"); // Index pointer into the input array (new and old) fprintf(outfile, "off_t _inputfield_index_pointer, _inputfield_old_index_pointer;\n"); fprintf(outfile, "for (unsigned int _component=0; _component<%i; _component++) {\n" "\tif (componentInputIndices[_component] == -1)\n" "\t\tcontinue;\n\n" "_inputfield_index_pointer = -42; // Just so that we always seek the first time\n", vectorType() == DOUBLE ? vectorComponents : 2*vectorComponents); field()->openLoops(outfile, initialSpace(), vectorNameList, DO_NOT_PARALLELISE_LOOP); // Save the old index pointer, and clear the new one fprintf(outfile, "_inputfield_old_index_pointer = _inputfield_index_pointer;\n" "_inputfield_index_pointer = 0;\n\n"); for (long unsigned int i=0; igeometry()->nDims(); i++) fprintf(outfile, "long _inputfield_i%li;\n", i); for (long unsigned int i=0; igeometry()->nDims(); i++) { string dimName; if (!((initialSpace()>>i)&1)) { // x space dimName = field()->geometry()->dimension(i)->name.c_str(); fprintf(outfile, "_inputfield_i%1$li = lround((%2$s - _inputfield_min%1$li)/dimDelta[%1$li]);\n\n", i, dimName.c_str()); } else { // k space dimName = string("k") + field()->geometry()->dimension(i)->name.c_str(); fprintf(outfile, "_inputfield_i%1$li = lround(%2$s/dimDelta[%1$li]) + (inputLattice[%1$li]/2);\n", i, dimName.c_str()); } // check to see if the input grid has this coordinate value fprintf(outfile, "if (_inputfield_i%1$li < 0 || _inputfield_i%1$li >= inputLattice[%1$li])\n" "// The input grid doesn't cover this point\n" "\t goto ENDLOOP;\n\n", i); // check that the input coordinate matches up with the field coordinate fprintf(outfile, "{\n\tdouble _inputfield_%1$s;\n" "\tif (isPrecisionDouble)\n" "\t\t _inputfield_%1$s = inputData[%2$li].doublePtr[_inputfield_i%2$li];\n" "\telse\n" "\t\t _inputfield_%1$s = inputData[%2$li].floatPtr[_inputfield_i%2$li];\n\n" "\tif (fabs(_inputfield_%1$s - %1$s) > dimDelta[%2$li]/10) {\n" "\t// This only happens if your input field grid does not exactly match up with the simulation grid\n" "\t\t printf(\"The input field coordinate in the '%1$s' dimension does not match up with the field coordinate\\n\");\n" "\t\t printf(\"_i%2$li: %%li, %1$s: %%e, _inputfield_i%2$li: %%li, _inputfield_%1$s: %%e, d%1$s: %%e, diff/Delta: %%e\\n\", \n" "\t\t\t\t\t\t _i%2$li, %1$s, _inputfield_i%2$li, _inputfield_%1$s, dimDelta[%2$li], fabs(_inputfield_%1$s - %1$s)/dimDelta[%2$li]);\n" "\t\t exit(1);\n" "\t}\n}\n\n", dimName.c_str(), i); // Calculate the input field index pointer fprintf(outfile, "_inputfield_index_pointer += _inputfield_i%li", i); for (long unsigned int j=i+1; jgeometry()->nDims(); j++) { fprintf(outfile, "*inputLattice[%li]", j); } fprintf(outfile, ";\n\n"); } fprintf(outfile, "double value;\n"); fprintf(outfile, "if (_inputfield_index_pointer != _inputfield_old_index_pointer + 1) \n" "\t fseeko(inputFile, binaryFileBaseOffset + (componentInputIndices[_component]-_%s_ndims)*vectorFieldSize + \n" "\t\t unsignedLongSize + _inputfield_index_pointer*realNumberSize, SEEK_SET);\n", fieldName); fprintf(outfile, "if (isPrecisionDouble) {\n" "\t fread(&value, sizeof(double), 1, inputFile);\n" "\t if (!dataEncodingIsNative)\n" "\t\t value = XMDSSwapDouble(value);\n" " }\n" "\t else {\n" "\t float temp;\n" "\t fread(&temp, sizeof(float), 1, inputFile);\n" "\t if (!dataEncodingIsNative)\n" "\t\t temp = XMDSSwapFloat(temp);\n" "\t value = (double)temp;\n" " }\n"); if (vectorType() == DOUBLE) fprintf(outfile, "_%1$s_%2$s[_%1$s_%2$s_index_pointer+_component] = value;\n", fieldName, vectorName); else // COMPLEX fprintf(outfile, "if (_component & 1) \n" "\t _%1$s_%2$s[_%1$s_%2$s_index_pointer+_component/2].im = value;\n" "else \n" "\t _%1$s_%2$s[_%1$s_%2$s_index_pointer+_component/2].re = value;\n\n", fieldName, vectorName); fprintf(outfile, "ENDLOOP:\n\n"); field()->closeLoops(outfile, initialSpace(), vectorNameList); fprintf(outfile, "} // end loop over components \n"); fprintf(outfile, "\t fclose(inputFile);\n" "\t delete [] dimNames;\n" "\t delete [] componentNames;\n" "\t free(binaryDataFilename);\n" "\t delete [] inputLattice;\n" "\t delete [] componentInputIndices;\n" "\t for (int i =0; i<_%s_ndims; i++) {\n" "\t\t if (isPrecisionDouble)\n" "\t\t\t delete [] inputData[i].doublePtr;\n" "\t\t else\n" "\t\t\t delete [] inputData[i].floatPtr;\n" "\t }\n" "\t delete [] inputData;\n", fieldName); // Delete noises (if needed) if (simulation()->parameters()->stochastic) { fprintf(outfile, " delete[] _noises;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noises2;\n"); } } } else { // something must have really screwed up to get here... throw xmdsException("For some reason the input file is neither ascii, binary or xsil...\nHow did we get here??"); } } else { // initialisation from code if (simulation()->parameters()->stochastic) { fprintf(outfile, "const double _var = 1.0"); for (unsigned long i=0; iparameters()->errorCheck) { fprintf(outfile, "double *_noises2 = new double[_n_noises];\n"); } fprintf(outfile, "\n"); } field()->vectors2space(outfile, initialSpace(), myVectorNamesList, ""); list vectorNameList = myVectorNamesList; vectorNameList.push_back(*name()); // The code could be doing anything, let's be safe field()->openLoops(outfile, initialSpace(), vectorNameList, DO_NOT_PARALLELISE_LOOP); char indent[64]; for (unsigned long i=0; iparameters()->stochastic) { if (simulation()->parameters()->errorCheck) { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s_make_noises(_gen1, _var/2, 0, _noises, _n_noises);\n", indent); fprintf(outfile, "%s_make_noises(_gen2, _var/2, 0, _noises2, _n_noises);\n", indent); } else { fprintf(outfile, "%s_make_noises(_gen1, _var/2, _noises, _n_noises);\n", indent); fprintf(outfile, "%s_make_noises(_gen2, _var/2, _noises2, _n_noises);\n", indent); } fprintf(outfile, "%sfor (unsigned long _s0=0; _s0<_n_noises; _s0++)\n", indent); fprintf(outfile, "%s _noises[_s0] += _noises2[_s0];\n", indent); fprintf(outfile, "\n"); } else { if (simulation()->parameters()->noiseKind == "poissonian") { fprintf(outfile, "%s_make_noises(_gen, _var, 0, _noises, _n_noises);\n", indent); } else { fprintf(outfile, "%s_make_noises(_gen, _var, _noises, _n_noises);\n", indent); } fprintf(outfile, "\n"); } } fprintf(outfile, "// ********** Code from vector element***********\n"); fprintf(outfile, "%s\n", myCode.c_str()); fprintf(outfile, "// **********************************************\n"); fprintf(outfile, "\n"); field()->closeLoops(outfile, initialSpace(), vectorNameList); if (simulation()->parameters()->stochastic) { fprintf(outfile, " delete[] _noises;\n"); if (simulation()->parameters()->errorCheck) { fprintf(outfile, " delete[] _noises2;\n"); } } } if (needsFFTWRoutines()) { fprintf(outfile, "\n"); fprintf(outfile, "_%s_%s_space=%li;\n", field()->name()->c_str(), name()->c_str(), initialSpace()); } fprintf(outfile, "}\n"); fprintf(outfile, "\n"); } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xmds_vector_element.h0000644000076500000240000000536211033277417015150 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and the xmds-devel team This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xmds_vector_element.h 1507 2007-08-15 09:47:34Z paultcochrane $ */ /*! @file xmds_vector_element.h @brief More detailed explanation... */ #ifndef XMDS_VECTOR_ELEMENT_H #define XMDS_VECTOR_ELEMENT_H #include #include #include // ***************************************************************************** // ***************************************************************************** // xmdsVectorElement // ***************************************************************************** // ***************************************************************************** //! xmds vector element class class xmdsVectorElement : public xmdsVector, public xmdsElement { public : //! Constructor for the xmdsVectorElement object xmdsVectorElement( const xmdsSimulation *const yourSimulation, const bool& yourVerboseMode, const xmdsField *const yourField); //! Destructor ~xmdsVectorElement(); //! Processes an element of an xmds vector element void processElement( const Element *const yourElement); private : XMLString myFileName; //!< The input filename of the initialisation vector int myInputFileFormat; //!< The input file format list myVectorNamesList; //!< The list of vector names XMLString myCode; //!< The string of code for initialisation of the vector(s) string myInitialisationMomentGroupName; //!< The moment group number in the XSIL file that will be used for initialisation bool isGeometryMatchingModeStrict; //!< True if the XSIL input geometry must exactly match the field geometry //! Write the initialisation routine to file void writeInitialiseRoutine( FILE *const outfile) const; }; #endif // XMDS_VECTOR_ELEMENT_H xmds-1.6.6/source/xml_basics.cc0000644000076500000240000005303611033277417013365 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope, Andrew Reid and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xml_basics.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xml_basics.h @brief Basic xml parsing classes and methods More detailed explanation... */ #include extern bool xmlDebugFlag; // ************************************************************************** // ************************************************************************** // XMLException // ************************************************************************** // ************************************************************************** long nXMLExceptions=0; //!< The number of XML exceptions // ************************************************************************** XMLException::XMLException() { if (xmlDebugFlag) { nXMLExceptions++; printf("XMLException::XMLException()\n"); printf("nXMLExceptions=%li\n", nXMLExceptions); } code=UNKNOWN_ERR; } // ************************************************************************** XMLException::XMLException( const unsigned short& error) { if (xmlDebugFlag) { nXMLExceptions++; printf("XMLException::XMLException(unsigned short error)\n"); printf("nXMLExceptions=%li\n", nXMLExceptions); } code=error; } // ************************************************************************** XMLException::~XMLException() { if (xmlDebugFlag) { nXMLExceptions--; printf("XMLException::~XMLException()\n"); printf("nXMLExceptions=%li\n", nXMLExceptions); } } // ************************************************************************** const char* XMLException::getError() const { switch (code) { case UNKNOWN_ENCODING_ERR : return "XMLException::UNKNOWN_ENCODING_ERR\n"; break; case UNEXPECTED_EOF_ERR : return "XMLException::UNEXPECTED_EOF_ERR\n"; break; case RANGE_ERR : return "XMLException::RANGE_ERR\n"; break; case INVALID_CHAR_ERR : return "XMLException::INVALID_CHAR_ERR\n"; break; default : return "XMLException::UNKNOWN_ERR\n"; } } // ************************************************************************** // ************************************************************************** // XMLChar // ************************************************************************** // ************************************************************************** // ********************************************************************** bool XMLChar::isChar( const char& ch) { if (ch>=0x0020) { return 1; } if (isWhiteSpace(ch)) { return 1; } return 0; } // ********************************************************************** bool XMLChar::isCharData( const char& ch) { if ((ch=='<')|(ch=='&')) { return 0; } return isChar(ch); } // ********************************************************************** bool XMLChar::isWhiteSpace( const char& ch) { return ((ch==0x20)|(ch==0x09)|(ch==0x0D)|(ch==0x0A)); } // ********************************************************************** bool XMLChar::isLatinLetter( const char& ch) { return (((ch>='A')&(ch<='Z'))|((ch>='a')&(ch<='z'))); } // ********************************************************************** bool XMLChar::isLatinDigit( const char& ch) { return ((ch>='0')&(ch<='9')); } // ********************************************************************** bool XMLChar::isLatinHexDigit( const char& ch) { return (((ch>='0')&(ch<='9')) |((ch>='A')&(ch<='F')) |((ch>='a')&(ch<='f'))); } // ********************************************************************** bool XMLChar::isLetter( const char& ch) { return isBaseChar(ch); } // ********************************************************************** bool XMLChar::isBaseChar( const char& ch) { return isLatinLetter(ch); } // ********************************************************************** bool XMLChar::isDigit( const char& ch) { return isLatinDigit(ch); } // ********************************************************************** bool XMLChar::isNameChar( const char& ch) { if (isNCNameChar(ch)) { return 1; } if (ch==':') { return 1; } return 0; } // ********************************************************************** bool XMLChar::isNCNameChar( const char& ch) { if (isLetter(ch)) { return 1; } if (isDigit(ch)) { return 1; } if ((ch=='.')|(ch=='-')|(ch=='_')) { return 1; } return 0; } // ********************************************************************** bool XMLChar::isPubidChar( const char& ch) { if (isLatinLetter(ch)) { return 1; } if (isLatinDigit(ch)) { return 1; } if ((ch==0x20)|(ch==0x0D)|(ch==0x0A)) { return 1; } if ((ch=='-')|(ch==0x27)|(ch=='(')) { return 1; } if ((ch==')')|(ch=='+')|(ch==',')) { return 1; } if ((ch=='.')|(ch=='/')|(ch==':')) { return 1; } if ((ch=='=')|(ch=='?')|(ch==';')) { return 1; } if ((ch=='!')|(ch=='*')|(ch=='#')) { return 1; } if ((ch=='@')|(ch=='$')|(ch=='_')|(ch=='%')) { return 1; } return 0; } // ************************************************************************** // ************************************************************************** // XMLString // ************************************************************************** // ************************************************************************** long nXMLStrings=0; //!< The number of XML strings // ************************************************************************** // XMLString default constructor XMLString::XMLString() { if (xmlDebugFlag) { nXMLStrings++; printf("XMLString::XMLString()\n"); printf("nXMLStrings=%li\n", nXMLStrings); } _length=0; _c_str_valid=0; } // ********************************************************************** // XMLString construction from C-style string XMLString::XMLString( const char* s) { if (xmlDebugFlag) { nXMLStrings++; printf("XMLString::XMLString(const char* s) = %s\n", s); printf("nXMLStrings=%li\n", nXMLStrings); } _length=0; while (s[_length]) { _length++; } _data = new char[_length]; for (unsigned long i=0; i<_length; i++) { _data[i] = s[i]; } _c_str_valid=0; } // ********************************************************************** // XMLString construction from another XMLString XMLString::XMLString( const XMLString& s) { if (xmlDebugFlag) { nXMLStrings++; printf("XMLString::XMLString(const XMLString& s) = %s\n", s.c_str()); printf("nXMLStrings=%li\n", nXMLStrings); } _length=s._length; _data = new char[_length]; for (unsigned long i=0; i<_length; i++) { _data[i] = s._data[i]; } _c_str_valid=0; } // ********************************************************************** // XMLString default destructor XMLString::~XMLString() { if (xmlDebugFlag) { nXMLStrings--; printf("XMLString::~XMLString()\n"); printf("nXMLStrings=%li\n", nXMLStrings); } if (_length) { delete _data; } if (_c_str_valid) { delete _c_str; } } // ********************************************************************** XMLString& XMLString::operator=( const XMLString& s) { if (this != &s) { // so as to never copy itself! if (_length) { delete _data; } if (_c_str_valid) { delete _c_str; } _length=s.length(); _data = new char[_length]; for (unsigned long i=0; i<_length; i++) { _data[i] = s._data[i]; } _c_str_valid=0; } return *this; } // ********************************************************************** XMLString& XMLString::operator=( const char* s) { if (_length) { delete _data; } if (_c_str_valid) { delete _c_str; } _length=0; while (!(s[_length]==0)) { _length++; } _data = new char[_length+1]; for (unsigned long i=0; i<=_length; i++){ _data[i] = s[i]; } _c_str_valid=0; return *this; } // ********************************************************************** unsigned long XMLString::length() const { return _length; } // ********************************************************************** const char* XMLString::c_str() const { if (!_c_str_valid) { _c_str = new char[_length+1]; for (unsigned long i=0; i<_length; i++) { _c_str[i]=(char) _data[i]; } _c_str[_length]=0; _c_str_valid=1; } return _c_str; } // ********************************************************************** char XMLString::data( const unsigned long& index) const { if (index>=_length) { throw XMLException(XMLException::RANGE_ERR); } return _data[index]; } // ********************************************************************** bool XMLString::operator==( const XMLString& s) const { if (&s==this) { return 1; } if (s.length()!=_length){ return 0; } bool result=1; for (unsigned long i=0; i<_length; i++) { result = result&(s._data[i]==_data[i]); } return result; } // ********************************************************************** bool XMLString::operator!=( const XMLString& s) const { return !((*this)==s); } // ********************************************************************** XMLString& XMLString::operator+=( const XMLString& s) { unsigned long newLength = _length + s._length; char* newData = new char[newLength]; unsigned long i; for (i = 0; i < _length; i++) { newData[i] = _data[i]; } for (i = _length; i < newLength; i++) { newData[i] = s._data[i-_length]; } if (_length) { delete _data; } _data = newData; _length = newLength; if (_c_str_valid) { delete _c_str; } _c_str_valid = 0; return *this; } // ********************************************************************** long XMLString::loadFromFile( FILE* infile) { if (_length) { delete _data; } if (_c_str_valid) { delete _c_str; } fseek(infile, 0, SEEK_END); _length = ftell(infile); fseek(infile, 0, SEEK_SET); _data = new char[_length]; for (unsigned long i=0; i<_length; i++) { _data[i] = fgetc(infile); } _c_str_valid=0; return _length; } // ********************************************************************** void XMLString::insertString( const unsigned long& offset, const XMLString& s) { if (offset > _length) { return; } unsigned long newLength = _length + s._length; char* newData = new char[newLength]; unsigned long i; for (i = 0; i < offset; i++) { newData[i] = _data[i]; } for (i = 0; i < s._length; i++) { newData[offset + i] = s._data[i]; } for (i = offset; i < _length; i++) { newData[offset + s._length + i] = _data[i]; } if (_length) { delete _data; } _data = newData; _length = newLength; if (_c_str_valid) { delete _c_str; } _c_str_valid = 0; } // ********************************************************************** void XMLString::deleteData( const unsigned long& offset, const unsigned long& count) { unsigned long i = offset + count; while (i < _length) { _data[i - count] = _data[i]; } if (offset + count > _length) { _length = offset; } else { _length -= count; } if (_c_str_valid) { delete _c_str; } _c_str_valid = 0; } // ********************************************************************** void XMLString::replaceData( const unsigned long& offset, unsigned long count, const XMLString& s) { if (offset > _length) { *this += s; } if (offset + count > _length) { count = _length - offset; } unsigned long newLength = _length + s._length - count; char* newData = new char[newLength]; unsigned long i; for (i = 0; i < offset; i++) { newData[i] = _data[i]; } for (i = offset; i < offset+s._length; i++) { newData[i] = s._data[i-offset]; } for (i = offset+s._length; i < newLength; i++) { newData[i] = _data[i-s._length+count]; } if (_length) { delete _data; } _data = newData; _length = newLength; if (_c_str_valid) { delete _c_str; } _c_str_valid = 0; } // ********************************************************************** void XMLString::subString( XMLString& subS, const unsigned long& begin, const unsigned long& end_plus_one) const { if (end_plus_one>_length) { throw XMLException(XMLException::RANGE_ERR); } if (end_plus_one<=begin) { subS=""; return; } if (subS._length) { delete subS._data; } if (subS._c_str_valid) { delete subS._c_str; } subS._c_str_valid=0; subS._data = new char[end_plus_one-begin]; for (unsigned long i=begin; i #define STDIO #endif // *************************************************************************** // *************************************************************************** // XMLException // *************************************************************************** // *************************************************************************** //! XMLException class class XMLException { public : //! Enumerator containing the exception error codes enum { UNKNOWN_ENCODING_ERR = 1, UNEXPECTED_EOF_ERR = 2, RANGE_ERR = 3, INVALID_CHAR_ERR = 4, UNKNOWN_ERR = 0 }; //! The error code? Possibly? unsigned short code; //! Constructor of an XMLException object XMLException(); //! Constructor of an XMLException object XMLException( const unsigned short& error); //! Destructor ~XMLException(); //! Gets an xml error const char* getError() const; }; // *************************************************************************** // *************************************************************************** // XMLChar // *************************************************************************** // *************************************************************************** //! Namespace for an xml character namespace XMLChar { //! Determines if character is a character bool isChar( const char& ch); //! Determines if character is character data bool isCharData( const char& ch); //! Determines if character is whitespace bool isWhiteSpace( const char& ch); //! Determines if character is a latin letter bool isLatinLetter( const char& ch); //! Determines if character is a latin digit bool isLatinDigit( const char& ch); //! Determines if character is a latin hex digit bool isLatinHexDigit( const char& ch); //! Determines if character is a letter bool isLetter( const char& ch); //! Determines if character is a base character bool isBaseChar( const char& ch); //! Determines if character is a digit bool isDigit( const char& ch); //! Determines if character is a name character bool isNameChar( const char& ch); //! Determines if character is a NC name character bool isNCNameChar( const char& ch); //! Determines if character is a public id character bool isPubidChar( const char& ch); } // *************************************************************************** // *************************************************************************** // XMLString // *************************************************************************** // *************************************************************************** //! XMLString class class XMLString { private : char* _data; //!< Internal variable for data unsigned long _length; //!< Internal variable for length of an XML string mutable char* _c_str; //!< Internal variable for a C string mutable bool _c_str_valid; //!< Internal variable showing if a C string is valid public: //! Constructor of an XMLString object XMLString(); //! Constructor of an XMLString object XMLString( const char* s); //! Constructor of an XMLString object XMLString( const XMLString& s); //! Destructor ~XMLString(); //! Assignment operator for XMLString object XMLString& operator=( const XMLString& s); //! Assignment operator for XMLString object XMLString& operator=( const char* s); //! Returns the length of an XMLString unsigned long length() const; //! Converts an XMLString to a C string const char* c_str() const; //! Returns data at index (buh?) char data( const unsigned long& index) const; //! Equality operator bool operator==( const XMLString& s) const; //! Inequality operator bool operator!=( const XMLString& s) const; //! += operator XMLString& operator+=( const XMLString& s); //! Loads an xml string from file infile long loadFromFile( FILE* infile); //! Returns a substring of an XML string starting at begin and ending at end_plus_one void subString( XMLString& subS, const unsigned long& begin, const unsigned long& end_plus_one) const; //! Inserts string at offset void insertString( const unsigned long& offset, const XMLString& s); //! Deletes count data (characters?) starting at offset void deleteData( const unsigned long& offset, const unsigned long& count); //! Replaces count data (characters?) starting at offset void replaceData( const unsigned long& offset, unsigned long count, const XMLString& s); //! Determines if string has illegal characters bool hasIllegalCharacters() const; //! Determines if starts with xml bool beginsWithxml() const; //! Determins if starts with XxMmLl (what is this supposed to mean?) bool beginsWithXxMmLl() const; //! Determines if is xml (I think) bool eqxml() const; //! Determines if is xml namespace (I think) bool eqxmlns() const; //! Determines if is a name bool isName() const; //! Determines if is a NC name bool isNCName() const; //! Determines if namespace is well formed bool isNSWellFormed() const; //! Determines if is a version number bool isVersionNum() const; //! Determines if is an encoding name bool isEncName() const; //! Determines if is a public id literal bool isPubidLiteral() const; //! Determines if is a split namespace name bool splitNSName( XMLString& prefix, XMLString& localPart) const; //! Determines if is a qualified name bool isQualifiedName(); //! Determines if is all whitespace bool isAllWhiteSpace() const; //! Determines if is as unsigned long bool asULong( unsigned long& outULong) const; //! Determines if is as double bool asDouble( double& outDouble) const; //! Changes to Latin alphanumeric (I think) void goLatinAlphaNumeric(); //! Changes to Latin alphanumeric with '_' replaced with '0' (for Mathematica) void goLatinAlphaNumericNoUnderScore(); }; /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xml_parser.cc0000644000076500000240000041766511033277417013431 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xml_parser.cc 1885 2008-03-18 15:24:56Z paultcochrane $ */ /*! @file xml_parser.cc @brief XML parser classes and methods More detailed explanation... */ #include #include #include #include #include #define DEBUGXMLPARSER 0 //!< Whether or not to debug the XML parser #define DEBUGXMLENTITYSTREAMS 0 //!< Whether or not to debug the entity streams // ************************************************************************** // ************************************************************************** // XMLParserException // ************************************************************************** // ************************************************************************** long nXMLParserExceptions=0; //!< The number of XML parser exceptions // ************************************************************************** XMLParserException::XMLParserException() : theError(UNKNOWN_ERR), theXMLEntityStreamStack(0), theErrorMessage("") { if (DEBUGXMLPARSER) { nXMLParserExceptions++; printf("XMLParserException::XMLParserException\n"); printf("nXMLParserExceptions=%li\n", nXMLParserExceptions); } } // ************************************************************************** XMLParserException::XMLParserException( const list *const yourXMLEntityStreamStack, const char *const yourErrorMessage, const unsigned short& yourError) : theError(yourError), theXMLEntityStreamStack(yourXMLEntityStreamStack), theErrorMessage(yourErrorMessage) { if (DEBUGXMLPARSER) { nXMLParserExceptions++; printf("XMLParserException::XMLParserException\n"); printf("nXMLParserExceptions=%li\n", nXMLParserExceptions); } } // ************************************************************************** XMLParserException::~XMLParserException() { if (DEBUGXMLPARSER) { nXMLParserExceptions--; printf("XMLParserException::~XMLParserException\n"); printf("nXMLParserExceptions=%li\n", nXMLParserExceptions); } } // ************************************************************************** const char* XMLParserException::getError() { const char* errorName; switch (theError) { case BAD_XML_ERR: errorName="XMLParserException::BAD_XML_ERR\n"; break; case ENCODING_NOT_SUPPORTED_ERR: errorName="XMLParserException::ENCODING_NOT_SUPPORTED_ERR\n"; break; case INVALID_FILE_ERR : errorName="XMLParserException::INVALID_FILE_ERR\n"; break; case INTERNAL_ERR: errorName="XMLParserException::INTERNAL_ERR\n"; break; default : errorName="XMLParserException::UNKNOWN_ERR\n"; } if (theXMLEntityStreamStack != 0) { s[0]=0; if (theXMLEntityStreamStack->size()==0) { return errorName; } char s2[256]; list::const_iterator ppXMLEntityStream = theXMLEntityStreamStack->begin(); sprintf(s2, "%sIn stream '%s', line %li, column %li, ", errorName, (*ppXMLEntityStream)->name()->c_str(), (*ppXMLEntityStream)->streamPos.lineNumber, (*ppXMLEntityStream)->streamPos.columnNumber); strcat(s, s2); ppXMLEntityStream++; while (ppXMLEntityStream!=theXMLEntityStreamStack->end()) { sprintf(s2, "\n which was referenced from stream '%s', line %li, column %li, ", (*ppXMLEntityStream)->name()->c_str(), (*ppXMLEntityStream)->streamPos.lineNumber, (*ppXMLEntityStream)->streamPos.columnNumber); strcat(s, s2); ppXMLEntityStream++; } sprintf(s2, "\nthe following error occurred:\n %s\n", theErrorMessage); strcat(s, s2); return s; } else return errorName; } // ************************************************************************** // ************************************************************************** // XMLEntityStream // ************************************************************************** // ************************************************************************** long nXMLEntityStreams=0; //!< The number of XML entity streams // ************************************************************************** XMLEntityStream::XMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourSystemID): myXMLParser(yourXMLParser), myName(yourName), myParentXMLEntityStream(yourParentXMLEntityStream), mySystemID(yourSystemID) { if (DEBUGXMLENTITYSTREAMS) { nXMLEntityStreams++; printf("%s, XMLEntityStream::XMLEntityStream\n", myName.c_str()); printf(" nXMLEntityStreams=%li\n", nXMLEntityStreams); } streamPos.count=0; streamPos.lineNumber=1; streamPos.columnNumber=1; errormessage[0]=0; myTextStringValid=0; } // ************************************************************************** XMLEntityStream::~XMLEntityStream() { if (DEBUGXMLENTITYSTREAMS) { nXMLEntityStreams--; printf("%s, XMLEntityStream::~XMLEntityStream\n", myName.c_str()); printf(" nXMLEntityStreams=%li\n", nXMLEntityStreams); } list::iterator ppXMLEntityStream = myXMLEntityStreamList.begin(); while (ppXMLEntityStream != myXMLEntityStreamList.end()) { delete *ppXMLEntityStream; ppXMLEntityStream++; } } // ************************************************************************** const XMLString* XMLEntityStream::name() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::name\n", myName.c_str()); } return &myName; } // ************************************************************************** XMLEntityStream* XMLEntityStream::parentXMLEntityStream() { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::parentXMLEntityStream\n", myName.c_str()); } return myParentXMLEntityStream; } // ************************************************************************** bool XMLEntityStream::atEnd() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::atEnd\n", myName.c_str()); } return streamPos.count >= myTextString.length(); } // ************************************************************************** //char XMLEntityStream::nextChar() { signed char XMLEntityStream::nextChar() { if (!myTextStringValid) { makeTextString(); } if (streamPos.count>=myTextString.length()) { return EOF; } else { char c=myTextString.data(streamPos.count); streamPos.columnNumber++; if (c==0x0A) { streamPos.lineNumber++; streamPos.columnNumber=1; } streamPos.count++; if (DEBUGXMLENTITYSTREAMS) { printf("%s:%li, %c\n", myName.c_str(), streamPos.count, c); } return c; } } // ************************************************************************** XMLEntityStream* XMLEntityStream::addParameterXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::addParameterXMLEntityStream\n", myName.c_str()); } XMLEntityStream* newXMLEntityStream = new ParameterXMLEntityStream(myXMLParser, this, name, PublicID, SystemID); myXMLEntityStreamList.push_front(newXMLEntityStream); return newXMLEntityStream; } // ************************************************************************** XMLEntityStream* XMLEntityStream::addParameterXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::addParameterXMLEntityStream\n", myName.c_str()); } XMLEntityStream* newXMLEntityStream = new ParameterXMLEntityStream(myXMLParser, this, name, EntityLiteral); myXMLEntityStreamList.push_front(newXMLEntityStream); return newXMLEntityStream; } // ************************************************************************** XMLEntityStream* XMLEntityStream::addGeneralXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::addGeneralXMLEntityStream\n", myName.c_str()); } XMLEntityStream* newXMLEntityStream = new GeneralXMLEntityStream(myXMLParser, this, name, PublicID, SystemID); myXMLEntityStreamList.push_front(newXMLEntityStream); return newXMLEntityStream; } // ************************************************************************** XMLEntityStream* XMLEntityStream::addGeneralXMLEntityStream( const XMLString& name, const XMLString& EntityLieteral) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStrea m::addGeneralXMLEntityStream\n", myName.c_str()); } XMLEntityStream* newXMLEntityStream = new GeneralXMLEntityStream(myXMLParser, this, name, EntityLieteral); myXMLEntityStreamList.push_front(newXMLEntityStream); return newXMLEntityStream; } // ************************************************************************** XMLEntityStream* XMLEntityStream::addUnparsedXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID, const XMLString& NotationName) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::addUnparsedXMLEntityStream\n", myName.c_str()); } XMLEntityStream* newXMLEntityStream = new UnparsedXMLEntityStream(myXMLParser, this, name, PublicID, SystemID, NotationName); myXMLEntityStreamList.push_front(newXMLEntityStream); return newXMLEntityStream; } // ************************************************************************** XMLEntityStream* XMLEntityStream::getXMLEntityStream( const XMLString& getName, const XMLEntityStreamType& ofEntityType) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::getXMLEntityStream\n", myName.c_str()); } XMLEntityStream* testXMLEntityStream; XMLEntityStream* nextXMLEntityStream; list::const_iterator ppXMLEntityStream; // first try locally testXMLEntityStream=0; ppXMLEntityStream = myXMLEntityStreamList.begin(); while ((testXMLEntityStream==0)&(ppXMLEntityStream != myXMLEntityStreamList.end())) { if ((*(*ppXMLEntityStream)->name()==getName) & ((*ppXMLEntityStream)->entityType()==ofEntityType)) { testXMLEntityStream = *ppXMLEntityStream; } ppXMLEntityStream++; } if (testXMLEntityStream==0) { // now try the more general search tree downwards routine starting with // the immediate parent and working our way up the ancestral line each time // it fails, until it gets to Adam. if (myParentXMLEntityStream==0) { // I am the root element. Go straight to getXMLEntityStreamTreeWalkDown testXMLEntityStream = getXMLEntityStreamTreeWalkDown(getName, ofEntityType); } else { nextXMLEntityStream=myParentXMLEntityStream; while ((testXMLEntityStream==0)&(nextXMLEntityStream!=0)) { testXMLEntityStream = nextXMLEntityStream->getXMLEntityStreamTreeWalkDown(getName, ofEntityType); nextXMLEntityStream = nextXMLEntityStream->parentXMLEntityStream(); } } } if (testXMLEntityStream!=0) { for (list::const_iterator ppXMLEntityStream = myXMLParser->XMLEntityStreamStack.begin() ; ppXMLEntityStream != myXMLParser->XMLEntityStreamStack.end(); ppXMLEntityStream++) { if (testXMLEntityStream==*ppXMLEntityStream) { sprintf(errormessage, "Circular reference to parameter entity '%s'", getName.c_str()); throw XMLParserException(&myXMLParser->XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } } testXMLEntityStream->streamPos.count=0; testXMLEntityStream->streamPos.columnNumber=1; testXMLEntityStream->streamPos.lineNumber=1; } return testXMLEntityStream; } // ************************************************************************** void XMLEntityStream::printStreamTree( unsigned long level) const { for (unsigned long i=0; i::const_iterator ppXMLEntityStream = myXMLEntityStreamList.begin(); while (ppXMLEntityStream != myXMLEntityStreamList.end()) { (*ppXMLEntityStream)->printStreamTree(level+1); ppXMLEntityStream++; } } // ************************************************************************** XMLEntityStream* XMLEntityStream::getXMLEntityStreamTreeWalkDown( const XMLString& name, const XMLEntityStreamType& ofEntityType) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::getXMLEntityStreamTreeWalkDown\n", myName.c_str()); } if ((myName==name)&(entityType()==ofEntityType)) { return this; } XMLEntityStream* testXMLEntityStream=0; list::const_iterator ppXMLEntityStream = myXMLEntityStreamList.begin(); while ((testXMLEntityStream==0)&(ppXMLEntityStream != myXMLEntityStreamList.end())) { testXMLEntityStream = (*ppXMLEntityStream)->getXMLEntityStreamTreeWalkDown(name, ofEntityType); ppXMLEntityStream++; } return testXMLEntityStream; } // ************************************************************************** void XMLEntityStream::loadExternalTextString() { if (DEBUGXMLENTITYSTREAMS) { printf("%s, XMLEntityStream::loadExternalTextString\n", myName.c_str()); } // check that file exists FILE *infile = fopen(mySystemID.c_str(), "r"); if (infile==0) { sprintf(errormessage, "Cannot open '%s' for reading", mySystemID.c_str()); throw XMLParserException(&myXMLParser->XMLEntityStreamStack, errormessage, XMLParserException::INVALID_FILE_ERR); } // load file into myTextString; myTextString.loadFromFile(infile); fclose(infile); } // ************************************************************************** // ************************************************************************** // RootXMLEntityStream // ************************************************************************** // ************************************************************************** // ************************************************************************** RootXMLEntityStream::RootXMLEntityStream( XMLParser *const yourXMLParser, const XMLString& yourSystemID): XMLEntityStream(yourXMLParser, 0, "document_entity", yourSystemID) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, RootXMLEntityStream::RootXMLEntityStream\n", myName.c_str()); } } // ************************************************************************** XMLEntityStream::XMLEntityStreamType RootXMLEntityStream::entityType() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, RootXMLEntityStream::entityType\n", myName.c_str()); } return ROOT_ENTITY; } // ************************************************************************** XMLEntityStream::XMLEntityLocationType RootXMLEntityStream::entityLocation() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, RootXMLEntityStream::entityLocation\n", myName.c_str()); } return INTERNAL_ENTITY; } // ************************************************************************** const XMLString* RootXMLEntityStream::replacementText() { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "RootXMLEntityStream::replacementText() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** void RootXMLEntityStream::makeTextString() { if (DEBUGXMLENTITYSTREAMS) { printf("%s, RootXMLEntityStream::makeTextString\n", myName.c_str()); } loadExternalTextString(); myTextStringValid=1; } // ************************************************************************** // ************************************************************************** // GPXMLEntityStream // ************************************************************************** // ************************************************************************** // ************************************************************************** // constructor for an internal entity GPXMLEntityStream::GPXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourEntityLiteral): XMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, ""), myPublicID(""), myEntityLiteral(yourEntityLiteral), myEntityLocation(INTERNAL_ENTITY) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GPXMLEntityStream::GPXMLEntityStream - internal\n", myName.c_str()); } } // ************************************************************************** // constructor for an external entity GPXMLEntityStream::GPXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID): XMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, yourSystemID), myPublicID(yourPublicID), myEntityLiteral(""), myEntityLocation(EXTERNAL_ENTITY) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GPXMLEntityStream::GPXMLEntityStream - external\n", myName.c_str()); } } // ************************************************************************** XMLEntityStream::XMLEntityLocationType GPXMLEntityStream::entityLocation() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GPXMLEntityStream::entityLocation\n", myName.c_str()); } return myEntityLocation; } // ************************************************************************** const XMLString* GPXMLEntityStream::replacementText() { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GPXMLEntityStream::replacementText\n", myName.c_str()); } if (!myTextStringValid) { makeTextString(); } return &myTextString; } // ************************************************************************** void GPXMLEntityStream::makeTextString() { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GPXMLEntityStream::makeTextString\n", myName.c_str()); } myTextStringValid=1; if (myEntityLocation==EXTERNAL_ENTITY) { loadExternalTextString(); // parse for TextDecl XMLString VersionNum; XMLString EncName; myXMLParser->matchProduction77TextDecl(this, VersionNum, EncName); // now remove TextDecl from myTextString myTextString.replaceData(0, streamPos.count, ""); streamPos.count=0; return; } // if here, we must be an internal entity, in which case we ought to // be preparsed for character and parameter entity refs myTextString=myEntityLiteral; //char c; signed char c; unsigned long refLength; XMLString refName; XMLEntityStream* refXMLEntityStream; StreamPositionStruct lastPos; lastPos=streamPos; c=nextChar(); while (c!=EOF) { if (c=='&') { streamPos=lastPos; refLength=myXMLParser->matchProduction66CharRef(this, c); streamPos=lastPos; if (refLength>0) { const char s[2]={c, 0}; myTextString.replaceData(streamPos.count, refLength, s); streamPos.columnNumber += refLength; streamPos.count++; } lastPos=streamPos; c=nextChar(); } if (c=='%') { // might be the % in an declaration // therefore check next character, and proceed only if not a WhiteSpace c=nextChar(); if (!XMLChar::isWhiteSpace(c)) { streamPos=lastPos; refLength=myXMLParser->matchProduction69PEReference(this, refName); streamPos=lastPos; refXMLEntityStream = getXMLEntityStream(refName, XMLEntityStream::PARAMETER_ENTITY); if (refXMLEntityStream==0) { sprintf(errormessage, "Parameter entity '%s' unknown", refName.c_str()); throw XMLParserException(&myXMLParser->XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } myXMLParser->XMLEntityStreamStack.push_front(refXMLEntityStream); myTextString.replaceData(streamPos.count, refLength, *refXMLEntityStream->replacementText()); myXMLParser->XMLEntityStreamStack.pop_front(); } } lastPos=streamPos; c=nextChar(); } streamPos.count=0; streamPos.lineNumber=1; streamPos.columnNumber=1; if (DEBUGXMLENTITYSTREAMS) { printf("myTextString=%s\n", myTextString.c_str()); } } // ************************************************************************** // ************************************************************************** // ParameterXMLEntityStream // ************************************************************************** // ************************************************************************** // ************************************************************************** // constructor for an internal entity ParameterXMLEntityStream::ParameterXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourEntityLiteral): GPXMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, yourEntityLiteral) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, ParameterXMLEntityStream::ParameterXMLEntityStream - internal\n", myName.c_str()); } } // ************************************************************************** // constructor for an external entity ParameterXMLEntityStream::ParameterXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID): GPXMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, yourPublicID, yourSystemID) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, ParameterXMLEntityStream::ParameterXMLEntityStream - external\n", myName.c_str()); } } // ************************************************************************** XMLEntityStream::XMLEntityStreamType ParameterXMLEntityStream::entityType() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, ParameterXMLEntityStream::entityType\n", myName.c_str()); } return PARAMETER_ENTITY; } // ************************************************************************** // ************************************************************************** // GeneralXMLEntityStream // ************************************************************************** // ************************************************************************** // ************************************************************************** // constructor for an internal entity GeneralXMLEntityStream::GeneralXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourEntityLiteral): GPXMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, yourEntityLiteral) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GeneralXMLEntityStream::GeneralXMLEntityStream - internal\n", myName.c_str()); } } // ************************************************************************** // constructor for an external entity GeneralXMLEntityStream::GeneralXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID): GPXMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, yourPublicID, yourSystemID) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GeneralXMLEntityStream::GeneralXMLEntityStream - external\n", myName.c_str()); } } // ************************************************************************** XMLEntityStream::XMLEntityStreamType GeneralXMLEntityStream::entityType() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, GeneralXMLEntityStream::entityType\n", myName.c_str()); } return GENERAL_ENTITY; } // ************************************************************************** // ************************************************************************** // UnparsedXMLEntityStream // ************************************************************************** // ************************************************************************** // ************************************************************************** UnparsedXMLEntityStream::UnparsedXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID, const XMLString& yourNotationName): XMLEntityStream(yourXMLParser, yourParentXMLEntityStream, yourName, yourSystemID), myPublicID(yourPublicID), myNotationName(yourNotationName) { if (DEBUGXMLENTITYSTREAMS) { printf("%s, UnparsedXMLEntityStream::UnparsedXMLEntityStream\n", myName.c_str()); } } // ************************************************************************** XMLEntityStream::XMLEntityStreamType UnparsedXMLEntityStream::entityType() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, UnparsedXMLEntityStream::entityType\n", myName.c_str()); } return UNPARSED_ENTITY; } // ************************************************************************** XMLEntityStream::XMLEntityLocationType UnparsedXMLEntityStream::entityLocation() const { if (DEBUGXMLENTITYSTREAMS) { printf("%s, UnparsedXMLEntityStream::entityLocation\n", myName.c_str()); } return EXTERNAL_ENTITY; } // ************************************************************************** const XMLString* UnparsedXMLEntityStream::replacementText() { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::replacementText() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** bool UnparsedXMLEntityStream::atEnd() const { return 1; } // ************************************************************************** XMLEntityStream* UnparsedXMLEntityStream::addParameterXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID) { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::addParameterXMLEntityStream() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** XMLEntityStream* UnparsedXMLEntityStream::addParameterXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral) { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::addParameterXMLEntityStream() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** XMLEntityStream* UnparsedXMLEntityStream::addGeneralXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral) { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::addGeneralXMLEntityStream() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** XMLEntityStream* UnparsedXMLEntityStream::addGeneralXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID, const XMLString& NotationName) { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::addGeneralXMLEntityStream() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** XMLEntityStream* UnparsedXMLEntityStream::addUnparsedXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID, const XMLString& NotationName) { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::addUnparsedXMLEntityStream() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** XMLEntityStream* UnparsedXMLEntityStream::getXMLEntityStream( const XMLString& getName, const XMLEntityStreamType& ofEntityType) { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::getXMLEntityStream() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** void UnparsedXMLEntityStream::makeTextString() { throw XMLParserException(&myXMLParser->XMLEntityStreamStack, "UnparsedXMLEntityStream::makeTextString() called!", XMLParserException::INTERNAL_ERR); } // ************************************************************************** // ************************************************************************** // XMLParser // ************************************************************************** // ************************************************************************** // ************************************************************************** XMLParser::XMLParser() { if (DEBUGXMLPARSER) { printf("XMLParser::XMLParser()\n"); } myxmdsBytePoint=0; } // ************************************************************************** XMLParser::~XMLParser() { if (DEBUGXMLPARSER) { printf("XMLParser::~XMLParser()\n"); } if (rootXMLEntityStream != 0) { delete rootXMLEntityStream; } if (DEBUGXMLPARSER) { printf(" ...XMLParser deleted\n"); } } // ************************************************************************** Document* XMLParser::parseFromFile( const char* fileName) { if (DEBUGXMLPARSER) { printf("XMLParser::parseFromFile\n"); } XMLEntityStreamStack.clear(); rootXMLEntityStream = new RootXMLEntityStream(this, fileName); XMLEntityStreamStack.push_front(rootXMLEntityStream); // add default expansions for the general entities // < > & ' and " rootXMLEntityStream->addGeneralXMLEntityStream("lt", "&#60;"); rootXMLEntityStream->addGeneralXMLEntityStream("gt", "&#62;"); rootXMLEntityStream->addGeneralXMLEntityStream("amp", "&#38;"); rootXMLEntityStream->addGeneralXMLEntityStream("apos", "&#39;"); rootXMLEntityStream->addGeneralXMLEntityStream("quot", "&#34;"); (*XMLEntityStreamStack.begin())=rootXMLEntityStream; theDocumentType=0; theDocument=0; rootVersionNum="1.0"; rootEncName=""; StandAlone=0; try { matchProduction01Document(); } catch(XMLException XMLErr) { printf("Could not load Document\n"); printf("due to the following XMLException:\n"); printf("%s", XMLErr.getError()); } catch(DOMException DOMErr) { printf("Could not load Document\n"); printf("due to the following DOMException:\n"); printf("%s", DOMErr.getError()); } if (DEBUGXMLPARSER) { myDOMImplementation.printAll(); } return (theDocument); } // ************************************************************************** unsigned long XMLParser::xmdsBytePoint() const { if (DEBUGXMLPARSER) { printf("XMLParser::xmdsBytePoint\n"); } return myxmdsBytePoint; } /* The folowwing routines are designed to parse the productions laid out in XML 1.0 (second edition). These productions fall into three categories: 1. Required. An error at any stage of parsing a required production will generate the XMLParserException BAD_XML_ERR. These routines are declared with the return type void. 2. Optional. An error at the early stages of parsing will not be reported and the routine will back out and return 0. If the parsing passes a 'critical point' (the point at which the intended production is uniquely specified) the routine will generate the XMLParserException BAD_XML_ERR so that the user may know where they are going wrong. These routines are declared as type bool so that the calling routine knows whether or not the attempted parse was successful. 3. Either of the above, in which case the routine is passed a bool parameter 'required' so that it knows which behaviour is expected. The definition of where the 'critical point' should go is not easy, as many productons are comprised of ORed subproductions, and yet it would be nice to be able to feed reasonable error messages to the user if they have made a reconisable attempt at a particular production. Therefore many productions test for their subproductions in a particular order, with the last one to be tested having a very early critical point, and yeilding error messages that encompass all the other subproductions. */ // ************************************************************************** void XMLParser::matchProduction01Document() { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction01Document\n"); } matchProduction22Prolog(); if (!matchProduction39Element(0)) { // no root element throw XMLParserException(&XMLEntityStreamStack, "Root element expected.", XMLParserException::BAD_XML_ERR); } while (matchProduction27Misc(0)); // what is this supposed to do?? PTC //char c = (*XMLEntityStreamStack.begin())->nextChar(); signed char c = (*XMLEntityStreamStack.begin())->nextChar(); if (c!=EOF) { // what is this extra stuff? throw XMLParserException(&XMLEntityStreamStack, "End of file expected.", XMLParserException::BAD_XML_ERR); } } // ************************************************************************** long XMLParser::matchProduction03S( XMLEntityStream *const thisStream, const bool required) const { // this production is sometimes required and sometimes optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction03S\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; long length=0; //char c=thisStream->nextChar(); signed char c=thisStream->nextChar(); while (XMLChar::isWhiteSpace(c)&(c!=EOF)) { lastStreamPos = thisStream->streamPos; length++; c=thisStream->nextChar(); } if (!XMLChar::isWhiteSpace(c)) { thisStream->streamPos = lastStreamPos; } if ((length==0)&required) { throw XMLParserException(&XMLEntityStreamStack, "White space expected.", XMLParserException::BAD_XML_ERR); } return length; } // ************************************************************************** long XMLParser::matchProduction03SDeep( const bool required) { // this production is like the normal whitespace production, // except that it also descends and climbs PE streams, since // allowable white space forms logical boundaries between atoms of a DTD if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction03SDeep\n"); } if (XMLEntityStreamStack.size()==1) { return matchProduction03S((*XMLEntityStreamStack.begin()), required); } StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; XMLEntityStream* nextXMLEntityStream; long length=0; //char c=(*XMLEntityStreamStack.begin())->nextChar(); signed char c=(*XMLEntityStreamStack.begin())->nextChar(); while (XMLChar::isWhiteSpace(c)|(c=='%')|(c==EOF)) { if (c==EOF) { if (XMLEntityStreamStack.size()==1) { throw XMLParserException(&XMLEntityStreamStack, "Unexpected end of file", XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.pop_front(); } else if (c=='%') { // might yet be the % in an declaration // therefore check next character, and proceed only if not a WhiteSpace c=(*XMLEntityStreamStack.begin())->nextChar(); if (!XMLChar::isWhiteSpace(c)) { (*XMLEntityStreamStack.begin())->streamPos.count -= 2; (*XMLEntityStreamStack.begin())->streamPos.columnNumber -= 2; XMLString refName; StreamPositionStruct lastStreamPos2 = (*XMLEntityStreamStack.begin())->streamPos; matchProduction69PEReference((*XMLEntityStreamStack.begin()), refName); nextXMLEntityStream = (*XMLEntityStreamStack.begin())->getXMLEntityStream(refName, XMLEntityStream::PARAMETER_ENTITY); if (nextXMLEntityStream==0) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos2; sprintf(errormessage, "Parameter entity '%s' unknown", refName.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.push_front(nextXMLEntityStream); } else { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; if ((length==0)&required) { throw XMLParserException(&XMLEntityStreamStack, "White space expected", XMLParserException::BAD_XML_ERR); } return length; } } length++; lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); } (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; if ((length==0)&required) { throw XMLParserException(&XMLEntityStreamStack, "White space expected", XMLParserException::BAD_XML_ERR); } return length; } // ************************************************************************** bool XMLParser::matchProduction05Name( XMLEntityStream *const thisStream, XMLString& Name) const { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction05Name\n"); } if (!matchProduction07Nmtoken(thisStream, Name)) { return 0; } // critical point // and check that it is a valid name if (!Name.isName()) { thisStream->streamPos.columnNumber -= Name.length(); throw XMLParserException(&XMLEntityStreamStack, "Not a valid Name", XMLParserException::BAD_XML_ERR); } if (DEBUGXMLPARSER) { printf("Name = '%s'\n", Name.c_str()); } return 1; } // ************************************************************************** bool XMLParser::matchProduction07Nmtoken( XMLEntityStream *const thisStream, XMLString& Nmtoken) const { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction07Nmtoken\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; // first of all need to determine length of NMToken unsigned long length=0; //char c=thisStream->nextChar(); signed char c=thisStream->nextChar(); if (c==EOF) { return 0; } while (XMLChar::isNameChar(c)) { length++; c=thisStream->nextChar(); } thisStream->streamPos = lastStreamPos; if (length==0) { return 0; } char* s = new char[length+1]; for (unsigned long i=0; inextChar(); } s[length]=0; Nmtoken=s; delete s; if (DEBUGXMLPARSER) { printf("Nmtoken = '%s'\n", Nmtoken.c_str()); } return 1; } // ************************************************************************** void XMLParser::matchProduction09EntityLiteral( XMLString& EntityLiteral) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction09EntityLiteral\n"); } matchProductionQuotedString((*XMLEntityStreamStack.begin()), EntityLiteral); } // ************************************************************************** void XMLParser::matchProduction10AttValue( XMLString& AttValue) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction_AttVal\n"); } matchProductionQuotedString((*XMLEntityStreamStack.begin()), AttValue); // check it for "<" for (unsigned long i=0; istreamPos.columnNumber -= PubidLiteral.length() + 1; throw XMLParserException(&XMLEntityStreamStack, "not a valid PubidLiteral", XMLParserException::BAD_XML_ERR); } } // ************************************************************************** bool XMLParser::matchProduction14CharData( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction14CharData\n"); } list lastXMLEntityStreamStack; list lastStreamsPosition; // store last position in this and all parent streams storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); // need to get length and expand general entity // and character references as we go long length=sweepContent(0); // now restore last position for this and all parent streams restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (length==0) { return 0; } char* s=new char[length+1]; sweepContent(s); XMLString CharData=s; delete s; Node* newTextNode = theDocument->createTextNode(CharData); containingElement->appendChild(newTextNode); if (DEBUGXMLPARSER) { printf("CharData = '%s'\n", CharData.c_str()); } return 1; } // ************************************************************************** bool XMLParser::matchProduction15Comment( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction15Comment\n"); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { // comment incorrectly terminated throw XMLParserException(&XMLEntityStreamStack, "'-->' expected", XMLParserException::BAD_XML_ERR); } if (!(containingElement==0)) { Node* newCommentNode = theDocument->createComment(Comment); containingElement->appendChild(newCommentNode); } if (DEBUGXMLPARSER) { printf("Comment = '%s'\n", Comment.c_str()); } return 1; } // ************************************************************************** bool XMLParser::matchProduction16PI( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction16PI\n"); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "streamPos.columnNumber -= PITarget.length(); throw XMLParserException(&XMLEntityStreamStack, "illegal processing instruction target name", XMLParserException::BAD_XML_ERR); } StreamPositionStruct lastStreamPos1 = (*XMLEntityStreamStack.begin())->streamPos; long whiteSpace=matchProduction03S((*XMLEntityStreamStack.begin()), 0); StreamPositionStruct lastStreamPos2 = (*XMLEntityStreamStack.begin())->streamPos; long length = howFarTo("?>"); if ((length>0)&(whiteSpace==0)) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos1; throw XMLParserException(&XMLEntityStreamStack, "white space expected", XMLParserException::BAD_XML_ERR); } (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos2; loadNChar((*XMLEntityStreamStack.begin()), PIString, length); if (!(containingElement==0)) { Node* newProcessingInstructionNode = theDocument->createProcessingInstruction(PITarget, PIString); containingElement->appendChild(newProcessingInstructionNode); } if (DEBUGXMLPARSER) { printf("PITarget = '%s'\n", PITarget.c_str()); printf("PIString = '%s'\n", PIString.c_str()); } // skip the '?>' (*XMLEntityStreamStack.begin())->streamPos.count += 2; (*XMLEntityStreamStack.begin())->streamPos.columnNumber += 2; return 1; } // ************************************************************************** void XMLParser::matchProduction17PITarget( XMLString& PITarget) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction17PITarget\n"); } matchProduction05Name((*XMLEntityStreamStack.begin()), PITarget); } // ************************************************************************** bool XMLParser::matchProduction18CDSect( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction18CDSect\n"); } if (!matchProduction19CDStart()) { return 0; } // critical point XMLString CData; matchProduction20CData(CData); matchProduction21CDEnd(); Node* newCDATASectionNode = theDocument->createCDATASection(CData); containingElement->appendChild(newCDATASectionNode); return 1; } // ************************************************************************** bool XMLParser::matchProduction19CDStart() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction19CDStart\n"); } return (matchProductionFixedString((*XMLEntityStreamStack.begin()), "streamPos; long length = howFarTo("]]>"); (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; loadNChar((*XMLEntityStreamStack.begin()), CData, length); if (DEBUGXMLPARSER) { printf("CData = '%s'\n", CData.c_str()); } return 1; } // ************************************************************************** bool XMLParser::matchProduction21CDEnd() { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction21CDEnd\n"); } return (matchProductionFixedString((*XMLEntityStreamStack.begin()), "]]>")); } // ************************************************************************** void XMLParser::matchProduction22Prolog() { // this production is required // note, however, that all of its sub-productions are optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction22Prolog\n"); } matchProduction23XMLDecl(); while (matchProduction27Misc(0)); // again, what is this doing?? PTC matchProduction28doctypedecl(); if (!(theDocumentType==0)) { while (matchProduction27Misc(0)); // and again... PTC } } // ************************************************************************** bool XMLParser::matchProduction23XMLDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction23XMLDecl\n"); } StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), " not an XMLDecl => back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; return 0; } // critical point XMLString tempString; if (matchProduction24VersionInfo((*XMLEntityStreamStack.begin()), tempString)) { rootVersionNum=tempString; } { if (matchProduction80EncodingDecl((*XMLEntityStreamStack.begin()), tempString)) rootEncName=tempString; } matchProduction32SDDecl(); matchProduction03S((*XMLEntityStreamStack.begin()), 0); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "?>")) { // XMLDecl incorrectly terminated throw XMLParserException(&XMLEntityStreamStack, "'?>' expected", XMLParserException::BAD_XML_ERR); } return 0; } // ************************************************************************** bool XMLParser::matchProduction24VersionInfo( XMLEntityStream *const thisStream, XMLString& VersionNum) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction24VersionInfo\n"); } if (!matchProductionFixedString(thisStream, "version")) { throw XMLParserException(&XMLEntityStreamStack, "'version' expected", XMLParserException::BAD_XML_ERR); } matchProduction25Eq(thisStream); matchProductionQuotedString(thisStream, VersionNum); if (!VersionNum.isVersionNum()) { // isn't a VersionNum thisStream->streamPos.columnNumber -= VersionNum.length() + 1; throw XMLParserException(&XMLEntityStreamStack, "not a valid Version number", XMLParserException::BAD_XML_ERR); } if (DEBUGXMLPARSER) { printf("VersionNum = '%s'\n", VersionNum.c_str()); } return 1; } // ************************************************************************** void XMLParser::matchProduction25Eq( XMLEntityStream *const thisStream) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction25Eq\n"); } matchProduction03S(thisStream, 0); if (!matchProductionFixedString(thisStream, "=")) { throw XMLParserException(&XMLEntityStreamStack, "'=' expected", XMLParserException::BAD_XML_ERR); } matchProduction03S(thisStream, 0); } // ************************************************************************** bool XMLParser::matchProduction27Misc( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction27Misc\n"); } if (matchProduction03SDeep(0)>0) { return 1; } if (matchProduction15Comment(containingElement)) { return 1; } if (matchProduction16PI(containingElement)) { return 1; } return 0; } // ************************************************************************** bool XMLParser::matchProduction28aDeclSep() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction28aDeclSep\n"); } if (matchProduction03SDeep(0)>0) { return 1; } XMLString refName; unsigned long refLength; XMLEntityStream* refStream; refLength=matchProduction69PEReference((*XMLEntityStreamStack.begin()), refName); if (refLength==0) { return 0; } // we have found a PEReference, now need to find its stream and descend // into it refStream = (*XMLEntityStreamStack.begin())->getXMLEntityStream(refName, XMLEntityStream::PARAMETER_ENTITY); if (refStream==0) { (*XMLEntityStreamStack.begin())->streamPos.count -= refLength; (*XMLEntityStreamStack.begin())->streamPos.columnNumber -= refLength; sprintf(errormessage, "Parameter Entity '%s' unknown", refName.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.push_front(refStream); return 1; } // ************************************************************************** bool XMLParser::matchProduction28doctypedecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction28doctypedecl\n"); } StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "streamPos = lastStreamPos; return 0; } // critical point XMLString doctypeName; XMLString SystemLiteral; XMLString PubidLiteral; if (!matchProduction05Name((*XMLEntityStreamStack.begin()), doctypeName)) { throw XMLParserException(&XMLEntityStreamStack, "Name (for DTD) expected.", XMLParserException::BAD_XML_ERR); } matchProduction03S((*XMLEntityStreamStack.begin()), 0); matchProduction75ExternalID(PubidLiteral, SystemLiteral); matchProduction03S((*XMLEntityStreamStack.begin()), 0); // OK, now we can create 'theDocumentType' theDocumentType = myDOMImplementation.createDocumentType(doctypeName, PubidLiteral, SystemLiteral); // now if we have a SystemLiteral we need to create an XMLEntityStream for it, and // descend into it in order to parse the external DTD before processing the // internal subset if (SystemLiteral.length()>0) { if (StandAlone) { throw XMLParserException(&XMLEntityStreamStack, "External DTD not allowed in standalone documents", XMLParserException::BAD_XML_ERR); } XMLEntityStream* newXMLEntityStream = (*XMLEntityStreamStack.begin())->addParameterXMLEntityStream( doctypeName, PubidLiteral, SystemLiteral); XMLEntityStreamStack.push_front(newXMLEntityStream); matchProduction31extSubsetDecl(); if (XMLEntityStreamStack.size()>1) { throw XMLParserException(&XMLEntityStreamStack, "markupdecl|conditionalSect|DeclSep expected", XMLParserException::BAD_XML_ERR); } } // now parse internal subset if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "[")) { bool more2go = 1; while (more2go) { more2go = matchProduction29markupdecl(); if ((*XMLEntityStreamStack.begin())!=rootXMLEntityStream) { more2go = more2go|matchProduction61conditionalSect(); } more2go = more2go|matchProduction28aDeclSep(); if (!more2go) { if ((*XMLEntityStreamStack.begin())!=rootXMLEntityStream) { if ((*XMLEntityStreamStack.begin())->atEnd()) { (*XMLEntityStreamStack.begin()) = (*XMLEntityStreamStack.begin())->parentXMLEntityStream(); } else { throw XMLParserException(&XMLEntityStreamStack, "markupdecl|conditionalSect|DeclSep expected", XMLParserException::BAD_XML_ERR); } more2go=1; } } } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "]")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "']' expected", XMLParserException::BAD_XML_ERR); } matchProduction03S((*XMLEntityStreamStack.begin()), 0); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ">")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>'expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction29markupdecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction29markupdecl\n"); } if (matchProduction45elementdecl()) { return 1; } if (matchProduction52AttlistDecl()) { return 1; } if (matchProduction70EntityDecl()) { return 1; } if (matchProduction82NotationDecl()) { return 1; } if (matchProduction16PI(0)) { return 1; } if (matchProduction15Comment(0)) { return 1; } return 0; } // ************************************************************************** void XMLParser::matchProduction31extSubsetDecl() { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction31extSubsetDecl\n"); } // this production is optional const unsigned long enteringlevel = XMLEntityStreamStack.size(); while (1) { if (matchProduction29markupdecl()) {} else if (matchProduction61conditionalSect()) {} else if (matchProduction28aDeclSep()) {} else if (XMLEntityStreamStack.size()<=enteringlevel) { return; } else { throw XMLParserException(&XMLEntityStreamStack, "markupdecl|conditionalSect|DeclSep expected", XMLParserException::BAD_XML_ERR); } } } // ************************************************************************** bool XMLParser::matchProduction32SDDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction32SDDecl\n"); } StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; if (matchProduction03S((*XMLEntityStreamStack.begin()), 0)==0) { return 0; // there was no white space } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "standalone")) { // back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; return 0; } // critical point matchProduction25Eq((*XMLEntityStreamStack.begin())); XMLString SDDecl; lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; matchProductionQuotedString((*XMLEntityStreamStack.begin()), SDDecl); if (SDDecl=="yes") { StandAlone = 1; } else if (SDDecl=="no") { StandAlone = 0; } else { // isn't an SDDecl (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; (*XMLEntityStreamStack.begin())->streamPos.columnNumber++; throw XMLParserException(&XMLEntityStreamStack, "'yes' or 'no' expected for StandAlone declaration", XMLParserException::BAD_XML_ERR); } if (DEBUGXMLPARSER) { printf("SDDecl = '%s'\n", SDDecl.c_str()); } return 1; } // ************************************************************************** bool XMLParser::matchProduction39Element( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction39Element\n"); } const XMLEntityStream *const enteringXMLEntityStream = (*XMLEntityStreamStack.begin()); StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; XMLString tagName; list myAttributeNamesList; list myAttributeValuesList; Element* newElement; bool isEmptyElement=0; if (matchProduction44EmptyElementTag(&tagName, &myAttributeNamesList, &myAttributeValuesList)) { isEmptyElement=1; } else if (!matchProduction40STag(&tagName, &myAttributeNamesList, &myAttributeValuesList)) { return 0; } if ((theDocument==0)&(theDocumentType!=0)) { if (tagName != *theDocumentType->nodeName()) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; (*XMLEntityStreamStack.begin())->streamPos.columnNumber++; sprintf(errormessage, "Expecting root element to be '%s'\n", theDocumentType->nodeName()->c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } } // need to compile a list of local URI bindings list localPrefixes; list localURIs; XMLString defaultURI; list::const_iterator pAttName = myAttributeNamesList.begin(); list::const_iterator pAttValue = myAttributeValuesList.begin(); while (pAttName!=myAttributeNamesList.end()) { if (pAttName->eqxmlns()) { defaultURI = *pAttValue; } else { XMLString attPrefix; XMLString attLocalName; if (pAttName->splitNSName(attPrefix, attLocalName)) { if (attPrefix.eqxmlns()) { localPrefixes.push_back(attLocalName); localURIs.push_back(*pAttValue); } } } pAttName++; pAttValue++; } // now find URI binding for element tagName XMLString prefix; XMLString localName; XMLString namespaceURI; if (tagName.splitNSName(prefix, localName)) { // prefix exists, is it xml:? if (prefix.eqxml()) { if (DEBUGXMLPARSER) { printf("my prefix is xml, will use XML_NAMESPACEURI binding\n"); } namespaceURI = XML_NAMESPACEURI; } if (namespaceURI.length()==0) { // not xml: => look for xmlns:prefix="..." binding // firstly look for local binding if (DEBUGXMLPARSER) { printf("my prefix is not xml, looking for local binding\n"); } list::const_iterator pLocalPrefix=localPrefixes.begin(); list::const_iterator pLocalURIs=localURIs.begin(); while ((namespaceURI.length()==0)&(pLocalPrefix!=localPrefixes.end())) { if (*pLocalPrefix==prefix) { namespaceURI=*pLocalURIs; } pLocalPrefix++; pLocalURIs++; } } if ((namespaceURI.length()==0)&!(containingElement==0)) { // didn't find one in attributes, look in ancestor elements if (DEBUGXMLPARSER) { printf("my prefix is not xml, looking for binding in ancestor element\n"); } const XMLString* pNamespaceURI=containingElement->lookupNamespaceURI(prefix); if (!(pNamespaceURI==0)) { namespaceURI=*pNamespaceURI; } } if (namespaceURI.length()==0) { // cannot find a URI binding (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; (*XMLEntityStreamStack.begin())->streamPos.columnNumber++; throw XMLParserException(&XMLEntityStreamStack, "Cannot find internal URI binding for this prefix", XMLParserException::BAD_XML_ERR); } } else { // no prefix => look for default xmlns="..." binding if (!(defaultURI.length()==0)) { // a local default exists if (DEBUGXMLPARSER) { printf("there is a local default URI binding\n"); } namespaceURI=defaultURI; } else if (!(containingElement==0)) { // no local default, try in ancestor elements if (DEBUGXMLPARSER) { printf("looking for default binding in ancestor element\n"); } const XMLString* pNamespaceURI=containingElement->lookupNamespaceURI(""); if (!(pNamespaceURI==0)) { namespaceURI=*pNamespaceURI; } } } if (DEBUGXMLPARSER) { printf("my namespaceURI binding is'%s'\n", namespaceURI.c_str()); } if (theDocument==0) { theDocument = myDOMImplementation.createDocument(namespaceURI, tagName, theDocumentType); newElement = theDocument->documentElement(); } else { if (namespaceURI.length()==0) { newElement = theDocument->createElement(tagName); } else { newElement = theDocument->createElementNS(namespaceURI, tagName); } } if (!(containingElement==0)) { containingElement->appendChild(newElement); } // now add the attributes pAttName = myAttributeNamesList.begin(); pAttValue = myAttributeValuesList.begin(); while (pAttName!=myAttributeNamesList.end()) { if (DEBUGXMLPARSER) { printf("examining attribute %s='%s'\n", pAttName->c_str(), pAttValue->c_str()); } if (pAttName->splitNSName(prefix, localName)) { // attribute has a prefix if (DEBUGXMLPARSER) { printf(" attribute has a prefix\n"); } namespaceURI=""; if (prefix.eqxml()) { namespaceURI = XML_NAMESPACEURI; } else if (prefix.eqxmlns()) { namespaceURI = XMLNS_NAMESPACEURI; } else { // need to look for local binding if (DEBUGXMLPARSER) { printf(" prefix is not xml or xmlns, looking for local binding\n"); } list::const_iterator pLocalPrefix=localPrefixes.begin(); list::const_iterator pLocalURIs=localURIs.begin(); while ((namespaceURI.length()==0)&(pLocalPrefix!=localPrefixes.end())) { if (*pLocalPrefix==prefix) { namespaceURI=*pLocalURIs; } pLocalPrefix++; pLocalURIs++; } } if ((namespaceURI.length()==0)&!(containingElement==0)) { // look for default in ancestor elements if (DEBUGXMLPARSER) { printf("no local binding found, looking for ancestral binding\n"); } const XMLString* pNamespaceURI=containingElement->lookupNamespaceURI(""); if (!(pNamespaceURI==0)) { namespaceURI=*pNamespaceURI; } } if (namespaceURI.length()==0) { sprintf(errormessage, "Cannot find internal URI binding for prefix '%s'\n", prefix.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } // all is ok, can add NSAttribute newElement->setAttributeNS(namespaceURI, *pAttName, *pAttValue); } else { // attribute has no prefix if (DEBUGXMLPARSER) { printf(" attribute has no prefix\n"); } if (pAttName->eqxmlns()) { namespaceURI = XMLNS_NAMESPACEURI; } else { namespaceURI = defaultURI; } if (namespaceURI.length()==0) { newElement->setAttribute(*pAttName, *pAttValue); } else { newElement->setAttributeNS(namespaceURI, *pAttName, *pAttValue); } } pAttName++; pAttValue++; } if (!isEmptyElement) { matchProduction43content(newElement); if ((*XMLEntityStreamStack.begin()) != enteringXMLEntityStream) { throw XMLParserException(&XMLEntityStreamStack, "End tag without start tag in same entity", XMLParserException::BAD_XML_ERR); } myxmdsBytePoint = (*XMLEntityStreamStack.begin())->streamPos.count; matchProduction42ETag(tagName); } return 1; } // ************************************************************************** bool XMLParser::matchProduction40STag( XMLString* tagName, list* myAttributeNamesList, list* myAttributeValuesList) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction40STag\n"); } StreamPositionStruct lastStreamPos1 = (*XMLEntityStreamStack.begin())->streamPos; if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "<")) { return 0; } StreamPositionStruct lastStreamPos2 = (*XMLEntityStreamStack.begin())->streamPos; //char c=(*XMLEntityStreamStack.begin())->nextChar(); signed char c=(*XMLEntityStreamStack.begin())->nextChar(); if (c==EOF) { // back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos1; return 0; } if (!XMLChar::isLetter(c)) { // back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos1; return 0; } // critical point (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos2; matchProduction05Name((*XMLEntityStreamStack.begin()), *tagName); // We are now recording the starting point of every starting tag // as an attribute. We can then use this information for script // debugging purposes. This is a fudge on the XML parser but should // be fine for our own purposes... { XMLString *newXMLString = new XMLString("xmdsLineNumber"); myAttributeNamesList->push_back(*newXMLString); char newCString[12]; // storage space for a long integer sprintf(newCString, "%lu", lastStreamPos1.lineNumber); newXMLString = new XMLString(newCString); myAttributeValuesList->push_back(*newXMLString); newXMLString = new XMLString("xmdsColumnNumber"); myAttributeNamesList->push_back(*newXMLString); sprintf(newCString, "%lu", lastStreamPos1.columnNumber); newXMLString = new XMLString(); myAttributeValuesList->push_back(*newXMLString); } while (matchProduction03S((*XMLEntityStreamStack.begin()), 0)) { XMLString nextAttributeName; XMLString nextAttributeValue; XMLString* newXMLString; if (matchProduction41Attribute(nextAttributeName, nextAttributeValue)) { newXMLString = new XMLString(nextAttributeName); myAttributeNamesList->push_back(*newXMLString); newXMLString = new XMLString(nextAttributeValue); myAttributeValuesList->push_back(*newXMLString); } } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ">")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction41Attribute( XMLString& AttName, XMLString& AttValue) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction41Attribute\n"); } StreamPositionStruct lastStreamPos; lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; //char c=(*XMLEntityStreamStack.begin())->nextChar(); signed char c=(*XMLEntityStreamStack.begin())->nextChar(); if (c==EOF) { return 0; } if (!XMLChar::isLetter(c)) { // not an attribute (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; return 0; } (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; matchProduction05Name((*XMLEntityStreamStack.begin()), AttName); // check that AttName is NS well formed if (!AttName.isNSWellFormed()) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; throw XMLParserException(&XMLEntityStreamStack, "Attribute name not NameSpace well formed", XMLParserException::BAD_XML_ERR); } // check that prefix and localName are valid XMLString prefix; XMLString localName; if (AttName.splitNSName(prefix, localName)) { if (!(prefix.eqxmlns()|prefix.eqxml())&prefix.beginsWithxml()) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; throw XMLParserException(&XMLEntityStreamStack, "Prefix not allowed to begin with (X|x)(M|m)(L|l)", XMLParserException::BAD_XML_ERR); } if (localName.length()==0) { throw XMLParserException(&XMLEntityStreamStack, "Where is the local name?", XMLParserException::BAD_XML_ERR); } } else { if (!AttName.eqxmlns()&AttName.beginsWithxml()) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; throw XMLParserException(&XMLEntityStreamStack, "Atrribute name not allowed to begin with (X|x)(M|m)(L|l)", XMLParserException::BAD_XML_ERR); } } matchProduction25Eq((*XMLEntityStreamStack.begin())); lastStreamPos=(*XMLEntityStreamStack.begin())->streamPos; matchProduction10AttValue(AttValue); (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; // now parse the AttValue for character and general entity refs, // checking for circular references as we go. See 14CharData for prior example list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); long length=sweepAttValue(0); restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); char* s=new char[length+1]; sweepAttValue(s); AttValue=s; delete s; return 1; } // ************************************************************************** void XMLParser::matchProduction42ETag( XMLString& RequiredName) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction42ETag\n"); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "streamPos.count -= ETagName.length(); (*XMLEntityStreamStack.begin())->streamPos.columnNumber -= ETagName.length(); sprintf(errormessage, "End tag for element '%s' expected", RequiredName.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } matchProduction03S((*XMLEntityStreamStack.begin()), 0); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ">")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>' expected", XMLParserException::BAD_XML_ERR); } } // ************************************************************************** void XMLParser::matchProduction43content( Element* containingElement) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction43content\n"); } bool contentFound=1; while (contentFound) { if (contentFound=matchProduction14CharData(containingElement)) {} else if (contentFound=matchProduction39Element(containingElement)) {} // else if (contentFound=matchProduction67Reference(containingElement)) {} else if (contentFound=matchProduction18CDSect(containingElement)) {} else if (contentFound=matchProduction16PI(containingElement)) {} else { (contentFound=matchProduction15Comment(containingElement)); } } } // ************************************************************************** bool XMLParser::matchProduction44EmptyElementTag( XMLString* tagName, list* myAttributeNamesList, list* myAttributeValuesList) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction44EmptyElementTag\n"); } // this routine is a special case of the normal STag routine, in that // it will go the end and then back out if no / found StreamPositionStruct lastStreamPos1 = (*XMLEntityStreamStack.begin())->streamPos; if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "<")) { return 0; } StreamPositionStruct lastStreamPos2 = (*XMLEntityStreamStack.begin())->streamPos; //char c=(*XMLEntityStreamStack.begin())->nextChar(); signed char c=(*XMLEntityStreamStack.begin())->nextChar(); if (c==EOF) { // back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos1; return 0; } if (!XMLChar::isLetter(c)) { // back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos1; return 0; } // while this routine will go to the end and then back out if no /> found // it well test the tagName and the attribute list for errors anyway (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos2; matchProduction05Name((*XMLEntityStreamStack.begin()), *tagName); // check that tagName is NS well formed if (!tagName->isNSWellFormed()) { (*XMLEntityStreamStack.begin())->streamPos.columnNumber -= tagName->length(); throw XMLParserException(&XMLEntityStreamStack, "Element tagName not NameSpace well formed", XMLParserException::BAD_XML_ERR); } // check that prefix and localName are valid XMLString prefix; XMLString localName; if (tagName->splitNSName(prefix, localName)) { if ((!prefix.eqxml())&prefix.beginsWithxml()) { (*XMLEntityStreamStack.begin())->streamPos.columnNumber -= tagName->length(); throw XMLParserException(&XMLEntityStreamStack, "Prefix not allowed to begin with (X|x)(M|m)(L|l)", XMLParserException::BAD_XML_ERR); } if (localName.length()==0) { throw XMLParserException(&XMLEntityStreamStack, "Where is the local name?", XMLParserException::BAD_XML_ERR); } } else { if (tagName->beginsWithxml()) { (*XMLEntityStreamStack.begin())->streamPos.columnNumber -= tagName->length(); throw XMLParserException(&XMLEntityStreamStack, "Element name not allowed to begin with (X|x)(M|m)(L|l)", XMLParserException::BAD_XML_ERR); } } while (matchProduction03S((*XMLEntityStreamStack.begin()), 0)) { XMLString nextAttributeName; XMLString nextAttributeValue; XMLString* newXMLString; if (matchProduction41Attribute(nextAttributeName, nextAttributeValue)) { // test new attribute to see if its name is unique in this element tag for (list::const_iterator pXMLString = myAttributeNamesList->begin(); pXMLString != myAttributeNamesList->end(); pXMLString++) { if (nextAttributeName==*pXMLString) { throw XMLParserException(&XMLEntityStreamStack, "Duplicated attribute!", XMLParserException::BAD_XML_ERR); } } // add new attribute to list newXMLString = new XMLString(nextAttributeName); myAttributeNamesList->push_back(*newXMLString); newXMLString = new XMLString(nextAttributeValue); myAttributeValuesList->push_back(*newXMLString); } } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "/>")) { // back out myAttributeNamesList->clear(); myAttributeValuesList->clear(); (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos1; return 0; } return 1; } // ************************************************************************** bool XMLParser::matchProduction45elementdecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction45elementdecl\n"); } const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>'expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** void XMLParser::matchProduction46contentspec() { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction46contentspec\n"); } if (matchProduction51Mixed()) { return; } if (matchProduction47children()) { // test for children after mixed return; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "EMPTY")) { return; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "ANY")) { return; } throw XMLParserException(&XMLEntityStreamStack, "'EMPTY' or 'ANY' or mixed or children productions expected", XMLParserException::BAD_XML_ERR); } // ************************************************************************** bool XMLParser::matchProduction47children() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction47children\n"); } StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; if (!matchProduction49choice()) { if (!matchProduction50seq()) { // testing seq after choice is important! // back out (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; return 0; } } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "?")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "*")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "+")) { return 1; } return 1; } // ************************************************************************** bool XMLParser::matchProduction48cp() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction48cp\n"); } XMLString Name; if (!matchProduction49choice()) { if (!matchProduction50seq()) { try { matchProduction05Name((*XMLEntityStreamStack.begin()), Name); } catch(XMLParserException XMLRoutinesErr) { return 0; } } } if (matchProduction03SDeep(0)>0) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "?")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "*")) { return 1; } matchProductionFixedString((*XMLEntityStreamStack.begin()), "+"); return 1; } // ************************************************************************** bool XMLParser::matchProduction49choice() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction49choice\n"); } list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); bool foundOR=0; if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "(")) { return 0; } matchProduction03SDeep(0); if (!matchProduction48cp()) { // back out restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); return 0; } matchProduction03SDeep(0); while (matchProductionFixedString((*XMLEntityStreamStack.begin()), "|")) { // critical point matchProduction03SDeep(0); if (!matchProduction48cp()) { throw XMLParserException(&XMLEntityStreamStack, "Name or (choice) or (seq) expected", XMLParserException::BAD_XML_ERR); } matchProduction03SDeep(0); foundOR=1; } if (!foundOR) { // back out restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); return 0; } if ((*XMLEntityStreamStack.begin()) != (*lastXMLEntityStreamStack.begin())) { // Bad nesting throw XMLParserException(&XMLEntityStreamStack, "Logical structures not properly nested.", XMLParserException::BAD_XML_ERR); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ")")) { throw XMLParserException(&XMLEntityStreamStack, "'|' or ')' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction50seq() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction50seq\n"); } const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "(")) { return 0; } // set critical point here, but test for seq after choice // and children after mixed, this way at least opening with a bracket // will generate informative error messages matchProduction03SDeep(0); if (!matchProduction48cp()) { throw XMLParserException(&XMLEntityStreamStack, "#PCDATA or Name or (choice) or (seq) expected", XMLParserException::BAD_XML_ERR); } matchProduction03SDeep(0); while (matchProductionFixedString((*XMLEntityStreamStack.begin()), ", ")) { matchProduction03SDeep(0); if (!matchProduction48cp()) { throw XMLParserException(&XMLEntityStreamStack, "Name or (choice) or (seq) expected", XMLParserException::BAD_XML_ERR); } matchProduction03SDeep(0); } if ((*XMLEntityStreamStack.begin()) != enteringStream) { // Bad nesting throw XMLParserException(&XMLEntityStreamStack, "Logical structures not properly nested.", XMLParserException::BAD_XML_ERR); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ")")) { throw XMLParserException(&XMLEntityStreamStack, "',' or '|' or ')' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction51Mixed() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction51Mixed\n"); } list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "(")) { // back out restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); return 0; } matchProduction03SDeep(0); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "#PCDATA")) { // back out restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); return 0; } // critcal point matchProduction03SDeep(0); XMLString Name; bool hasNames=0; while (matchProductionFixedString((*XMLEntityStreamStack.begin()), "|")) { matchProduction03SDeep(0); matchProduction05Name((*XMLEntityStreamStack.begin()), Name); matchProduction03SDeep(0); hasNames=1; } if ((*XMLEntityStreamStack.begin()) != (*lastXMLEntityStreamStack.begin())) { // Bad nesting throw XMLParserException(&XMLEntityStreamStack, "Logical structures not properly nested.", XMLParserException::BAD_XML_ERR); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ")")) { throw XMLParserException(&XMLEntityStreamStack, "')' expected", XMLParserException::BAD_XML_ERR); } if (hasNames) { if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "*")) { throw XMLParserException(&XMLEntityStreamStack, "'*' expected", XMLParserException::BAD_XML_ERR); } } return 1; } // ************************************************************************** bool XMLParser::matchProduction52AttlistDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction52AttlistDecl\n"); } const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction53AttDef() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction53AttDef\n"); } if (matchProduction03SDeep(0)==0) { return 0; } char c=(*XMLEntityStreamStack.begin())->nextChar(); if (c=='>') { // back out, but it doesn't matter that we have covered the white space (*XMLEntityStreamStack.begin())->streamPos.count--; (*XMLEntityStreamStack.begin())->streamPos.columnNumber--; return 0; } // critical point XMLString attName; matchProduction05Name((*XMLEntityStreamStack.begin()), attName); matchProduction03SDeep(1); matchProduction54AttType(); matchProduction03SDeep(1); matchProduction60DefaultDecl(); return 1; } // ************************************************************************** void XMLParser::matchProduction54AttType() { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction54AttType\n"); } if (matchProduction55StringType()) { return; } if (matchProduction56TokenizedType()) { return; } if (matchProduction57EnumeratedType()) { return; } throw XMLParserException(&XMLEntityStreamStack, "AttType expected", XMLParserException::BAD_XML_ERR); } // ************************************************************************** bool XMLParser::matchProduction55StringType() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction55StringType\n"); } return matchProductionFixedString((*XMLEntityStreamStack.begin()), "CDATA"); } // ************************************************************************** bool XMLParser::matchProduction56TokenizedType() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction56TokenizedType\n"); } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "NMTOKENS")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "NMTOKEN")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "ENTITIES")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "ENTITY")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "IDREFS")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "IDREF")) { return 1; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "ID")) { return 1; } return 0; } // ************************************************************************** bool XMLParser::matchProduction57EnumeratedType() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction57EnumeratedType\n"); } if (matchProduction58NotationType()) { return 1; } if (matchProduction59Enumeration()) { return 1; } return 0; } // ************************************************************************** bool XMLParser::matchProduction58NotationType() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction58NotationType\n"); } XMLString Name; if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "NOTATION")) { return 0; } // critical point matchProduction03SDeep(1); const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "(")) { throw XMLParserException(&XMLEntityStreamStack, "'(' expected", XMLParserException::BAD_XML_ERR); } matchProduction03SDeep(0); matchProduction05Name((*XMLEntityStreamStack.begin()), Name); matchProduction03SDeep(0); while (matchProductionFixedString((*XMLEntityStreamStack.begin()), "|")) { matchProduction03SDeep(0); matchProduction05Name((*XMLEntityStreamStack.begin()), Name); matchProduction03SDeep(0); } if ((*XMLEntityStreamStack.begin()) != enteringStream) { // Bad nesting throw XMLParserException(&XMLEntityStreamStack, "Logical structures not properly nested.", XMLParserException::BAD_XML_ERR); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ")")) { throw XMLParserException(&XMLEntityStreamStack, "')' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction59Enumeration() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction59Enumeration\n"); } XMLString Nmtoken; const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "(")) { return 0; } // critical point matchProduction03SDeep(0); matchProduction07Nmtoken((*XMLEntityStreamStack.begin()), Nmtoken); matchProduction03SDeep(0); while (matchProductionFixedString((*XMLEntityStreamStack.begin()), "|")) { matchProduction03SDeep(0); matchProduction07Nmtoken((*XMLEntityStreamStack.begin()), Nmtoken); matchProduction03SDeep(0); } if ((*XMLEntityStreamStack.begin()) != enteringStream) { // Bad nesting throw XMLParserException(&XMLEntityStreamStack, "Logical structures not properly nested.", XMLParserException::BAD_XML_ERR); } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), ")")) { throw XMLParserException(&XMLEntityStreamStack, "')' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** void XMLParser::matchProduction60DefaultDecl() { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction60DefaultDecl\n"); } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "#REQUIRED")) { return; } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "#IMPLIED")) { return; } matchProductionFixedString((*XMLEntityStreamStack.begin()), "#FIXED"); matchProduction03SDeep(0); XMLString AttValue; try { matchProduction10AttValue(AttValue); } catch(XMLParserException) { throw XMLParserException(&XMLEntityStreamStack, "'#REQUIRED' or '#IMPLIED' or '#FIXED AttValue' expected", XMLParserException::BAD_XML_ERR); } } // ************************************************************************** bool XMLParser::matchProduction61conditionalSect() { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction61conditionalSect\n"); } // this production is optional if (matchProduction62includeSect()) { return 1; } if (matchProduction63ignoreSect()) { return 1; } return 0; } // ************************************************************************** bool XMLParser::matchProduction62includeSect() { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction62includeSect\n"); } // this production is optional list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { throw XMLParserException(&XMLEntityStreamStack, "']]>' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction63ignoreSect() { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction63ignoreSect\n"); } // this production is optional list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { throw XMLParserException(&XMLEntityStreamStack, "']]>' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** void XMLParser::matchProduction64ignoreSectContents() { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction64ignoreSectContents\n"); } // this production is optional matchProduction65ignore(); while (matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { throw XMLParserException(&XMLEntityStreamStack, "']]>' expected", XMLParserException::BAD_XML_ERR); } matchProduction65ignore(); } } // ************************************************************************** void XMLParser::matchProduction65ignore() { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction65ignore\n"); } // this production is optional //char s[4]={0, 0, 0, 0}; signed char s[4]={0, 0, 0, 0}; StreamPositionStruct l[3]; l[0]=(*XMLEntityStreamStack.begin())->streamPos; s[0]=(*XMLEntityStreamStack.begin())->nextChar(); l[1]=(*XMLEntityStreamStack.begin())->streamPos; s[1]=(*XMLEntityStreamStack.begin())->nextChar(); if (s[0]==EOF) { (*XMLEntityStreamStack.begin())->streamPos=l[0]; return; } l[2]=(*XMLEntityStreamStack.begin())->streamPos; s[2]=(*XMLEntityStreamStack.begin())->nextChar(); while ((s[2]!=EOF)&&strcmp((char *)s, "")) { s[0]=s[1]; s[1]=s[2]; l[0]=l[1]; l[1]=l[2]; l[2]=(*XMLEntityStreamStack.begin())->streamPos; s[2]=(*XMLEntityStreamStack.begin())->nextChar(); } (*XMLEntityStreamStack.begin())->streamPos=l[0]; } // ************************************************************************** unsigned long XMLParser::matchProduction66CharRef( XMLEntityStream *const thisStream, //char& cRef) const { signed char& cRef) const { if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction66CharRef\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; //char c; signed char c; c=thisStream->nextChar(); if (c!='&') { thisStream->streamPos=lastStreamPos; return 0; }; c=thisStream->nextChar(); if (c!='#') { thisStream->streamPos=lastStreamPos; return 0; }; // critcal point bool hexNumber=0; c=thisStream->nextChar(); if (c=='x') { hexNumber=1; c=thisStream->nextChar(); } unsigned long length=0; if (hexNumber) { while (XMLChar::isLatinHexDigit(c)&(c!=EOF)) { length++; c=thisStream->nextChar(); } } else { while (XMLChar::isLatinDigit(c)&(c!=EOF)) { length++; c=thisStream->nextChar(); } } if (length==0) { if (hexNumber) { throw XMLParserException(&XMLEntityStreamStack, "hexadecimal reference expected", XMLParserException::BAD_XML_ERR); } else { throw XMLParserException(&XMLEntityStreamStack, "decimal reference expected", XMLParserException::BAD_XML_ERR); } } thisStream->streamPos.count -= length+1; thisStream->streamPos.columnNumber -= length+1; char* CharRefString; unsigned int CharRef; CharRefString = new char[length+1]; for (unsigned long i=0; inextChar(); } CharRefString[length]=0; if (hexNumber) { sscanf(CharRefString, "%x", &CharRef); } else { sscanf(CharRefString, "%u", &CharRef); } delete CharRefString; // finally check termination lastStreamPos = thisStream->streamPos; c=thisStream->nextChar(); if (c!=';') { // not correctly terminated thisStream->streamPos=lastStreamPos; throw XMLParserException(&XMLEntityStreamStack, "';' expected", XMLParserException::BAD_XML_ERR); }; if (CharRef&0xFF00) { // UTF16 and higher encodings not supported throw XMLParserException(&XMLEntityStreamStack, "Reference to Unicode XML character unable to be processed", XMLParserException::BAD_XML_ERR); } cRef = (char)CharRef; if (!XMLChar::isChar(cRef)) { // illegal character throw XMLParserException(&XMLEntityStreamStack, "Reference to Illegal XML character", XMLParserException::BAD_XML_ERR); } if (DEBUGXMLPARSER) { printf("CharRef = %c\n", CharRef); } if (hexNumber) { return length+4; } return length+3; } // ************************************************************************** unsigned long XMLParser::matchProduction68EntityRef( XMLEntityStream *const thisStream, XMLString& refName) const { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction68EntityRef\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; char c; c=thisStream->nextChar(); if (c!='&') { thisStream->streamPos=lastStreamPos; return 0; }; //critical point if (!matchProduction05Name(thisStream, refName)) { throw XMLParserException(&XMLEntityStreamStack, "Name expected", XMLParserException::BAD_XML_ERR); } lastStreamPos = thisStream->streamPos; c=thisStream->nextChar(); if (c!=';') { thisStream->streamPos=lastStreamPos; throw XMLParserException(&XMLEntityStreamStack, "';' expected", XMLParserException::BAD_XML_ERR); } return refName.length()+2; } // ************************************************************************** unsigned long XMLParser::matchProduction69PEReference( XMLEntityStream *const thisStream, XMLString& PEName) const { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction69PEReference\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; char c; c=thisStream->nextChar(); if (c!='%') { thisStream->streamPos=lastStreamPos; return 0; }; //critical point if (!matchProduction05Name(thisStream, PEName)) { throw XMLParserException(&XMLEntityStreamStack, "Name expected", XMLParserException::BAD_XML_ERR); } lastStreamPos = thisStream->streamPos; c=thisStream->nextChar(); if (c!=';') { thisStream->streamPos=lastStreamPos; throw XMLParserException(&XMLEntityStreamStack, "';' expected", XMLParserException::BAD_XML_ERR); } return PEName.length()+2; } // ************************************************************************** bool XMLParser::matchProduction70EntityDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction70EntityDecl\n"); } if (matchProduction72PEDecl()) { return 1; } if (matchProduction71GEDecl()) { // do this one second for sake of error reporting return 1; } return 0; } // ************************************************************************** bool XMLParser::matchProduction71GEDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction71GEDecl\n"); } const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>' expected", XMLParserException::BAD_XML_ERR); } // ok, now we have a new XMLEntityStream to load into storage: if (NotationName.length()>0) { (*XMLEntityStreamStack.begin())->addUnparsedXMLEntityStream( EntityDeclName, PubidLiteral, SystemLiteral, NotationName); } else if (SystemLiteral.length()>0) { (*XMLEntityStreamStack.begin())->addGeneralXMLEntityStream( EntityDeclName, PubidLiteral, SystemLiteral); } else { (*XMLEntityStreamStack.begin())->addGeneralXMLEntityStream(EntityDeclName, EntityLiteral); } return 1; } // ************************************************************************** bool XMLParser::matchProduction72PEDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction72PEDecl\n"); } list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>' expected", XMLParserException::BAD_XML_ERR); } // ok, now we have a new XMLEntityStream to load into storage: if (SystemLiteral.length()>0) { (*XMLEntityStreamStack.begin())->addParameterXMLEntityStream( EntityDeclName, PubidLiteral, SystemLiteral); } else { (*XMLEntityStreamStack.begin())->addParameterXMLEntityStream(EntityDeclName, EntityLiteral); } return 1; } // ************************************************************************** void XMLParser::matchProduction73EntityDef( XMLString& PubidLiteral, XMLString& SystemLiteral, XMLString& NotationName, XMLString& EntityLiteral) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction73EntityDef\n"); } if (matchProduction75ExternalID(PubidLiteral, SystemLiteral)) { matchProduction76NDataDecl(NotationName); } else { try { matchProduction09EntityLiteral(EntityLiteral); } catch(XMLParserException) { throw XMLParserException(&XMLEntityStreamStack, "EntityLiteral or ExternalID expected", XMLParserException::BAD_XML_ERR); } } } // ************************************************************************** void XMLParser::matchProduction74PEDef( XMLString& PubidLiteral, XMLString& SystemLiteral, XMLString& EntityLiteral) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction74PEDef\n"); } if (!matchProduction75ExternalID(PubidLiteral, SystemLiteral)) { try { matchProduction09EntityLiteral(EntityLiteral); } catch(XMLParserException) { throw XMLParserException(&XMLEntityStreamStack, "EntityLiteral or ExternalID expected", XMLParserException::BAD_XML_ERR); } } } // ************************************************************************** bool XMLParser::matchProduction75ExternalID( XMLString& PubidLiteral, XMLString& SystemLiteral) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction75ExternalID\n"); } if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "SYSTEM")) { // it is a SYSTEM declaration matchProduction03SDeep(1); matchProduction11SystemLiteral(SystemLiteral); } else if (matchProductionFixedString((*XMLEntityStreamStack.begin()), "PUBLIC")) { // it is a PUBLIC declaration matchProduction03SDeep(1); matchProduction12PubidLiteral(PubidLiteral); matchProduction03SDeep(1); matchProduction11SystemLiteral(SystemLiteral); } else return 0; return 1; } // ************************************************************************** bool XMLParser::matchProduction76NDataDecl( XMLString& NotationName) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction76NDataDecl\n"); } list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (matchProduction03SDeep(0)==0) { return 0; } if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "NDATA")) { // no NDATA therefore not a NDataDecl restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); return 0; } // critical point matchProduction03SDeep(1); matchProduction05Name((*XMLEntityStreamStack.begin()), NotationName); return 1; } // ************************************************************************** void XMLParser::matchProduction77TextDecl( XMLEntityStream *const thisStream, XMLString& VersionNum, XMLString& EncName) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction77TextDecl\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; if (!matchProductionFixedString(thisStream, " not a TextDecl => back out thisStream->streamPos = lastStreamPos; return; } // critical point matchProduction24VersionInfo(thisStream, VersionNum); matchProduction80EncodingDecl(thisStream, EncName); matchProduction03S(thisStream, 0); if (!matchProductionFixedString(thisStream, "?>")) { // TextDecl incorrectly terminated throw XMLParserException(&XMLEntityStreamStack, "'?>' expected", XMLParserException::BAD_XML_ERR); } } // ************************************************************************** bool XMLParser::matchProduction80EncodingDecl( XMLEntityStream *const thisStream, XMLString& EncName) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction80EncodingDecl\n"); } StreamPositionStruct lastStreamPos = thisStream->streamPos; if (matchProduction03S(thisStream, 0)==0) { return 0; // there was no white space } if (!matchProductionFixedString(thisStream, "encoding")) { // back out thisStream->streamPos = lastStreamPos; return 0; } // critical point matchProduction25Eq(thisStream); matchProduction81EncName(thisStream, EncName); return 1; } // ************************************************************************** void XMLParser::matchProduction81EncName( XMLEntityStream *const thisStream, XMLString& EncName) { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction81EncName\n"); } matchProductionQuotedString(thisStream, EncName); if (!EncName.isEncName()) { // isn't an EncName thisStream->streamPos.columnNumber -= EncName.length() + 1; throw XMLParserException(&XMLEntityStreamStack, "not a valid Encoding name", XMLParserException::BAD_XML_ERR); } if (DEBUGXMLPARSER) { printf("EncName = '%s'\n", EncName.c_str()); } } // ************************************************************************** bool XMLParser::matchProduction82NotationDecl() { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction82NotationDecl\n"); } const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "")) { // not correctly terminated throw XMLParserException(&XMLEntityStreamStack, "'>' expected", XMLParserException::BAD_XML_ERR); } return 1; } // ************************************************************************** bool XMLParser::matchProduction83PublicID( XMLString& PubidLiteral) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProduction83PublicID\n"); } // this production is a special case of the 75ExternalID production in which // the systemliteral is not required -- a bit tricky to pick this one up! list lastXMLEntityStreamStack; list lastStreamsPosition; storeStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); if (!matchProductionFixedString((*XMLEntityStreamStack.begin()), "PUBLIC")) { return 0; } matchProduction03SDeep(1); matchProduction12PubidLiteral(PubidLiteral); matchProduction03SDeep(0); char c=(*XMLEntityStreamStack.begin())->nextChar(); if (c!='>') { // back out restoreStreamPos(lastXMLEntityStreamStack, lastStreamsPosition); return 0; } (*XMLEntityStreamStack.begin())->streamPos.count--; (*XMLEntityStreamStack.begin())->streamPos.columnNumber--; return 1; } // ************************************************************************** long XMLParser::howFarTo( const char* pattern) { if (DEBUGXMLPARSER) { printf("XMLParser::howFarTo '%s'\n", pattern); } StreamPositionStruct lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; // return if pattern null pointer if (pattern==0) { return 0; } // get pattern length long patternLength=0; while (!(pattern[patternLength]==0)) { patternLength++; } // return if pattern empty string if (patternLength==0) { return 0; } // create test pattern and load from file long i; //char c; signed char c; char* testPattern = new char[patternLength+1]; for (i=0; inextChar())==EOF) { delete testPattern; throw XMLException(XMLException::UNEXPECTED_EOF_ERR); } testPattern[i]=c; } testPattern[patternLength]=0; // now step testpattern to the right until match is found long distance=0; while (strcmp(testPattern, pattern)) { if ((c=(*XMLEntityStreamStack.begin())->nextChar())==EOF) { delete testPattern; throw XMLException(XMLException::UNEXPECTED_EOF_ERR); } for (i=0; istreamPos = lastStreamPos; return distance; } // ************************************************************************** bool XMLParser::matchProductionFixedString( XMLEntityStream *const thisStream, const char* pattern) { // this production is optional if (DEBUGXMLPARSER) { printf("XMLParser::matchProductionFixedString '%s'\n", pattern); } long length=0; while (!(pattern[length]==0)) { length++; } if (length==0) { return 1; } StreamPositionStruct lastStreamPos = thisStream->streamPos; XMLString testString; loadNChar(thisStream, testString, length); if (testString==pattern) { return 1; } thisStream->streamPos=lastStreamPos; return 0; } // ************************************************************************** void XMLParser::matchProductionQuotedString( XMLEntityStream *const thisStream, XMLString& quotedString) const { // this production is required if (DEBUGXMLPARSER) { printf("XMLParser::matchProductionQuotedString\n"); } StreamPositionStruct lastStreamPos1 = thisStream->streamPos; //char c=thisStream->nextChar(); signed char c=thisStream->nextChar(); if (!((c==0x22)|(c==0x27))) { thisStream->streamPos = lastStreamPos1; throw XMLParserException(&XMLEntityStreamStack, "Single or double quote expected", XMLParserException::BAD_XML_ERR); } //char quoteUsed = c; signed char quoteUsed = c; StreamPositionStruct lastStreamPos2 = thisStream->streamPos; long length=0; c=thisStream->nextChar(); while (!(c==quoteUsed)&(c!=EOF)) { length++; c=thisStream->nextChar(); } if (c!=quoteUsed) { throw XMLParserException(&XMLEntityStreamStack, "Unexpected end of stream", XMLParserException::BAD_XML_ERR); } thisStream->streamPos = lastStreamPos2; char* s = new char[length+1]; for (long i=0; inextChar(); } s[length]=0; quotedString=s; delete s; c=thisStream->nextChar(); } // ************************************************************************** unsigned long XMLParser::sweepContent( char* s) { if (DEBUGXMLPARSER) { printf("XMLParser::sweepContent\n"); } // this routine sweeps through element content and returns the length of the // content. It is then called a second time with the appropriate memory // allocated to s, and loads the data into s //char c; signed char c; XMLEntityStream* testNextXMLEntityStream; unsigned long refLength; XMLString refName; StreamPositionStruct lastStreamPos; unsigned long length = 0; bool cont = 1; while (cont) { lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); while (c==EOF) { if (XMLEntityStreamStack.size()==1) { throw XMLParserException(&XMLEntityStreamStack, "Unexpected end of file", XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.pop_front(); lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); } while (c=='&') { // need to expand character and general entity references (*XMLEntityStreamStack.begin())->streamPos.count--; (*XMLEntityStreamStack.begin())->streamPos.columnNumber--; refLength=matchProduction66CharRef((*XMLEntityStreamStack.begin()), c); if (refLength>0) { // it was a character reference if (s!=0) { s[length]=c; } length++; } else { // must be a general entity reference refLength=matchProduction68EntityRef((*XMLEntityStreamStack.begin()), refName); testNextXMLEntityStream = (*XMLEntityStreamStack.begin())->getXMLEntityStream(refName, XMLEntityStream::GENERAL_ENTITY); if (testNextXMLEntityStream==0) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; sprintf(errormessage, "General entity '%s' unknown", refName.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.push_front(testNextXMLEntityStream); } lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); while (c==EOF) { if (XMLEntityStreamStack.size()==1) { throw XMLParserException(&XMLEntityStreamStack, "Unexpected end of file", XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.pop_front(); lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); } } cont = XMLChar::isCharData(c); if (cont) { if (s!=0) { s[length]=c; } length++; } } (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; if (s!=0) { s[length]=0; } return length; } // ************************************************************************** unsigned long XMLParser::sweepAttValue( char* s) { if (DEBUGXMLPARSER) { printf("XMLParser::sweepAttValue\n"); } // this routine sweeps through the AttValue content and returns the length of // the content. It is then called a second time with the appropriate memory // allocated to s, and loads the data into s // note it uses the current entity stream, assuming that it is already // positioned just before the opening quote. //char c; signed char c; XMLEntityStream* testNextXMLEntityStream; unsigned long refLength; XMLString refName; StreamPositionStruct lastStreamPos; unsigned long length = 0; //char quoteUsed = (*XMLEntityStreamStack.begin())->nextChar(); signed char quoteUsed = (*XMLEntityStreamStack.begin())->nextChar(); const XMLEntityStream *const enteringStream = (*XMLEntityStreamStack.begin()); bool cont = 1; while (cont) { lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); while (c==EOF) { if (XMLEntityStreamStack.size()==1) { throw XMLParserException(&XMLEntityStreamStack, "Unexpected end of file", XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.pop_front(); lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); } while (c=='&') { // need to expand character and general entity references (*XMLEntityStreamStack.begin())->streamPos.count--; (*XMLEntityStreamStack.begin())->streamPos.columnNumber--; refLength=matchProduction66CharRef((*XMLEntityStreamStack.begin()), c); if (refLength>0) { // it was a character reference if (s!=0) { s[length]=c; length++; } } else { // must be a general entity reference refLength=matchProduction68EntityRef((*XMLEntityStreamStack.begin()), refName); testNextXMLEntityStream = (*XMLEntityStreamStack.begin())->getXMLEntityStream(refName, XMLEntityStream::GENERAL_ENTITY); if (testNextXMLEntityStream==0) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; sprintf(errormessage, "General entity '%s' unknown", refName.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } if (testNextXMLEntityStream->entityLocation()==XMLEntityStream::EXTERNAL_ENTITY) { (*XMLEntityStreamStack.begin())->streamPos = lastStreamPos; sprintf(errormessage, "Reference to external entity '%s' not allowed in AttValue", refName.c_str()); throw XMLParserException(&XMLEntityStreamStack, errormessage, XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.push_front(testNextXMLEntityStream); } lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); while (c==EOF) { if (XMLEntityStreamStack.size()==1) { throw XMLParserException(&XMLEntityStreamStack, "Unexpected end of file", XMLParserException::BAD_XML_ERR); } XMLEntityStreamStack.pop_front(); lastStreamPos = (*XMLEntityStreamStack.begin())->streamPos; c=(*XMLEntityStreamStack.begin())->nextChar(); } } cont = XMLChar::isCharData(c) &!((c==quoteUsed)&((*XMLEntityStreamStack.begin())==enteringStream)); if (cont) { if (s!=0) { s[length]=c; } length++; } } if (s!=0) { s[length]=0; } return length; } // ************************************************************************** void XMLParser::loadNChar( XMLEntityStream *const thisStream, XMLString& outString, const unsigned long& length) const { if (DEBUGXMLPARSER) { printf("XMLParser::loadNChar\n"); } char* s = new char[length+1]; for (unsigned long i=0; inextChar(); } s[length]=0; outString=s; delete s; } // ************************************************************************** void XMLParser::storeStreamPos( list& lastXMLEntityStreamStack, list& andTheirPositions) { if (DEBUGXMLPARSER) { printf("XMLParser::storeStreamPos\n"); } lastXMLEntityStreamStack.clear(); andTheirPositions.clear(); for (list::const_iterator ppXMLEntityStream = XMLEntityStreamStack.begin(); ppXMLEntityStream != XMLEntityStreamStack.end(); ppXMLEntityStream++) { lastXMLEntityStreamStack.push_back(*ppXMLEntityStream); andTheirPositions.push_back((*ppXMLEntityStream)->streamPos); } } // ************************************************************************** void XMLParser::restoreStreamPos( const list& lastXMLEntityStreamStack, const list& andTheirPositions) { if (DEBUGXMLPARSER) { printf("XMLParser::restoreStreamPos\n"); } XMLEntityStreamStack.clear(); list::const_iterator ppXMLEntityStream; ppXMLEntityStream = lastXMLEntityStreamStack.begin(); list::const_iterator pStreamPositionStruct; pStreamPositionStruct = andTheirPositions.begin(); while (ppXMLEntityStream != lastXMLEntityStreamStack.end()) { XMLEntityStreamStack.push_back(*ppXMLEntityStream); (*ppXMLEntityStream)->streamPos = *pStreamPositionStruct; ppXMLEntityStream++; pStreamPositionStruct++; } } // ************************************************************************** void XMLParser::printEntityStreamStack() const { if (DEBUGXMLPARSER) { printf("XMLParser::printEntityStreamStack\n"); } for (list::const_iterator ppXMLEntityStream = XMLEntityStreamStack.begin(); ppXMLEntityStream != XMLEntityStreamStack.end(); ppXMLEntityStream++) { printf(" %s, %li, %li\n", (*ppXMLEntityStream)->name()->c_str(), (*ppXMLEntityStream)->streamPos.lineNumber, (*ppXMLEntityStream)->streamPos.columnNumber); } } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xml_parser.h0000644000076500000240000006432111033277417013256 00000000000000/* Copyright (C) 2000-2007 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xml_parser.h 1599 2007-11-17 13:42:49Z paultcochrane $ */ /*! @file xml_parser.h @brief Header defining xml parser objects */ #ifndef LIST #include #define LIST #endif // ****************************************************************************** // ****************************************************************************** // XMLParserException // ****************************************************************************** // ****************************************************************************** class XMLEntityStream; //! XMLParserException class class XMLParserException { public : //! Enumerator of various xml errors enum { BAD_XML_ERR, ENCODING_NOT_SUPPORTED_ERR, INVALID_FILE_ERR, INTERNAL_ERR, UNKNOWN_ERR}; const unsigned short theError; //!< Number defining the error //! Constructor of XMLParserException object XMLParserException(); //! Constructor of XMLParserException object XMLParserException( const list *const yourXMLEntityStreamStack, const char *const yourErrorMessage, const unsigned short& yourError); //! Destructor ~XMLParserException(); //! Gets an xml parser error const char* getError(); private : char s[2048]; //!< Container variable for a string of characters const list *const theXMLEntityStreamStack; //!< The XML entity stream stack const char *const theErrorMessage; //!< The error message to print }; // ****************************************************************************** // ****************************************************************************** // XMLEntityStream // ****************************************************************************** // ****************************************************************************** //! Structure containing the stream position struct StreamPositionStruct { unsigned long count; //!< Counter variable unsigned long lineNumber; //!< Current line number unsigned long columnNumber; //!< Current column number }; class XMLParser; //! XMLEntityStream class class XMLEntityStream { public : //! Keeps tabs on the stream position StreamPositionStruct streamPos; //! Constructor for XMLEntityStream object XMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourSystemID); //! Destructor virtual ~XMLEntityStream(); //! Returns the name as an XMLString const XMLString* name() const; //! Returns the parent xml entity stream XMLEntityStream* parentXMLEntityStream(); //! Enumerator containing the xml entity stream types enum XMLEntityStreamType { ROOT_ENTITY, PARAMETER_ENTITY, GENERAL_ENTITY, UNPARSED_ENTITY}; //! Returns the entity type virtual XMLEntityStreamType entityType() const = 0; //! Enumerator containing the xml entity location type enum XMLEntityLocationType { INTERNAL_ENTITY, EXTERNAL_ENTITY}; //! Returns the entity location virtual XMLEntityLocationType entityLocation() const = 0; //! Determines if are at the end of the xml stream bool atEnd() const; //virtual char nextChar(); //! Returns the next character in the stream virtual signed char nextChar(); //! Returns the replacement text as an XMLString virtual const XMLString* replacementText() = 0; //! Adds a parameter xml entity stream XMLEntityStream* addParameterXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID); //! Adds a parameter xml entity stream XMLEntityStream* addParameterXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral); //! Adds a general xml entity stream XMLEntityStream* addGeneralXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral); //! Adds a general xml entity stream XMLEntityStream* addGeneralXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID); //! Adds an unparsed xml entity stream XMLEntityStream* addUnparsedXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID, const XMLString& NotationName); //! Gets an xml entity stream XMLEntityStream* getXMLEntityStream( const XMLString& getName, const XMLEntityStreamType& ofEntityType); //! Prints the stream tree void printStreamTree( unsigned long level) const; protected: char errormessage[1024]; //!< Stores the error message XMLParser *const myXMLParser; //!< Declares the xml parser object const XMLString myName; //!< Declares the xml string name XMLString myTextString; //!< Declares the text string bool myTextStringValid; //!< Indicates if the text is valid //! Gets the xml entity stream tree walk down XMLEntityStream* getXMLEntityStreamTreeWalkDown( const XMLString& name, const XMLEntityStreamType& ofEntityType); //! Loads an external text string void loadExternalTextString(); //! Makes a text string void virtual makeTextString() = 0; private : XMLEntityStream *const myParentXMLEntityStream; //!< Undocumented const XMLString mySystemID; //!< Undocumented list myXMLEntityStreamList; //!< Undocumented }; // ****************************************************************************** // ****************************************************************************** // RootXMLEntityStream // ****************************************************************************** // ****************************************************************************** //! RootXMLEntityStream class class RootXMLEntityStream: public XMLEntityStream { public: //! Constructor of RootXMLEntityStream object RootXMLEntityStream( XMLParser *const yourXMLParser, const XMLString& yourSystemID); //! Returns the entity type of the xml entity stream XMLEntityStreamType entityType() const; //! Returns the entity location of the xml entity stream XMLEntityLocationType entityLocation() const; //! Returns the replacement text as an XMLString const XMLString* replacementText(); protected: //! Makes a text string void makeTextString(); }; // ****************************************************************************** // ****************************************************************************** // GPXMLEntityStream // ****************************************************************************** // ****************************************************************************** //! GPXMLEntityStream class class GPXMLEntityStream: public XMLEntityStream { public: //! Constructor for an internal entity //! Finally Greg has commented something!! GPXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourEntityLiteral); //! Constructor for an external entity //! Finally Greg has commented something!! GPXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID); //! Returns the entity location XMLEntityLocationType entityLocation() const; //! Returns the replacement text as an XMLString const XMLString* replacementText(); protected: //! Makes a text string void makeTextString(); private: const XMLString myPublicID; //!< The current public id of the entity const XMLString myEntityLiteral; //!< The literal string of the entity const XMLEntityLocationType myEntityLocation; //!< The entity location }; // ****************************************************************************** // ****************************************************************************** // ParameterXMLEntityStream // ****************************************************************************** // ****************************************************************************** //! ParameterXMLEntityStream class class ParameterXMLEntityStream: public GPXMLEntityStream { public: //! Constructor for an internal entity //! Finally Greg has commented something!! ParameterXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourEntityLiteral); //! Constructor for an external entity //! Finally Greg has commented something!! ParameterXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID); //! Returns the entity type XMLEntityStreamType entityType() const; }; // ****************************************************************************** // ****************************************************************************** // GeneralXMLEntityStream // ****************************************************************************** // ****************************************************************************** //! GeneralXMLEntityStream class class GeneralXMLEntityStream: public GPXMLEntityStream { public: //! Constructor for an internal entity //! Finally Greg has commented something!! GeneralXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourEntityLiteral); //! Constructor for an external entity //! Finally Greg has commented something!! GeneralXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID); //! Returns the entity type XMLEntityStreamType entityType() const; }; // ****************************************************************************** // ****************************************************************************** // UnparsedXMLEntityStream // ****************************************************************************** // ****************************************************************************** //! UnparsedXMLEntityStream class class UnparsedXMLEntityStream: public XMLEntityStream { public: //! Constructor for an external entity //! Finally Greg has commented something!! UnparsedXMLEntityStream( XMLParser *const yourXMLParser, XMLEntityStream *const yourParentXMLEntityStream, const XMLString& yourName, const XMLString& yourPublicID, const XMLString& yourSystemID, const XMLString& yourNotationName); //! Returns the entity type XMLEntityStreamType entityType() const; //! Returns the entity location XMLEntityLocationType entityLocation() const; //! Returns the replacement text const XMLString* replacementText(); // overrides of XMLEntityStream functions that // should never be called for this entity //! Determines if are at end of entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ bool atEnd() const; //! Adds a parameter xml entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ XMLEntityStream* addParameterXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID); //! Adds a parameter xml entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ XMLEntityStream* addParameterXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral); //! Adds a general xml entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ XMLEntityStream* addGeneralXMLEntityStream( const XMLString& name, const XMLString& EntityLiteral); //! Adds a general xml entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ XMLEntityStream* addGeneralXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID, const XMLString& NotationName); //! Adds an unparsed xml entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ XMLEntityStream* addUnparsedXMLEntityStream( const XMLString& name, const XMLString& PublicID, const XMLString& SystemID, const XMLString& NotationName); //! Gets an xml entity stream /*! Overrides of XMLEntityStream functions that should never be called for this entity */ XMLEntityStream* getXMLEntityStream( const XMLString& getName, const XMLEntityStreamType& ofEntityType); protected: //! Makes a text string void makeTextString(); private: const XMLString myPublicID; //!< The public id of the entity const XMLString myNotationName; //!< The notation name (of the entity?) }; // ****************************************************************************** // ****************************************************************************** // XMLParser // ****************************************************************************** // ****************************************************************************** //! XMLParser class class XMLParser { public : //! An xml entity stream stack list XMLEntityStreamStack; //! Constructor for XMLParser object XMLParser(); //! Destructor ~XMLParser(); //! Parses xml given fileName Document* parseFromFile( const char* fileName); //! Returns xmds byte point (whatever that may mean) unsigned long xmdsBytePoint() const; //! Matches production 66 character reference (whatever that may mean) unsigned long matchProduction66CharRef( XMLEntityStream *const thisStream, //char& cRef) const; signed char& cRef) const; //! Matches production 69 PE reference (whatever that may mean) unsigned long matchProduction69PEReference( XMLEntityStream *const thisStream, XMLString& PEName) const; //! Matches production 77 text declaration (whatever that may mean) void matchProduction77TextDecl( XMLEntityStream *const thisStream, XMLString& VersionNum, XMLString& encoding); private : KissDOMImplementation myDOMImplementation; //!< Undocumented DocumentType* theDocumentType; //!< Undocumented Document* theDocument; //!< Undocumented XMLEntityStream* rootXMLEntityStream; //!< Undocumented XMLEntityStream* currentXMLEntityStream; //!< Undocumented char errormessage[1024]; //!< Undocumented unsigned long myxmdsBytePoint; //!< Undocumented // stuff recovered from the XMLDecl routine XMLString rootVersionNum; //!< Undocumented XMLString rootEncName; //!< Undocumented bool StandAlone; //!< Undocumented //! Undocumented /*! @todo document this method */ void matchProduction01Document(); //! Undocumented /*! @todo document this method */ long matchProduction03S( XMLEntityStream *const thisStream, const bool required) const; //! Undocumented /*! @todo document this method */ long matchProduction03SDeep( const bool required); //! Undocumented /*! @todo document this method */ bool matchProduction05Name( XMLEntityStream *const thisStream, XMLString& Name) const; //! Undocumented /*! @todo document this method */ bool matchProduction07Nmtoken( XMLEntityStream *const thisStream, XMLString& Nmtoken) const; //! Undocumented /*! @todo document this method */ void matchProduction09EntityLiteral( XMLString& EntityLiteral); //! Undocumented /*! @todo document this method */ void matchProduction10AttValue( XMLString& AttValue); //! Undocumented /*! @todo document this method */ void matchProduction11SystemLiteral( XMLString& SystemLiteral); //! Undocumented /*! @todo document this method */ void matchProduction12PubidLiteral( XMLString& PubidLiteral); //! Undocumented /*! @todo document this method */ bool matchProduction14CharData( Element* containingElement); //! Undocumented /*! @todo document this method */ bool matchProduction15Comment( Element* containingElement); //! Undocumented /*! @todo document this method */ bool matchProduction16PI( Element* containingElement); //! Undocumented /*! @todo document this method */ void matchProduction17PITarget( XMLString& PITarget); //! Undocumented /*! @todo document this method */ bool matchProduction18CDSect( Element* containingElement); //! Undocumented /*! @todo document this method */ bool matchProduction19CDStart(); //! Undocumented /*! @todo document this method */ bool matchProduction20CData( XMLString& CData); //! Undocumented /*! @todo document this method */ bool matchProduction21CDEnd(); //! Undocumented /*! @todo document this method */ void matchProduction22Prolog(); //! Undocumented /*! @todo document this method */ bool matchProduction23XMLDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction24VersionInfo( XMLEntityStream *const thisStream, XMLString& VersionNum); //! Undocumented /*! @todo document this method */ void matchProduction25Eq( XMLEntityStream *const thisStream); //! Undocumented /*! @todo document this method */ bool matchProduction27Misc( Element* containingElement); //! Undocumented /*! @todo document this method */ bool matchProduction28doctypedecl(); //! Undocumented /*! @todo document this method */ bool matchProduction28aDeclSep(); //! Undocumented /*! @todo document this method */ bool matchProduction29markupdecl(); //! Undocumented /*! @todo document this method */ void matchProduction31extSubsetDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction32SDDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction39Element( Element* containingElement); //! Undocumented /*! @todo document this method */ bool matchProduction40STag( XMLString* tagName, list* myAttributeNamesList, list* myAttributeValuesList); //! Undocumented /*! @todo document this method */ bool matchProduction41Attribute( XMLString& AttName, XMLString& AttValue); //! Undocumented /*! @todo document this method */ void matchProduction42ETag( XMLString& RequiredName); //! Undocumented /*! @todo document this method */ void matchProduction43content( Element* containingElement); //! Undocumented /*! @todo document this method */ bool matchProduction44EmptyElementTag( XMLString* tagName, list* myAttributeNamesList, list* myAttributeValuesList); //! Undocumented /*! @todo document this method */ bool matchProduction45elementdecl(); //! Undocumented /*! @todo document this method */ void matchProduction46contentspec(); //! Undocumented /*! @todo document this method */ bool matchProduction47children(); //! Undocumented /*! @todo document this method */ bool matchProduction48cp(); //! Undocumented /*! @todo document this method */ bool matchProduction49choice(); //! Undocumented /*! @todo document this method */ bool matchProduction50seq(); //! Undocumented /*! @todo document this method */ bool matchProduction51Mixed(); //! Undocumented /*! @todo document this method */ bool matchProduction52AttlistDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction53AttDef(); //! Undocumented /*! @todo document this method */ void matchProduction54AttType(); //! Undocumented /*! @todo document this method */ bool matchProduction55StringType(); //! Undocumented /*! @todo document this method */ bool matchProduction56TokenizedType(); //! Undocumented /*! @todo document this method */ bool matchProduction57EnumeratedType(); //! Undocumented /*! @todo document this method */ bool matchProduction58NotationType(); //! Undocumented /*! @todo document this method */ bool matchProduction59Enumeration(); //! Undocumented /*! @todo document this method */ void matchProduction60DefaultDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction61conditionalSect(); //! Undocumented /*! @todo document this method */ bool matchProduction62includeSect(); //! Undocumented /*! @todo document this method */ bool matchProduction63ignoreSect(); //! Undocumented /*! @todo document this method */ void matchProduction64ignoreSectContents(); //! Undocumented /*! @todo document this method */ void matchProduction65ignore(); //! Undocumented /*! @todo document this method */ unsigned long matchProduction68EntityRef( XMLEntityStream *const thisStream, XMLString& refName) const; //! Undocumented /*! @todo document this method */ bool matchProduction70EntityDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction71GEDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction72PEDecl(); //! Undocumented /*! @todo document this method */ void matchProduction73EntityDef( XMLString& PubidLiteral, XMLString& SystemLiteral, XMLString& NotationName, XMLString& EntityLiteral); //! Undocumented /*! @todo document this method */ void matchProduction74PEDef( XMLString& PubidLiteral, XMLString& SystemLiteral, XMLString& EntityLiteral); //! Undocumented /*! @todo document this method */ bool matchProduction75ExternalID( XMLString& PubidLiteral, XMLString& SystemLiteral); //! Undocumented /*! @todo document this method */ bool matchProduction76NDataDecl( XMLString& NotationName); //! Undocumented /*! @todo document this method */ bool matchProduction80EncodingDecl( XMLEntityStream *const thisStream, XMLString& EncName); //! Undocumented /*! @todo document this method */ void matchProduction81EncName( XMLEntityStream *const thisStream, XMLString& EncName); //! Undocumented /*! @todo document this method */ bool matchProduction82NotationDecl(); //! Undocumented /*! @todo document this method */ bool matchProduction83PublicID( XMLString& PubidLiteral); //! Undocumented /*! @todo document this method */ long howFarTo( const char* pattern); //! Undocumented /*! @todo document this method */ bool matchProductionFixedString( XMLEntityStream *const thisStream, const char* pattern); //! Undocumented /*! @todo document this method */ void matchProductionQuotedString( XMLEntityStream *const thisStream, XMLString& quotedString) const; //! Undocumented /*! @todo document this method */ unsigned long sweepContent( char* s); //! Undocumented /*! @todo document this method */ unsigned long sweepAttValue( char* s); //! Undocumented /*! @todo document this method */ void loadNChar( XMLEntityStream *const thisStream, XMLString& outString, const unsigned long& length) const; //! Undocumented /*! @todo document this method */ void storeStreamPos( list& lastXMLEntityStreamStack, list& StreamPositionStructList); //! Undocumented /*! @todo document this method */ void restoreStreamPos( const list& lastXMLEntityStreamStack, const list& andTheirPositions); //! Undocumented /*! @todo document this method */ void printEntityStreamStack() const; }; #define XMLPARSER //!< Undocumented /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xsil2graphics.cc0000644000076500000240000002425111033277417014020 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope, Andrew Reid and Paul Cochrane This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xsil2graphics.cc 1993 2008-04-16 23:59:10Z andyferris $ */ /*! @file xsil2graphics.cc @brief the xsil2graphics utility program classes and methods More detailed explanation... */ // This program converts xmds field data objects in XSIL // format to various other input formats #include #include #include #include #include #include #include #include // ********************************************************************** //! Display the usage of xsil2graphics void display_usage() { cout << "\n"; cout << "xsil2graphics utility supplied with xmds version "; cout << VERSION; cout << "\n" "\n" "Usage: xsil2graphics [options] infile(s)\n" "Options:\n" " infile(s): required, the input xsil file or files\n" " -h/--help: optional, display this information\n" " -m/--matlab: optional, produce matlab/octave output (default)\n" " -s/--scilab: optional, produce scilab output\n" " -a/--mathematica: optional, produce mathematica 5.x output\n" " -e/--mathematica: optional, produce mathematica output\n" " -g/--gnuplot: optional, produce gnuplot output\n" " -r/--R: optional, produce R output\n" " -p/--plot: optional, generate plotting output (matlab/octave)\n" " -o/--outfile: optional, alternate output file name (one input file only)\n" " -v/--verbose: optional, verbose output\n" "\n" "For further help, please see http://www.xmds.org\n"; } bool debugFlag = 0; bool xmlDebugFlag = 0; // ********************************************************************** //! The main routine of xsil2graphics /*! @param argc The number of arguments to the program @param argv The "vector" of arguments to the program */ int main( int argc, char **argv) { bool verbose = 0; XMLString inFileName; XMLString * inFileNames; XMLString outFileName = ""; XMLString outFileNameBase; outputFormatEnum outFormat = FORMAT_NONE; bool plotFlag = false; // process arguments int resp; while (1) { static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"verbose", no_argument, 0, 'v'}, {"matlab", no_argument, 0, 'm'}, {"scilab", no_argument, 0, 's'}, {"mathematica5", no_argument, 0, 'a'}, {"mathematica", no_argument, 0, 'e'}, {"gnuplot", no_argument, 0, 'g'}, {"R", no_argument, 0, 'r'}, {"plot", no_argument, 0, 'p'}, {"outfile", required_argument, 0, 'o'}, {"debug", no_argument, 0, 'd'}, {"xmldebug", no_argument, 0, 'x'}, {0, 0, 0, 0} }; int option_index = 0; resp = getopt_xmds_long(argc, argv, "hvdxmsaegrpo:", long_options, &option_index); if (resp == -1) { break; } switch (resp) { case 'h': display_usage(); return 0; case 'v': verbose = 1; break; case 'd': debugFlag = 1; break; case 'x': xmlDebugFlag = 1; case 'm': outFormat = FORMAT_MATLAB; break; case 's': outFormat = FORMAT_SCILAB; break; case 'a': outFormat = FORMAT_MATHEMATICA5; break; case 'e': outFormat = FORMAT_MATHEMATICA; break; case 'g': outFormat = FORMAT_GNUPLOT; break; case 'r': outFormat = FORMAT_R; break; case 'p': plotFlag = true; break; case 'o': outFileName = optarg; break; default: display_usage(); return 0; } } int fnameCount; // process non-option command line elements if (optind_xmds < argc) { fnameCount = argc - optind_xmds; inFileNames = new XMLString[fnameCount]; int i = 0; while (optind_xmds < argc) { inFileNames[i] = argv[optind_xmds]; optind_xmds++; i++; } } else { // error, no input file was specified cerr << "Error: no input file specified.\nExiting.\n"; display_usage(); return 1; } if (fnameCount > 1 && outFileName.length() != 0) { // error, input file name already exists cerr << "Error: multiple input files not allowed when specifying output filename\n\n"; display_usage(); return 0; } // set matlab to be the default output if (outFormat == FORMAT_NONE) { cout << "Output file format defaulting to matlab.\n"; outFormat = FORMAT_MATLAB; } // If multiple files are specified then we repeat for each one for (int j=0; j 0) { inFileName.subString(outFileName, 0, lastdot); } else { outFileName = inFileName; } // keep the base file name for use in xsilfield outFileNameBase = outFileName; if (outFormat == FORMAT_MATLAB) { cout << "Generating output for matlab\n"; outFileName += ".m"; } else if (outFormat == FORMAT_SCILAB) { cout << "Generating output for scilab\n"; outFileName += ".sci"; } else if (outFormat == FORMAT_MATHEMATICA5) { cout << "Generating output for Mathematica 5.x\n"; outFileName += ".nb"; } else if (outFormat == FORMAT_MATHEMATICA) { cout << "Generating output for Mathematica\n"; outFileName += ".nb"; } else if (outFormat == FORMAT_GNUPLOT) { cout << "Generating output for Gnuplot\n"; outFileName += ".gnu"; } else if (outFormat == FORMAT_R) { cout << "Generating output for R\n"; outFileName += ".R"; } else { cerr << "Error: unspecified output format\n"; cerr << "I got " << outFileName.c_str() << " as the format\n"; } cout << "Output file name defaulting to '" << outFileName.c_str() << "'\n"; } else { // display what the output filename is cout << "Output file name set to '" << outFileName.c_str() << "'\n"; } // ************************************ // find and process xsil children // ************************************ const NodeList* candidateElements; list xsilNodeList; if (*theDocument->documentElement()->nodeName() == "simulation") { candidateElements = theDocument->documentElement()->getElementsByTagName("XSIL", 0); if (candidateElements->length() < 1) { cerr << "Error: no elements from within element.\n" "Exiting.\n"; return 1; } for (unsigned long i=0; ilength(); i++) { xsilNodeList.push_back(candidateElements->item(i)); } } else if (*theDocument->documentElement()->nodeName() == "XSIL") { xsilNodeList.push_back(theDocument->documentElement()); } else { cerr << "Error: expecting root element to be or .\n" "Exiting.\n"; return 1; } list::const_iterator ppNode = xsilNodeList.begin(); FILE* outfile = fopen(outFileName.c_str(), "w"); if (outfile == 0) { cerr << "Error: Could not open file '" << outFileName.c_str() << "' for writing.\nExiting.\n"; return 1; } for (unsigned long i=0; i (*ppNode); const DOMString *mgName = nextElement->getAttribute("Name"); int mgNumber = i+1; if (std::strcmp("breakpoint", mgName->c_str()) == 0) { mgNumber = 1; } else { sscanf(mgName->c_str(), "moment_group_%i", &mgNumber); } cout << "Processing xsil data container " << mgNumber << " ...\n"; xsilField myxsilField; try { myxsilField.processElement(nextElement); } catch(xmdsException xmdsErr) { cerr << "Could not load data container\n" << "due to the following xsilException:\n" << xmdsErr.getError() << "Exiting.\n"; fclose(outfile); return 1; } cout << "Writing data container " << i+1 << " to file ...\n"; myxsilField.writeAsFormat(outfile, outFormat, mgNumber, outFileNameBase.c_str(), plotFlag); ppNode++; } fclose(outfile); outFileName = ""; // Clear this to generate the default output filename for the next input file } return 0; } /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/source/xsil_field.cc0000644000076500000240000014106611033277417013364 00000000000000/* Copyright (C) 2000-2008 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane Modifications to output in Mathematica format by Andrew Reid This file is part of xmds. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: xsil_field.cc 1955 2008-04-07 09:54:11Z paultcochrane $ */ /*! @file xsil_field.cc @brief XSIL format parsing classes and methods More detailed explanation... */ #include #include #include #include #include #include //! Turn debugging on or off #define DEBUG 0 // ************************************************************************** // ************************************************************************** // xsilField public // ************************************************************************** // ************************************************************************** long nxsilFields = 0; //!< The number of xsil fields // ************************************************************************** xsilField::xsilField() { if (DEBUG) { nxsilFields++; printf("xsilField::xsilField\n"); printf("nxsilFields=%li\n", nxsilFields); } } // ************************************************************************** xsilField::~xsilField() { if (DEBUG) { nxsilFields--; printf("xsilField::~xsilField\n"); printf("nxsilFields=%li\n", nxsilFields); } } // ************************************************************************** void xsilField::processElement(const Element *const yourElement) { if (DEBUG) { printf("xsilField::processElement\n"); } fieldName = ""; nIndependentVariables = 0; variableNamesList.clear(); latticeList.clear(); const NodeList* candidateElements; const NamedNodeMap* elementAttributes; const Node* attributeNode; list anXMLStringList; // ************************************ // find name elementAttributes = yourElement->attributes(); attributeNode = elementAttributes->getNamedItem("Name"); if (attributeNode != 0) { fieldName = *attributeNode->nodeValue(); } else { throw xmdsException(yourElement, "Where is my Name='...' attribute?"); } // ************************************ // find n_independent Param assignment candidateElements = yourElement->getElementsByTagName("Param", 0); if (candidateElements->length() > 1) { throw xmdsException(yourElement, "Only one element expected "); } elementAttributes = candidateElements->item(0)->attributes(); attributeNode = elementAttributes->getNamedItem("Name"); if (attributeNode != 0) { if (*attributeNode->nodeValue() == "n_independent") { if (!candidateElements->item(0)->textContent(0)->asULong(nIndependentVariables)) { throw xmdsException(candidateElements->item(0), "Invalid positive integer format"); } } else { throw xmdsException(candidateElements->item(0), "Unknown element"); } } else { throw xmdsException(candidateElements->item(0), "Where is my Name='...' attribute?"); } // ************************************ // find Arrays candidateElements = yourElement->getElementsByTagName("Array", 0); if (candidateElements->length() != 2) { throw xmdsException(yourElement, "Exactly two elements expected "); } // ************************************ // find variables Array elementAttributes = candidateElements->item(0)->attributes(); attributeNode = elementAttributes->getNamedItem("Name"); if (attributeNode != 0) { if (*attributeNode->nodeValue() != "variables") { sprintf(errorMessage(), "Unknown element '%s'", attributeNode->nodeValue()->c_str()); throw xmdsException(yourElement, errorMessage()); } } else { throw xmdsException(candidateElements->item(0), "Where is my Name='...' attribute?"); } const Element* myVariablesArrayElement = dynamic_cast(candidateElements->item(0)); // ************************************ // find data Array elementAttributes = candidateElements->item(1)->attributes(); attributeNode = elementAttributes->getNamedItem("Name"); if (attributeNode != 0) { if (*attributeNode->nodeValue() != "data") { sprintf(errorMessage(), "Unknown element '%s'", attributeNode->nodeValue()->c_str()); throw xmdsException(yourElement, errorMessage()); } } else { throw xmdsException(candidateElements->item(1), "Where is my Name='...' attribute?"); } const Element* myDataArrayElement = dynamic_cast(candidateElements->item(1)); // ************************************ // process variables Array unsigned long nVariables; candidateElements = myVariablesArrayElement->getElementsByTagName("Dim", 0); if (candidateElements->length() > 1) { throw xmdsException(myVariablesArrayElement, "Only one element expected "); } if (!candidateElements->item(0)->textContent(0)->asULong(nVariables)) { throw xmdsException(candidateElements->item(0), "Invalid positive integer format"); } getAssignmentStrings(myVariablesArrayElement, "Stream", 1, nVariables, variableNamesList); // ************************************ // process data Array candidateElements = myDataArrayElement->getElementsByTagName("Dim", 0); if (candidateElements->length() != nIndependentVariables+1) { sprintf(errorMessage(), "Exactly %li elements expected", nIndependentVariables + 1); throw xmdsException(myDataArrayElement, errorMessage()); } for (unsigned long i=0; ilength(); i++) { unsigned long nextDim; if (!candidateElements->item(i)->textContent(0)->asULong(nextDim)) { throw xmdsException(candidateElements->item(i), "Invalid positive integer format"); } latticeList.push_back(nextDim); } candidateElements = myDataArrayElement->getElementsByTagName("Stream", 0); if (candidateElements->length() != 1) { throw xmdsException(myDataArrayElement, "A element expected"); } const Element* myStreamElement = dynamic_cast(candidateElements->item(0)); // get the Metalink tags candidateElements = myDataArrayElement->getElementsByTagName("Metalink", 1); if (candidateElements->length() != 1) { throw xmdsException(myDataArrayElement, " element expected"); } // get the Format attribute elementAttributes = candidateElements->item(0)->attributes(); attributeNode = elementAttributes->getNamedItem("Format"); if (attributeNode != 0) { if (*attributeNode->nodeValue() != "Text" && *attributeNode->nodeValue() != "Binary") { sprintf(errorMessage(), "Unknown attribute '%s'", attributeNode->nodeValue()->c_str()); throw xmdsException(yourElement, errorMessage()); } } else { throw xmdsException(candidateElements->item(0), "Where is my Format='...' attribute?"); } // determine the stream format and work out where the data is streamFormat = *attributeNode->nodeValue(); if (streamFormat == "Text") { // ok then, the data is ascii, go get it tiger! data = *myStreamElement->textContent(0); } else if (streamFormat == "Binary") { // data is binary, the textContent of the Stream element is the datafile filename binDatFname = *myStreamElement->textContent(0); // try to remove whitespace chars std::string tmp = binDatFname.c_str(); std::string tmp2; for (unsigned long int i=0; igetNamedItem("Encoding"); if (attributeNode != 0) { if (*attributeNode->nodeValue() != "LittleEndian" && *attributeNode->nodeValue() != "BigEndian") { sprintf(errorMessage(), "Unknown attribute '%s'", attributeNode->nodeValue()->c_str()); throw xmdsException(yourElement, errorMessage()); } } else { throw xmdsException(candidateElements->item(0), "Where is my Encoding='...' attribute?"); } // the binary encoding of the data file binEncoding = *attributeNode->nodeValue(); // get the precision attribute elementAttributes = candidateElements->item(0)->attributes(); attributeNode = elementAttributes->getNamedItem("precision"); if (attributeNode != 0) { if (*attributeNode->nodeValue() != "single" && *attributeNode->nodeValue() != "double") { sprintf(errorMessage(), "Unknown attribute '%s'", attributeNode->nodeValue()->c_str()); throw xmdsException(yourElement, errorMessage()); } } else { throw xmdsException(candidateElements->item(0), "Where is my precison='...' attribute?"); } // the precison of the binary data binPrecision = *attributeNode->nodeValue(); // get the UnsignedLong attribute elementAttributes = candidateElements->item(0)->attributes(); attributeNode = elementAttributes->getNamedItem("UnsignedLong"); if (attributeNode != 0) { if (*attributeNode->nodeValue() != "ulong" && *attributeNode->nodeValue() != "uint32" && *attributeNode->nodeValue() != "uint64") { sprintf(errorMessage(), "Unknown attribute '%s'", attributeNode->nodeValue()->c_str()); throw xmdsException(yourElement, errorMessage()); } ulongType = *attributeNode->nodeValue(); } else { ulongType = "ulong"; printf("Defaulting to ulong\n"); } } } // ************************************************************************** void xsilField::writeAsFormat( FILE *const outfile, const outputFormatEnum& format, const long& iD, const char *datFileNameBase, bool plotFlag) { if (DEBUG) { printf("xsilField::writeAsFormat\n"); } // In order to avoid having any underscores in the variable names for // Mathematica one needs to avoid using the xsil filename, in case it is in // a disallowed format, therefore a new variable will be created which // contains the name minus any underscores, to use throughout the // Mathematica portions of the code. It's a string because that makes // removing just the underscores easier. string datFileNameClear(datFileNameBase); if ((format == FORMAT_MATHEMATICA)||(format == FORMAT_MATHEMATICA5)) { for (unsigned long i=0; i::const_iterator pXMLString = variableNamesList.begin(); pXMLString != variableNamesList.end(); pXMLString++) { fprintf(tempfile, " %s ", pXMLString->c_str()); } } else if (format == FORMAT_R) { // R likes to have the names the same in the header as in the data for (list::const_iterator pXMLString = variableNamesList.begin(); pXMLString != variableNamesList.end(); pXMLString++) { fprintf(tempfile, " %s_%li ", pXMLString->c_str(), iD); } } // write data fprintf(tempfile, "%s", data.c_str()); fclose(tempfile); // there is no file used by Gnuplot to load the data, so we can just // return here now if (format == FORMAT_GNUPLOT) { fprintf(outfile, "# Gnuplot requires no variable loading commands.\n" "# Please use the relevant plot commands to display your data.\n" "# This comment is just a placeholder.\n"); return; // returning from a void function, duh. } /*! \todo Writing of the files for data loading into the various * environments should really be in separate routines */ // If the output format is Mathematica, an initial line is needed to load // an addon package with some necessary commands if (format == FORMAT_MATHEMATICA5) { fprintf(outfile, "<< LinearAlgebra`MatrixManipulation`\n"); } // initialise variables list::iterator pXMLString = variableNamesList.begin(); for (unsigned long i=0; igoLatinAlphaNumericNoUnderScore(); } else{ pXMLString->goLatinAlphaNumeric(); } char tempString[64]; // Mathematica doesn't like an '_' in variable names. if ((format == FORMAT_MATHEMATICA)||(format == FORMAT_MATHEMATICA5)) { sprintf(tempString, "%li", iD); } else { sprintf(tempString, "_%li", iD); } *pXMLString += tempString; // Since Mathematica has a very different format to Scilab and Matlab, // this needs to be split off, even though the purpose is very similar. if (format == FORMAT_MATHEMATICA5) { if (nIndependentVariables == 0) { fprintf(outfile, "%s = Table[0, {i1, 1}];\n", pXMLString->c_str()); } else if (nIndependentVariables == 1) { if (i == 0) { fprintf(outfile, "tempd1 = Table[0, {i1, %li}];\n", lattice(0)); } else { fprintf(outfile, "%s = Table[0, {i1, %li}];\n", pXMLString->c_str(), lattice(0)); } } else { if (i < nIndependentVariables) { fprintf(outfile, "tempd%li = Table[0, {i1, %li}", i+1, lattice(nIndependentVariables-1)); } else { fprintf(outfile, "%s = Table[0, {i1, %li}", pXMLString->c_str(), lattice(nIndependentVariables-1)); } for (unsigned long j=nIndependentVariables-1; j>0; j--) { fprintf(outfile, ", {i%li, %li}", (nIndependentVariables - j + 1) , lattice(j-1)); } fprintf(outfile, "];\n"); } if (i < nIndependentVariables) { fprintf(outfile, "%s = Table[0, {i1, %li}];\n", pXMLString->c_str(), lattice(i)); } } else if (format == FORMAT_MATHEMATICA) { // Version 6+ needs no headers } // The section for Matlab and Scilab else if (format == FORMAT_MATLAB || format == FORMAT_SCILAB) { if (nIndependentVariables == 0) { fprintf(outfile, "%s = zeros(1, 1);\n", pXMLString->c_str()); } else if (nIndependentVariables == 1) { if (i == 0) { fprintf(outfile, "temp_d1 = zeros(1, %li);\n", lattice(0)); } else { fprintf(outfile, "%s = zeros(1, %li);\n", pXMLString->c_str(), lattice(0)); } } else { if (i < nIndependentVariables) { fprintf(outfile, "temp_d%li = zeros(%li", i+1, lattice(nIndependentVariables-1)); } else { fprintf(outfile, "%s = zeros(%li", pXMLString->c_str(), lattice(nIndependentVariables-1)); } for (unsigned long j=nIndependentVariables-1; j>0; j--) { fprintf(outfile, ", %li", lattice(j-1)); } fprintf(outfile, ");\n"); } if (i < nIndependentVariables) { fprintf(outfile, "%s = zeros(1, %li);\n", pXMLString->c_str(), lattice(i)); } } else if (format == FORMAT_R) { // I don't think we need to add anything here for R, but this is // just a placeholder just in case } else { throw xmdsException("Unknown ASCII output format!\n"); } pXMLString++; } fprintf(outfile, "\n"); // load in temp file if (format == FORMAT_SCILAB) { fprintf(outfile, "%s%li = fscanfMat('%s');\n", datFileNameBase, iD, datFileName); } else if (format == FORMAT_MATHEMATICA5) { fprintf(outfile, "%s%li = Import[\"%s\", \"Table\"];\n\n", datFileNameClear.c_str(), iD, datFileName); } else if (format == FORMAT_MATHEMATICA) { fprintf(outfile, "%s%li = Drop[Drop[Import[\"%s\", \"Table\"],1],-1];\n\n", datFileNameClear.c_str(), iD, datFileName); } else if (format == FORMAT_R) { fprintf(outfile, "%s%li <- read.table(\"%s\", header=TRUE)\n", datFileNameBase, iD, datFileName); } else { // matlab and octave fprintf(outfile, "load %s -ascii\n", datFileName); } if (format == FORMAT_MATHEMATICA) { // Initialising for (unsigned long i=nIndependentVariables; ic_str(),datFileNameClear.c_str(), iD,i+1,i+1); for (unsigned long j=0; j0; j--) { fprintf(outfile, ", {i%li, 1, %li}", (nIndependentVariables - j), lattice(j)); } fprintf(outfile, ", {i%li, 1, %li}]\n\n", nIndependentVariables, lattice(0)); } // Initialising for (unsigned long i=nIndependentVariables; ic_str()); for (unsigned long j=0; j0; j--) { fprintf(outfile, ", {i%li, 1, %li}", (nIndependentVariables - j), lattice(j)); } fprintf(outfile, ", {i%li, 1, %li}]\n\n", nIndependentVariables, lattice(0)); } } else if (format == FORMAT_MATLAB || format == FORMAT_SCILAB) { // Matlab, Octave and Scilab for (unsigned long i=0; ic_str(), datFileNameBase, iD, i+1); } } else if (format == FORMAT_R) { for (unsigned long i=nIndependentVariables; ic_str(), datFileNameBase, iD, variableName(i)->c_str()); } } // work out coordinates, again Mathematica has a different required format for (unsigned long i=0; ic_str(),datFileNameClear.c_str(), iD,lattice(i)); if (i+1c_str(), i+1); } else if (format == FORMAT_MATLAB || format == FORMAT_SCILAB) { fprintf(outfile, "%s(:) = temp_d%li(", variableName(i)->c_str(), i+1); } else if (format == FORMAT_R) { fprintf(outfile, "%s <- %s%li$%s\n", variableName(i)->c_str(), datFileNameBase, iD, variableName(i)->c_str()); } else { throw xmdsException("Unknown output data format!\n"); } if (i == (nIndependentVariables-1)) { if (format == FORMAT_MATHEMATICA5) { fprintf(outfile, "i"); } else if (format == FORMAT_MATLAB || format == FORMAT_SCILAB) { fprintf(outfile, ":"); } } else { if (format != FORMAT_R) { fprintf(outfile, "1"); } } for (unsigned long j=nIndependentVariables-1; j>0; j--) { if ((j-1) == i) { if (format == FORMAT_MATHEMATICA5) { fprintf(outfile, ", i"); } else if (format == FORMAT_MATLAB || format == FORMAT_SCILAB) { fprintf(outfile, ", :"); } } else { if (format != FORMAT_R) { fprintf(outfile, ", 1"); } } } if (format == FORMAT_MATHEMATICA5) { fprintf(outfile, "]], {i, 1, %li}]\n", lattice(i)); } else if (format == FORMAT_MATLAB || format == FORMAT_SCILAB) { fprintf(outfile, ");\n"); } } } fprintf(outfile, "\n"); // clear excess variables if (format == FORMAT_MATHEMATICA5) { fprintf(outfile, "Clear[ %s%li, %s%licolumn", datFileNameClear.c_str(), iD, datFileNameClear.c_str(), iD); for (unsigned long i=0; ic_str()); for (unsigned long i=1; ic_str()); } fprintf(outfile, "\"]\n"); } fprintf(outfile, "\n"); } else if (streamFormat == "Binary") { if (format == FORMAT_MATLAB) { // work out how matlab will interpret endian-ness std::string machineFormat; if (binEncoding == "BigEndian") { machineFormat = "ieee-be"; } else if (binEncoding == "LittleEndian") { machineFormat = "ieee-le"; } else { machineFormat = "native"; } fprintf(outfile, "fpDat = fopen('%s', 'r', '%s');\n", binDatFname.c_str(), machineFormat.c_str()); fprintf(outfile, "if (fpDat < 0)\n"); fprintf(outfile, " disp('Cannot open binary data file: %s')\n", binDatFname.c_str()); fprintf(outfile, " return\n"); fprintf(outfile, "end\n"); unsigned long int k = 0; for (list::iterator pXMLString = variableNamesList.begin(); pXMLString != variableNamesList.end(); pXMLString++) { char tempString[64]; sprintf(tempString, "_%li", iD); *pXMLString += tempString; if (k < nIndependentVariables) { fprintf(outfile, "%sLen = fread(fpDat, 1, '%s');\n", pXMLString->c_str(), ulongType.c_str()); fprintf(outfile, "%s = zeros(1, %sLen);\n", pXMLString->c_str(), pXMLString->c_str()); fprintf(outfile, "%s(:) = fread(fpDat, %sLen, '%s');\n", pXMLString->c_str(), pXMLString->c_str(), binPrecision.c_str()); } else if (k >= nIndependentVariables) { fprintf(outfile, "%sLen = fread(fpDat, 1, '%s');\n", pXMLString->c_str(), ulongType.c_str()); if (nIndependentVariables <= 1) { fprintf(outfile, "%s = fread(fpDat, %sLen, '%s');\n", pXMLString->c_str(), variableNamesList.begin()->c_str(), binPrecision.c_str()); } else if (nIndependentVariables == 2) { fprintf(outfile, "%s = fread(fpDat, [%sLen, %sLen], '%s');\n", pXMLString->c_str(), (++variableNamesList.begin())->c_str(), variableNamesList.begin()->c_str(), binPrecision.c_str()); } else if (nIndependentVariables > 2) { // now we need to create a multi-dimensional matrix, // and this is harder to do... // we need to read in a matrix-sized (ie 2D) block at a time, // and append this to the other dimensions the number of // independent variables determines the dimensions of the // N-D matrix to produce // construct the for loop to loop over the third and subsequent dimensions list::iterator pIndepVars = variableNamesList.begin(); for (unsigned long int inumIndepVars=2; inumIndepVarsc_str()); pIndepVars++; } // generate the first part of the string, which is the array to be assigned into fprintf(outfile, "%s(:, :, ", pXMLString->c_str()); pIndepVars = variableNamesList.begin(); for (unsigned long int inumIndepVars=nIndependentVariables-1; inumIndepVars>=2; inumIndepVars--) { fprintf(outfile, "index%li", inumIndepVars-2); // need to append a comma if not the last index to append if (inumIndepVars != 2) { fprintf(outfile, ", "); } } // generate the fread statement // to do this, I have to work out what the last and second-to-last // independent variable names are this is because, for some reason, // one can't inspect a given element of a list // first, the last one pIndepVars = variableNamesList.begin(); XMLString lastIndepVar; for (unsigned long int inumIndepVars=0; inumIndepVars::iterator pXMLString = variableNamesList.begin(); pXMLString != variableNamesList.end(); pXMLString++) { fprintf(outfile, "%sLen ", pXMLString->c_str()); } for (unsigned long int inumIndepVars=2; inumIndepVars tag).\n" "Exiting...\n"); exit(254); } else if (format == FORMAT_MATHEMATICA5) { // I have no idea if binary data works with Mathematica, // so for the moment, barf, and tell why, and give some alternative. printf("\nFatal error: Sorry, but at the moment reading binary data \n" "into older versions of Mathematica is not implemented. To be able to use Mathematica,\n" "please change your output format to ascii (in the tag), or use version 6.0 or later.\n" "Exiting...\n"); exit(254); } else if (format == FORMAT_MATHEMATICA) { // work out how Mathematica will interpret endian-ness std::string machineFormat; if (binEncoding == "BigEndian") { machineFormat = "1"; } else if (binEncoding == "LittleEndian") { machineFormat = "-1"; } else { machineFormat = "$ByteOrdering"; } std::string uLongFormat; if ((string) ulongType.c_str() == "uint32") { uLongFormat = "UnsignedInteger32"; } else if ((string) ulongType.c_str() == "uint64") { uLongFormat = "UnsignedInteger64"; } else { // Have to guess uLongFormat = "UnsignedInteger32"; } std::string outputPrecision; if ((string) binPrecision.c_str() == "single") { outputPrecision = "Real32"; } else if ((string) binPrecision.c_str() == "double") { outputPrecision = "Real64"; } else { // Have to guess outputPrecision = "Real64"; } fprintf(outfile, "fpDat = OpenRead[\"%s\",BinaryFormat -> True];\n", binDatFname.c_str()); unsigned long int k = 0; for (list::iterator pXMLString = variableNamesList.begin(); pXMLString != variableNamesList.end(); pXMLString++) { pXMLString->goLatinAlphaNumericNoUnderScore(); char tempString[64]; sprintf(tempString, "%li", iD); *pXMLString += tempString; if (k < nIndependentVariables) { fprintf(outfile, "%sLen = BinaryRead[fpDat, \"%s\", ByteOrdering->%s];\n", pXMLString->c_str(), uLongFormat.c_str(), machineFormat.c_str()); fprintf(outfile, "%s = BinaryReadList[fpDat, {\"%s\"}, %sLen, ByteOrdering->%s];\n", pXMLString->c_str(), outputPrecision.c_str(), pXMLString->c_str(), machineFormat.c_str()); } else if (k >= nIndependentVariables) { fprintf(outfile, "%sLen = BinaryRead[fpDat, \"%s\", ByteOrdering->%s];\n", pXMLString->c_str(), uLongFormat.c_str(), machineFormat.c_str()); if (nIndependentVariables == 1) { fprintf(outfile, "%s = BinaryReadList[fpDat, {\"%s\"}, %sLen, ByteOrdering->%s];\n", pXMLString->c_str(), outputPrecision.c_str(), pXMLString->c_str(), machineFormat.c_str()); } else { list::iterator getLastNameXMLString = variableNamesList.begin(); for (unsigned long int indepVars = 0; indepVars%s]", pXMLString->c_str(), outputPrecision.c_str(), getLastNameXMLString->c_str(), machineFormat.c_str()); list::iterator tempXMLString = variableNamesList.begin(); for (unsigned long int indepVars = 0; indepVarsc_str()); tempXMLString++; } fprintf(outfile, "],{"); for (unsigned long int indepVars = 0; indepVars::iterator pXMLString = variableNamesList.begin(); pXMLString != variableNamesList.end(); pXMLString++) { fprintf(outfile, "%sLen\n ", pXMLString->c_str()); } for (unsigned long int inumIndepVars=2; inumIndepVarsc_str()); fprintf(outfile, "%s)\n", variableName(1)->c_str()); // put labels on the axes fprintf(outfile, "xlabel('%s')\n", variableName(0)->c_str()); fprintf(outfile, "ylabel('%s')\n", variableName(1)->c_str()); } // if we have two independent variables then we do a plot3 else if (nIndependentVariables == 2) { // generate the plot command fprintf(outfile, "mesh("); for (long unsigned int i=0; ic_str()); } fprintf(outfile, "%s)\n", variableName(nIndependentVariables)->c_str()); // put labels on the axes fprintf(outfile, "xlabel('%s')\n", variableName(0)->c_str()); fprintf(outfile, "ylabel('%s')\n", variableName(1)->c_str()); fprintf(outfile, "zlabel('%s')\n", variableName(2)->c_str()); } else { fprintf(outfile, "%% can't yet plot more than two independent variables\n"); } // give the thing a title fprintf(outfile, "title('%s')\n", datFileNameBase); } } // ************************************************************************** // ************************************************************************** // xsilField private // ************************************************************************** // ************************************************************************** // ************************************************************************** unsigned long xsilField::lattice( const unsigned long& index) const { if (DEBUG) { printf("xsilField::lattice\n"); } if (index >= latticeList.size()) { throw xmdsException("Internal range error in xsilField::lattice"); } list::const_iterator pULong = latticeList.begin(); for (unsigned long i=0; i= variableNamesList.size()) { throw xmdsException("Internal range error in xsilField::variableName"); } list::const_iterator pXMLString = variableNamesList.begin(); for (unsigned long i=0; i #include #include bool initialiseFieldFromXSILFile( const char *filename, const char *mgName, unsigned long dimension, char **dimNames, char **componentNames, // output variables char**binaryDataFilename, int *unsignedLongSize, bool *dataEncodingIsNative, bool *isPrecisionDouble, unsigned long *nDataComponents, unsigned long **inputLattice, int **componentIndicesPtr) { XMLParser myXMLParser; Document *theDocument = 0; try { theDocument = myXMLParser.parseFromFile(filename); } catch(XMLParserException XMLRoutinesErr) { printf("Could not load XSIL file '%s'\n", filename); printf("Due to the following XMLParser exception:\n"); printf("%s\n", XMLRoutinesErr.getError()); return false; } // ************************************ // find and process xsil children // ************************************ const NodeList* candidateElements; list xsilNodeList; if (*theDocument->documentElement()->nodeName() == "simulation") { candidateElements = theDocument->documentElement()->getElementsByTagName("XSIL", 0); if (candidateElements->length() < 1) { printf("Error: no elements from within element.\n"); return false; } for (unsigned long i=0; ilength(); i++) { xsilNodeList.push_back(candidateElements->item(i)); } } else if (*theDocument->documentElement()->nodeName() == "XSIL") { xsilNodeList.push_back(theDocument->documentElement()); } else { printf("Error: expecting root element to be or .\n"); return false; } for (list::const_iterator ppNode = xsilNodeList.begin(); ppNode != xsilNodeList.end(); ppNode++) { xsilField myxsilField; const Element* nextElement = dynamic_cast(*ppNode); try { myxsilField.processElement(nextElement); } catch(xmdsException xmdsErr) { printf("Could not load XSIL data container\n"); printf("due to the following XSIL exception:\n"); printf("%s", xmdsErr.getError()); return false; } if (strcmp("NULL", mgName) == 0) { // We only want to use the first XSIL element if there is only one XSIL element if (xsilNodeList.size() != 1) { printf("This XSIL file contains more than one moment group, and no moment group number\n" "was specified in the tag. Try adding a moment_group=\"X\"\n" "attribute (e.g. )\n\n"); return false; } } else if (myxsilField.fieldName != mgName) { // If the moment group name isn't the same as the current one, keep looking continue; } // Check dimension if (myxsilField.nIndependentVariables != dimension) { printf("The dimension of the XSIL moment group does not match the dimension of the\nvector being initialised\n"); printf("Are you sure that you specified the correct moment group number?\n\n"); return false; } // Check dimension names for (long unsigned int i=0; ic_str(), dimNames[i]); printf("Are you sure that you set the initial space (whether each dimension is in fourier space or not) correctly in your script?\n\n"); return false; } } unsigned long numVariables = myxsilField.lattice(dimension); // !!!!! this for loop doesn't do anything!!!!! // it looks like it determines the number of components, if so, then // there should be a comment here to that effect. unsigned long numComponents; for (numComponents=0; componentNames[numComponents]!=NULL; numComponents++) ; // Check that all the variable names are there int *componentIndices = new int[numComponents]; *componentIndicesPtr = componentIndices; for (long unsigned int i=0; ic_str()); if (j != numVariables) { printf(", "); } } printf("\n"); return false; } // Check that the data format is binary if (myxsilField.streamFormat != "Binary") { printf("The XSIL input interpreter does not support XSIL files with " "the data in ASCII. Use binary instead\n"); return false; } // Check that the binary encoding format is native *dataEncodingIsNative = true; if (CPU_IS_LITTLE_ENDIAN) { if (myxsilField.binEncoding != "LittleEndian") { *dataEncodingIsNative = false; } } else if (CPU_IS_BIG_ENDIAN) { if (myxsilField.binEncoding != "BigEndian") { *dataEncodingIsNative = false; } } else { printf("Warning: I don't know what my endian-ness is... " "I'm going to assume that the data from the XSIL file is in " "my native endian encoding\n"); } *isPrecisionDouble = myxsilField.binPrecision == "double" ? true : false; *nDataComponents = numVariables; unsigned long *lattice = new unsigned long[dimension]; for (long unsigned int i=0; i variableNamesList; //!< The list of variable names //! The list of lattices /*! (which I think is a list of the dimensions of each lattice in the sim) */ list latticeList; XMLString streamFormat; //!< Format of the data stream, either Text or Binary XMLString data; //!< A data string XMLString binDatFname; //!< The filename of the binary data file XMLString binEncoding; //!< The binary encoding (i.e. big or little endian) XMLString binPrecision; //!< The binary data precision (i.e. single or double) XMLString ulongType; //!< The explicit type for ulong (i.e. ulong, uint32 or uint64) }; /* * Local variables: * c-indentation-style: bsd * c-basic-offset: 2 * indent-tabs-mode: nil * End: * * vim: tabstop=2 expandtab shiftwidth=2: */ xmds-1.6.6/TODO0000644000076500000240000000412611033277571010117 000000000000001. NaN checking and terminate (final samples if pending, save, execute only breakpoints thereafter) 1b. NaN checking on stochastic multi-path and continue later paths up to termination. 2. Check (and fix?) seeding on the scheduler. Particularly in error checking case. Are the chosen seeds unique? This may be OK. Fastest check will be a debug set of examples. Document choice of seeds. 3. Nonlinear k-space operators. Works in all IP and EX algorithms, although the nonlinear part itself is never done in the interaction picture. a. New nonlinearKOperators element (same features as koperators) b. Search for terms in CDATA, just like EX algorithm, with less checks on arguments. c. Define underlying variables like EX (more trouble with name) and initialise them. d. Go_space code (like EX) e. Check and edit CDATA of the actual nonlinear operator definitions. This might reuse lines from the original. dpsi_dt = blahdeblah + N1[psi*h(x)*conj(psi)] + N2[phi]; f. Documentation 4. IP picture checks should cause barfs if people don't read doco. 5. Allow Fourier and mixed spaces for calculation of moment groups. Remap any Fourier EX variables and transform them to the appropriate space. 6. Allow more tags to be specified by arbitrary C-code. So far, , , and could, for instance, be specified by a const in the section, or by a command-line input argument. Some tags I (Andy) am interested in generalising are: (in field, integrate, and sample), , (and related cutoff). Other possibilities include the mean for Poissonian noise, but I've never used it... Some of these tags will introduce complications. eg checking that lattice is divisible by samples, etc, will need to be done at run time. 7. Remove check for divided by is integer for adaptive algorithms. 8. Document and . 9. Document Poissonian noise with an example.