mirror of
https://codeberg.org/vcbferreira/NuFI_deal.ii
synced 2026-08-12 14:33:18 +02:00
updated params, added save vector to save_results
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ namespace Parameters
|
||||
|
||||
//spline options
|
||||
constexpr int SPLINE_NX = 562;
|
||||
constexpr double SPLINE_DX = LX/SPLINE_NX;
|
||||
constexpr double SPLINE_DX = LX/(SPLINE_NX-1);
|
||||
constexpr size_t SPLINE_ORDER = 4;
|
||||
|
||||
//Plotting options
|
||||
|
||||
@@ -23,4 +23,6 @@ void save_Efield(unsigned int n,
|
||||
unsigned int Nx_out,
|
||||
const std::string &filename);
|
||||
|
||||
void save_space_vector(const std::vector<double>& vals, const std::string& filename, size_t it);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -102,3 +102,15 @@ void save_Efield(unsigned int n,
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
|
||||
void save_space_vector(const std::vector<double>& vals, const std::string& filename, size_t it)
|
||||
{
|
||||
std::ofstream file("results/" + filename + "_" + std::to_string(it) + ".dat");
|
||||
|
||||
if (!file) throw std::runtime_error("failed to start file in results/");
|
||||
|
||||
file << vals.size() << "\n";
|
||||
file << Parameters::X_DOMAIN_LEFT << " " << Parameters::X_DOMAIN_RIGHT << "\n";
|
||||
file << std::fixed << std::setprecision(8);
|
||||
for (double val : vals) file << val << "\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user