Comments (4)
The best solution is to check that the total number of elements in user-provided array is consistent with the size of array in the file
from trexio.
You can't do it without passing the size of the array as a parameter to the function. I agree that it would be good to do it, but I am sure that the users will complain that it is redundant because we already have set nucleus_num.
Maybe we should provide both variants : one safe where you pass the dimensions as an additional parameter (an array of dimensions), and an unsafe variant which is what we have now.
from trexio.
In the Fortran interface it should be possible to do that:
interface
integer function trexio_write_nucleus_coord_s (trex_file, dset, dim) bind(C)
use, intrinsic :: iso_c_binding
integer(8), intent(in), value :: trex_file
real(8), intent(in) :: dset(*)
integer(4), intent(in) :: dim(2)
end function trexio_write_nucleus_coord_s
end interface
integer function trexio_write_nucleus_coord (trex_file, dset)
use, intrinsic :: iso_c_binding
integer(8), intent(in), value :: trex_file
real(8), intent(in) :: dset(:,:)
call trexio_write_nucleus_coord_s(trex_file, dset, shape(dset))
end function trexio_write_nucleus_coord
So that the fortran has only the "unsafe" API, but it calls the safe C routines. The real unsafe nature will only be present in C.
from trexio.
@scemama I agree that this is not really user-friendly and unfortunately we cannot evaluate the number of elements when a pointer to an array is passed to a C function. For the Fortran and Python interfaces it is doable.
from trexio.
Related Issues (20)
- Still reachable memory reported by Valgrind
- pkg-config is broken after HDF5 detection rewriting
- External group HOT 2
- search bar for the website
- machine-independent emacs config for org-mode
- version-dependent compilation issue with Autotools HOT 1
- Version number in file HOT 1
- user name and machine in file? HOT 1
- Write numerical attributes that are not positive or float
- Compilation : User side improvement HOT 2
- ecp_local_coef does not have L=0 data for Z>1 HOT 1
- Impossible to disable maintainer mode
- Co-existing HDF5 (serial and parallel) + PKG_CHECK_MODULES issue HOT 2
- Backwards incompatibility of `TREXIO_TEXT` back end
- Symmetry in indices of sparse data HOT 2
- Add a hdf5 <-> text converter HOT 1
- Broken backwards compatibility HOT 1
- Warnings when compiling
- verbose error reporting HOT 2
- Does the TREXIO format support Cartesian contaminants? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trexio.