Commit f884152f authored by Stefan Pfeifer's avatar Stefan Pfeifer

Fix warnings, update libraries

parent e240d427
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
{
"limb": {
"width": {
"args": [0.0, 1.0],
"vals": [0.05, 0.01]
"args": [
0.0,
1.0
],
"vals": [
0.05,
0.01
]
},
"layers": [
{
"name": "Default",
"name": "",
"height": {
"args": [0.0, 1.0],
"vals": [0.01, 0.008]
"args": [
0.0,
1.0
],
"vals": [
0.01,
0.008
]
},
"rho": 500.0,
"E": 40.0e9
"E": 40000000000.0
}
],
"curvature": {
"args": [0.3, 0.4],
"vals": [-1.0, 1.0]
"args": [
0.3,
0.4
],
"vals": [
-1.0,
1.0
]
},
"offset_x": 0.0,
"offset_y": 0.0,
......@@ -37,9 +55,9 @@
"arrow_mass": 0.02
},
"settings": {
"n_limb_elements": 25,
"n_string_elements": 25,
"step_factor": 0.8
"n_elements_limb": 25,
"n_elements_string": 25,
"step_factor": 0.5
},
"meta": {
"comments": "",
......
File mode changed from 100644 to 100755
INCLUDEPATH += /home/s/Libraries/Eigen-3.2.8 \
/home/s/Libraries/Catch-1.5.6 \
/home/s/Libraries/Boost-1.61.0 \
/home/s/Libraries/Cereal-1.1.2/include \
# QCustomPlot 1.3.2
INCLUDEPATH += /media/s/Daten/Libraries/Eigen-3.2.9 \
/media/s/Daten/Libraries/Catch-1.5.6 \
/media/s/Daten/Libraries/Boost-1.61.0 \
/media/s/Daten/Libraries/Cereal-1.2.0/include \
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -28,34 +28,31 @@ public:
}
Node create_node(std::array<double, 3> u_node, std::array<bool, 3> dof_types)
Node create_node(std::array<double, 3> u_node, std::array<bool, 3> active)
{
return Node{create_dof(u_node[0], dof_types[0]),
create_dof(u_node[1], dof_types[1]),
create_dof(u_node[2], dof_types[2])};
return Node{create_dof(u_node[0], active[0]),
create_dof(u_node[1], active[1]),
create_dof(u_node[2], active[2])};
}
Dof create_dof(double u_dof, bool type)
Dof create_dof(double u_dof, bool active)
{
switch(type)
if(active)
{
case true:
{
size_t n = u.size() + 1;
u = (VectorXd(n) << u, u_dof).finished();
v = (VectorXd(n) << v, 0.0).finished();
a = (VectorXd(n) << a, 0.0).finished();
p = (VectorXd(n) << p, 0.0).finished();
size_t n = u.size() + 1;
u = (VectorXd(n) << u, u_dof).finished();
v = (VectorXd(n) << v, 0.0).finished();
a = (VectorXd(n) << a, 0.0).finished();
p = (VectorXd(n) << p, 0.0).finished();
return Dof{type, n-1};
}
case false:
{
size_t n = uf.size() + 1;
uf = (VectorXd(n) << uf, u_dof).finished();
return Dof{active, n-1};
}
else
{
size_t n = uf.size() + 1;
uf = (VectorXd(n) << uf, u_dof).finished();
return Dof{type, n-1};
}
return Dof{active, n-1};
}
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -37,7 +37,7 @@ public:
this->phi_ref_1 = phi_ref_1;
}
virtual void set_state(const VectorView<Dof> u, const VectorView<Dof> v)
virtual void set_state(const VectorView<Dof> u, const VectorView<Dof> /*v*/)
{
dx = u(dofs[3]) - u(dofs[0]);
dy = u(dofs[4]) - u(dofs[1]);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -75,6 +75,6 @@ public:
virtual void updateView(const T& data) = 0;
private:
ViewFunction<T> view_fn;
Document& doc;
ViewFunction<T> view_fn;
};
File mode changed from 100644 to 100755
......@@ -90,12 +90,12 @@ private slots:
bool save()
{
return false;
}
bool saveAs()
{
return false;
}
void about()
......
File mode changed from 100644 to 100755
......@@ -26,7 +26,7 @@ QT_CHARTS_USE_NAMESPACE
class Delegate : public QItemDelegate
{
public:
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const override
{
QLineEdit* line_edit = new QLineEdit(parent);
line_edit->setValidator(new QDoubleValidator); // Todo: Domain?
......@@ -119,6 +119,8 @@ public:
data.add(arg, val);
}
return data;
}
void initInputData()
......
......@@ -16,7 +16,9 @@ int main()
//data.save("../examples/default.bow");
InputData data;
data.load("../examples/default.bow");
data.save("../examples/default.bow");
//data.load("../examples/default.bow");
DiscreteLimb limb(data);
......
File mode changed from 100644 to 100755
......@@ -12,9 +12,16 @@ struct DiscreteLimb
std::vector<double> y;
std::vector<double> phi;
std::vector<double> h; // Total cross section height (used for contact)
std::vector<double> Cee;
std::vector<double> Ckk;
std::vector<double> Cek;
std::vector<double> rhoA;
DiscreteLimb(const InputData& input)
{
calculate_nodes(input);
calculate_properties(input);
}
private:
......@@ -42,11 +49,16 @@ private:
};
state_type z0 = {input.limb.offset_x, input.limb.offset_y, input.limb.angle + M_PI_2};
unsigned n = input.settings.n_limb_elements;
unsigned n = input.settings.n_elements_limb;
double s0 = kappa.arg_min();
double ds = (kappa.arg_max() - kappa.arg_min())/n;
auto stepper = make_controlled<error_stepper_type>(1.0e-10, 1.0e-6); // Todo: Magic numbers
integrate_n_steps(stepper, system, z0, s0, ds, n, observer);
}
void calculate_properties(const InputData& /*input*/)
{
}
};
......@@ -9,10 +9,10 @@ struct Limb
{
struct Layer
{
std::string name;
DataSeries height;
double rho;
double E;
std::string name = "";
DataSeries height = {{0.0, 1.0}, {0.01, 0.008}};
double rho = 500.0;
double E = 40.0e9;
template<class Archive>
void serialize(Archive & archive)
......@@ -24,13 +24,13 @@ struct Limb
}
};
DataSeries width;
std::vector<Layer> layers;
DataSeries curvature;
double offset_x;
double offset_y;
double angle;
double tip_mass;
DataSeries width = {{0.0, 1.0}, {0.05, 0.01}};
std::vector<Layer> layers = {Layer()};
DataSeries curvature = {{0.3, 0.4}, {-1.0, 1.0}};
double offset_x = 0.0;
double offset_y = 0.0;
double angle = 0.0;
double tip_mass = 0.0;
template<class Archive>
void serialize(Archive & archive)
......@@ -47,12 +47,12 @@ struct Limb
struct String
{
double strand_stiffness;
double strand_density;
unsigned n_strands;
double strand_stiffness = 3100.0;
double strand_density = 0.05;
unsigned n_strands = 10;
double center_mass;
double end_mass;
double center_mass = 0.0;
double end_mass = 0.0;
template<class Archive>
void serialize(Archive & archive)
......@@ -67,9 +67,9 @@ struct String
struct Operation
{
double brace_height;
double draw_length;
double arrow_mass;
double brace_height = 0.2;
double draw_length = 0.7;
double arrow_mass = 0.02;
template<class Archive>
void serialize(Archive & archive)
......@@ -82,23 +82,23 @@ struct Operation
struct Settings
{
unsigned n_limb_elements;
unsigned n_string_elements;
double step_factor;
unsigned n_elements_limb = 25;
unsigned n_elements_string = 25;
double step_factor = 0.5;
template<class Archive>
void serialize(Archive & archive)
{
archive(CEREAL_NVP(n_limb_elements),
CEREAL_NVP(n_string_elements),
archive(CEREAL_NVP(n_elements_limb),
CEREAL_NVP(n_elements_string),
CEREAL_NVP(step_factor));
}
};
struct Meta
{
std::string comments;
std::string version; // Todo: Get default value from somewhere?
std::string comments = "";
std::string version = ""; // Todo: Get default value from somewhere?
template<class Archive>
void serialize(Archive & archive)
......@@ -130,6 +130,11 @@ struct InputData
{
// Todo: Handle file not existing or inability to parse
std::ifstream file(path);
if(!file)
{
throw std::runtime_error(strerror(errno)); // Todo: Better message with filename
}
cereal::JSONInputArchive archive(file);
serialize(archive);
}
......@@ -138,6 +143,11 @@ struct InputData
{
// Todo: Handle file not existing
std::ofstream file(path);
if(!file)
{
throw std::runtime_error(strerror(errno)); // Todo: Better message with filename
}
cereal::JSONOutputArchive archive(file);
serialize(archive);
}
......
File mode changed from 100644 to 100755
#include "Domain.hpp"
template<>
void check_domain<Domain::All>(double val)
void check_domain<Domain::All>(double /*val*/)
{
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -18,7 +18,7 @@ public:
return label_;
}
double factor(double value) const
double factor() const
{
return factor_;
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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