Skip to content
Snippets Groups Projects
Commit 7294984d authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Create an include folder for headers

parent 55c0c3c0
No related branches found
No related tags found
No related merge requests found
build/include
build/cluster/* build/cluster/*
build/sphere/* build/sphere/*
build/trapping/* build/trapping/*
......
File moved
extern "C" void open_file_(int*, const char*, const char*, const char*);
extern "C" void close_file_(int*);
extern "C" void read_int_(int*, int*);
extern "C" void write_complex_(int*, double*, double*);
extern "C" void write_double_(int*, double*);
extern "C" void write_int_(int*, int*);
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include "List.h" #include "../include/file_io.h"
#include "../include/List.h"
using namespace std; using namespace std;
...@@ -391,24 +392,27 @@ int main(int argc, char **argv) { ...@@ -391,24 +392,27 @@ int main(int argc, char **argv) {
// The FORTRAN code writes an auxiliary file in binary format. This should // The FORTRAN code writes an auxiliary file in binary format. This should
// be avoided or possibly replaced with the use of standard file formats for // be avoided or possibly replaced with the use of standard file formats for
// scientific use (e.g. FITS). // scientific use (e.g. FITS).
ofstream tedf_file; int uid = 27;
tedf_file.open("c_TEDF", ofstream::binary); string bin_file_name = "c_TEDF";
tedf_file.write(reinterpret_cast<char *>(&nsph), sizeof(nsph)); string status = "UNKNOWN";
string mode = "UNFORMATTED";
open_file_(&uid, bin_file_name.c_str(), status.c_str(), mode.c_str());
write_int_(&uid, &nsph);
for (int iogi = 0; iogi < nsph; iogi++) for (int iogi = 0; iogi < nsph; iogi++)
tedf_file.write(reinterpret_cast<char *>(iog + iogi), sizeof(iog[iogi])); write_int_(&uid, (iog + iogi));
tedf_file.write(reinterpret_cast<char *>(&exdc), sizeof(exdc)); write_double_(&uid, &exdc);
tedf_file.write(reinterpret_cast<char *>(&wp), sizeof(wp)); write_double_(&uid, &wp);
tedf_file.write(reinterpret_cast<char *>(&xip), sizeof(xip)); write_double_(&uid, &xip);
tedf_file.write(reinterpret_cast<char *>(&idfc), sizeof(idfc)); write_int_(&uid, &idfc);
tedf_file.write(reinterpret_cast<char *>(&nxi), sizeof(nxi)); write_int_(&uid, &nxi);
for (int i115 = 1; i115 <= nsph; i115++) { for (int i115 = 1; i115 <= nsph; i115++) {
if (iog[i115 - 1] < i115) continue; if (iog[i115 - 1] < i115) continue;
tedf_file.write(reinterpret_cast<char *>(nshl + i115 - 1), sizeof(nshl[i115 - 1])); write_int_(&uid, (nshl + i115 -1));
tedf_file.write(reinterpret_cast<char *>(ros + i115 - 1), sizeof(ros[i115 - 1])); write_double_(&uid, (ros + i115 - 1));
nsh = nshl[i115 - 1]; nsh = nshl[i115 - 1];
if (i115 == 1) nsh += ies; if (i115 == 1) nsh += ies;
for (int ins = 0; ins < nsh; ins++) for (int ins = 0; ins < nsh; ins++)
tedf_file.write(reinterpret_cast<char *>(rcf[i115 - 1] + ins), sizeof(rcf[i115 - 1][ins])); write_double_(&uid, (rcf[i115 - 1] + ins));
} }
// Remake the dc0m matrix. // Remake the dc0m matrix.
dc0m = new complex<double>**[max_nsh]; dc0m = new complex<double>**[max_nsh];
...@@ -435,12 +439,11 @@ int main(int argc, char **argv) { ...@@ -435,12 +439,11 @@ int main(int argc, char **argv) {
// The FORTRAN code writes the complex numbers as a 16-byte long binary stream. // The FORTRAN code writes the complex numbers as a 16-byte long binary stream.
// Here we assume that the 16 bytes are equally split in 8 bytes to represent the // Here we assume that the 16 bytes are equally split in 8 bytes to represent the
// real part and 8 bytes to represent the imaginary one. // real part and 8 bytes to represent the imaginary one.
tedf_file.write(reinterpret_cast<char *>(&dc0_real), sizeof(dc0_real)); write_complex_(&uid, &dc0_real, &dc0_img);
tedf_file.write(reinterpret_cast<char *>(&dc0_img), sizeof(dc0_img));
} }
} }
} }
tedf_file.close(); close_file_(&uid);
if (idfc != 0) { if (idfc != 0) {
fprintf(output, " DIELECTRIC CONSTANTS\n"); fprintf(output, " DIELECTRIC CONSTANTS\n");
for (int i473 = 1; i473 <= nsph; i473++) { for (int i473 = 1; i473 <= nsph; i473++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment