Commit 82363551 authored by JasonPries's avatar JasonPries
Browse files

Remove using namespace std;

parent 6c0792d8
......@@ -222,7 +222,7 @@ bool Edge::swap() {
}
bool Edge::recursive_swap() {
// #TODO, May need to have two different recursive swap methods, one for midpoint insertion and one for circumcenter insertion
// TODO, May need to have two different recursive swap methods, one for midpoint insertion and one for circumcenter insertion
if (!is_locally_optimal() && swap()) {
Edge * next = Next;
Edge * prev = Prev;
......
......@@ -745,7 +745,7 @@ void Mesh::save_as(std::string path, std::string file_name) const {
const Point *v0 = Edges[i]->Node;
const Point *v1 = Edges[i]->Next->Node;
const Point *v2 = Edges[i]->Next->Next->Node;
fs << v0->X << "," << v1->X << "," << v2->X << "," << v0->Y << "," << v1->Y << "," << v2->Y << "\n";
fs << v0->X << ',' << v1->X << ',' << v2->X << ',' << v0->Y << ',' << v1->Y << ',' << v2->Y << '\n';
}
fs.close();
......
......@@ -26,8 +26,8 @@ bool Constellation::twin(std::list<Star>::iterator &s_out, std::list<Branch>::it
return false;
}
void Constellation::supremum(list<Star>::iterator &s_out, list<Branch>::iterator &b_out) {
pair<double,double> sup{0.0,0.0};
void Constellation::supremum(std::list<Star>::iterator &s_out, std::list<Branch>::iterator &b_out) {
std::pair<double,double> sup{0.0,0.0};
double ang{0.0};
for (auto s = Stars.begin(); s != Stars.end(); ++s) {
......@@ -76,8 +76,8 @@ void Constellation::pop(const Curve *c) {
}
bool Constellation::boundary(Contour *c) {
vector<const Curve *> curves;
vector<bool> orientation;
std::vector<const Curve *> curves;
std::vector<bool> orientation;
// Base of induction
auto s{Stars.begin()};
......@@ -122,8 +122,8 @@ bool Constellation::boundary(Contour *c) {
}
bool Constellation::contours(std::vector<Contour *> &contours) {
vector<const Curve *> contour_curves;
vector<bool> orientation;
std::vector<const Curve *> contour_curves;
std::vector<bool> orientation;
while (size() > 0) {
bool success = find_closed_contour(contour_curves, orientation);
......
......@@ -12,20 +12,20 @@ public:
size_t size() { return Stars.size(); };
bool contours(vector<Contour *> &contours);
bool contours(std::vector<Contour *> &contours);
bool boundary(Contour *c);
private:
list<Star> Stars;
std::list<Star> Stars;
void pop(const Curve *c = nullptr);
bool twin(list<Star>::iterator &s_out, list<Branch>::iterator &b_out);
bool twin(std::list<Star>::iterator &s_out, std::list<Branch>::iterator &b_out);
void supremum(list<Star>::iterator &s_out, list<Branch>::iterator &b_out);
void supremum(std::list<Star>::iterator &s_out, std::list<Branch>::iterator &b_out);
bool find_closed_contour(vector<const Curve *> &curves, vector<bool> &orientation);
bool find_closed_contour(std::vector<const Curve *> &curves, std::vector<bool> &orientation);
};
#endif //OERSTED_CONSTELLATION_H
\ No newline at end of file
......@@ -93,9 +93,9 @@ void Sketch::save_as<SaveMethod::Rasterize>(std::string path, std::string file_n
if (!Curves[i]->ForConstruction) {
for (size_t j = 0; j <= 10; ++j) {
Vertex v = Curves[i]->point(j / 10.0);
fs << v.x() << "," << v.y() << "\n";
fs << v.x() << ',' << v.y() << '\n';
}
fs << "NaN" << "," << "NaN" << "\n";
fs << "NaN" << ',' << "NaN" << '\n';
}
}
......
......@@ -14,8 +14,6 @@
#include <boost/filesystem.hpp>
using namespace std;
class Sketch;
// Sketch Parameter
......
......@@ -226,10 +226,10 @@ TEST(Mesh, create__narrow_diamond_domain) {
Point cc1 = m.triangle(1)->circumcenter();
EXPECT_NEAR(0.0, cc0.X, TOL);
EXPECT_NEAR(0.75, abs(cc0.Y), TOL);
EXPECT_NEAR(0.75, std::abs(cc0.Y), TOL);
EXPECT_NEAR(0.0, cc1.X, TOL);
EXPECT_NEAR(0.75, abs(cc1.Y), TOL);
EXPECT_NEAR(0.75, std::abs(cc1.Y), TOL);
EXPECT_NEAR(-cc0.Y, cc1.Y, TOL);
}
......
......@@ -7,8 +7,6 @@
#define SAVE_DIR "./test/output/Mesh/"
#define TOL 4e-8
using namespace std;
bool edges_are_optimal(Mesh &m) {
for (size_t i = 0;i < m.size_edges();++i) {
EXPECT_TRUE(m.edge(i)->is_locally_optimal());
......@@ -51,7 +49,7 @@ bool edges_are_valid(Mesh &m) {
return true;
}
void forced_refinement(Mesh &m, string file_name, size_t num_refines) {
void forced_refinement(Mesh &m, std::string file_name, size_t num_refines) {
double minq = m.MinimumElementQuality;
double mine = m.MinimumElementSize;
double maxe = m.MaximumElementSize;
......@@ -64,10 +62,10 @@ void forced_refinement(Mesh &m, string file_name, size_t num_refines) {
try {
m.refine_once();
}
catch (const exception except) {
catch (const std::exception except) {
throw;
}
m.save_as(SAVE_DIR, file_name + "_" + to_string(i));
m.save_as(SAVE_DIR, file_name + "_" + std::to_string(i));
edges_are_valid(m);
edges_are_optimal(m);
......@@ -78,8 +76,8 @@ void forced_refinement(Mesh &m, string file_name, size_t num_refines) {
m.MaximumElementSize = maxe;
}
vector<size_t> map_verticies_to_points(vector<Vertex> verts, Mesh m) {
vector<size_t> index;
std::vector<size_t> map_verticies_to_points(std::vector<Vertex> verts, Mesh m) {
std::vector<size_t> index;
index.reserve(verts.size());
for (size_t i = 0;i != verts.size();++i) {
......@@ -92,7 +90,7 @@ vector<size_t> map_verticies_to_points(vector<Vertex> verts, Mesh m) {
}
}
return move(index);
return std::move(index);
}
#endif //OERSTED_TEST_MESH_HPP
......@@ -236,7 +236,7 @@ TEST(Constraint, Angle) {
s.solve();
s.save_as<SaveMethod::Rasterize>(SAVE_DIR, string("Constraint__Angle_LineSegment_LineSegment_")+to_string(i));
s.save_as<SaveMethod::Rasterize>(SAVE_DIR, std::string("Constraint__Angle_LineSegment_LineSegment_")+std::to_string(i));
EXPECT_NEAR(0.0, v0.x(), TOL);
EXPECT_NEAR(0.0, v0.y(), TOL);
......@@ -279,7 +279,7 @@ TEST(Constraint, Angle_Coincident) {
s.solve();
s.save_as<SaveMethod::Rasterize>(SAVE_DIR, string("Constraint__Angle_Coincident_")+to_string(i));
s.save_as<SaveMethod::Rasterize>(SAVE_DIR, std::string("Constraint__Angle_Coincident_")+std::to_string(i));
EXPECT_NEAR(0.0, v0.x(), TOL);
EXPECT_NEAR(0.0, v0.y(), TOL);
......
......@@ -9,7 +9,7 @@ TEST(Contour, Triangle_CCW) {
LineSegment l1{v1, v2};
LineSegment l2{v2, v0};
vector<const Curve *> vc(3);
std::vector<const Curve *> vc(3);
vc[0] = &l0;
vc[1] = &l1;
vc[2] = &l2;
......@@ -36,7 +36,7 @@ TEST(Contour, Triangle_CW) {
LineSegment l1{v2, v1};
LineSegment l2{v0, v2};
vector<const Curve *> vc(3);
std::vector<const Curve *> vc(3);
vc[0] = &l0;
vc[1] = &l1;
vc[2] = &l2;
......@@ -63,7 +63,7 @@ TEST(Contour, Triangle) {
LineSegment l1{v1, v2};
LineSegment l2{v2, v0};
vector<const Curve *> vc(3);
std::vector<const Curve *> vc(3);
vc[0] = &l2;
vc[1] = &l0;
vc[2] = &l1;
......@@ -85,7 +85,7 @@ TEST(Contour, Nonclosed_Failure) {
Vertex v0{0.0, 0.0};
Vertex v1{1.0, 1.0};
LineSegment l0{v0, v1};
vector<const Curve *> c(1);
std::vector<const Curve *> c(1);
c[0] = &l0;
EXPECT_ANY_THROW(Contour cont{c}); // Construction should fail since the contour is not closed
......@@ -106,7 +106,7 @@ TEST(Contour, Disjoint_Failure) {
LineSegment l4{v4, v5};
LineSegment l5{v5, v3};
vector<const Curve *> c(6);
std::vector<const Curve *> c(6);
c[0] = &l0;
c[1] = &l1;
c[2] = &l2;
......@@ -127,7 +127,7 @@ TEST(Contour, Implicit_Self_Intersection_Failure) {
LineSegment l2{v2, v3};
LineSegment l3{v3, v0};
vector<const Curve *> c(4);
std::vector<const Curve *> c(4);
c[0] = &l0;
c[1] = &l1;
c[2] = &l2;
......@@ -155,7 +155,7 @@ TEST(Contour, Explicit_Self_Intersection_Failure) {
LineSegment l4{vc, v3};
LineSegment l5{v3, v0};
vector<const Curve *> c(6);
std::vector<const Curve *> c(6);
c[0] = &l0;
c[1] = &l1;
c[2] = &l2;
......
......@@ -21,8 +21,8 @@ TEST(Curve, supremum) {
Coincident<LineSegment> &coin0 = s.new_element<Coincident<LineSegment>>(origin, l0);
Coincident<LineSegment> &coin1 = s.new_element<Coincident<LineSegment>>(origin, l1);
pair<double,double> sc0 = c0.supremum();
pair<double,double> sl0 = l0.supremum();
std::pair<double,double> sc0 = c0.supremum();
std::pair<double,double> sl0 = l0.supremum();
EXPECT_GT(sc0, sl0);
......
......@@ -372,7 +372,7 @@ TEST(Rotate, overlapping) {
Coincident<LineSegment> &co0 = s.new_element<Coincident<LineSegment>>(v0, l1);
Angle &a0 = s.new_element<Angle>(l0, l1, a_deg);
vector<const Curve *> vec({&l0, &l1, &c0, &c1});
std::vector<const Curve *> vec({&l0, &l1, &c0, &c1});
RotateCopy &r0 = s.new_element<RotateCopy>(vec, &v0, 360.0 / N, N - 2);
s.save_as<SaveMethod::Rasterize>(SAVE_DIR, "Rotate__overlapping_0");
......
......@@ -9,6 +9,4 @@
#define TOL 4e-8 //#TODO: Tolerance is limited by accuracy of tangency constraint
#define SAVE_DIR "./test/output/Sketch/"
using namespace std;
#endif
\ No newline at end of file
#include "test_Sketch.hpp"
bool star_angle_sum_equals_2pi(vector<Star> &stars) {
bool star_angle_sum_equals_2pi(std::vector<Star> &stars) {
for (auto s = stars.begin(); s != stars.end(); ++s) {
double angle = 0.0;
for (auto b = s->begin(); b != s->end(); ++b) {
......@@ -198,7 +198,7 @@ TEST(Star, find_closed_contour_0) {
// Manual contour creation
{
vector<Star> stars;
std::vector<Star> stars;
stars.push_back(Star{&v0, &sketch});
stars.push_back(Star{&v1, &sketch});
......@@ -240,7 +240,7 @@ TEST(Star, find_closed_contour_1) {
// Manual contour construction
{
vector<Star> stars;
std::vector<Star> stars;
stars.push_back(Star{&v0, &sketch});
stars.push_back(Star{&v1, &sketch});
stars.push_back(Star{&v2, &sketch});
......@@ -284,7 +284,7 @@ TEST(Star, find_closed_contour_2) {
// Manual contour construction
{
vector<Star> stars;
std::vector<Star> stars;
stars.push_back(Star{&v0, &sketch});
stars.push_back(Star{&v1, &sketch});
stars.push_back(Star{&v2, &sketch});
......@@ -354,7 +354,7 @@ TEST(Star, find_closed_contour_3) {
// Manual contour construction
{
vector<Star> stars;
std::vector<Star> stars;
stars.push_back(Star{&v0, &sketch});
stars.push_back(Star{&v1, &sketch});
......
......@@ -18,7 +18,7 @@ TEST(Vertex, rotate) {
double x, y;
tie(x, y) = v.rotate(&origin, angle);
std::tie(x, y) = v.rotate(&origin, angle);
EXPECT_NEAR(hypot(x - origin.x(), y - origin.y()), r, r * TOL);
EXPECT_NEAR(origin.x(), x, r * TOL);
......
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