1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-23 12:56:53 +01:00
Commit Graph

444 Commits

Author SHA1 Message Date
2e2dac3982 modify rc_open only if it is not a NULL pointer 2021-09-24 12:23:59 +02:00
67b00efa9c handle return error of trexio_open in the Python API 2021-09-22 16:40:55 +02:00
9457a826d2 return error code from trexio_open [C, Fortran] 2021-09-22 14:50:22 +02:00
14472cda48 better error handling in case of invalid dimensioning variable 2021-09-22 11:33:27 +02:00
389d265f7f fix cppcheck warnings regarding redundant size_dset_str checks 2021-09-21 16:08:04 +02:00
d1a9af4185 remove blank spaces in front of pointers 2021-09-21 15:54:11 +02:00
788f7e666d read single numerical attributes based on _isSet bool flag 2021-09-21 15:41:12 +02:00
d5405e700c raise TREXIO_INVALID_ARG_2 also when writing zero as dimensioning variable 2021-09-21 14:35:29 +02:00
6459543afd better front end documentation for numerical attributes 2021-09-21 10:58:07 +02:00
11a17c65d3 add attr_ prefix to the template file name for numerical attributes 2021-09-21 10:41:37 +02:00
c22e9d2925 put back sanity check that dimensioning variables are positive 2021-09-20 17:00:05 +02:00
ce0d98b984 add conversion of float-like attributes into an output tuple 2021-09-20 15:52:55 +02:00
4b9827048f adapt the templates in back ends 2021-09-20 15:51:36 +02:00
261e7c8b84 modify front end for more general numerical attributes 2021-09-20 13:16:44 +02:00
11dadaab36 add tutorial HTML page to the main documentation 2021-09-15 13:43:57 +02:00
f251f0afba remove unnecessary comments in the SWIG interface 2021-09-14 17:30:05 +02:00
d04106f72d max_str_len should be int32_t to properly check for negative values 2021-09-13 13:35:45 +02:00
1589995775 do not use warnings for an attempt to overwrite in the Python API 2021-09-13 11:46:31 +02:00
2bd4ef9bfd add has_ functions to the Python API 2021-09-13 11:29:00 +02:00
77e3f1ac11 print UserWarning instead of raising Error for an attempt to overwrite data
following suggestion of Vijay G.C.
2021-09-12 14:24:50 +02:00
d060808467 do not reveal paths to trexio (security concerns) 2021-09-12 13:36:24 +02:00
12dd1fd8dc apply some suggestions from cppcheck 2021-09-12 13:25:03 +02:00
40d5fc31fc check that the data object exists before reading it from the file 2021-09-10 09:38:26 +02:00
67e59f156c explicitly provide __version__ attribute of the trexio module 2021-09-08 19:28:18 +02:00
96678fea2e adapt write functions to receive multidimensional arrays or lists 2021-09-07 17:14:23 +02:00
3e82fd9ae8 FIX: a bug that was leading to Python and valgrind errors 2021-08-31 12:11:22 +03:00
74c69bb293 better Exception handling with custom exception class 2021-08-30 18:04:35 +03:00
5a2b4d96a7 reshape output arrays by default when reading from the file 2021-08-27 16:08:39 +03:00
7b5ebf6272 implement TREXIO File class and change import of pytrexio module 2021-08-26 17:01:53 +03:00
4c28a4cac8 add type converters for numerical arrays in read/write Python functions 2021-08-26 13:14:46 +03:00
1dcd32ef7d add SWIG typemaps for safe API calls in single and double precision 2021-08-25 13:31:17 +03:00
ed7e3902e2 add memory-safe functions in single or double precision 2021-08-24 13:32:01 +03:00
2911e91941 make dim an optional argument in read_ functions
if dim is None - the function read all necessary dimensions from the TREXIO file
2021-08-24 12:51:43 +03:00
6f7c23aa11 add missing annotations 2021-08-21 13:13:55 +03:00
4fe86ee980 add Python docstrings for API functions
+ move definition of Fortran and Python back ends from Constant Prefixes to Back Ends section
2021-08-21 12:47:36 +03:00
5d5025ae1d get rid of _safe suffix and add dimension to read_dset_str functions 2021-08-20 13:43:15 +03:00
831973fc8e better python compilation 2021-08-18 16:28:43 +03:00
902147b45b better structure of the python directory 2021-08-18 15:40:42 +03:00
9cc552409f rename the front-end Python module 2021-08-18 13:30:03 +03:00
f0bccee32d single top-level import of pytrexio resolves bug with caching 2021-08-18 13:28:37 +03:00
0b223b9d6e return type cast of exit codes and back ends in C
add top-level string_of_error function in Python
2021-08-14 12:27:11 +03:00
721352cb89 add missing support for reading single string attributes 2021-08-11 16:01:36 +03:00
209f4506c8 update gitignore 2021-08-11 16:01:04 +03:00
2be1abd571 add Python front end 2021-08-11 15:59:58 +03:00
ec7a39f6c2 strict int types for DIM1 and arrays 2021-08-06 16:24:11 +03:00
808adc7cd8 add typemaps and tests for numpy int arrays
+ some cleaning in the Python test and SWIG interface files
2021-08-06 14:04:29 +03:00
1388ddef80 fix warnings produced during compilation of the Python extension module 2021-08-06 12:06:42 +03:00
d0c19e0ce0 pytrexio build and pip install working 2021-08-05 17:55:34 +03:00
60c28c1f3b rename python test and add temporary TODO 2021-08-04 14:13:23 +03:00
9a28b8d4bc Revert "create python directory and add TODO objectives"
This reverts commit 6ce91a6669.
2021-08-04 12:07:27 +03:00
6ce91a6669 create python directory and add TODO objectives 2021-08-04 10:18:36 +03:00
e0162d4570 return double datasets as numpy arrays using numpy.i and safe API 2021-07-28 15:59:29 +02:00
ea0ea0ac38 move from distutils to setuptools
sdist and install arguments of setup.py work!
2021-07-28 15:57:42 +02:00
f3dbfc7be2 added License and install_requires in setup.py + cleaning 2021-07-28 10:33:33 +02:00
da5a990acc add memory-safe API for numerical datasets 2021-07-28 10:19:00 +02:00
9f4176a8b6 resolve major compiler warnings produced by distutils 2021-07-27 11:06:06 +02:00
171cf1662b ignore __pycache__ 2021-07-26 19:28:56 +02:00
9bbae8fd7c replace some integers with TREXIO-native constants 2021-07-26 19:27:45 +02:00
1f98604d58 add pattern matching for arrays of strings + comments 2021-07-26 18:49:26 +02:00
12c2a3a014 update gitignore 2021-07-26 18:43:49 +02:00
8c6289a8ba build Python module using pythonic distutils 2021-07-26 18:43:15 +02:00
4faee98092 Merge branch 'master' into swig-python 2021-07-23 16:38:06 +02:00
578819afe7 do not propagate the local user name from config.h to trexio.h 2021-07-23 16:19:15 +02:00
2f876ef7cd write TREXIO version in the file if not done yet 2021-07-23 15:55:16 +02:00
856412f06a propagate package version and user name to trexio.h 2021-07-23 15:49:42 +02:00
836603fd32 do no wrap-up the code from back ends and private header 2021-07-20 14:22:54 +02:00
678f90f86a add a note on alternative way to re-define ill-defined constants 2021-07-20 12:31:21 +02:00
46eec89774 remove unsafe and unused file_name field from trexio_hdf5_s 2021-07-20 12:08:18 +02:00
ac28110696 add include guard to the trexio_private.h file 2021-07-20 12:06:44 +02:00
88e777f68b resolve complaint about undefined TREXIO_MAX_FILENAME_LENGTH and remove unused assert header 2021-07-20 11:36:23 +02:00
e06e0b3745 commented brute force patch for re-defining constants in the target language 2021-07-20 10:42:25 +02:00
9fa2bc2835 disable type casting in constant definitions to access them in the target language
required because SWIG cannot handle definitions with type casting
2021-07-20 10:39:05 +02:00
d527561440 add test of basic I/O for Python 2021-07-19 17:59:26 +02:00
79d374bdff [WIP] Python interface generated by SWIG 2021-07-19 17:58:50 +02:00
411334e2ee Merge branch 'master' into unit-testing 2021-06-22 14:46:39 +02:00
3bd730557c remove H5LDget_dset_dims to be compatible with HDF5 v.1.8.21 2021-06-22 12:21:25 +02:00
c8fd3ba045 remove redundant check of overwriting 2021-06-21 12:48:32 +02:00
07d2945333 rename TREXIO_NUM_ALREADY_EXISTS return code 2021-06-21 12:47:39 +02:00
ec0db01f0c Documentation in dist 2021-06-18 12:04:03 +02:00
q-posev
c9f639e0e8 fix compiler warning from MacOS 2021-06-17 20:20:46 +02:00
1a54b7fcf6 fix compiler warning for const pointers 2021-06-15 12:04:30 +02:00
ac45a937af Merge branch 'master' into add-strings 2021-06-15 11:49:42 +02:00
da188dbea0 add top-level read/write functions for single strings [fortran] 2021-06-15 11:26:03 +02:00
b92a15cce7 add top-level read/write functions for string arrays [fortran] 2021-06-15 10:20:01 +02:00
eadc2c63ac fix leaking memory [front] 2021-06-14 16:27:08 +02:00
5553e9110e add top-level read/write functions that accept arrays of strings directly 2021-06-14 15:40:26 +02:00
ae32a02652 pass max_str_len parameter also to read group_str 2021-06-14 14:36:19 +02:00
be66feec16 introduce _assert and _strarray2str helper subroutines for Fortran 2021-06-14 11:55:17 +02:00
535d7ed019 enable operation on string attributes [text] 2021-06-11 18:15:30 +02:00
a40804be2e fix leaking memory and avoid allocation of empty blocks 2021-06-11 14:46:24 +02:00
13b8d24108 [WIP] prepare new subloop triggers for the generator to properly read/free groups [text] 2021-06-10 16:35:38 +02:00
2b3e79054a [WIP] working pieces for read_dset_str [text] 2021-06-10 16:34:16 +02:00
bec752361c Index OK 2021-06-10 01:49:43 +02:00
1b504d92bf Merge branch 'master' into index 2021-06-10 00:32:20 +02:00
5abac3fec2 [WIP] working write dset of strings, but with memory leak [text] 2021-06-09 18:10:59 +02:00
57b2b63902 add C preprocessor directive for memory reclaim call 2021-06-09 13:52:54 +02:00
5c4782eb03 fix Fortran interface 2021-06-08 16:11:38 +02:00
842b0efaa8 use strncat instead of strcat 2021-06-08 14:59:03 +02:00
2e210bc212 bring back the max_str_len argument for read_ functions [hdf5] 2021-06-08 14:50:59 +02:00
57a83d7cf2 cleaning front end 2021-06-08 14:50:17 +02:00
36e85039d5 make file names consistent with the C test 2021-06-08 14:39:04 +02:00
f2c5a3a51b add max_str_len argument to read/write a single string 2021-06-08 10:45:43 +02:00
231fe479e7 inline with master branch 2021-06-07 11:01:37 +02:00
1ce1872916 fix missing things after merge 2021-06-04 18:42:35 +02:00
ea9ffaea43 Fix fortran tests 2021-06-04 18:14:45 +02:00
d57f2004ba Merge branch 'master' into add-strings 2021-06-04 18:09:26 +02:00
31bf17c66a Merge branch 'master' into evgeny 2021-06-04 17:30:51 +02:00
34478e366a resolve front end 2021-06-04 17:28:56 +02:00
1bfc8d0c6c fix typos 2021-06-04 17:02:14 +02:00
5b1cf03aaf [WIP] add has/read/write functions for string attributes [front,hdf5] 2021-06-04 15:33:50 +02:00
4549276e86 Add trexio_set_one_based in fortran interface 2021-06-04 15:00:13 +02:00
77f2858548 Add index in files 2021-06-04 14:43:27 +02:00
3ce9c57376 safer strncpy in the front end 2021-06-04 09:18:59 +02:00
4fceb6624d fix error handling in write_group_dset 2021-06-03 17:33:31 +02:00
52e636f610 fix error handling in read_group_dset 2021-06-03 17:32:50 +02:00
40e9aa9234 introduce max_str_len parameter 2021-06-03 16:13:11 +02:00
ed1393f5de Merge branch 'automake' of github.com:TREX-CoE/trexio into automake 2021-06-03 13:56:49 +02:00
75af136d4f Moved sparse documentation in src/templates_front/templator_front.org 2021-06-03 13:56:45 +02:00
aa4251b943 read_group_dset can operate on char* directly instead of char** 2021-06-03 13:41:43 +02:00
d2bc25ef03 less allocations in the front end 2021-06-03 13:39:02 +02:00
40bfc581ee use newline char as a delimeter 2021-06-03 10:26:19 +02:00
5043d058bd Merge branch 'automake' of github.com:TREX-CoE/trexio into automake 2021-06-03 09:57:57 +02:00
a5ae1d239b Improve HDF5 in configure 2021-06-03 01:25:20 +02:00
693f8d3846 fix file reopening for writing new variables 2021-06-02 20:19:39 +02:00
7a9d078859 remove append mode 2021-06-02 14:40:23 +02:00
0b5136f14c add error handling for an attempt to overwrite something 2021-06-02 14:23:58 +02:00
8aa4721758 Documentation 2021-06-02 11:19:03 +02:00
196224c63b use newline character as a delimeter for array of strings 2021-06-01 18:12:15 +02:00
0f444074c9 better error handling [front] 2021-06-01 16:45:13 +02:00
6979c84c38 parse char* strings and convert them to char** for back ends 2021-06-01 14:58:16 +02:00
f45fee6cbf explicit types for strings [HDF5] 2021-06-01 10:41:00 +02:00
753c767ce2 first working prototype for string datasets [HDF5] 2021-05-31 16:42:11 +02:00
edfe8817d1 [WIP] temporarily disable calls to text back end 2021-05-31 16:40:25 +02:00
b5a6987758 first prototype of read/write string datasets 2021-05-31 13:26:52 +02:00
c18b75a11d explicit string type in front end templates 2021-05-28 17:53:26 +02:00
8b580fee4a Automake done. Need to improve tests 2021-05-28 13:36:39 +02:00
42f81b2cc6 prepare templates and files for datasets with strings [all] 2021-05-27 15:14:01 +02:00
70531b0ff6 more general group_dset_h5_dtype variable in the templates [hdf5] 2021-05-27 13:59:45 +02:00
1575c1f4d0 add functions for has/read/write_dset_str [front] 2021-05-27 13:58:35 +02:00
Evgeny Posenitskiy
29d927675e
Major refactoring of the generator script (#47)
* minor cleaning

* create functions for dictionary parsers in the external file

* remove files_exclude since post-processing does the job

* no need to have group_group_dset when propagatin dsets

* oneliner for paths to templates

* add dset_per_group dict

* add function to iteratively populate string based on triggers list

* added recursive replacer for numbers

* add recursive replaces for datasets

* add function for text groups  [iterative+recursive upd]

* do not define triggers in the master script

* transition to helper dictionaries

* cleaning

* comment main code blocks

* rearrange parameters

* add documentation strings to the functions

* minor cleaning and changes

* adapt build_trexio script

* add consisteny check for dimensioning variables
2021-05-26 19:11:46 +02:00
1d5c452071 Not bugs found with scan-build 2021-05-19 22:02:40 +02:00
0cc24bd21e error handling for trexio_text_deinit function 2021-05-19 15:03:15 +02:00
q-posev
f77a5af4e0 fix a typo 2021-05-18 12:07:37 +02:00
q-posev
047153b7c1 remove NULL pointer check for file_name in text 2021-05-18 11:43:05 +02:00
q-posev
d97c111284 fix the default precision of int datasets 2021-05-18 11:42:26 +02:00
692f45ed7f Correct rank in Fortran interface 2021-05-08 00:35:53 +02:00
cd8332a3e5 Added notes for sparse data structures 2021-05-07 00:02:12 +02:00
87bb6fcb6e Better error messages 2021-05-06 19:56:42 +02:00
7302f02b9c Improved error messages 2021-05-06 19:54:37 +02:00
181fe988f3 Fixed append problem 2021-05-06 19:40:27 +02:00
1cfa313d07 Error messages 2021-05-06 18:25:51 +02:00
q-posev
6e54e89d24 inttypes macros for rdm 2021-05-06 18:17:41 +02:00
20d551a70b include inttypes to fix portability issues in text back end 2021-05-06 18:08:28 +02:00
57655a8344 add error message for an attempt to overwrite dimensioning variables 2021-05-06 17:44:31 +02:00
db5544e810 Improved error codes 2021-05-06 15:09:50 +02:00
5e3c085fb7 discard patch for rdm 2021-05-06 09:38:28 +02:00
d3b35ae453 discard portability patch 2021-05-06 09:35:48 +02:00
q-posev
48d300674a portability patch for mac 2021-05-06 09:19:05 +02:00
c7349ef2ef datarootdir in src/Makefile.in 2021-05-05 13:46:40 +02:00
f272d27863 pkgconfig 2021-05-05 12:17:15 +02:00
f7dea1fd1c Fixed configure and install 2021-05-05 11:37:48 +02:00
9c2b240418 more portable HDF5 back end 2021-05-04 20:22:58 +02:00
5f4f94646f replace ULLONG with UINT64 2021-05-04 14:16:12 +02:00
daf3fdeb8b Fixed warning about strlen in strncpy 2021-05-04 10:03:32 +02:00
03f58a649e fixed make install and introduced uninstall targets 2021-05-03 15:15:49 +02:00
q-posev
a9c506dd15 fix distcheck rule 2021-04-30 20:10:06 +02:00
q-posev
be8386f770 rm libtrexio after creating a copy in the lib directory 2021-04-30 19:58:38 +02:00
4578fb1a2b adapt rules for new structure of the root directory 2021-04-30 19:04:43 +02:00
51660199c2 create tests directory 2021-04-30 15:50:41 +02:00
1e9581e2d2 move tests to the corresponding directory 2021-04-30 15:50:05 +02:00
caee3576b7 move generator to tools directory 2021-04-30 14:22:32 +02:00
203e9027a6 fix paths 2021-04-30 14:12:23 +02:00
faa936cc54 move build_trexio script to tools directory 2021-04-30 13:50:51 +02:00
Evgeny Posenitskiy
818d66d4d3
Autoconfig with optional HDF5 compilation (#42)
Makefile.in:
* recursive build;
* advanced make targets;
* major support for autoconf and minor for package managers.

configure.ac:
* optional HDF5 compilation [default: --with-hdf5];
* add -fPIC to CFLAGS if missing.
2021-04-28 15:30:18 +02:00
08a28c9ae4 Using pkg-config for hdf5 in Makefile 2021-04-26 22:46:43 +02:00
728d7bb3ad Fixed test : coord(3,12) 2021-04-20 01:34:11 +02:00
Evgeny Posenitskiy
8defdaa0c0
org-mode to html conversion for the documentation website (#41)
* working static html doc website generated from org-mode files

* fix build_doc script

* add gitignore

* add gitignore

* clean html garbage

* documented hdf5

* documented text back end
2021-04-09 16:45:44 +02:00
7e55933fea make consistent hierarchy in org-mode files 2021-04-08 11:40:50 +02:00
b656917323 consistent naming init/deinit instead init/finalize in back ends 2021-04-08 11:31:51 +02:00
b8c9bfa2df renamed build_trex script 2021-04-08 11:25:42 +02:00
Evgeny Posenitskiy
c43259176d
Add 32-bit funcs and document front end (#39)
* 32-bit functions
* adapt tests since the default write/read_num is now 32-bit
* minor cleaning in the generator
* add test for _32 functionality
* rm stdint-based types from test
* documentation
* rm trailing whitespaces in emacs
* change TREXIO_INVALID_BACK_END
* update gitignore
2021-04-07 17:37:04 +02:00
4e47e497d5 Table to generate error codes and string_of_error function 2021-04-01 22:48:04 +02:00
0419a8c87b Improved Makefile 2021-04-01 22:45:42 +02:00
200473ad16 generate full library + dummy fix for group names 2021-03-30 21:42:42 +02:00
42df2253eb better error handling 2021-03-30 16:03:34 +02:00
7d24442984 FIX: truncated precision of floats [text] 2021-03-30 15:44:26 +02:00
5fb1418f9b BUG: truncated precision for doubles [text] 2021-03-30 14:20:46 +02:00
53d51a7902 add tests for has_ functionality 2021-03-30 11:56:04 +02:00
0d0bed0585 forgot text templator 2021-03-30 11:51:05 +02:00
068beacb07 working has_ functions [all] 2021-03-30 11:50:02 +02:00
679c462d63 enhanced fortran interface 2021-03-29 14:34:41 +02:00
Evgeny Posenitskiy
18c6fb845f
Smart deallocation of dsets upon failure in read_group [text] (#35)
* fix FC variable
* smart deallocation of dsets + some cleaning in templator [text]
2021-03-29 13:27:54 +02:00
5fc0371276 Compliant with CERT 2021-03-29 00:37:56 +02:00
086a34d5b1 const 2021-03-29 00:34:56 +02:00
3f2261ea9b Undefined num_id in HDF5 2021-03-29 00:34:03 +02:00
9edeb7825e strncat 2021-03-28 22:41:49 +02:00
56389752de const 2021-03-28 22:38:32 +02:00
4e68a808a0 scope and shadowed variable 2021-03-28 22:14:24 +02:00
35daf9db05 Redundant assignments 2021-03-28 22:10:56 +02:00
e10285efee Format strings 2021-03-28 22:01:56 +02:00