more fixes for flatmesh

+ fix gcc warning
+ add conversion function for boost.python
+ switch build off by default due to travis build failure for Py3
This commit is contained in:
wmayer
2018-04-29 14:50:41 +02:00
parent a385c66260
commit 36ba2bca08
3 changed files with 26 additions and 3 deletions

View File

@@ -261,7 +261,7 @@ OPTION(BUILD_JTREADER "Build the FreeCAD jt reader module" OFF)
OPTION(BUILD_MATERIAL "Build the FreeCAD material module" ON)
OPTION(BUILD_MESH "Build the FreeCAD mesh module" ON)
OPTION(BUILD_MESH_PART "Build the FreeCAD mesh part module" ON)
OPTION(BUILD_FLAT_MESH "Build the FreeCAD flat mesh module" ON)
OPTION(BUILD_FLAT_MESH "Build the FreeCAD flat mesh module" OFF)
OPTION(BUILD_OPENSCAD "Build the FreeCAD openscad module" ON)
OPTION(BUILD_PART "Build the FreeCAD part module" ON)
OPTION(BUILD_PART_DESIGN "Build the FreeCAD part design module" ON)

View File

@@ -147,6 +147,29 @@ boost::python::list interpolateFlatFacePy(FaceUnwrapper& instance, const py::obj
return plist;
}
boost::python::list getFlatBoundaryNodesPy(FaceUnwrapper& instance)
{
std::vector<ColMat<double, 3>> mat_array = instance.getFlatBoundaryNodes();
boost::python::list ary;
for (auto mat : mat_array) {
boost::python::list plist;
auto cols = mat.cols();
auto rows = mat.rows();
for (int i=0; i<rows; i++) {
boost::python::list vec;
for (int j=0; j<cols; j++) {
double c = mat.coeff(i, j);
vec.append(c);
}
plist.append(vec);
}
ary.append(plist);
}
return ary;
}
BOOST_PYTHON_MODULE(flatmesh)
@@ -203,7 +226,7 @@ BOOST_PYTHON_MODULE(flatmesh)
.def(py::init<ColMat<double, 3>, ColMat<long, 3>>())
.def("findFlatNodes", &FaceUnwrapper::findFlatNodes)
.def("interpolateFlatFace", &interpolateFlatFacePy)
.def("getFlatBoundaryNodes", &FaceUnwrapper::getFlatBoundaryNodes)
.def("getFlatBoundaryNodes", &getFlatBoundaryNodesPy)
.def_readonly("tris", &FaceUnwrapper::tris)
.def_readonly("nodes", &FaceUnwrapper::xyz_nodes)
.def_readonly("uv_nodes", &FaceUnwrapper::uv_nodes)

View File

@@ -455,7 +455,7 @@ void LscmRelax::lscm()
std::vector<trip> mat_triplets;
for (auto triplet: triple_list)
{
if (triplet.col() > static_cast<size_t>((this->vertices.cols() - this->fixed_pins.size()) * 2 - 1))
if (triplet.col() > static_cast<int>((this->vertices.cols() - this->fixed_pins.size()) * 2 - 1))
rhs_triplets.push_back(triplet);
else
mat_triplets.push_back(triplet);