Commit f944cea3 authored by p7k's avatar p7k

Default to use $HOME for saving files

parent 4cbceb52
......@@ -938,6 +938,10 @@ void Mesh::save_as(std::string path, std::string file_name) const {
This is a stub for visualization
*/
std::string home(std::getenv("HOME"));
path = home + path;
if (!std::experimental::filesystem::exists(path)) {
std::experimental::filesystem::create_directories(path);
}
......
......@@ -46,6 +46,9 @@ void Swarm::run() {
}
void Swarm::set_output_file(std::string path, std::string file_name) {
std::string home(std::getenv("HOME"));
path = home + path;
if (!std::experimental::filesystem::exists(path)) {
std::experimental::filesystem::create_directories(path);
}
......
......@@ -272,6 +272,9 @@ std::vector<std::shared_ptr<DiscreteBoundary>> FiniteElementMesh<P, Q>::make_dis
template<size_t P, size_t Q>
void FiniteElementMesh<P, Q>::write_scalar(Oe::VectorXd const &v, std::string path, std::string file_name) const {
std::string home(std::getenv("HOME"));
path = home + path;
if (!std::experimental::filesystem::exists(path)) {
std::experimental::filesystem::create_directories(path);
}
......@@ -315,6 +318,9 @@ void FiniteElementMesh<P, Q>::write_scalar(Oe::VectorXd const &v, std::string pa
template<size_t P, size_t Q>
void FiniteElementMesh<P, Q>::write_vector(Oe::ArrayXd const &Fx, Oe::ArrayXd const &Fy, std::string path, std::string file_name) const {
std::string home(std::getenv("HOME"));
path = home + path;
if (!std::experimental::filesystem::exists(path)) {
std::experimental::filesystem::create_directories(path);
}
......
......@@ -62,7 +62,7 @@ protected:
double_t ai = vc->atan(vi0);
double_t ao = vc->atan(vo0);
if (abs(ai - ao) > FLT_EPSILON * M_PI) { // TODO: Check for branch cut discontinuity due to numerical errors
if (std::abs(ai - ao) > FLT_EPSILON * M_PI) { // TODO: Check for branch cut discontinuity due to numerical errors
std::cerr << "Periodic boundaries should be aligned when creating airgap. Airgap will not be created" << std::endl;
return;
}
......
......@@ -189,6 +189,9 @@ void Sketch::save_as<SaveMethod::Rasterize>(std::string path, std::string file_n
This is a stub for visualization
*/
std::string home(std::getenv("HOME"));
path = home + path;
if (!std::experimental::filesystem::exists(path)) {
std::experimental::filesystem::create_directories(path);
}
......
#include "Library_Integration_Test.hpp"
std::string SAVE_DIR = "./test/output/Integration/";
#define SAVE_DIR "/Oersted/test/output/Integration/"
TEST(Full_Circle, Magnetostatic_Uniform_Current_Density) {
// Create Sketch
......
......@@ -67,7 +67,7 @@ public:
me.save_as(SAVE_DIR, std::string("mesh"));
}
std::string SAVE_DIR = "./test/output/Integration/test_Annuli/";
std::string SAVE_DIR = "/Oersted/output/Integration/test_Annuli/";
std::vector<std::shared_ptr<Curve>> inner_boundaries;
std::vector<std::shared_ptr<Curve>> outer_boundaries;
......
......@@ -45,7 +45,7 @@ public:
circle_contour = me.select_contour(Point{0.0,0.0});
}
std::string SAVE_DIR = "./test/output/Integration/test_Circle/";
std::string SAVE_DIR = "/Oersted/output/Integration/test_Circle/";
std::vector<std::shared_ptr<Curve>> boundaries;
......
......@@ -67,7 +67,7 @@ public:
me.save_as(SAVE_DIR, std::string("mesh"));
}
std::string SAVE_DIR = "./test/output/Integration/test_HalfAnnuli/";
std::string SAVE_DIR = "/Oersted/output/Integration/test_HalfAnnuli/";
std::shared_ptr<Vertex> origin;
......
......@@ -45,7 +45,7 @@ public:
square_contour = me.select_contour(Point{0.5,0.5});
}
std::string SAVE_DIR = "./test/output/Integration/test_Square/";
std::string SAVE_DIR = "/Oersted/test/output/Integration/test_Square/";
std::vector<std::shared_ptr<Curve>> boundaries;
......
......@@ -5,7 +5,7 @@
#include "Mesh.hpp"
#include "Mest_Test_Utility.h"
#define SAVE_DIR "./test/output/Mesh/"
#define SAVE_DIR "/test/output/Mesh/"
#define TOL 4e-8
#endif //OERSTED_TEST_MESH_HPP
......@@ -12,6 +12,6 @@
#include <random>
#define SAVE_DIR "./test/output/Model Templates/"
#define SAVE_DIR "/Oersted/test/output/Model Templates/"
#endif //OERSTED_TEST_MODELTEMPLATES_HPP
\ No newline at end of file
......@@ -4,6 +4,6 @@
#include "Optimization.hpp"
#include "gtest.h"
#define SAVE_DIR "./test/output/Optimization/"
#define SAVE_DIR "/Oersted/test/output/Optimization/"
#endif //OERSTED_TEST_OPTIMIZATION_HPP
......@@ -7,6 +7,6 @@
#include "Physics.hpp"
#define SAVE_DIR "./test/output/Physics/"
#define SAVE_DIR "/Oersted/test/output/Physics/"
#endif //OERSTED_TEST_PHYSICS_HPP
......@@ -8,7 +8,7 @@
#include "gtest.h"
#define TOL FLT_EPSILON // TODO: Tolerance is limited by accuracy of tangency constraint
#define SAVE_DIR "./test/output/Sketch/"
#define SAVE_DIR "/Oersted/test/output/Sketch/"
void test_sketch_size(Sketch &s, size_t nverts, size_t ncurves, size_t nconstraints, size_t ncontours);
......
......@@ -6,7 +6,7 @@
#include "gtest.h"
#include "../Mesh/Mest_Test_Utility.h"
#define SDIR "./test/output/UseCases/sketch/"
#define MDIR "./test/output/UseCases/mesh/"
#define SDIR "/Oersted/test/output/UseCases/sketch/"
#define MDIR "/Oersted/test/output/UseCases/mesh/"
#endif //OERSTED_TEST_USECASES_HPP
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment