-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
119 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// Author: Valerio Bertone: [email protected] | ||
// | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
namespace NangaParbat | ||
{ | ||
/** | ||
* @brief Utility function to generate an interpolation grid | ||
* @param n: the number of nodes of the grid | ||
* @param min: the lower bound | ||
* @param max: the upper bound | ||
* @param ext: the number of extra nodes (default: 0) | ||
* @param lgt: whether the grid is logarithmically spaced (default: false) | ||
* @return a linearly-spaced grid with "n" nodes between "min" and | ||
* "max" plus "ext" extra nodes on the right. | ||
*/ | ||
std::vector<double> GenerateGrid(int const& n, double const& min, double const& max, int const& ext = 0, bool const& lgt = false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Author: Valerio Bertone: [email protected] | ||
// | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace NangaParbat | ||
{ | ||
/** | ||
* @brief Function that lists elements in a directory | ||
* @param path: path to the directory | ||
* @return a vector of elements | ||
*/ | ||
std::vector<std::string> list_dir(std::string const& path); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
set(fastinterface_source | ||
fastinterface.cc | ||
convolutiontable.cc | ||
utilities.cc | ||
bstar.cc | ||
) | ||
|
||
add_library(fastinterface OBJECT ${fastinterface_source}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set(utilities_source | ||
generategrid.cc | ||
linearsystems.cc | ||
listdir.cc | ||
bstar.cc | ||
) | ||
|
||
add_library(utilities OBJECT ${utilities_source}) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// Author: Valerio Bertone: [email protected] | ||
// | ||
|
||
#include "NangaParbat/generategrid.h" | ||
|
||
#include <cmath> | ||
|
||
namespace NangaParbat | ||
{ | ||
//_________________________________________________________________________________ | ||
std::vector<double> GenerateGrid(int const& n, double const& min, double const& max, int const& ext, bool const& lgt) | ||
{ | ||
std::vector<double> grid(n+ext+1); | ||
if (lgt) | ||
{ | ||
const double step = log( max / min ) / n; | ||
for (int i = 0; i <= n + ext; i++) | ||
grid[i] = min * exp( i * step ); | ||
} | ||
else | ||
{ | ||
const double step = ( max - min ) / n; | ||
for (int i = 0; i <= n + ext; i++) | ||
grid[i] = min + i * step; | ||
} | ||
return grid; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,35 +2,12 @@ | |
// Author: Valerio Bertone: [email protected] | ||
// | ||
|
||
#include "NangaParbat/utilities.h" | ||
#include "NangaParbat/linearsystems.h" | ||
|
||
#include <iostream> | ||
#include <cmath> | ||
#include <gsl/gsl_linalg.h> | ||
#include <apfel/constants.h> | ||
#include <dirent.h> | ||
|
||
namespace NangaParbat | ||
{ | ||
//_________________________________________________________________________________ | ||
std::vector<double> GenerateGrid(int const& n, double const& min, double const& max, int const& ext, bool const& lgt) | ||
{ | ||
std::vector<double> grid(n+ext+1); | ||
if (lgt) | ||
{ | ||
const double step = log( max / min ) / n; | ||
for (int i = 0; i <= n + ext; i++) | ||
grid[i] = min * exp( i * step ); | ||
} | ||
else | ||
{ | ||
const double step = ( max - min ) / n; | ||
for (int i = 0; i <= n + ext; i++) | ||
grid[i] = min + i * step; | ||
} | ||
return grid; | ||
} | ||
|
||
//_________________________________________________________________________________ | ||
apfel::matrix<double> CholeskyDecomposition(apfel::matrix<double> const V) | ||
{ | ||
|
@@ -151,21 +128,4 @@ namespace NangaParbat | |
} | ||
return lambda; | ||
} | ||
|
||
//_________________________________________________________________________________ | ||
std::vector<std::string> list_dir(std::string const& path) | ||
{ | ||
struct dirent *entry; | ||
DIR *dir = opendir(path.c_str()); | ||
|
||
if (dir == NULL) | ||
return {}; | ||
|
||
std::vector<std::string> dirlist; | ||
while ((entry = readdir(dir)) != NULL) | ||
dirlist.push_back(entry->d_name); | ||
|
||
closedir(dir); | ||
return dirlist; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Author: Valerio Bertone: [email protected] | ||
// | ||
|
||
#include "NangaParbat/listdir.h" | ||
|
||
#include <dirent.h> | ||
#include <vector> | ||
|
||
namespace NangaParbat | ||
{ | ||
//_________________________________________________________________________________ | ||
std::vector<std::string> list_dir(std::string const& path) | ||
{ | ||
struct dirent *entry; | ||
DIR *dir = opendir(path.c_str()); | ||
|
||
if (dir == NULL) | ||
return {}; | ||
|
||
std::vector<std::string> dirlist; | ||
while ((entry = readdir(dir)) != NULL) | ||
dirlist.push_back(entry->d_name); | ||
|
||
closedir(dir); | ||
return dirlist; | ||
} | ||
} |