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@84cc086228 🚀
This commit is contained in:
parent
80bf224a46
commit
3f3927ec64
@ -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-28 Fri 10:17 -->
|
||||
<!-- 2021-06-04 Fri 12:15 -->
|
||||
<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-28 Fri 10:17</p>
|
||||
<p class="date">Created: 2021-06-04 Fri 12:15</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-28 Fri 10:17 -->
|
||||
<!-- 2021-06-04 Fri 12:15 -->
|
||||
<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-28 Fri 10:17</p>
|
||||
<p class="date">Created: 2021-06-04 Fri 12:15</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-28 Fri 10:17 -->
|
||||
<!-- 2021-06-04 Fri 12:15 -->
|
||||
<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>
|
||||
@ -299,6 +299,28 @@ for the JavaScript code in this tag.
|
||||
}
|
||||
/*]]>*///-->
|
||||
</script>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
displayAlign: "center",
|
||||
displayIndent: "0em",
|
||||
|
||||
"HTML-CSS": { scale: 100,
|
||||
linebreaks: { automatic: "false" },
|
||||
webFont: "TeX"
|
||||
},
|
||||
SVG: {scale: 100,
|
||||
linebreaks: { automatic: "false" },
|
||||
font: "TeX"},
|
||||
NativeMML: {scale: 100},
|
||||
TeX: { equationNumbers: {autoNumber: "AMS"},
|
||||
MultLineWidth: "85%",
|
||||
TagSide: "right",
|
||||
TagIndent: ".8em"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="org-div-home-and-up">
|
||||
@ -311,46 +333,47 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org09776d2">1. Coding conventions</a>
|
||||
<li><a href="#org84645b7">1. Coding conventions</a>
|
||||
<ul>
|
||||
<li><a href="#org86b325f">1.1. Memory allocation</a></li>
|
||||
<li><a href="#orga682226">1.1. Memory allocation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orgd9b5315">2. Front end</a>
|
||||
<li><a href="#org25b4c1d">2. Front end</a>
|
||||
<ul>
|
||||
<li><a href="#org3302cd5">2.1. Error handling</a></li>
|
||||
<li><a href="#org6806614">2.2. Back ends</a></li>
|
||||
<li><a href="#orgdab5f30">2.3. Read/write behavior</a></li>
|
||||
<li><a href="#org7d0824d">2.4. TREXIO file type</a></li>
|
||||
<li><a href="#orgafc9b54">2.5. Polymorphism of the file handle</a></li>
|
||||
<li><a href="#org36e50d8">2.6. File opening</a></li>
|
||||
<li><a href="#orga893e27">2.7. File closing</a></li>
|
||||
<li><a href="#org96fad3f">2.8. C helper functions</a></li>
|
||||
<li><a href="#org0cf9a25">2.1. Error handling</a></li>
|
||||
<li><a href="#org441bc37">2.2. Back ends</a></li>
|
||||
<li><a href="#org92825c2">2.3. Read/write behavior</a></li>
|
||||
<li><a href="#org6bc2172">2.4. TREXIO file type</a></li>
|
||||
<li><a href="#org28aaa0a">2.5. Polymorphism of the file handle</a></li>
|
||||
<li><a href="#orgb12e187">2.6. File opening</a></li>
|
||||
<li><a href="#org0fce83e">2.7. File closing</a></li>
|
||||
<li><a href="#org4bc7201">2.8. C helper functions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org7494694">3. Templates for front end</a>
|
||||
<li><a href="#orgce5d3dc">3. Templates for front end</a>
|
||||
<ul>
|
||||
<li><a href="#orgf395f30">3.1. Templates for front end has/read/write a dimension</a>
|
||||
<li><a href="#orgb2af4b7">3.1. Templates for front end has/read/write a dimension</a>
|
||||
<ul>
|
||||
<li><a href="#org7467291">3.1.1. C templates for front end</a></li>
|
||||
<li><a href="#org220d1b2">3.1.2. Fortran templates for front end</a></li>
|
||||
<li><a href="#org95e34d4">3.1.1. C templates for front end</a></li>
|
||||
<li><a href="#org1d3c2a2">3.1.2. Fortran templates for front end</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orge3507d5">3.2. Templates for front end has/read/write a dataset</a>
|
||||
<li><a href="#orgda84b33">3.2. Templates for front end has/read/write a dataset</a>
|
||||
<ul>
|
||||
<li><a href="#org557de09">3.2.1. C templates for front end</a></li>
|
||||
<li><a href="#org02db47e">3.2.2. Fortran templates for front end</a></li>
|
||||
<li><a href="#org54ac865">3.2.1. C templates for front end</a></li>
|
||||
<li><a href="#org4698ede">3.2.2. Fortran templates for front end</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org1753b9e">3.3. Sparse data structures</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org62e2628">4. Fortran helper/wrapper functions</a></li>
|
||||
<li><a href="#org060103a">4. Fortran helper/wrapper functions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org09776d2" class="outline-2">
|
||||
<h2 id="org09776d2"><span class="section-number-2">1</span> Coding conventions</h2>
|
||||
<div id="outline-container-org84645b7" class="outline-2">
|
||||
<h2 id="org84645b7"><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>
|
||||
@ -365,8 +388,8 @@ for the JavaScript code in this tag.
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org86b325f" class="outline-3">
|
||||
<h3 id="org86b325f"><span class="section-number-3">1.1</span> Memory allocation</h3>
|
||||
<div id="outline-container-orga682226" class="outline-3">
|
||||
<h3 id="orga682226"><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
|
||||
@ -401,8 +424,8 @@ The maximum string size for the filenames is 4096 characters.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd9b5315" class="outline-2">
|
||||
<h2 id="orgd9b5315"><span class="section-number-2">2</span> Front end</h2>
|
||||
<div id="outline-container-org25b4c1d" class="outline-2">
|
||||
<h2 id="org25b4c1d"><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.
|
||||
@ -410,10 +433,10 @@ TREXIO front end is modular, which simplifies implementation of new back ends.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org3302cd5" class="outline-3">
|
||||
<h3 id="org3302cd5"><span class="section-number-3">2.1</span> Error handling</h3>
|
||||
<div id="outline-container-org0cf9a25" class="outline-3">
|
||||
<h3 id="org0cf9a25"><span class="section-number-3">2.1</span> Error handling</h3>
|
||||
<div class="outline-text-3" id="text-2-1">
|
||||
<table id="org8827a15" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orgd310c63" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -518,54 +541,60 @@ TREXIO front end is modular, which simplifies implementation of new back ends.
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_NUM_ALREADY_EXISTS</code></td>
|
||||
<td class="org-right">13</td>
|
||||
<td class="org-left">'Variable already exists'</td>
|
||||
<td class="org-left">'Dimensioning variable already exists'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_DSET_ALREADY_EXISTS</code></td>
|
||||
<td class="org-right">14</td>
|
||||
<td class="org-left">'Dataset already exists'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_OPEN_ERROR</code></td>
|
||||
<td class="org-right">14</td>
|
||||
<td class="org-right">15</td>
|
||||
<td class="org-left">'Error opening file'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_LOCK_ERROR</code></td>
|
||||
<td class="org-right">15</td>
|
||||
<td class="org-right">16</td>
|
||||
<td class="org-left">'Error locking file'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_UNLOCK_ERROR</code></td>
|
||||
<td class="org-right">16</td>
|
||||
<td class="org-right">17</td>
|
||||
<td class="org-left">'Error unlocking file'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_FILE_ERROR</code></td>
|
||||
<td class="org-right">17</td>
|
||||
<td class="org-right">18</td>
|
||||
<td class="org-left">'Invalid file handle'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_GROUP_READ_ERROR</code></td>
|
||||
<td class="org-right">18</td>
|
||||
<td class="org-right">19</td>
|
||||
<td class="org-left">'Error reading group'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_GROUP_WRITE_ERROR</code></td>
|
||||
<td class="org-right">19</td>
|
||||
<td class="org-right">20</td>
|
||||
<td class="org-left">'Error writing group'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_ELEM_READ_ERROR</code></td>
|
||||
<td class="org-right">20</td>
|
||||
<td class="org-right">21</td>
|
||||
<td class="org-left">'Error reading element'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>TREXIO_ELEM_WRITE_ERROR</code></td>
|
||||
<td class="org-right">21</td>
|
||||
<td class="org-right">22</td>
|
||||
<td class="org-left">'Error writing element'</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -643,7 +672,10 @@ The text strings are extracted from the previous table.
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid dimensions"</span>;
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> TREXIO_NUM_ALREADY_EXISTS:
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Variable already exists"</span>;
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Dimensioning variable already exists"</span>;
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> TREXIO_DSET_ALREADY_EXISTS:
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Dataset already exists"</span>;
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> TREXIO_OPEN_ERROR:
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Error opening file"</span>;
|
||||
@ -695,8 +727,8 @@ The text strings are extracted from the previous table.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6806614" class="outline-3">
|
||||
<h3 id="org6806614"><span class="section-number-3">2.2</span> Back ends</h3>
|
||||
<div id="outline-container-org441bc37" class="outline-3">
|
||||
<h3 id="org441bc37"><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:
|
||||
@ -726,8 +758,8 @@ lines that correspond to the <code>TREXIO_JSON</code> back end (not implemented
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgdab5f30" class="outline-3">
|
||||
<h3 id="orgdab5f30"><span class="section-number-3">2.3</span> Read/write behavior</h3>
|
||||
<div id="outline-container-org92825c2" class="outline-3">
|
||||
<h3 id="org92825c2"><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
|
||||
@ -755,8 +787,8 @@ concurrent programs, the behavior is not specified.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org7d0824d" class="outline-3">
|
||||
<h3 id="org7d0824d"><span class="section-number-3">2.4</span> TREXIO file type</h3>
|
||||
<div id="outline-container-org6bc2172" class="outline-3">
|
||||
<h3 id="org6bc2172"><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
|
||||
@ -788,8 +820,8 @@ TREXIO files will have as a first argument the TREXIO file handle.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgafc9b54" class="outline-3">
|
||||
<h3 id="orgafc9b54"><span class="section-number-3">2.5</span> Polymorphism of the file handle</h3>
|
||||
<div id="outline-container-org28aaa0a" class="outline-3">
|
||||
<h3 id="org28aaa0a"><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
|
||||
@ -808,8 +840,8 @@ corresponding types for all back ends can be safely casted to
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org36e50d8" class="outline-3">
|
||||
<h3 id="org36e50d8"><span class="section-number-3">2.6</span> File opening</h3>
|
||||
<div id="outline-container-orgb12e187" class="outline-3">
|
||||
<h3 id="orgb12e187"><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.
|
||||
@ -824,7 +856,6 @@ input parameters:
|
||||
<ul class="org-ul">
|
||||
<li><code>'w'</code> - (write) creates a new file as READWRITE (overwrite existing file)</li>
|
||||
<li><code>'r'</code> - (read) opens existing file as READONLY</li>
|
||||
<li><code>'a'</code> - (append) either opens file in READWRITE mode if it already exists or creates a new one</li>
|
||||
</ul></li>
|
||||
<li><code>back_end</code> - integer number (or the corresponding global parameter) specifying the back end
|
||||
<ul class="org-ul">
|
||||
@ -859,7 +890,7 @@ should tend to avoid renaming the <code>.txt</code> data files.
|
||||
<span style="color: #a020f0;">if</span> (back_end < 0) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
||||
<span style="color: #a020f0;">if</span> (back_end >= TREXIO_INVALID_BACK_END) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
||||
|
||||
<span style="color: #a020f0;">if</span> (mode != <span style="color: #8b2252;">'r'</span> && mode != <span style="color: #8b2252;">'w'</span> && mode != <span style="color: #8b2252;">'a'</span>) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
||||
<span style="color: #a020f0;">if</span> (mode != <span style="color: #8b2252;">'r'</span> && mode != <span style="color: #8b2252;">'w'</span>) <span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
||||
|
||||
<span style="color: #228b22;">trexio_t</span>* <span style="color: #a0522d;">result</span> = <span style="color: #008b8b;">NULL</span>;
|
||||
<span style="color: #228b22;">void</span>* <span style="color: #a0522d;">result_tmp</span> = <span style="color: #008b8b;">NULL</span>;
|
||||
@ -973,8 +1004,8 @@ should tend to avoid renaming the <code>.txt</code> data files.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orga893e27" class="outline-3">
|
||||
<h3 id="orga893e27"><span class="section-number-3">2.7</span> File closing</h3>
|
||||
<div id="outline-container-org0fce83e" class="outline-3">
|
||||
<h3 id="org0fce83e"><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.
|
||||
@ -1072,8 +1103,8 @@ output:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org96fad3f" class="outline-3">
|
||||
<h3 id="org96fad3f"><span class="section-number-3">2.8</span> C helper functions</h3>
|
||||
<div id="outline-container-org4bc7201" class="outline-3">
|
||||
<h3 id="org4bc7201"><span class="section-number-3">2.8</span> C helper functions</h3>
|
||||
<div class="outline-text-3" id="text-2-8">
|
||||
<p>
|
||||
#+begin<sub>src</sub> c :tangle prefix<sub>front.c</sub>
|
||||
@ -1111,21 +1142,20 @@ for (int i=0; i<str<sub>max</sub><sub>num</sub>; i++){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org7494694" class="outline-2">
|
||||
<h2 id="org7494694"><span class="section-number-2">3</span> Templates for front end</h2>
|
||||
<div id="outline-container-orgce5d3dc" class="outline-2">
|
||||
<h2 id="orgce5d3dc"><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>:
|
||||
</p>
|
||||
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python">{
|
||||
<span style="color: #8b2252;">"nucleus"</span>: {
|
||||
<span style="color: #8b2252;">"num"</span> : [ <span style="color: #8b2252;">"int"</span> , [ ] ]
|
||||
, <span style="color: #8b2252;">"charge"</span> : [ <span style="color: #8b2252;">"float"</span>, [ <span style="color: #8b2252;">"nucleus.num"</span> ] ]
|
||||
, <span style="color: #8b2252;">"coord"</span> : [ <span style="color: #8b2252;">"float"</span>, [ <span style="color: #8b2252;">"nucleus.num"</span>, <span style="color: #8b2252;">"3"</span> ] ]
|
||||
, <span style="color: #8b2252;">"label"</span> : [ <span style="color: #8b2252;">"char"</span> , [ <span style="color: #8b2252;">"nucleus.num"</span>, <span style="color: #8b2252;">"32"</span> ] ]
|
||||
, <span style="color: #8b2252;">"label"</span> : [ <span style="color: #8b2252;">"str"</span> , [ <span style="color: #8b2252;">"nucleus.num"</span> ] ]
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
@ -1292,7 +1322,7 @@ parts:
|
||||
<ol class="org-ol">
|
||||
<li>Dimensioning variables (contain <code>num</code> in their names). These are always scalar integers.</li>
|
||||
<li>Datasets. These can be vectors, matrices or tensors. The types are indicated in <code>trex.json</code>.
|
||||
Currently supported types: int, float. TODO: strings.</li>
|
||||
Currently supported types: int, float and strings.</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
@ -1302,8 +1332,8 @@ or double precision for integer and floating point numbers.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf395f30" class="outline-3">
|
||||
<h3 id="orgf395f30"><span class="section-number-3">3.1</span> Templates for front end has/read/write a dimension</h3>
|
||||
<div id="outline-container-orgb2af4b7" class="outline-3">
|
||||
<h3 id="orgb2af4b7"><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.
|
||||
@ -1372,8 +1402,8 @@ This section concerns API calls related to dimensioning variables.
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org7467291" class="outline-4">
|
||||
<h4 id="org7467291"><span class="section-number-4">3.1.1</span> C templates for front end</h4>
|
||||
<div id="outline-container-org95e34d4" class="outline-4">
|
||||
<h4 id="org95e34d4"><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
|
||||
@ -1426,6 +1456,7 @@ precision (see Table above).
|
||||
{
|
||||
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
<span style="color: #a020f0;">if</span> (num < 0 ) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
|
||||
<span style="color: #a020f0;">if</span> (trexio_has_$group_num$(file) == TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> TREXIO_NUM_ALREADY_EXISTS;
|
||||
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc</span> = TREXIO_GROUP_WRITE_ERROR;
|
||||
|
||||
@ -1491,6 +1522,7 @@ precision (see Table above).
|
||||
|
||||
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
<span style="color: #a020f0;">if</span> (num < 0 ) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
|
||||
<span style="color: #a020f0;">if</span> (trexio_has_$group_num$(file) == TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> TREXIO_NUM_ALREADY_EXISTS;
|
||||
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc</span> = TREXIO_GROUP_WRITE_ERROR;
|
||||
|
||||
@ -1566,8 +1598,8 @@ precision (see Table above).
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org220d1b2" class="outline-4">
|
||||
<h4 id="org220d1b2"><span class="section-number-4">3.1.2</span> Fortran templates for front end</h4>
|
||||
<div id="outline-container-org1d3c2a2" class="outline-4">
|
||||
<h4 id="org1d3c2a2"><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.
|
||||
@ -1653,8 +1685,8 @@ These templates are based on the use of <code>iso_c_binding</code>. Pointers hav
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orge3507d5" class="outline-3">
|
||||
<h3 id="orge3507d5"><span class="section-number-3">3.2</span> Templates for front end has/read/write a dataset</h3>
|
||||
<div id="outline-container-orgda84b33" class="outline-3">
|
||||
<h3 id="orgda84b33"><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.
|
||||
@ -1723,8 +1755,8 @@ This section concerns API calls related to datasets.
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org557de09" class="outline-4">
|
||||
<h4 id="org557de09"><span class="section-number-4">3.2.1</span> C templates for front end</h4>
|
||||
<div id="outline-container-org54ac865" class="outline-4">
|
||||
<h4 id="org54ac865"><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.
|
||||
@ -1783,6 +1815,7 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
|
||||
|
||||
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
<span style="color: #a020f0;">if</span> ($group_dset$ == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
|
||||
<span style="color: #a020f0;">if</span> (trexio_has_$group_dset$(file) == TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> TREXIO_DSET_ALREADY_EXISTS;
|
||||
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
int64_t $group_dset_dim$ = 0;
|
||||
@ -1886,6 +1919,7 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
|
||||
|
||||
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
<span style="color: #a020f0;">if</span> ($group_dset$ == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
|
||||
<span style="color: #a020f0;">if</span> (trexio_has_$group_dset$(file) == TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> TREXIO_DSET_ALREADY_EXISTS;
|
||||
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
int64_t $group_dset_dim$ = 0;
|
||||
@ -1988,8 +2022,8 @@ The basic (non-suffixed) API call on datasets deals with double precision (see T
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org02db47e" class="outline-4">
|
||||
<h4 id="org02db47e"><span class="section-number-4">3.2.2</span> Fortran templates for front end</h4>
|
||||
<div id="outline-container-org4698ede" class="outline-4">
|
||||
<h4 id="org4698ede"><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>.
|
||||
@ -2074,10 +2108,152 @@ These templates are based on the use of <code>iso_c_binding</code>. Pointers hav
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1753b9e" class="outline-3">
|
||||
<h3 id="org1753b9e"><span class="section-number-3">3.3</span> Sparse data structures</h3>
|
||||
<div class="outline-text-3" id="text-3-3">
|
||||
<p>
|
||||
Sparse data structures are used typically for large tensors such as
|
||||
two-electron integrals. For example, in the <code>trex.json</code> file sparse
|
||||
arrays appear as for the <code>eri</code> :
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #8b2252;">"ao_2e_int"</span> : {
|
||||
<span style="color: #8b2252;">"eri_num"</span> : [ <span style="color: #8b2252;">"int"</span>, [ ] ]
|
||||
<span style="color: #8b2252;">"eri"</span> : [ <span style="color: #8b2252;">"float sparse"</span>, [ <span style="color: #8b2252;">"ao.num"</span>, <span style="color: #8b2252;">"ao.num"</span>, <span style="color: #8b2252;">"ao.num"</span>, <span style="color: #8b2252;">"ao.num"</span> ] ]
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org62e2628" class="outline-2">
|
||||
<h2 id="org62e2628"><span class="section-number-2">4</span> Fortran helper/wrapper functions</h2>
|
||||
<p>
|
||||
The electron repulsion integral \(\langle ij | kl \rangle\) is
|
||||
represented as a quartet of integers \((i,j,k,l)\) and a floating
|
||||
point value.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To store \(N\) integrals in the file, we store
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>An array of quartets of integers</li>
|
||||
<li>An array of values (floats)</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Both arrays have the same size, \(N\), the number of non-zero integrals.
|
||||
Knowing the maximum dimensions allows to check that the integers are
|
||||
in a valid range, and also lets the library choose the smallest
|
||||
integer representation to compress the storage.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Fortran uses 1-based array indexing, while C uses 0-based indexing.
|
||||
Internally, we use a 0-based representation but the Fortran binding
|
||||
does the appropriate conversion when reading or writing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As the number of integrals to store can be prohibitively large, we
|
||||
provide the possibility to read/write the integrals in chunks. So the
|
||||
functions take two extra parameters:
|
||||
</p>
|
||||
<ul class="org-ul">
|
||||
<li><code>offset</code> : the index of the 1st integral we want to read. An
|
||||
offset of zero implies to read the first integral.</li>
|
||||
<li><code>num</code> : the number of integrals to read.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
We provide a function to read a chunk of indices, and a function to
|
||||
read a chunk of values, because some users might want to read only
|
||||
the values of the integrals, or only the indices.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here is an example for the indices:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
<span style="color: #0000ff;">trexio_read_chunk_ao_2e_int_eri_index_32</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>,
|
||||
<span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">buffer</span>)
|
||||
{
|
||||
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
<span style="color: #a020f0;">if</span> (offset < 0L) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
|
||||
<span style="color: #a020f0;">if</span> (num < 0L) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_3;
|
||||
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span> = 4; // <span style="color: #b22222;">To be set by generator : number of indices</span>
|
||||
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nmax</span>; // <span style="color: #b22222;">Max number of integrals</span>
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri_num(<span style="color: #a020f0;">const</span> <span style="color: #228b22;">file</span>, &nmax);
|
||||
<span style="color: #a020f0;">if</span> (rc != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc;
|
||||
|
||||
<span style="color: #a020f0;">switch</span> (file->back_end) {
|
||||
|
||||
<span style="color: #a020f0;">case</span> TREXIO_TEXT:
|
||||
<span style="color: #a020f0;">return</span> trexio_text_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
|
||||
<span style="color: #a020f0;">case</span> TREXIO_HDF5:
|
||||
<span style="color: #a020f0;">return</span> trexio_hdf5_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, rank, nmax);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
|
||||
<span style="color: #a020f0;">default</span>:
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE; /* <span style="color: #b22222;">Impossible case </span>*/
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
For the values,
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
<span style="color: #0000ff;">trexio_read_chunk_ao_2e_int_eri_value_64</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>,
|
||||
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">buffer</span>)
|
||||
{
|
||||
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
<span style="color: #a020f0;">if</span> (offset < 0L) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
|
||||
<span style="color: #a020f0;">if</span> (num < 0L) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_3;
|
||||
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nmax</span>; // <span style="color: #b22222;">Max number of integrals</span>
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
|
||||
rc = trexio_read_ao_2e_int_eri_num(<span style="color: #a020f0;">const</span> <span style="color: #228b22;">file</span>, &nmax);
|
||||
<span style="color: #a020f0;">if</span> (rc != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc;
|
||||
|
||||
<span style="color: #a020f0;">switch</span> (file->back_end) {
|
||||
|
||||
<span style="color: #a020f0;">case</span> TREXIO_TEXT:
|
||||
<span style="color: #a020f0;">return</span> trexio_text_read_chunk_ao_2e_int_eri_value(file, buffer, offset, num, nmax);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
|
||||
<span style="color: #a020f0;">case</span> TREXIO_HDF5:
|
||||
<span style="color: #a020f0;">return</span> trexio_hdf5_read_chunk_ao_2e_int_eri_index(file, buffer, offset, num, nmax);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
|
||||
<span style="color: #a020f0;">default</span>:
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE; /* <span style="color: #b22222;">Impossible case </span>*/
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org060103a" class="outline-2">
|
||||
<h2 id="org060103a"><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.
|
||||
@ -2106,7 +2282,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-28 Fri 10:17</p>
|
||||
<p class="date">Created: 2021-06-04 Fri 12:15</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-28 Fri 10:17 -->
|
||||
<!-- 2021-06-04 Fri 12:15 -->
|
||||
<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="#orgda092bd">1. HDF5 back end</a>
|
||||
<li><a href="#org78c864e">1. HDF5 back end</a>
|
||||
<ul>
|
||||
<li><a href="#orgf865f94">1.1. Template for HDF5 definitions</a></li>
|
||||
<li><a href="#orgb61a42e">1.2. Template for HDF5 structures</a></li>
|
||||
<li><a href="#org883a2b1">1.3. Template for HDF5 init/deinit</a></li>
|
||||
<li><a href="#org322fdc9">1.4. Template for HDF5 has/read/write a number</a></li>
|
||||
<li><a href="#org87b63e3">1.5. Template for HDF5 has/read/write a dataset</a></li>
|
||||
<li><a href="#org3893fc8">1.1. Template for HDF5 definitions</a></li>
|
||||
<li><a href="#org1771dad">1.2. Template for HDF5 structures</a></li>
|
||||
<li><a href="#org6f1c985">1.3. Template for HDF5 init/deinit</a></li>
|
||||
<li><a href="#orgd1089e4">1.4. Template for HDF5 has/read/write a number</a></li>
|
||||
<li><a href="#org12d3dea">1.5. Template for HDF5 has/read/write a dataset</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgda092bd" class="outline-2">
|
||||
<h2 id="orgda092bd"><span class="section-number-2">1</span> HDF5 back end</h2>
|
||||
<div id="outline-container-org78c864e" class="outline-2">
|
||||
<h2 id="org78c864e"><span class="section-number-2">1</span> HDF5 back end</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
</div>
|
||||
<div id="outline-container-orgf865f94" class="outline-3">
|
||||
<h3 id="orgf865f94"><span class="section-number-3">1.1</span> Template for HDF5 definitions</h3>
|
||||
<div id="outline-container-org3893fc8" class="outline-3">
|
||||
<h3 id="org3893fc8"><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-orgb61a42e" class="outline-3">
|
||||
<h3 id="orgb61a42e"><span class="section-number-3">1.2</span> Template for HDF5 structures</h3>
|
||||
<div id="outline-container-org1771dad" class="outline-3">
|
||||
<h3 id="org1771dad"><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-org883a2b1" class="outline-3">
|
||||
<h3 id="org883a2b1"><span class="section-number-3">1.3</span> Template for HDF5 init/deinit</h3>
|
||||
<div id="outline-container-org6f1c985" class="outline-3">
|
||||
<h3 id="org6f1c985"><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>
|
||||
@ -379,13 +379,9 @@ for the JavaScript code in this tag.
|
||||
// <span style="color: #b22222;">reading the existing file -> open as RDONLY</span>
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'a'</span>:
|
||||
// <span style="color: #b22222;">appending the existing file -> open as RDWR</span>
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'w'</span>:
|
||||
// <span style="color: #b22222;">writing the existing file -> overwrite it (_TRUNC) [_EXCL | H5F_ACC_DEBUG as an alternative]</span>
|
||||
f->file_id = H5Fcreate(file->file_name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
// <span style="color: #b22222;">writing the existing file -> open as RDWRITE</span>
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
}
|
||||
|
||||
@ -393,8 +389,7 @@ for the JavaScript code in this tag.
|
||||
|
||||
<span style="color: #a020f0;">switch</span> (file->mode) {
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'r'</span>:
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'a'</span>:
|
||||
// <span style="color: #b22222;">reading or appending non-existing file -> error</span>
|
||||
// <span style="color: #b22222;">reading non-existing file -> error</span>
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'w'</span>:
|
||||
// <span style="color: #b22222;">writing non-existing file -> create it</span>
|
||||
@ -406,13 +401,15 @@ for the JavaScript code in this tag.
|
||||
|
||||
/* <span style="color: #b22222;">Create or open groups in the hdf5 file assuming that they exist if file exists </span>*/
|
||||
<span style="color: #a020f0;">switch</span> (file->mode) {
|
||||
// <span style="color: #b22222;">the switch for 'r'/'a' is reached only if file exists</span>
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'r'</span>:
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'a'</span>:
|
||||
f->$group$_group = H5Gopen(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'w'</span>:
|
||||
f->$group$_group = H5Gcreate(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (f_exists == 1) {
|
||||
f->$group$_group = H5Gopen(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
} <span style="color: #a020f0;">else</span> {
|
||||
f->$group$_group = H5Gcreate(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
}
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
}
|
||||
<span style="color: #a020f0;">if</span> (f->$group$_group <= 0L) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
@ -440,8 +437,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org322fdc9" class="outline-3">
|
||||
<h3 id="org322fdc9"><span class="section-number-3">1.4</span> Template for HDF5 has/read/write a number</h3>
|
||||
<div id="outline-container-orgd1089e4" class="outline-3">
|
||||
<h3 id="orgd1089e4"><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>
|
||||
@ -563,8 +560,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org87b63e3" class="outline-3">
|
||||
<h3 id="org87b63e3"><span class="section-number-3">1.5</span> Template for HDF5 has/read/write a dataset</h3>
|
||||
<div id="outline-container-org12d3dea" class="outline-3">
|
||||
<h3 id="org12d3dea"><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>
|
||||
@ -698,7 +695,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-28 Fri 10:17</p>
|
||||
<p class="date">Created: 2021-06-04 Fri 12:15</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-28 Fri 10:17 -->
|
||||
<!-- 2021-06-04 Fri 12:15 -->
|
||||
<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="#orgaf91f06">1. TEXT back end</a>
|
||||
<li><a href="#orgac72b89">1. TEXT back end</a>
|
||||
<ul>
|
||||
<li><a href="#orgeec4ed9">1.1. Template for group-related structures in text back end</a></li>
|
||||
<li><a href="#orge05bcbe">1.2. Template for general structure in text back end</a></li>
|
||||
<li><a href="#orgd54502d">1.3. Initialize function (constant part)</a></li>
|
||||
<li><a href="#org4ffd338">1.4. Deinitialize function (templated part)</a></li>
|
||||
<li><a href="#orgd3b4ec4">1.5. Template for text read struct</a></li>
|
||||
<li><a href="#org6efabe4">1.6. Template for text flush struct</a></li>
|
||||
<li><a href="#org8efb102">1.7. Template for text free memory</a></li>
|
||||
<li><a href="#org4bbfd0b">1.8. Template for has/read/write the <code>$group_num$</code> attribute</a></li>
|
||||
<li><a href="#org31914ff">1.9. Template for has/read/write the <code>$group_dset$</code> dataset</a></li>
|
||||
<li><a href="#org5ae7ff5">1.10. RDM struct (hard-coded)</a>
|
||||
<li><a href="#org0d2be68">1.1. Template for group-related structures in text back end</a></li>
|
||||
<li><a href="#org29c0aca">1.2. Template for general structure in text back end</a></li>
|
||||
<li><a href="#org713130f">1.3. Initialize function (constant part)</a></li>
|
||||
<li><a href="#orgdc4ed3a">1.4. Deinitialize function (templated part)</a></li>
|
||||
<li><a href="#org9ff6131">1.5. Template for text read struct</a></li>
|
||||
<li><a href="#orgbb48b37">1.6. Template for text flush struct</a></li>
|
||||
<li><a href="#orgb833e6c">1.7. Template for text free memory</a></li>
|
||||
<li><a href="#org0810ddd">1.8. Template for has/read/write the <code>$group_num$</code> attribute</a></li>
|
||||
<li><a href="#org72afbab">1.9. Template for has/read/write the <code>$group_dset$</code> dataset</a></li>
|
||||
<li><a href="#orgfaf77f8">1.10. RDM struct (hard-coded)</a>
|
||||
<ul>
|
||||
<li><a href="#org58a7cc9">1.10.1. Read the complete struct</a></li>
|
||||
<li><a href="#org2cf86d5">1.10.2. Flush the complete struct</a></li>
|
||||
<li><a href="#orgfefa0c8">1.10.3. Free memory</a></li>
|
||||
<li><a href="#org49ee03c">1.10.4. Read/Write the one<sub>e</sub> attribute</a></li>
|
||||
<li><a href="#orgb5f2fc3">1.10.5. Read/Write the two<sub>e</sub> attribute</a></li>
|
||||
<li><a href="#org02537a0">1.10.1. Read the complete struct</a></li>
|
||||
<li><a href="#org6f94686">1.10.2. Flush the complete struct</a></li>
|
||||
<li><a href="#orgfde3988">1.10.3. Free memory</a></li>
|
||||
<li><a href="#org6e1ce25">1.10.4. Read/Write the one<sub>e</sub> attribute</a></li>
|
||||
<li><a href="#org7dbb9bb">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-orgaf91f06" class="outline-2">
|
||||
<h2 id="orgaf91f06"><span class="section-number-2">1</span> TEXT back end</h2>
|
||||
<div id="outline-container-orgac72b89" class="outline-2">
|
||||
<h2 id="orgac72b89"><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-orgeec4ed9" class="outline-3">
|
||||
<h3 id="orgeec4ed9"><span class="section-number-3">1.1</span> Template for group-related structures in text back end</h3>
|
||||
<div id="outline-container-org0d2be68" class="outline-3">
|
||||
<h3 id="org0d2be68"><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-orge05bcbe" class="outline-3">
|
||||
<h3 id="orge05bcbe"><span class="section-number-3">1.2</span> Template for general structure in text back end</h3>
|
||||
<div id="outline-container-org29c0aca" class="outline-3">
|
||||
<h3 id="org29c0aca"><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-orgd54502d" class="outline-3">
|
||||
<h3 id="orgd54502d"><span class="section-number-3">1.3</span> Initialize function (constant part)</h3>
|
||||
<div id="outline-container-org713130f" class="outline-3">
|
||||
<h3 id="org713130f"><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>
|
||||
@ -505,8 +505,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4ffd338" class="outline-3">
|
||||
<h3 id="org4ffd338"><span class="section-number-3">1.4</span> Deinitialize function (templated part)</h3>
|
||||
<div id="outline-container-orgdc4ed3a" class="outline-3">
|
||||
<h3 id="orgdc4ed3a"><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>
|
||||
@ -531,8 +531,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd3b4ec4" class="outline-3">
|
||||
<h3 id="orgd3b4ec4"><span class="section-number-3">1.5</span> Template for text read struct</h3>
|
||||
<div id="outline-container-org9ff6131" class="outline-3">
|
||||
<h3 id="org9ff6131"><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*
|
||||
@ -698,8 +698,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6efabe4" class="outline-3">
|
||||
<h3 id="org6efabe4"><span class="section-number-3">1.6</span> Template for text flush struct</h3>
|
||||
<div id="outline-container-orgbb48b37" class="outline-3">
|
||||
<h3 id="orgbb48b37"><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>
|
||||
@ -758,8 +758,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8efb102" class="outline-3">
|
||||
<h3 id="org8efb102"><span class="section-number-3">1.7</span> Template for text free memory</h3>
|
||||
<div id="outline-container-orgb833e6c" class="outline-3">
|
||||
<h3 id="orgb833e6c"><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.
|
||||
@ -795,8 +795,8 @@ Memory is allocated when reading. The following function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4bbfd0b" class="outline-3">
|
||||
<h3 id="org4bbfd0b"><span class="section-number-3">1.8</span> Template for has/read/write the <code>$group_num$</code> attribute</h3>
|
||||
<div id="outline-container-org0810ddd" class="outline-3">
|
||||
<h3 id="org0810ddd"><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>
|
||||
@ -858,8 +858,8 @@ Memory is allocated when reading. The following function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org31914ff" class="outline-3">
|
||||
<h3 id="org31914ff"><span class="section-number-3">1.9</span> Template for has/read/write the <code>$group_dset$</code> dataset</h3>
|
||||
<div id="outline-container-org72afbab" class="outline-3">
|
||||
<h3 id="org72afbab"><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.
|
||||
@ -956,12 +956,12 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org5ae7ff5" class="outline-3">
|
||||
<h3 id="org5ae7ff5"><span class="section-number-3">1.10</span> RDM struct (hard-coded)</h3>
|
||||
<div id="outline-container-orgfaf77f8" class="outline-3">
|
||||
<h3 id="orgfaf77f8"><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-org58a7cc9" class="outline-4">
|
||||
<h4 id="org58a7cc9"><span class="section-number-4">1.10.1</span> Read the complete struct</h4>
|
||||
<div id="outline-container-org02537a0" class="outline-4">
|
||||
<h4 id="org02537a0"><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>);
|
||||
@ -1056,8 +1056,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org2cf86d5" class="outline-4">
|
||||
<h4 id="org2cf86d5"><span class="section-number-4">1.10.2</span> Flush the complete struct</h4>
|
||||
<div id="outline-container-org6f94686" class="outline-4">
|
||||
<h4 id="org6f94686"><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>);
|
||||
@ -1099,8 +1099,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgfefa0c8" class="outline-4">
|
||||
<h4 id="orgfefa0c8"><span class="section-number-4">1.10.3</span> Free memory</h4>
|
||||
<div id="outline-container-orgfde3988" class="outline-4">
|
||||
<h4 id="orgfde3988"><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.
|
||||
@ -1136,8 +1136,8 @@ Memory is allocated when reading. The followig function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org49ee03c" class="outline-4">
|
||||
<h4 id="org49ee03c"><span class="section-number-4">1.10.4</span> Read/Write the one<sub>e</sub> attribute</h4>
|
||||
<div id="outline-container-org6e1ce25" class="outline-4">
|
||||
<h4 id="org6e1ce25"><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.
|
||||
@ -1203,8 +1203,8 @@ The <code>one_e</code> array is assumed allocated with the appropriate size.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb5f2fc3" class="outline-4">
|
||||
<h4 id="orgb5f2fc3"><span class="section-number-4">1.10.5</span> Read/Write the two<sub>e</sub> attribute</h4>
|
||||
<div id="outline-container-org7dbb9bb" class="outline-4">
|
||||
<h4 id="org7dbb9bb"><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
|
||||
@ -1312,7 +1312,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-28 Fri 10:17</p>
|
||||
<p class="date">Created: 2021-06-04 Fri 12:15</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user