From 1be9bd3220fb0678351198708bb34ad1fa0db346 Mon Sep 17 00:00:00 2001 From: scemama Date: Tue, 2 Nov 2021 10:53:25 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20TREX-CoE?= =?UTF-8?q?/trexio@20f06d63ec9653c6c730c1a2311cf2c4ca96dace=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.html | 4 +- Sparse.html | 16 +- index.html | 4 +- templator_front.html | 536 +++++++++++++++++++++++++++---------------- templator_hdf5.html | 52 ++--- templator_text.html | 112 ++++----- trex.html | 116 +++++----- 7 files changed, 491 insertions(+), 349 deletions(-) diff --git a/README.html b/README.html index f2267a6..657a280 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TREXIO source code documentation @@ -343,7 +343,7 @@ and bug reports should be submitted at

Author: TREX-CoE

-

Created: 2021-11-01 Mon 10:44

+

Created: 2021-11-02 Tue 10:53

Validate

diff --git a/Sparse.html b/Sparse.html index 74b3ddc..dcb8330 100644 --- a/Sparse.html +++ b/Sparse.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -232,8 +232,8 @@ for the JavaScript code in this tag.

Table of Contents

@@ -241,8 +241,8 @@ for the JavaScript code in this tag. See templatorfront.org

-
-

1 Text back end

+
+

1 Text back end

As the size of the dataset should be extensible, the simplest @@ -256,8 +256,8 @@ The offset can be used with fseek(69L*offset, SEEK_SET)

-
-

2 HDF5 Back end

+
+

2 HDF5 Back end

We need to declare the number of rows of the dataset as @@ -278,7 +278,7 @@ If the offset+num > nmax, we need to extend the dataset.

-

Created: 2021-11-01 Mon 10:44

+

Created: 2021-11-02 Tue 10:53

Validate

diff --git a/index.html b/index.html index f2267a6..657a280 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TREXIO source code documentation @@ -343,7 +343,7 @@ and bug reports should be submitted at

Author: TREX-CoE

-

Created: 2021-11-01 Mon 10:44

+

Created: 2021-11-02 Tue 10:53

Validate

diff --git a/templator_front.html b/templator_front.html index 288d4f7..39e0197 100644 --- a/templator_front.html +++ b/templator_front.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Front end API @@ -333,125 +333,125 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Coding conventions

+
+

1 Coding conventions

  • integer types will be defined using types given in stdint.h
  • @@ -466,8 +466,8 @@ for the JavaScript code in this tag.
-
-

1.1 Memory allocation

+
+

1.1 Memory allocation

Memory allocation of structures can be facilitated by using the @@ -502,8 +502,8 @@ The maximum string size for the filenames is 4096 characters.

-
-

2 Front end

+
+

2 Front end

All calls to TREXIO are thread-safe. @@ -511,10 +511,10 @@ TREXIO front end is modular, which simplifies implementation of new back ends.

-
-

2.1 Error handling

+
+

2.1 Error handling

- +
@@ -694,6 +694,12 @@ TREXIO front end is modular, which simplifies implementation of new back ends. + + + + + + @@ -736,8 +742,8 @@ TREXIO front end is modular, which simplifies implementation of new back ends. -
-

2.1.1 Decoding errors

+
+

2.1.1 Decoding errors

The trexio_string_of_error converts an exit code into a string. The @@ -760,8 +766,8 @@ The text strings are extracted from the previous table.

-
-
2.1.1.1 C source code
+
+
2.1.1.1 C source code
const char*
@@ -849,6 +855,9 @@ The text strings are extracted from the previous table.
   case TREXIO_DSET_MISSING:
     return "Dataset does not exist in the file";
     break;
+  case TREXIO_BACK_END_MISSING:
+    return "Requested back end is disabled";
+    break;
   case TREXIO_INVALID_STR_LEN:
     return "Invalid max_str_len";
     break;
@@ -866,8 +875,8 @@ The text strings are extracted from the previous table.
 
-
-
2.1.1.2 Fortran interface
+
+
2.1.1.2 Fortran interface
interface
@@ -883,8 +892,8 @@ The text strings are extracted from the previous table.
 
-
-
2.1.1.3 Python interface
+
+
2.1.1.3 Python interface
class Error(Exception):
@@ -923,8 +932,8 @@ The text strings are extracted from the previous table.
 
-
-

2.2 Back ends

+
+

2.2 Back ends

TREXIO has several back ends: @@ -948,42 +957,83 @@ lines that correspond to the TREXIO_JSON back end (not implemented

-
-

2.2.1 C

+
+

2.2.1 C

typedef int32_t back_end_t;
 
 #define TREXIO_HDF5             ( (back_end_t) 0 )
 #define TREXIO_TEXT             ( (back_end_t) 1 )
-/*#define TREXIO_JSON             ( (back_end_t) 2 )*/
 #define TREXIO_INVALID_BACK_END ( (back_end_t) 2 )
+/*#define TREXIO_JSON             ( (back_end_t) 2 )*/
 
 #define TREXIO_DELIM            "\n"
 
+ +

+The helper function trexio_has_backend returns true if TREXIO compilation includes a back end provided as an argument; false otherwise. +This is useful due to the fact that HDF5 back end can be disabled at configure step. +

+ +
+
bool trexio_has_backend(back_end_t back_end);
+
+
+ +
+
bool trexio_has_backend(back_end_t back_end) {
+  switch (back_end) {
+    case TREXIO_TEXT:
+      return true;
+    case TREXIO_HDF5:
+#ifdef HAVE_HDF5
+      return true;
+#else
+      return false;
+#endif
+  }
+  return false;
+}   
+
+
-
-

2.2.2 Fortran

+
+

2.2.2 Fortran

-
  integer(trexio_backend), parameter :: TREXIO_HDF5 = 0
+
  integer(trexio_backend), parameter :: TREXIO_HDF5 = 0 
   integer(trexio_backend), parameter :: TREXIO_TEXT = 1
 ! integer(trexio_backend), parameter :: TREXIO_JSON = 2
   integer(trexio_backend), parameter :: TREXIO_INVALID_BACK_END = 2
 
+ +

+The function below is a Fortran interface for the aforementioned C-compatible trexio_has_backend function. +

+ +
+
interface
+   logical function trexio_has_backend (back_end) bind(C)
+     use, intrinsic :: iso_c_binding
+     integer(4), intent(in), value :: back_end
+   end function trexio_has_backend
+end interface
+
+
-
-

2.2.3 Python

+
+

2.2.3 Python

# define TREXIO back ends
-TREXIO_HDF5 = 0
+TREXIO_HDF5 = 0 
 TREXIO_TEXT = 1
 #TREXIO_JSON = 2
 TREXIO_INVALID_BACK_END = 2
@@ -993,8 +1043,8 @@ lines that correspond to the TREXIO_JSON back end (not implemented
 
-
-

2.3 Read/write behavior

+
+

2.3 Read/write behavior

Every time a reading function is called, the data is read from the @@ -1022,8 +1072,8 @@ concurrent programs, the behavior is not specified.

-
-

2.4 TREXIO file type

+
+

2.4 TREXIO file type

trexio_s is the the main type for TREXIO files, visible to the users @@ -1057,8 +1107,8 @@ TREXIO files will have as a first argument the TREXIO file handle.

-
-

2.4.1 TREXIOFile Python class

+
+

2.4.1 TREXIOFile Python class

class File:
@@ -1131,8 +1181,8 @@ TREXIO files will have as a first argument the TREXIO file handle.
 
-
-

2.5 Polymorphism of the file handle

+
+

2.5 Polymorphism of the file handle

Polymorphism of the trexio_t type is handled by ensuring that the @@ -1151,8 +1201,8 @@ corresponding types for all back ends can be safely casted to

-
-

2.6 File opening

+
+

2.6 File opening

trexio_open creates a new TREXIO file or opens existing one. @@ -1191,8 +1241,8 @@ renaming the .txt data files.

-
-

2.6.1 C

+
+

2.6.1 C

trexio_t*
@@ -1227,8 +1277,13 @@ renaming the .txt data files.
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     result_tmp = malloc(sizeof(trexio_hdf5_t));
     break;
+#else
+    if (rc_open != NULL) *rc_open = TREXIO_BACK_END_MISSING;
+    return NULL;
+#endif
 /*
   case TREXIO_JSON:
     result = (trexio_t*) malloc (sizeof(trexio_json_t));
@@ -1278,8 +1333,13 @@ renaming the .txt data files.
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_init(result);
     break;
+#else
+    if (rc_open != NULL) *rc_open = TREXIO_BACK_END_MISSING;
+    return NULL;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_init(result);
@@ -1308,8 +1368,13 @@ renaming the .txt data files.
       break;
 
     case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
       rc = trexio_hdf5_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION);
       break;
+#else
+      if (rc_open != NULL) *rc_open = TREXIO_BACK_END_MISSING;
+      return NULL;
+#endif 
 /*
     case TREXIO_JSON:
       rc = trexio_json_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION);
@@ -1336,8 +1401,13 @@ renaming the .txt data files.
     break;
   /* HDF5 v.>=1.10 has file locking activated by default */
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = TREXIO_SUCCESS;
     break;
+#else
+    if (rc_open != NULL) *rc_open = TREXIO_BACK_END_MISSING;
+    return NULL;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_lock(result);
@@ -1359,8 +1429,8 @@ renaming the .txt data files.
 
-
-

2.6.2 Fortran

+
+

2.6.2 Fortran

interface
@@ -1378,8 +1448,8 @@ renaming the .txt data files.
 
-
-

2.6.3 Python

+
+

2.6.3 Python

def open(file_name: str, mode: str, back_end: int):
@@ -1427,8 +1497,8 @@ renaming the .txt data files.
 
-
-

2.6.4 Zero-based versus one-based arrays of indices

+
+

2.6.4 Zero-based versus one-based arrays of indices

Because arrays are zero-based in Fortran, we need to set a flag to @@ -1461,8 +1531,8 @@ know if we need to shift by 1 arrays of indices.

-
-

2.7 File closing

+
+

2.7 File closing

trexio_close closes an existing trexio_t file. @@ -1479,8 +1549,8 @@ output:

-
-

2.7.1 C

+
+

2.7.1 C

trexio_exit_code
@@ -1501,8 +1571,12 @@ output:
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_deinit(file);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_deinit(file);
@@ -1526,8 +1600,12 @@ output:
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = TREXIO_SUCCESS;
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_unlock(file);
@@ -1551,8 +1629,8 @@ output:
 
-
-

2.7.2 Fortran

+
+

2.7.2 Fortran

interface
@@ -1566,8 +1644,8 @@ output:
 
-
-

2.7.3 Python

+
+

2.7.3 Python

def close(trexio_file):
@@ -1589,12 +1667,12 @@ output:
 
-
-

3 Templates for front end

+
+

3 Templates for front end

-
-

3.1 Description

+
+

3.1 Description

Consider the following block of trex.json: @@ -1815,12 +1893,12 @@ value will result in TREXIO_INVALID_ARG_2 exit code.

-
-

3.2 Templates for front end has/read/write a single numerical attribute

+
+

3.2 Templates for front end has/read/write a single numerical attribute

-
-

3.2.1 Introduction

+
+

3.2.1 Introduction

This section concerns API calls related to numerical attributes, @@ -1891,8 +1969,8 @@ namely single value of int/float types.

-
-

3.2.2 C templates for front end

+
+

3.2.2 C templates for front end

The C templates that correspond to each of the abovementioned @@ -1906,12 +1984,12 @@ precision (see Table above).

-
-
3.2.2.1 Function declarations
+
+
3.2.2.1 Function declarations
-
-
3.2.2.2 Source code for double precision functions
+
+
3.2.2.2 Source code for double precision functions
trexio_exit_code
@@ -1927,8 +2005,12 @@ precision (see Table above).
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_read_$group_num$(file, num);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_read_$group_num$(file, num);
@@ -1955,9 +2037,13 @@ precision (see Table above).
     return trexio_text_write_$group_num$(file, num);
     break;                                     
 
-  case TREXIO_HDF5:                            
+  case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_write_$group_num$(file, num);
-    break;                                     
+    break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*                                             
   case TREXIO_JSON:                            
     return trexio_json_write_$group_num$(file, num);
@@ -1972,8 +2058,8 @@ precision (see Table above).
 
-
-
3.2.2.3 Source code for single precision functions
+
+
3.2.2.3 Source code for single precision functions
trexio_exit_code
@@ -1992,8 +2078,12 @@ precision (see Table above).
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_read_$group_num$(file, &num_64);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc =trexio_json_read_$group_num$(file, &num_64);
@@ -2024,9 +2114,13 @@ precision (see Table above).
     return trexio_text_write_$group_num$(file, ($group_num_dtype_double$) num);
     break;                                             
 
-  case TREXIO_HDF5:                                    
+  case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_write_$group_num$(file, ($group_num_dtype_double$) num);
-    break;                                             
+    break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif 
 /*                                                     
   case TREXIO_JSON:                                    
     return trexio_json_write_$group_num$(file, ($group_num_dtype_double$) num);
@@ -2041,8 +2135,8 @@ precision (see Table above).
 
-
-
3.2.2.4 Source code for default functions
+
+
3.2.2.4 Source code for default functions
trexio_exit_code
@@ -2078,8 +2172,12 @@ precision (see Table above).
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_has_$group_num$(file);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_has_$group_num$(file);
@@ -2095,8 +2193,8 @@ precision (see Table above).
 
-
-

3.2.3 Fortran templates for front end

+
+

3.2.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -2181,8 +2279,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.2.4 Python templates for front end

+
+

3.2.4 Python templates for front end

def write_$group_num$(trexio_file, num_w: $group_num_py_dtype$) -> None: 
@@ -2267,12 +2365,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.3 Templates for front end has/read/write a dataset of numerical data

+
+

3.3 Templates for front end has/read/write a dataset of numerical data

-
-

3.3.1 Introduction

+
+

3.3.1 Introduction

This section concerns API calls related to datasets. @@ -2354,8 +2452,8 @@ This section concerns API calls related to datasets.

-
-

3.3.2 C templates for front end

+
+

3.3.2 C templates for front end

The C templates that correspond to each of the abovementioned functions can be found below. @@ -2366,13 +2464,13 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T

-
-
3.3.2.1 Function declarations
+
+
3.3.2.1 Function declarations
-
-
3.3.2.2 Source code for double precision functions
+
+
3.3.2.2 Source code for double precision functions
trexio_exit_code
@@ -2404,8 +2502,12 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_read_$group_dset$(file, $group_dset$, rank, dims);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_read_$group_dset$(file, $group_dset$, rank, dims);
@@ -2479,8 +2581,12 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_write_$group_dset$(file, $group_dset$_p, rank, dims);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_write_$group_dset$(file, $group_dset$_p, rank, dims);
@@ -2500,8 +2606,8 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
 
-
-
3.3.2.3 Source code for single precision functions
+
+
3.3.2.3 Source code for single precision functions
trexio_exit_code
@@ -2542,8 +2648,12 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_read_$group_dset$(file, $group_dset$_64, rank, dims);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_read_$group_dset$(file, $group_dset$_64, rank, dims);
@@ -2622,8 +2732,12 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_write_$group_dset$(file, $group_dset$_64, rank, dims);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_write_$group_dset$(file, $group_dset$_64, rank, dims);
@@ -2642,11 +2756,11 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
 
-
-
3.3.2.4 Source code for memory-safe functions
+
+
3.3.2.4 Source code for memory-safe functions
-
trexio_exit_code rc;
+
trexio_exit_code rc;
 int64_t $group_dset_dim$ = 0;
 
 /* Error handling for this call is added by the generator */
@@ -2802,8 +2916,8 @@ rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
 
-
-
3.3.2.5 Source code for default functions
+
+
3.3.2.5 Source code for default functions
trexio_exit_code
@@ -2861,8 +2975,12 @@ rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_has_$group_dset$(file);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_has_$group_dset$(file);
@@ -2877,8 +2995,8 @@ rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
 
-
-

3.3.3 Fortran templates for front end

+
+

3.3.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -2963,8 +3081,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.3.4 Python templates for front end

+
+

3.3.4 Python templates for front end

def write_$group_dset$(trexio_file, dset_w) -> None: 
@@ -3159,8 +3277,8 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.4 Sparse data structures

+
+

3.4 Sparse data structures

Sparse data structures are used typically for large tensors such as @@ -3301,12 +3419,12 @@ For the values,

-
-

3.5 Templates for front end has/read/write a dataset of strings

+
+

3.5 Templates for front end has/read/write a dataset of strings

-
-

3.5.1 Introduction

+
+

3.5.1 Introduction

This section concerns API calls related to datasets of strings. @@ -3346,8 +3464,8 @@ This section concerns API calls related to datasets of strings.

-
-

3.5.2 C templates for front end

+
+

3.5.2 C templates for front end

First parameter is the TREXIO file handle. Second parameter is the variable to be written/read @@ -3355,12 +3473,12 @@ to/from the TREXIO file (except for trexio_has_ functi

-
-
3.5.2.1 Function declarations
+
+
3.5.2.1 Function declarations
-
-
3.5.2.2 Source code for default functions
+
+
3.5.2.2 Source code for default functions
trexio_exit_code
@@ -3391,8 +3509,12 @@ to/from the TREXIO file (except for trexio_has_ functi
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_read_$group_dset$(file, dset_out, rank, dims, (uint32_t) max_str_len);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_read_$group_dset$(file, dset_out, rank, dims);
@@ -3516,8 +3638,12 @@ to/from the TREXIO file (except for trexio_has_ functi
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     rc = trexio_hdf5_write_$group_dset$(file, (const char**) dset_str, rank, dims);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     rc = trexio_json_write_$group_dset$(file, dset, rank, dims);
@@ -3585,8 +3711,12 @@ to/from the TREXIO file (except for trexio_has_ functi
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_has_$group_dset$(file);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_has_$group_dset$(file);
@@ -3602,8 +3732,8 @@ to/from the TREXIO file (except for trexio_has_ functi
 
-
-

3.5.3 Fortran templates for front end

+
+

3.5.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -3699,8 +3829,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.5.4 Python templates for front end

+
+

3.5.4 Python templates for front end

def write_$group_dset$(trexio_file, dset_w: list) -> None: 
@@ -3816,12 +3946,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.6 Templates for front end has/read/write a single string attribute

+
+

3.6 Templates for front end has/read/write a single string attribute

-
-

3.6.1 Introduction

+
+

3.6.1 Introduction

This section concerns API calls related to string attributes. @@ -3861,16 +3991,16 @@ This section concerns API calls related to string attributes.

-
-

3.6.2 C templates for front end

+
+

3.6.2 C templates for front end

-
-
3.6.2.1 Function declarations
+
+
3.6.2.1 Function declarations
-
-
3.6.2.2 Source code for default functions
+
+
3.6.2.2 Source code for default functions
trexio_exit_code
@@ -3889,8 +4019,12 @@ This section concerns API calls related to string attributes.
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_read_$group_str$(file, str_out, (uint32_t) max_str_len);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_read_$group_str$(file, str);
@@ -3923,8 +4057,12 @@ This section concerns API calls related to string attributes.
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_write_$group_str$(file, str);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_write_$group_str$(file, str);
@@ -3953,8 +4091,12 @@ This section concerns API calls related to string attributes.
     break;
 
   case TREXIO_HDF5:
+#ifdef HAVE_HDF5 
     return trexio_hdf5_has_$group_str$(file);
     break;
+#else
+    return TREXIO_BACK_END_MISSING;
+#endif
 /*
   case TREXIO_JSON:
     return trexio_json_has_$group_str$(file);
@@ -3970,8 +4112,8 @@ This section concerns API calls related to string attributes.
 
-
-

3.6.3 Fortran templates for front end

+
+

3.6.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -4048,8 +4190,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.6.4 Python templates for front end

+
+

3.6.4 Python templates for front end

def write_$group_str$(trexio_file, str_w: str) -> None: 
@@ -4139,8 +4281,8 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

4 Fortran helper/wrapper functions

+
+

4 Fortran helper/wrapper functions

The function below adapts the original C-based trexio_open for Fortran. @@ -4275,7 +4417,7 @@ two code are identical, i.e. if the assert statement pass.

Author: TREX-CoE

-

Created: 2021-11-01 Mon 10:43

+

Created: 2021-11-02 Tue 10:53

Validate

diff --git a/templator_hdf5.html b/templator_hdf5.html index 9864ace..ead1a0e 100644 --- a/templator_hdf5.html +++ b/templator_hdf5.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + HDF5 back end @@ -311,27 +311,27 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 HDF5 back end

+
+

1 HDF5 back end

-
-

1.1 Template for HDF5 definitions

+
+

1.1 Template for HDF5 definitions

#define $GROUP$_GROUP_NAME          "$group$"
@@ -343,8 +343,8 @@ for the JavaScript code in this tag.
 
-
-

1.2 Template for HDF5 structures

+
+

1.2 Template for HDF5 structures

typedef struct trexio_hdf5_s {
@@ -358,8 +358,8 @@ for the JavaScript code in this tag.
 
-
-

1.3 Template for HDF5 init/deinit

+
+

1.3 Template for HDF5 init/deinit

trexio_exit_code
@@ -439,8 +439,8 @@ for the JavaScript code in this tag.
 
-
-

1.4 Template for HDF5 has/read/write the numerical attribute

+
+

1.4 Template for HDF5 has/read/write the numerical attribute

trexio_exit_code
@@ -534,8 +534,8 @@ for the JavaScript code in this tag.
 
-
-

1.5 Template for HDF5 has/read/write the dataset of numerical data

+
+

1.5 Template for HDF5 has/read/write the dataset of numerical data

trexio_exit_code
@@ -658,8 +658,8 @@ for the JavaScript code in this tag.
 
-
-

1.6 Template for HDF5 has/read/write the dataset of strings

+
+

1.6 Template for HDF5 has/read/write the dataset of strings

trexio_exit_code
@@ -864,8 +864,8 @@ for the JavaScript code in this tag.
 
-
-

1.7 Template for HDF5 has/read/write the string attribute

+
+

1.7 Template for HDF5 has/read/write the string attribute

trexio_exit_code
@@ -992,7 +992,7 @@ for the JavaScript code in this tag.
 

Author: TREX-CoE

-

Created: 2021-11-01 Mon 10:44

+

Created: 2021-11-02 Tue 10:53

Validate

diff --git a/templator_text.html b/templator_text.html index cc85df3..122d1d2 100644 --- a/templator_text.html +++ b/templator_text.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TEXT back end @@ -311,26 +311,26 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 TEXT back end

+
+

1 TEXT back end

The "file" produced by the text back end is a directory with one @@ -361,8 +361,8 @@ The file is written when closed, or when the flush function is called.

-
-

1.1 Template for group-related structures in text back end

+
+

1.1 Template for group-related structures in text back end

typedef struct $group$_s {
@@ -381,8 +381,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

1.2 Template for general structure in text back end

+
+

1.2 Template for general structure in text back end

typedef struct rdm_s {
@@ -408,8 +408,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

1.3 Initialize function (constant part)

+
+

1.3 Initialize function (constant part)

trexio_exit_code
@@ -540,8 +540,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

1.4 Deinitialize function (templated part)

+
+

1.4 Deinitialize function (templated part)

trexio_exit_code
@@ -566,8 +566,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

1.5 Template for text read struct

+
+

1.5 Template for text read struct

$group$_t*
@@ -861,8 +861,8 @@ trexio_text_read_$group$ (trexio_text_t* 
 
-
-

1.6 Template for text flush struct

+
+

1.6 Template for text flush struct

trexio_exit_code
@@ -927,8 +927,8 @@ trexio_text_read_$group$ (trexio_text_t* 
 
-
-

1.7 Template for text free memory

+
+

1.7 Template for text free memory

Memory is allocated when reading. The following function frees memory. @@ -973,8 +973,8 @@ Memory is allocated when reading. The following function frees memory.

-
-

1.8 Template for has/read/write the numerical attribute

+
+

1.8 Template for has/read/write the numerical attribute

trexio_exit_code
@@ -1037,8 +1037,8 @@ Memory is allocated when reading. The following function frees memory.
 
-
-

1.9 Template for has/read/write the dataset of numerical data

+
+

1.9 Template for has/read/write the dataset of numerical data

The group_dset array is assumed allocated with the appropriate size. @@ -1134,8 +1134,8 @@ The group_dset array is assumed allocated with the appropriate size

-
-

1.10 Template for has/read/write the dataset of strings

+
+

1.10 Template for has/read/write the dataset of strings

The group_dset array is assumed allocated with the appropriate size. @@ -1236,8 +1236,8 @@ The group_dset array is assumed allocated with the appropriate size

-
-

1.11 Template for has/read/write the string attribute

+
+

1.11 Template for has/read/write the string attribute

trexio_exit_code
@@ -1311,12 +1311,12 @@ The group_dset array is assumed allocated with the appropriate size
 
-
-

1.12 RDM struct (hard-coded)

+
+

1.12 RDM struct (hard-coded)

-
-

1.12.1 Read the complete struct

+
+

1.12.1 Read the complete struct

rdm_t* trexio_text_read_rdm(trexio_text_t* const file);
@@ -1411,8 +1411,8 @@ The group_dset array is assumed allocated with the appropriate size
 
-
-

1.12.2 Flush the complete struct

+
+

1.12.2 Flush the complete struct

trexio_exit_code trexio_text_flush_rdm(trexio_text_t* const file);
@@ -1454,8 +1454,8 @@ The group_dset array is assumed allocated with the appropriate size
 
-
-

1.12.3 Free memory

+
+

1.12.3 Free memory

Memory is allocated when reading. The followig function frees memory. @@ -1491,8 +1491,8 @@ Memory is allocated when reading. The followig function frees memory.

-
-

1.12.4 Read/Write the onee attribute

+
+

1.12.4 Read/Write the onee attribute

The one_e array is assumed allocated with the appropriate size. @@ -1558,8 +1558,8 @@ The one_e array is assumed allocated with the appropriate size.

-
-

1.12.5 Read/Write the twoe attribute

+ @@ -399,8 +399,8 @@ arrays are 0-based. Hence, we introduce the index type which is an 1-based int in the Fortran interface and 0-based otherwise.

-
-

1 Metadata (metadata group)

+
+

1 Metadata (metadata group)

As we expect our files to be archived in open-data repositories, we @@ -410,7 +410,7 @@ which have participated to the creation of the file, a list of authors of the file, and a textual description.

-
'Dataset does not exist in the file'
TREXIO_BACK_END_MISSING26'Requested back end is disabled'
TREXIO_INVALID_STR_LEN 30
+
@@ -477,15 +477,15 @@ authors of the file, and a textual description. -
-

2 Electron (electron group)

+
+

2 Electron (electron group)

We consider wave functions expressed in the spin-free formalism, where the number of ↑ and ↓ electrons is fixed.

-
+
@@ -524,15 +524,15 @@ the number of ↑ and ↓ electrons is fixed. -
-

3 Nucleus (nucleus group)

+
+

3 Nucleus (nucleus group)

The nuclei are considered as fixed point charges. Coordinates are given in Cartesian \((x,y,z)\) format.

-
+
@@ -592,8 +592,8 @@ given in Cartesian \((x,y,z)\) format. -
-

4 Effective core potentials (ecp group)

+
+

4 Effective core potentials (ecp group)

An effective core potential (ECP) \(V_A^{\text{ECP}}\) replacing the @@ -626,7 +626,7 @@ The functions \(V_{A\ell}\) are parameterized as: See http://dx.doi.org/10.1063/1.4984046 or https://doi.org/10.1063/1.5121006 for more info.

-
+
@@ -724,8 +724,8 @@ The latter causes issues when written before ang_mom in the TREXIO

-
-

4.1 Example

+
+

4.1 Example

For example, consider H2 molecule with the following @@ -788,8 +788,8 @@ power = [

-
-

5 Basis set (basis group)

+
+

5 Basis set (basis group)

We consider here basis functions centered on nuclei. Hence, we enable @@ -842,7 +842,7 @@ If the the basis function is not considered normalized, \(\mathcal{N}_s=1\). All the basis set parameters are stored in one-dimensional arrays:

-
+
@@ -936,8 +936,8 @@ All the basis set parameters are stored in one-dimensional arrays:
-
-

5.1 Example

+
+

5.1 Example

For example, consider H2 with the following basis set (in GAMESS @@ -1015,8 +1015,8 @@ prim_factor =

-
-

6 Atomic orbitals (ao group)

+
+

6 Atomic orbitals (ao group)

Going from the atomic basis set to AOs implies a systematic @@ -1064,13 +1064,13 @@ shell, as in the GAMESS convention where

In such a case, one should set the normalization of the shell (in -the Basis set section) to \(\mathcal{N}_{z^2}\), which is the +the Basis set section) to \(\mathcal{N}_{z^2}\), which is the normalization factor of the atomic orbitals in spherical coordinates. The normalization factor of the \(xy\) function which should be introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).

- +
@@ -1122,8 +1122,8 @@ introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).
-
-

6.1 One-electron integrals (ao_1e_int group)

+
+

6.1 One-electron integrals (ao_1e_int group)

  • \[ \hat{V}_{\text{ne}} = \sum_{A=1}^{N_\text{nucl}} @@ -1141,7 +1141,7 @@ The one-electron integrals for a one-electron operator \(\hat{O}\) are over atomic orbitals.

    - +
    @@ -1208,8 +1208,8 @@ over atomic orbitals. -
    -

    6.2 Two-electron integrals (ao_2e_int group)

    +
    +

    6.2 Two-electron integrals (ao_2e_int group)

    The two-electron integrals for a two-electron operator \(\hat{O}\) are @@ -1230,7 +1230,7 @@ notation. \mathbf{r}_j \vert)}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron long range potential -

    +
    @@ -1270,10 +1270,10 @@ notation. -
    -

    7 Molecular orbitals (mo group)

    +
    +

    7 Molecular orbitals (mo group)

    -
    +
    @@ -1339,8 +1339,8 @@ notation.
-
-

7.1 One-electron integrals (mo_1e_int group)

+
+

7.1 One-electron integrals (mo_1e_int group)

The operators as the same as those defined in the @@ -1348,7 +1348,7 @@ The operators as the same as those defined in the the basis of molecular orbitals.

- +
@@ -1415,8 +1415,8 @@ the basis of molecular orbitals. -
-

7.2 Two-electron integrals (mo_2e_int group)

+
+

7.2 Two-electron integrals (mo_2e_int group)

The operators as the same as those defined in the @@ -1424,7 +1424,7 @@ The operators as the same as those defined in the the basis of molecular orbitals.

-
+
@@ -1464,13 +1464,13 @@ the basis of molecular orbitals. -
-

8 TODO Slater determinants

+
+

8 TODO Slater determinants

-
-

9 TODO Reduced density matrices (rdm group)

+
+

9 TODO Reduced density matrices (rdm group)

-
+
@@ -1525,7 +1525,7 @@ the basis of molecular orbitals.

Author: TREX-CoE

-

Created: 2021-11-01 Mon 10:44

+

Created: 2021-11-02 Tue 10:53

Validate