Skip to content

Commit c56f2c3

Browse files
author
Teseo Schneider
committed
better log, better ci, and pip?
1 parent b4cabdd commit c56f2c3

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

.travis.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ addons:
1111
sources:
1212
- ubuntu-toolchain-r-test
1313
packages:
14-
- libc++-dev
14+
# - libc++-dev
1515
- gcc-7
1616
- g++-7
17-
- libsuitesparse-dev
17+
# - libsuitesparse-dev
1818
env:
1919
- CC=gcc-7 && CXX=g++-7
2020
# - CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++"
@@ -23,4 +23,15 @@ install:
2323
- pip install plotly
2424
script:
2525
- python setup.py install
26-
- python setup.py test
26+
- python tests/bending.py
27+
- python tests/gravity.py
28+
- python tests/inflation.py
29+
- python tests/plane_hole.py
30+
- python tests/torsion.py
31+
deploy:
32+
provider: pypi
33+
user: "teseoch"
34+
password:
35+
secure: SBFTnlltZ+CsskcX+qILNOnEIQzK9fwnQKkZGKsxWuKn4VBA/M6olmTl/wOEzfYnrTdY3A9LrCX7b9D+/3CDCOhGkdFw6x1VRYySqkHtxk4UjdzXBnIPi9bf5GFDjIg/lOcKhR6bIhcRjEAu2bAYQTegyi936jHJuSglaLiK9S3/gWSH/fGbS22PFL0Nuh5o4o82MKeR9simNA9uXxTWdMr4SATEm/oOs2Itpmg9cKolizWPzRBT7WMMe9I61ULPkxFjMLtU1C+kXBB0ctE4FBIndZbEUnwYsceXw+gRrWTA+auc3ZvNbF7ilaAIYYXPPlWEewjt1Ib0vPZP1g/jpeLT0uDfpDuin5bJjDbdrjkD9mReBnpinbQU0o0KXX3IJWwcN+LW1r8NUB8K6T6iEiWQmy7D/9vX5jPRXe2zt7O63JWY61cD1VzPrKIeKY/CC0X4TP0PyujbsSpBI6O/5UE8VRZX1hp0YJOEywLqj3YRJ0HcSSanHccUI+sJlbZEGZaH/dJCbWqS25IGN6sXoXD1sfyS2d5XtD1758Sg7+5SLZoXa9fSGLntVhZ72kZjvRgJULirVEqbUqXjdtf3TMO6EtAQMWKgVVguqF9gqO/44R3omQa03bhnZNm9WDIft8ZyIRGk5On2OwVWvFb2ud/5PgmuOdw+auEat9oziNM=
36+
on:
37+
tags: true

src/binding.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TensorAssemblers { };
2424

2525

2626
namespace {
27-
void init_globals()
27+
void init_globals(polyfem::State &state)
2828
{
2929
static bool initialized = false;
3030

@@ -48,6 +48,8 @@ namespace {
4848
GEO::CmdLine::import_arg_group("pre");
4949
GEO::CmdLine::import_arg_group("algo");
5050

51+
state.init_logger("", 2, false);
52+
5153
initialized = true;
5254
}
5355
}
@@ -68,43 +70,43 @@ PYBIND11_MODULE(polyfempy, m) {
6870
.def(py::init<>())
6971

7072
.def("settings", [](polyfem::State &self, const std::string &json) {
71-
init_globals();
73+
init_globals(self);
7274
self.init(json::parse(json));
7375
},
7476
"load PDE and problem parameters from the settings",
7577
py::arg("json"))
7678

7779
.def("set_log_level", [](polyfem::State &s, int log_level) {
78-
init_globals();
80+
init_globals(s);
7981
log_level = std::max(0, std::min(6, log_level));
8082
spdlog::set_level(static_cast<spdlog::level::level_enum>(log_level));
8183
},
8284
"sets polyfem log level, valid value between 0 (all logs) and 6 (no logs)",
8385
py::arg("log_level"))
8486

8587
.def("load_mesh_from_settings", [](polyfem::State &s) {
86-
init_globals();
88+
init_globals(s);
8789
s.load_mesh();
8890
},
8991
"Loads a mesh from the 'mesh' field of the json and 'bc_tag' if any bc tags")
9092

9193
.def("load_mesh_from_path", [](polyfem::State &s, const std::string &path) {
92-
init_globals();
94+
init_globals(s);
9395
s.args["mesh"] = path;
9496
s.load_mesh();
9597
},
9698
"Loads a mesh from the path and 'bc_tag' from the json if any bc tags",
9799
py::arg("path"))
98100
.def("load_mesh_from_path_and_tags", [](polyfem::State &s, const std::string &path, const std::string &bc_tag) {
99-
init_globals();
101+
init_globals(s);
100102
s.args["mesh"] = path;
101103
s.args["bc_tag"] = bc_tag;
102104
s.load_mesh();
103105
},
104106
"Loads a mesh and bc_tags from path",
105107
py::arg("path"), py::arg("bc_tag_path"))
106108
.def("set_mesh", [](polyfem::State &s, const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) {
107-
init_globals();
109+
init_globals(s);
108110

109111
if(V.cols() == 2)
110112
s.mesh = std::make_unique<polyfem::Mesh2D>();
@@ -119,33 +121,33 @@ PYBIND11_MODULE(polyfempy, m) {
119121

120122

121123
.def("set_boundary_side_set_from_bary", [](polyfem::State &s, const std::function<int(const polyfem::RowVectorNd&)> &boundary_marker) {
122-
init_globals();
124+
init_globals(s);
123125
s.mesh->compute_boundary_ids(boundary_marker);
124126
},
125127
"Sets the side set for the boundary conditions, the functions takes the barycenter of the boundary (edge or face)",
126128
py::arg("boundary_marker"))
127129
.def("set_boundary_side_set_from_bary_and_boundary", [](polyfem::State &s, const std::function<int(const polyfem::RowVectorNd&, bool)> &boundary_marker) {
128-
init_globals();
130+
init_globals(s);
129131
s.mesh->compute_boundary_ids(boundary_marker);
130132
},
131133
"Sets the side set for the boundary conditions, the functions takes the barycenter of the boundary (edge or face) and a flag that says if the element is boundary",
132134
py::arg("boundary_marker"))
133135
.def("set_boundary_side_set_from_v_ids", [](polyfem::State &s, const std::function<int(const std::vector<int>&, bool)> &boundary_marker) {
134-
init_globals();
136+
init_globals(s);
135137
s.mesh->compute_boundary_ids(boundary_marker);
136138
},
137139
"Sets the side set for the boundary conditions, the functions takes the sorted list of vertex id and a flag that says if the element is boundary",
138140
py::arg("boundary_marker"))
139141

140142

141143
.def("set_rhs_from_path", [](polyfem::State &s, std::string &path) {
142-
init_globals();
144+
init_globals(s);
143145
s.args["rhs_path"] = path;
144146
},
145147
"Loads the rhs from a file",
146148
py::arg("path"))
147149
.def("set_rhs", [](polyfem::State &s, const Eigen::MatrixXd &rhs) {
148-
init_globals();
150+
init_globals(s);
149151
s.rhs_in = rhs;
150152
},
151153
"Sets the rhs",
@@ -154,7 +156,7 @@ PYBIND11_MODULE(polyfempy, m) {
154156

155157

156158
.def("solve",[](polyfem::State &s) {
157-
init_globals();
159+
init_globals(s);
158160

159161
s.compute_mesh_stats();
160162

0 commit comments

Comments
 (0)