1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-25 13:53:55 +01:00

Deploying to gh-pages from @ TREX-CoE/trexio@daf3fdeb8b 🚀

This commit is contained in:
scemama 2021-05-04 08:04:57 +00:00
parent c0ac147896
commit 85162999c8
5 changed files with 195 additions and 158 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-03 Mon 13:59 -->
<!-- 2021-05-04 Tue 08:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TREXIO source code documentation</title>
@ -341,7 +341,7 @@ and bug reports should be submitted at
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2021-05-03 Mon 13:59</p>
<p class="date">Created: 2021-05-04 Tue 08:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-03 Mon 13:59 -->
<!-- 2021-05-04 Tue 08:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TREXIO source code documentation</title>
@ -341,7 +341,7 @@ and bug reports should be submitted at
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2021-05-03 Mon 13:59</p>
<p class="date">Created: 2021-05-04 Tue 08:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-03 Mon 13:59 -->
<!-- 2021-05-04 Tue 08:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Front end API</title>
@ -311,45 +311,45 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgdbf382c">1. Coding conventions</a>
<li><a href="#org9b35a70">1. Coding conventions</a>
<ul>
<li><a href="#org4503912">1.1. Memory allocation</a></li>
<li><a href="#orgc0ef1e6">1.1. Memory allocation</a></li>
</ul>
</li>
<li><a href="#org9fa2282">2. Front end</a>
<li><a href="#org013daab">2. Front end</a>
<ul>
<li><a href="#org2e0f1f7">2.1. Error handling</a></li>
<li><a href="#orge6b0336">2.2. Back ends</a></li>
<li><a href="#orgad8ee72">2.3. Read/write behavior</a></li>
<li><a href="#org0d31558">2.4. TREXIO file type</a></li>
<li><a href="#orgee1609c">2.5. Polymorphism of the file handle</a></li>
<li><a href="#org60813ff">2.6. File opening</a></li>
<li><a href="#orgf779071">2.7. File closing</a></li>
<li><a href="#org75fe4b8">2.1. Error handling</a></li>
<li><a href="#org3bd6633">2.2. Back ends</a></li>
<li><a href="#org9b575f6">2.3. Read/write behavior</a></li>
<li><a href="#orgfcf1628">2.4. TREXIO file type</a></li>
<li><a href="#orgb3dd52a">2.5. Polymorphism of the file handle</a></li>
<li><a href="#orgb2e7321">2.6. File opening</a></li>
<li><a href="#org3b6c394">2.7. File closing</a></li>
</ul>
</li>
<li><a href="#orgf10ccdb">3. Templates for front end</a>
<li><a href="#org9471640">3. Templates for front end</a>
<ul>
<li><a href="#org0128eb3">3.1. Templates for front end has/read/write a dimension</a>
<li><a href="#org911b7fa">3.1. Templates for front end has/read/write a dimension</a>
<ul>
<li><a href="#org26fe49b">3.1.1. C templates for front end</a></li>
<li><a href="#org90cd6ac">3.1.2. Fortran templates for front end</a></li>
<li><a href="#org5165bc5">3.1.1. C templates for front end</a></li>
<li><a href="#org054d2a5">3.1.2. Fortran templates for front end</a></li>
</ul>
</li>
<li><a href="#org0b7ebd9">3.2. Templates for front end has/read/write a dataset</a>
<li><a href="#orgb9ea22a">3.2. Templates for front end has/read/write a dataset</a>
<ul>
<li><a href="#org87607b6">3.2.1. C templates for front end</a></li>
<li><a href="#org1d94400">3.2.2. Fortran templates for front end</a></li>
<li><a href="#org1ff18df">3.2.1. C templates for front end</a></li>
<li><a href="#orgaaa5542">3.2.2. Fortran templates for front end</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgd70fbc7">4. Fortran helper/wrapper functions</a></li>
<li><a href="#orgfeff045">4. Fortran helper/wrapper functions</a></li>
</ul>
</div>
</div>
<div id="outline-container-orgdbf382c" class="outline-2">
<h2 id="orgdbf382c"><span class="section-number-2">1</span> Coding conventions</h2>
<div id="outline-container-org9b35a70" class="outline-2">
<h2 id="org9b35a70"><span class="section-number-2">1</span> Coding conventions</h2>
<div class="outline-text-2" id="text-1">
<ul class="org-ul">
<li>integer types will be defined using types given in <code>stdint.h</code></li>
@ -364,8 +364,8 @@ for the JavaScript code in this tag.
</ul>
</div>
<div id="outline-container-org4503912" class="outline-3">
<h3 id="org4503912"><span class="section-number-3">1.1</span> Memory allocation</h3>
<div id="outline-container-orgc0ef1e6" class="outline-3">
<h3 id="orgc0ef1e6"><span class="section-number-3">1.1</span> Memory allocation</h3>
<div class="outline-text-3" id="text-1-1">
<p>
Memory allocation of structures can be facilitated by using the
@ -374,8 +374,8 @@ object is the same as the size of the data type pointed by the pointer.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #483d8b;">#define</span> <span style="color: #0000ff;">MALLOC</span>(<span style="color: #a0522d;">T</span>) (<span style="color: #228b22;">T</span>*) malloc (<span style="color: #a020f0;">sizeof</span>(T));
<span style="color: #483d8b;">#define</span> <span style="color: #0000ff;">CALLOC</span>(<span style="color: #a0522d;">N</span>,<span style="color: #a0522d;">T</span>) (<span style="color: #228b22;">T</span>*) calloc ((N),<span style="color: #a020f0;">sizeof</span>(T));
<pre class="src src-c"><span style="color: #483d8b;">#define</span> <span style="color: #0000ff;">MALLOC</span>(<span style="color: #a0522d;">T</span>) (<span style="color: #228b22;">T</span>*) malloc (<span style="color: #a020f0;">sizeof</span>(T))
<span style="color: #483d8b;">#define</span> <span style="color: #0000ff;">CALLOC</span>(<span style="color: #a0522d;">N</span>,<span style="color: #a0522d;">T</span>) (<span style="color: #228b22;">T</span>*) calloc ( (N) , <span style="color: #a020f0;">sizeof</span>(T) )
</pre>
</div>
@ -388,12 +388,19 @@ This can be facilitated by the use of the following macro:
<pre class="src src-c"><span style="color: #483d8b;">#define</span> <span style="color: #0000ff;">FREE</span>(<span style="color: #a0522d;">X</span>) { free(X) ; (X)=<span style="color: #008b8b;">NULL</span>; }
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org9fa2282" class="outline-2">
<h2 id="org9fa2282"><span class="section-number-2">2</span> Front end</h2>
<p>
The maximum string size for the filenames is 4096 characters.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">TREXIO_MAX_FILENAME_LENGTH</span> 4096
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org013daab" class="outline-2">
<h2 id="org013daab"><span class="section-number-2">2</span> Front end</h2>
<div class="outline-text-2" id="text-2">
<p>
All calls to TREXIO are thread-safe.
@ -401,10 +408,10 @@ TREXIO front end is modular, which simplifies impelementation of new back ends.
</p>
</div>
<div id="outline-container-org2e0f1f7" class="outline-3">
<h3 id="org2e0f1f7"><span class="section-number-3">2.1</span> Error handling</h3>
<div id="outline-container-org75fe4b8" class="outline-3">
<h3 id="org75fe4b8"><span class="section-number-3">2.1</span> Error handling</h3>
<div class="outline-text-3" id="text-2-1">
<table id="orga152212" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgdbfabbb" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -605,8 +612,8 @@ The text strings are extracted from the previous table.
</div>
</div>
<div id="outline-container-orge6b0336" class="outline-3">
<h3 id="orge6b0336"><span class="section-number-3">2.2</span> Back ends</h3>
<div id="outline-container-org3bd6633" class="outline-3">
<h3 id="org3bd6633"><span class="section-number-3">2.2</span> Back ends</h3>
<div class="outline-text-3" id="text-2-2">
<p>
TREXIO has several back ends:
@ -636,8 +643,8 @@ lines that correspond to the <code>TREXIO_JSON</code> back end (not implemented
</div>
</div>
</div>
<div id="outline-container-orgad8ee72" class="outline-3">
<h3 id="orgad8ee72"><span class="section-number-3">2.3</span> Read/write behavior</h3>
<div id="outline-container-org9b575f6" class="outline-3">
<h3 id="org9b575f6"><span class="section-number-3">2.3</span> Read/write behavior</h3>
<div class="outline-text-3" id="text-2-3">
<p>
Every time a reading function is called, the data is read from the
@ -665,8 +672,8 @@ concurrent programs, the behavior is not specified.
</p>
</div>
</div>
<div id="outline-container-org0d31558" class="outline-3">
<h3 id="org0d31558"><span class="section-number-3">2.4</span> TREXIO file type</h3>
<div id="outline-container-orgfcf1628" class="outline-3">
<h3 id="orgfcf1628"><span class="section-number-3">2.4</span> TREXIO file type</h3>
<div class="outline-text-3" id="text-2-4">
<p>
<code>trexio_s</code> is the the main type for TREXIO files, visible to the users
@ -698,8 +705,8 @@ TREXIO files will have as a first argument the TREXIO file handle.
</div>
</div>
</div>
<div id="outline-container-orgee1609c" class="outline-3">
<h3 id="orgee1609c"><span class="section-number-3">2.5</span> Polymorphism of the file handle</h3>
<div id="outline-container-orgb3dd52a" class="outline-3">
<h3 id="orgb3dd52a"><span class="section-number-3">2.5</span> Polymorphism of the file handle</h3>
<div class="outline-text-3" id="text-2-5">
<p>
Polymorphism of the <code>trexio_t</code> type is handled by ensuring that the
@ -718,8 +725,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org60813ff" class="outline-3">
<h3 id="org60813ff"><span class="section-number-3">2.6</span> File opening</h3>
<div id="outline-container-orgb2e7321" class="outline-3">
<h3 id="orgb2e7321"><span class="section-number-3">2.6</span> File opening</h3>
<div class="outline-text-3" id="text-2-6">
<p>
<code>trexio_open</code> creates a new TREXIO file or opens existing one.
@ -764,6 +771,7 @@ should tend to avoid renaming the <code>.txt</code> data files.
<span style="color: #a020f0;">if</span> (file_name == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
<span style="color: #a020f0;">if</span> (file_name[0] == <span style="color: #8b2252;">'\0'</span>) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
/* <span style="color: #b22222;">Check overflow in file_name </span>*/
<span style="color: #a020f0;">if</span> (back_end &lt; 0) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
<span style="color: #a020f0;">if</span> (back_end &gt;= TREXIO_INVALID_BACK_END) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
@ -794,8 +802,14 @@ should tend to avoid renaming the <code>.txt</code> data files.
/* <span style="color: #b22222;">Data for the parent type </span>*/
result-&gt;file_name = CALLOC(strlen(file_name)+1, <span style="color: #228b22;">char</span>);
strncpy(result-&gt;file_name, file_name, strlen(file_name)+1);
result-&gt;file_name = CALLOC(TREXIO_MAX_FILENAME_LENGTH, <span style="color: #228b22;">char</span>);
strncpy(result-&gt;file_name, file_name, TREXIO_MAX_FILENAME_LENGTH);
<span style="color: #a020f0;">if</span> (result-&gt;file_name[TREXIO_MAX_FILENAME_LENGTH-1] != <span style="color: #8b2252;">'\0'</span>) {
free(result-&gt;file_name);
free(result);
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
}
result-&gt;back_end = back_end;
result-&gt;mode = mode;
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">irc</span> = pthread_mutex_init ( &amp;(result-&gt;thread_lock), <span style="color: #008b8b;">NULL</span>);
@ -874,8 +888,8 @@ should tend to avoid renaming the <code>.txt</code> data files.
</div>
</div>
<div id="outline-container-orgf779071" class="outline-3">
<h3 id="orgf779071"><span class="section-number-3">2.7</span> File closing</h3>
<div id="outline-container-org3b6c394" class="outline-3">
<h3 id="org3b6c394"><span class="section-number-3">2.7</span> File closing</h3>
<div class="outline-text-3" id="text-2-7">
<p>
<code>trexio_close</code> closes an existing <code>trexio_t</code> file.
@ -920,8 +934,8 @@ output:
}
<span style="color: #a020f0;">if</span> (rc != TREXIO_SUCCESS) {
free(file-&gt;file_name);
free(file);
FREE(file-&gt;file_name);
FREE(file);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
@ -947,8 +961,7 @@ output:
/* <span style="color: #b22222;">Terminate front end </span>*/
free(file-&gt;file_name);
file-&gt;file_name = <span style="color: #008b8b;">NULL</span>;
FREE(file-&gt;file_name);
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">irc</span> = pthread_mutex_destroy( &amp;(file-&gt;thread_lock) );
@ -975,8 +988,8 @@ output:
</div>
</div>
<div id="outline-container-orgf10ccdb" class="outline-2">
<h2 id="orgf10ccdb"><span class="section-number-2">3</span> Templates for front end</h2>
<div id="outline-container-org9471640" class="outline-2">
<h2 id="org9471640"><span class="section-number-2">3</span> Templates for front end</h2>
<div class="outline-text-2" id="text-3">
<p>
Consider the following block of <code>trex.json</code>:
@ -1137,8 +1150,8 @@ TREXIO supports I/O with single or double precision for integer and floating poi
</div>
<div id="outline-container-org0128eb3" class="outline-3">
<h3 id="org0128eb3"><span class="section-number-3">3.1</span> Templates for front end has/read/write a dimension</h3>
<div id="outline-container-org911b7fa" class="outline-3">
<h3 id="org911b7fa"><span class="section-number-3">3.1</span> Templates for front end has/read/write a dimension</h3>
<div class="outline-text-3" id="text-3-1">
<p>
This section concerns API calls related to dimensioning variables.
@ -1207,8 +1220,8 @@ This section concerns API calls related to dimensioning variables.
</table>
</div>
<div id="outline-container-org26fe49b" class="outline-4">
<h4 id="org26fe49b"><span class="section-number-4">3.1.1</span> C templates for front end</h4>
<div id="outline-container-org5165bc5" class="outline-4">
<h4 id="org5165bc5"><span class="section-number-4">3.1.1</span> C templates for front end</h4>
<div class="outline-text-4" id="text-3-1-1">
<p>
The <code>C</code> templates that correspond to each of the abovementioned functions can be found below.
@ -1397,8 +1410,8 @@ The basic (non-suffixed) API call on dimensioning variables deals with single pr
</div>
</div>
<div id="outline-container-org90cd6ac" class="outline-4">
<h4 id="org90cd6ac"><span class="section-number-4">3.1.2</span> Fortran templates for front end</h4>
<div id="outline-container-org054d2a5" class="outline-4">
<h4 id="org054d2a5"><span class="section-number-4">3.1.2</span> Fortran templates for front end</h4>
<div class="outline-text-4" id="text-3-1-2">
<p>
The <code>Fortran</code> templates that provide an access to the <code>C</code> API calls from Fortran.
@ -1485,8 +1498,8 @@ These templates are based on the use of <code>iso_c_binding</code>. Pointers hav
</div>
<div id="outline-container-org0b7ebd9" class="outline-3">
<h3 id="org0b7ebd9"><span class="section-number-3">3.2</span> Templates for front end has/read/write a dataset</h3>
<div id="outline-container-orgb9ea22a" class="outline-3">
<h3 id="orgb9ea22a"><span class="section-number-3">3.2</span> Templates for front end has/read/write a dataset</h3>
<div class="outline-text-3" id="text-3-2">
<p>
This section concerns API calls related to datasets.
@ -1555,8 +1568,8 @@ This section concerns API calls related to datasets.
</table>
</div>
<div id="outline-container-org87607b6" class="outline-4">
<h4 id="org87607b6"><span class="section-number-4">3.2.1</span> C templates for front end</h4>
<div id="outline-container-org1ff18df" class="outline-4">
<h4 id="org1ff18df"><span class="section-number-4">3.2.1</span> C templates for front end</h4>
<div class="outline-text-4" id="text-3-2-1">
<p>
The C templates that correspond to each of the abovementioned functions can be found below.
@ -1814,8 +1827,8 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
</div>
</div>
<div id="outline-container-org1d94400" class="outline-4">
<h4 id="org1d94400"><span class="section-number-4">3.2.2</span> Fortran templates for front end</h4>
<div id="outline-container-orgaaa5542" class="outline-4">
<h4 id="orgaaa5542"><span class="section-number-4">3.2.2</span> Fortran templates for front end</h4>
<div class="outline-text-4" id="text-3-2-2">
<p>
The <code>Fortran</code> templates that provide an access to the <code>C</code> API calls from <code>Fortran</code>.
@ -1902,8 +1915,8 @@ These templates are based on the use of <code>iso_c_binding</code>. Pointers hav
</div>
</div>
<div id="outline-container-orgd70fbc7" class="outline-2">
<h2 id="orgd70fbc7"><span class="section-number-2">4</span> Fortran helper/wrapper functions</h2>
<div id="outline-container-orgfeff045" class="outline-2">
<h2 id="orgfeff045"><span class="section-number-2">4</span> Fortran helper/wrapper functions</h2>
<div class="outline-text-2" id="text-4">
<p>
The function below adapts the original C-based <code>trexio_open</code> for Fortran.
@ -1932,7 +1945,7 @@ Note, that Fortran interface calls the main <code>TREXIO</code> API, which is wr
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2021-05-03 Mon 13:59</p>
<p class="date">Created: 2021-05-04 Tue 08:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-03 Mon 13:59 -->
<!-- 2021-05-04 Tue 08:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>HDF5 back end</title>
@ -311,25 +311,25 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org3d47e58">1. HDF5 back end</a>
<li><a href="#org461013a">1. HDF5 back end</a>
<ul>
<li><a href="#org8d1c4f6">1.1. Template for HDF5 definitions</a></li>
<li><a href="#org41102b1">1.2. Template for HDF5 structures</a></li>
<li><a href="#org4fe7c17">1.3. Template for HDF5 init/deinit</a></li>
<li><a href="#org61a2a1b">1.4. Template for HDF5 has/read/write a number</a></li>
<li><a href="#org633b39e">1.5. Template for HDF5 has/read/write a dataset</a></li>
<li><a href="#orgfd9b1d5">1.1. Template for HDF5 definitions</a></li>
<li><a href="#orgdab67a6">1.2. Template for HDF5 structures</a></li>
<li><a href="#orga830190">1.3. Template for HDF5 init/deinit</a></li>
<li><a href="#org09ebb5b">1.4. Template for HDF5 has/read/write a number</a></li>
<li><a href="#org256bc77">1.5. Template for HDF5 has/read/write a dataset</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org3d47e58" class="outline-2">
<h2 id="org3d47e58"><span class="section-number-2">1</span> HDF5 back end</h2>
<div id="outline-container-org461013a" class="outline-2">
<h2 id="org461013a"><span class="section-number-2">1</span> HDF5 back end</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org8d1c4f6" class="outline-3">
<h3 id="org8d1c4f6"><span class="section-number-3">1.1</span> Template for HDF5 definitions</h3>
<div id="outline-container-orgfd9b1d5" class="outline-3">
<h3 id="orgfd9b1d5"><span class="section-number-3">1.1</span> Template for HDF5 definitions</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #483d8b;">#define</span> $GROUP$_GROUP_NAME <span style="color: #8b2252;">"$group$"</span>
@ -340,8 +340,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org41102b1" class="outline-3">
<h3 id="org41102b1"><span class="section-number-3">1.2</span> Template for HDF5 structures</h3>
<div id="outline-container-orgdab67a6" class="outline-3">
<h3 id="orgdab67a6"><span class="section-number-3">1.2</span> Template for HDF5 structures</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">trexio_hdf5_s</span> {
@ -356,8 +356,8 @@ for the JavaScript code in this tag.
</div>
<div id="outline-container-org4fe7c17" class="outline-3">
<h3 id="org4fe7c17"><span class="section-number-3">1.3</span> Template for HDF5 init/deinit</h3>
<div id="outline-container-orga830190" class="outline-3">
<h3 id="orga830190"><span class="section-number-3">1.3</span> Template for HDF5 init/deinit</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -440,8 +440,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org61a2a1b" class="outline-3">
<h3 id="org61a2a1b"><span class="section-number-3">1.4</span> Template for HDF5 has/read/write a number</h3>
<div id="outline-container-org09ebb5b" class="outline-3">
<h3 id="org09ebb5b"><span class="section-number-3">1.4</span> Template for HDF5 has/read/write a number</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -564,8 +564,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org633b39e" class="outline-3">
<h3 id="org633b39e"><span class="section-number-3">1.5</span> Template for HDF5 has/read/write a dataset</h3>
<div id="outline-container-org256bc77" class="outline-3">
<h3 id="org256bc77"><span class="section-number-3">1.5</span> Template for HDF5 has/read/write a dataset</h3>
<div class="outline-text-3" id="text-1-5">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -696,7 +696,7 @@ for the JavaScript code in this tag.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2021-05-03 Mon 13:59</p>
<p class="date">Created: 2021-05-04 Tue 08:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-03 Mon 13:59 -->
<!-- 2021-05-04 Tue 08:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TEXT back end</title>
@ -311,24 +311,24 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org00c4540">1. TEXT back end</a>
<li><a href="#org74aea16">1. TEXT back end</a>
<ul>
<li><a href="#orge4874aa">1.1. Template for group-related structures in text back end</a></li>
<li><a href="#org7345874">1.2. Template for general structure in text back end</a></li>
<li><a href="#org4714e9d">1.3. Initialize function (constant part)</a></li>
<li><a href="#org1746d54">1.4. Deinitialize function (templated part)</a></li>
<li><a href="#org41a784b">1.5. Template for text read struct</a></li>
<li><a href="#orgdf7c991">1.6. Template for text flush struct</a></li>
<li><a href="#org5910239">1.7. Template for text free memory</a></li>
<li><a href="#org92bacd4">1.8. Template for has/read/write the <code>$group_num$</code> attribute</a></li>
<li><a href="#org9f73219">1.9. Template for has/read/write the <code>$group_dset$</code> dataset</a></li>
<li><a href="#org0289f90">1.10. RDM struct (hard-coded)</a>
<li><a href="#org099f415">1.1. Template for group-related structures in text back end</a></li>
<li><a href="#org1be1678">1.2. Template for general structure in text back end</a></li>
<li><a href="#org325976b">1.3. Initialize function (constant part)</a></li>
<li><a href="#orga547085">1.4. Deinitialize function (templated part)</a></li>
<li><a href="#org663ff1e">1.5. Template for text read struct</a></li>
<li><a href="#org27c1502">1.6. Template for text flush struct</a></li>
<li><a href="#org04dd780">1.7. Template for text free memory</a></li>
<li><a href="#org1c0dde2">1.8. Template for has/read/write the <code>$group_num$</code> attribute</a></li>
<li><a href="#orgee76e27">1.9. Template for has/read/write the <code>$group_dset$</code> dataset</a></li>
<li><a href="#org24dbe96">1.10. RDM struct (hard-coded)</a>
<ul>
<li><a href="#orgffaf7f6">1.10.1. Read the complete struct</a></li>
<li><a href="#org6f476d8">1.10.2. Flush the complete struct</a></li>
<li><a href="#org39bf352">1.10.3. Free memory</a></li>
<li><a href="#org09e11e1">1.10.4. Read/Write the one<sub>e</sub> attribute</a></li>
<li><a href="#org5cd1d66">1.10.5. Read/Write the two<sub>e</sub> attribute</a></li>
<li><a href="#org6058dfd">1.10.1. Read the complete struct</a></li>
<li><a href="#orga2303fd">1.10.2. Flush the complete struct</a></li>
<li><a href="#orge078ce6">1.10.3. Free memory</a></li>
<li><a href="#orgd8079a3">1.10.4. Read/Write the one<sub>e</sub> attribute</a></li>
<li><a href="#org2f68fb1">1.10.5. Read/Write the two<sub>e</sub> attribute</a></li>
</ul>
</li>
</ul>
@ -337,8 +337,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org00c4540" class="outline-2">
<h2 id="org00c4540"><span class="section-number-2">1</span> TEXT back end</h2>
<div id="outline-container-org74aea16" class="outline-2">
<h2 id="org74aea16"><span class="section-number-2">1</span> TEXT back end</h2>
<div class="outline-text-2" id="text-1">
<p>
The "file" produced by the text back end is a directory with one
@ -359,8 +359,8 @@ The file is written when closed, or when the flush function is called.
</p>
</div>
<div id="outline-container-orge4874aa" class="outline-3">
<h3 id="orge4874aa"><span class="section-number-3">1.1</span> Template for group-related structures in text back end</h3>
<div id="outline-container-org099f415" class="outline-3">
<h3 id="org099f415"><span class="section-number-3">1.1</span> Template for group-related structures in text back end</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> $group$_s {
@ -376,8 +376,8 @@ The file is written when closed, or when the flush function is called.
</div>
</div>
<div id="outline-container-org7345874" class="outline-3">
<h3 id="org7345874"><span class="section-number-3">1.2</span> Template for general structure in text back end</h3>
<div id="outline-container-org1be1678" class="outline-3">
<h3 id="org1be1678"><span class="section-number-3">1.2</span> Template for general structure in text back end</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">rdm_s</span> {
@ -403,8 +403,8 @@ The file is written when closed, or when the flush function is called.
</div>
</div>
<div id="outline-container-org4714e9d" class="outline-3">
<h3 id="org4714e9d"><span class="section-number-3">1.3</span> Initialize function (constant part)</h3>
<div id="outline-container-org325976b" class="outline-3">
<h3 id="org325976b"><span class="section-number-3">1.3</span> Initialize function (constant part)</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -434,15 +434,19 @@ The file is written when closed, or when the flush function is called.
/* <span style="color: #b22222;">Create the lock file in the directory </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">lock_file_name</span> = <span style="color: #8b2252;">"/.lock"</span>;
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">str_size</span> = strlen(file-&gt;file_name) + strlen(lock_file_name) + 1;
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span> = CALLOC(str_size, <span style="color: #228b22;">char</span>);
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span> = CALLOC(TREXIO_MAX_FILENAME_LENGTH, <span style="color: #228b22;">char</span>);
<span style="color: #a020f0;">if</span> (file_name == <span style="color: #008b8b;">NULL</span>) {
<span style="color: #a020f0;">return</span> TREXIO_ALLOCATION_FAILED;
}
strncpy (file_name, file-&gt;file_name, str_size);
strncat (file_name, lock_file_name, strlen(lock_file_name));
strncpy (file_name, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
strncat (file_name, lock_file_name, TREXIO_MAX_FILENAME_LENGTH-strlen(lock_file_name));
<span style="color: #a020f0;">if</span> (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != <span style="color: #8b2252;">'\0'</span>) {
FREE(file_name);
<span style="color: #a020f0;">return</span> TREXIO_ALLOCATION_FAILED;
}
f-&gt;lock_file = open(file_name,O_WRONLY|O_CREAT|O_TRUNC, 0644);
FREE(file_name);
@ -507,8 +511,8 @@ The file is written when closed, or when the flush function is called.
</div>
</div>
<div id="outline-container-org1746d54" class="outline-3">
<h3 id="org1746d54"><span class="section-number-3">1.4</span> Deinitialize function (templated part)</h3>
<div id="outline-container-orga547085" class="outline-3">
<h3 id="orga547085"><span class="section-number-3">1.4</span> Deinitialize function (templated part)</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -532,8 +536,8 @@ The file is written when closed, or when the flush function is called.
</div>
</div>
<div id="outline-container-org41a784b" class="outline-3">
<h3 id="org41a784b"><span class="section-number-3">1.5</span> Template for text read struct</h3>
<div id="outline-container-org663ff1e" class="outline-3">
<h3 id="org663ff1e"><span class="section-number-3">1.5</span> Template for text read struct</h3>
<div class="outline-text-3" id="text-1-5">
<div class="org-src-container">
<pre class="src src-c">$group$_t*
@ -555,16 +559,22 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
/* <span style="color: #b22222;">Build the file name </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* $group$_file_name = <span style="color: #8b2252;">"/$group$.txt"</span>;
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">str_size</span> = strlen(file-&gt;parent.file_name) + strlen($group$_file_name) + 1;
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">file_name</span> = CALLOC(str_size, <span style="color: #228b22;">char</span>);
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">file_name</span> = CALLOC(TREXIO_MAX_FILENAME_LENGTH, <span style="color: #228b22;">char</span>);
<span style="color: #a020f0;">if</span> (file_name == <span style="color: #008b8b;">NULL</span>) {
FREE($group$);
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
}
strncpy (file_name, file-&gt;parent.file_name, str_size);
strncat (file_name, $group$_file_name, strlen($group$_file_name));
strncpy (file_name, file-&gt;parent.file_name, TREXIO_MAX_FILENAME_LENGTH);
strncat (file_name, $group$_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen($group$_file_name));
<span style="color: #a020f0;">if</span> (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != <span style="color: #8b2252;">'\0'</span>) {
FREE(file_name);
FREE($group$);
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
}
/* <span style="color: #b22222;">If the file exists, read it </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_name,<span style="color: #8b2252;">"r"</span>);
@ -724,8 +734,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
</div>
</div>
<div id="outline-container-orgdf7c991" class="outline-3">
<h3 id="orgdf7c991"><span class="section-number-3">1.6</span> Template for text flush struct</h3>
<div id="outline-container-org27c1502" class="outline-3">
<h3 id="org27c1502"><span class="section-number-3">1.6</span> Template for text flush struct</h3>
<div class="outline-text-3" id="text-1-6">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -783,8 +793,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
</div>
</div>
<div id="outline-container-org5910239" class="outline-3">
<h3 id="org5910239"><span class="section-number-3">1.7</span> Template for text free memory</h3>
<div id="outline-container-org04dd780" class="outline-3">
<h3 id="org04dd780"><span class="section-number-3">1.7</span> Template for text free memory</h3>
<div class="outline-text-3" id="text-1-7">
<p>
Memory is allocated when reading. The following function frees memory.
@ -825,8 +835,8 @@ Memory is allocated when reading. The following function frees memory.
</div>
</div>
<div id="outline-container-org92bacd4" class="outline-3">
<h3 id="org92bacd4"><span class="section-number-3">1.8</span> Template for has/read/write the <code>$group_num$</code> attribute</h3>
<div id="outline-container-org1c0dde2" class="outline-3">
<h3 id="org1c0dde2"><span class="section-number-3">1.8</span> Template for has/read/write the <code>$group_num$</code> attribute</h3>
<div class="outline-text-3" id="text-1-8">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -888,8 +898,8 @@ Memory is allocated when reading. The following function frees memory.
</div>
</div>
<div id="outline-container-org9f73219" class="outline-3">
<h3 id="org9f73219"><span class="section-number-3">1.9</span> Template for has/read/write the <code>$group_dset$</code> dataset</h3>
<div id="outline-container-orgee76e27" class="outline-3">
<h3 id="orgee76e27"><span class="section-number-3">1.9</span> Template for has/read/write the <code>$group_dset$</code> dataset</h3>
<div class="outline-text-3" id="text-1-9">
<p>
The <code>group_dset</code> array is assumed allocated with the appropriate size.
@ -986,12 +996,12 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
</div>
</div>
<div id="outline-container-org0289f90" class="outline-3">
<h3 id="org0289f90"><span class="section-number-3">1.10</span> RDM struct (hard-coded)</h3>
<div id="outline-container-org24dbe96" class="outline-3">
<h3 id="org24dbe96"><span class="section-number-3">1.10</span> RDM struct (hard-coded)</h3>
<div class="outline-text-3" id="text-1-10">
</div>
<div id="outline-container-orgffaf7f6" class="outline-4">
<h4 id="orgffaf7f6"><span class="section-number-4">1.10.1</span> Read the complete struct</h4>
<div id="outline-container-org6058dfd" class="outline-4">
<h4 id="org6058dfd"><span class="section-number-4">1.10.1</span> Read the complete struct</h4>
<div class="outline-text-4" id="text-1-10-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">rdm_t</span>* <span style="color: #0000ff;">trexio_text_read_rdm</span>(<span style="color: #228b22;">trexio_text_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>);
@ -1005,7 +1015,7 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
<span style="color: #a020f0;">if</span> (file-&gt;rdm != <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> file-&gt;rdm;
/* <span style="color: #b22222;">Allocate the data structure </span>*/
<span style="color: #228b22;">rdm_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">rdm</span> = MALLOC(rdm_t);
<span style="color: #228b22;">rdm_t</span>* <span style="color: #a0522d;">rdm</span> = MALLOC(rdm_t);
assert (rdm != <span style="color: #008b8b;">NULL</span>);
rdm-&gt;one_e = <span style="color: #008b8b;">NULL</span>;
@ -1015,13 +1025,19 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
/* <span style="color: #b22222;">Try to open the file. If the file does not exist, return </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">rdm_file_name</span> = <span style="color: #8b2252;">"/rdm.txt"</span>;
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">str_size</span> = strlen(file-&gt;parent.file_name) + strlen(rdm_file_name) + 1;
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">file_name</span> = CALLOC(str_size, <span style="color: #228b22;">char</span>);
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span> = CALLOC(TREXIO_MAX_FILENAME_LENGTH, <span style="color: #228b22;">char</span>);
assert (file_name != <span style="color: #008b8b;">NULL</span>);
strncpy (file_name, file-&gt;parent.file_name, str_size);
strncat (file_name, rdm_file_name, strlen(rdm_file_name));
strncpy (file_name, file-&gt;parent.file_name, TREXIO_MAX_FILENAME_LENGTH);
strncat (file_name, rdm_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(rdm_file_name));
<span style="color: #a020f0;">if</span> (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != <span style="color: #8b2252;">'\0'</span>) {
FREE(file_name);
FREE(rdm);
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
}
/* <span style="color: #b22222;">If the file exists, read it </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_name,<span style="color: #8b2252;">"r"</span>);
<span style="color: #a020f0;">if</span> (f != <span style="color: #008b8b;">NULL</span>) {
@ -1063,9 +1079,17 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
rc = fscanf(f, <span style="color: #8b2252;">"%1023s"</span>, buffer);
assert (rc == 1);
str_size = strlen(buffer);
rdm-&gt;two_e_file_name = CALLOC(str_size,<span style="color: #228b22;">char</span>);
strncpy(rdm-&gt;two_e_file_name, buffer, str_size);
rdm-&gt;two_e_file_name = CALLOC(TREXIO_MAX_FILENAME_LENGTH,<span style="color: #228b22;">char</span>);
strncpy(rdm-&gt;two_e_file_name, buffer, 1024);
<span style="color: #a020f0;">if</span> (rdm-&gt;two_e_file_name[TREXIO_MAX_FILENAME_LENGTH-1] != <span style="color: #8b2252;">'\0'</span>) {
FREE(file_name);
FREE(buffer);
FREE(rdm-&gt;one_e);
FREE(rdm-&gt;two_e_file_name);
FREE(rdm);
fclose(f);
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
}
FREE(buffer);
fclose(f);
@ -1085,8 +1109,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
</div>
</div>
<div id="outline-container-org6f476d8" class="outline-4">
<h4 id="org6f476d8"><span class="section-number-4">1.10.2</span> Flush the complete struct</h4>
<div id="outline-container-orga2303fd" class="outline-4">
<h4 id="orga2303fd"><span class="section-number-4">1.10.2</span> Flush the complete struct</h4>
<div class="outline-text-4" id="text-1-10-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_flush_rdm</span>(<span style="color: #228b22;">trexio_text_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>);
@ -1129,8 +1153,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
</div>
</div>
<div id="outline-container-org39bf352" class="outline-4">
<h4 id="org39bf352"><span class="section-number-4">1.10.3</span> Free memory</h4>
<div id="outline-container-orge078ce6" class="outline-4">
<h4 id="orge078ce6"><span class="section-number-4">1.10.3</span> Free memory</h4>
<div class="outline-text-4" id="text-1-10-3">
<p>
Memory is allocated when reading. The followig function frees memory.
@ -1175,8 +1199,8 @@ Memory is allocated when reading. The followig function frees memory.
</div>
</div>
<div id="outline-container-org09e11e1" class="outline-4">
<h4 id="org09e11e1"><span class="section-number-4">1.10.4</span> Read/Write the one<sub>e</sub> attribute</h4>
<div id="outline-container-orgd8079a3" class="outline-4">
<h4 id="orgd8079a3"><span class="section-number-4">1.10.4</span> Read/Write the one<sub>e</sub> attribute</h4>
<div class="outline-text-4" id="text-1-10-4">
<p>
The <code>one_e</code> array is assumed allocated with the appropriate size.
@ -1242,8 +1266,8 @@ The <code>one_e</code> array is assumed allocated with the appropriate size.
</div>
</div>
<div id="outline-container-org5cd1d66" class="outline-4">
<h4 id="org5cd1d66"><span class="section-number-4">1.10.5</span> Read/Write the two<sub>e</sub> attribute</h4>
<div id="outline-container-org2f68fb1" class="outline-4">
<h4 id="org2f68fb1"><span class="section-number-4">1.10.5</span> Read/Write the two<sub>e</sub> attribute</h4>
<div class="outline-text-4" id="text-1-10-5">
<p>
<code>two_e</code> is a sparse data structure, which can be too large to fit
@ -1351,7 +1375,7 @@ file for each sparse float structure.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2021-05-03 Mon 13:59</p>
<p class="date">Created: 2021-05-04 Tue 08:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>