summaryrefslogtreecommitdiff
path: root/src/util
Commit message (Collapse)AuthorAge
* use lrint and casts to avoid compiler warnings about type conversionrhaas2013-07-04
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@5030 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Replace Cactus complex number type with C/C++ complex numberseschnett2013-03-08
| | | | | | | | | | | | | | | | Map CCTK_COMPLEX to "double complex" in C, and "complex<double>" in C++. (It is already mapped to "double complex" in Fortran.) Update type definitions. Re-implement Cactus complex number math functions by calling the respective C functions. Update thorn that access real and imaginary parts of complex numbers to use standard-conforming methods instead. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4979 17b73243-c579-4c4c-a9d2-2d5706c11dac
* (1) Fix compilation issues on Pandorasbrandt2013-02-26
| | | | | | | | | | | | (2) Disallow setting multiple parameters on one line (3) Allow sign in floating point format to be optional (4) Use package piraha (5) change PirahaParser to cctk_PirahaParser (6) remove size.py git-svn-id: http://svn.cactuscode.org/flesh/trunk@4966 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Change the parameter parser to Pirahasbrandt2013-02-25
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4960 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Make data parameter of expression evaluation functions consthinder2012-11-30
| | | | | | data is a pointer to user-supplied data used for evaluating the expression. It should not be modified by the evaluation. Note that this modifies the flesh API to the (undocumented) thorn-visible function Util_ExpressionEvaluate. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4922 17b73243-c579-4c4c-a9d2-2d5706c11dac
* ParseFile.c: Change semantics of call to fread so that error check makes sensehinder2012-11-20
| | | | | | fread takes an "item size" and a "number of items" and returns the number of items successfully read. Previously, we asked for 1 item of the size of the file, to read the entire file. The error check which was added in r4915 assumed that the returned value of fread was the number of bytes read, which is not correct since only one item is returned, and causes Cactus to fail with a fatal error when any parameter file is loaded. The present commit changes the fread call to ask for file_size items of size 1, for which the error-checking code makes sense, as there are now file_size items returned. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4917 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Check file size while readingeschnett2012-11-19
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4915 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Cache result of gethostname() calleschnett2012-11-19
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4914 17b73243-c579-4c4c-a9d2-2d5706c11dac
* allow ${parfile} in parameter files to allow ${parfile}/subdirknarf2012-10-24
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4892 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added CCTK_TimerRunning and CCTK_TimerRunningIknarf2012-10-24
| | | | | | | These functions return whether a Cactus timer is running or not (either by name or by handle). git-svn-id: http://svn.cactuscode.org/flesh/trunk@4890 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add a flag indicating if a timer is running or not.knarf2012-10-24
| | | | | | | Starting a running timer and stopping a not running timer will produce a level 1 warning and will otherwise do nothing (will not actually start/stop twice). This fixes the issue at hand - although it will now produce that warning for the total simulation time timer - which is stopped multiple times within Carpet. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4889 17b73243-c579-4c4c-a9d2-2d5706c11dac
* List --exit-after-param-check in help texteschnett2012-10-23
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4885 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add missing call to va_endeschnett2012-10-23
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4884 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Provide macros to always make isnan available under its standard nameeschnett2012-10-22
| | | | | | | | | | | Provide macros to always make isnan available under its standard name, even if it actually needs to be called in a different manner. Provide C wrapper functions for isnan, which can function as fallback for C++. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4882 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct typoeschnett2012-10-18
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4877 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Remove unused and broken BinaryTree implementationeschnett2012-06-15
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4834 17b73243-c579-4c4c-a9d2-2d5706c11dac
* have CCTK_RegexMatch return a distinct error code if patterns is invalidrhaas2012-06-05
| | | | | | | | | | | | | | This patch changes the return value in the "does not compile" case to -1 and updates all source files that I could find that use it. Note that this patch changes behaviour of a routine. It used to return 0 for non-compiling patterns so thorns that test for C-like true would interpret invalid patterns as does-not-match, but will interpret the -1 return value as does-match. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4831 17b73243-c579-4c4c-a9d2-2d5706c11dac
* expand expression language, add error checking, and more documentationrhaas2012-04-19
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4804 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add missing #includeeschnett2012-04-16
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4800 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Simplify two routines in ParseFile.ceschnett2012-04-13
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4799 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Allow arithmetic expression in ParameterSetrhaas2012-04-11
| | | | | | | | | | | | | | | | | | Expression are of the form: foo::bar = 2*sin(foo:baz) ie. arithmetic and access to already set parameters. The new behaviour is triggered if the parameter string (for real, boolean and int parameters) does not parser properly as a double/int/bool. This last test is mostly an optimization. The largest change is actually in the expression parser which has been extended to handle eg. exponential notation and negations. It now uses a state machine to parse its input. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4797 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Make table printing functions publicly accessibleeschnett2011-11-09
| | | | | | | | | | | | The table data types (util_Table.h) have internal routines that print the table contents to screen. This can be helpful for debugging. This patch makes these functions publicly available. Add a routine Util_TablePrintPretty that converts a table to a nice, human-readable string. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4769 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Accept comments in multi-line strings in parameter fileseschnett2011-07-02
| | | | | | | | | | Modify the parameter file parser to accept comments in multi-line strings. These comments extend from a "#" character to the end of the line. This makes it much easier to comment out variables in output strings. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4710 17b73243-c579-4c4c-a9d2-2d5706c11dac
* from Ian Hinder:knarf2011-01-06
| | | | | | | | | | | | | | | Correctly load parameter files with DOS line-endings Before this commit, when a parameter file with DOS line-endings was used, certain features of Cactus did not work correctly. For example, setting an output directory of $parfile would create an output directory named "$parfile" instead of expanding the parameter filename. This commit converts any CR-LF sequences to LF immediately after the parameter file is loaded. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4663 17b73243-c579-4c4c-a9d2-2d5706c11dac
* The function can get confused with detecting the end of the bufferschnetter2010-01-18
| | | | | | | | | | | | | | when the last line is in a comment or in a string, and may overrun the end of the buffer. The symptoms are error messages past the last line of the parameter file, because the memory after the buffer end is interpreted as (probably mal-formed) parameter file content. Since the paring routine is quite complex, this patch works around this problem by increasing the size of the buffer by a few characters and setting these to NUL. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4594 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Modify the behaviour of mixed C/Fortran string comparisons, so that itschnetter2009-12-05
| | | | | | | | | | | | | is consistent with the routines converting Fortran strings to C strings. Fortran strings have a fixed length, and trailing white space is usually ignored. The Cactus routine converting Fortran to C strings did already ignore trailing white space, but the routine comparing Fortran and C strings did not. This is now consistent. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4590 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use size_t instead of char as index variable into the parse bufferschnetter2009-11-11
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4576 17b73243-c579-4c4c-a9d2-2d5706c11dac
* This patch improves the parser used by Cactus to prepocess parameterknarf2009-09-25
| | | | | | | | | | | | | | | | | | | files. The main changes are: - when reading a parameter file do not parse the file while reading, but read it first into a buffer, preprocess that and parse the buffer after that - replace the code which changes $parfile into the parameter file name to use this buffer preprocessing - replace $ENV{'*'} "defines" by environment variable values (*), e.g. $ENV{'HOME'} with $HOME. Frank git-svn-id: http://svn.cactuscode.org/flesh/trunk@4573 17b73243-c579-4c4c-a9d2-2d5706c11dac
* bugfix in {integer,real} parameter range checking routines for the casetradke2008-09-15
| | | | | | | | where there's only '*' given as allowed value (see also thread http://www.cactuscode.org/old/pipermail/developers/2008-September/005626.html) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4504 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Cactus has currently an error in its parameter checking. Itschnetter2008-06-17
| | | | | | | | | | | | | | | | | | | | | | | | interprets ranges consisting of single numbers as allowing this number and all larger numbers. For example, the specification INT spatial_order "Order of spatial differencing" { 2 :: "second order" 4 :: "fourth order" } 2 allows all numbers not less than 2. This patch corrects this problem. Since this involves regular expressions which are often difficult to read, I have broken up the regular expressions into macros containing sub-expressions. I have also replaced calls to atoi and atof with calls to strtol and strtod, since these allow error checking which also was not present before. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4496 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixing Network.c for Cray XT4 Compute Node Linux Compatibility.jshalf2007-10-26
| | | | | | | | | | | | | | | | | | | | | | Network.c uses gethostbyname() which is available on the front-end nodes of the XT4, but not available on Compute Node Linux back-end nodes. The code will link fine with gethostbyname(), but will resolve to the dynamically shared library version of glibc. Since the Compute nodes do not understand dynamically linked libraries (only static linking), then it causes a fatal runtime error if gethostbyname() is invoked even though the compiler will not provide any warning that something bad will occur. Therefore, if you #define CRAY_XT, it will disable the gethostbyname() so as to prevent a fatal runtime error when GetHostName is called. Need to find out a way to recognize Cray XT4/Compute-node-Linux systems automatically. The front-end of the XT4 looks exactly like a Linux cluster. (uname returns "Linux"). Perhaps add a test to the Linux cluster known architectures file that points it to a XT4_CNL known-architetures file. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4434 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct logic errors in CCTK_TimerPrintDataI:schnetter2006-12-19
| | | | | | | | | | | | | | Timer handles are not numbered consecutively from 0 upwards. It is therefore not possible to test for legal timer number by checking the range [0, CCTK_NumTimers()). Instead, for each timer handle one has to check whether handled data exist. Remove the feature that a timer number of -1 prints all existing timers, since it is not possible (?) to iterate over all existing timers. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4396 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct off-by-one error when checking for a legal timer number inschnetter2006-12-18
| | | | | | | CCTK_TimerPrintDataI. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4395 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed formatting for the %g format conversion for small numbers.goodale2006-11-14
| | | | | | | Fixes PR 2058. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4386 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Make the parameter file parser preserve newlines in multi-line string parametertradke2006-08-31
| | | | | | | | | | values. This makes its behaviour consistent with the flesh API routine CCTK_ParameterSet(). This closes PR Cactus/2050: preserve newlines in quoted string parameter values. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4371 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add new flesh API functions CCTK_CompileDateTime() and Util_CurrentDateTime()tradke2006-07-28
| | | | | | | | | | | | | to return a date/time stamp following the ISO 8601 standard format if possible (see http://www.cactuscode.org/old/pipermail/developers/2006-July/004971.html). Add the timezone information in the time stamp returned by Util_CurrentTime(). You also need to update lib/make/make.configuration now in order to compile src/datestamp.c. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4358 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix return code of CCTK_CreateDirectory() if it already exists.tradke2006-05-08
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4292 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Correct typographical error in warning messageschnetter2006-03-21
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4272 17b73243-c579-4c4c-a9d2-2d5706c11dac
* As discussed in today's Cactus call, applying patches from 14 Febswhite2006-03-02
| | | | | | | Patches mailing list. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4263 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix for the erroneuously lablelled memory corruption. It seems what was just ↵yye002006-01-10
| | | | | | needed was more checking. This checked out alright on lemieux. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4231 17b73243-c579-4c4c-a9d2-2d5706c11dac
* minor fix for complex numbersyye002006-01-06
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4230 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Patch from Erik Schnetter to track the capacity of the list andgoodale2005-12-13
| | | | | | | produce an error if it is exceeded. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4210 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabifying.goodale2005-10-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4163 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Renaming min macro to MIN to avoid a conflict on windows.goodale2005-10-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4162 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Print run time warnings while setting parameters with CCTK_WARNschnetter2005-09-26
| | | | | | | | | | | | | | instead of with fprintf (stderr, ...). Correct critical error in looking at the values of cctk_full_warnings, highlight_warning_messages, and cctk_strong_param_check. Handle the empty regular expression specially in CCTK_RegexMatch, since regcomp may treat it as illegal expression. In Cactus, an empty regular expression matches everything. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4150 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Ensure that the step size for integer parameter ranges is alwaysschnetter2005-09-04
| | | | | | | | | | positive. Cast to unsigned int when checking whether the parameter value complies with the step size. Explain why this is necessary. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4119 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add Cactus variable type CCTK_POINTER_TO_CONSTschnetter2005-08-25
| | | | | | | | | | Complete the implementation of the Cactus variable type CCTK_POINTER_TO_CONST. Define a constant CCTK_VARIABLE_POINTER_TO_CONST. Handle this variable when asking for its name and its size. Allow values of this type in tables. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4113 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Don't highlight parameter parser warning messages about newlines in quotedtradke2005-08-04
| | | | | | | | strings. This applies patch http://www.cactuscode.org/pipermail/patches/2005-June/000061.html. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4102 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Insert missing "do" statement (which did not make the code incorrectschnetter2005-07-16
| | | | | | | -- very interesting bug!) git-svn-id: http://svn.cactuscode.org/flesh/trunk@4092 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Change whitespace for the RESIZE_STACK, PUSHOP, and PUSHTOK macroschnetter2005-07-16
| | | | | | | definitions to make the code fit into 80 columns. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4091 17b73243-c579-4c4c-a9d2-2d5706c11dac