Skip to content

Commit 06076f5

Browse files
committed
fix
1 parent 69f4ba2 commit 06076f5

File tree

2 files changed

+9
-35
lines changed

2 files changed

+9
-35
lines changed

ikarus/python/dirichletvalues/dirichletvalues.hh

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,38 +76,17 @@ void registerDirichletValues(pybind11::handle scope, pybind11::class_<DirichletV
7676
cls.def_property_readonly("fixedDOFsize", &DirichletValues::fixedDOFsize);
7777
cls.def("isConstrained", [](DirichletValues& self, std::size_t i) -> bool { return self.isConstrained(i); });
7878

79-
cls.def("fixIthDOF", [](DirichletValues& self, const MultiIndex& i) { self.fixIthDOF(i); });
80-
81-
auto fixBoundaryDOFs_ = [](DirichletValues& self,
82-
const std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int)>& f) {
83-
auto lambda = [&](BackendType& vec, const MultiIndex& indexGlobal) {
84-
// we explicitly only allow flat indices
85-
f(vec.vector(), indexGlobal[0]);
86-
};
87-
self.fixBoundaryDOFs(lambda);
88-
};
89-
90-
auto fixBoundaryDOFsUsingLocalView_ =
91-
[](DirichletValues& self,
92-
const std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&)>& f) {
93-
94-
};
79+
cls.def("fixIthDOF", [](DirichletValues& self, std::size_t i) { self.fixIthDOF(MultiIndex(std::array{i})); });
9580

96-
auto fixBoundaryDOFsUsingLocalViewAndIntersection_ =
97-
[](DirichletValues& self,
98-
const std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&, const Intersection&)>& f) {
99-
100-
};
81+
using FixBoundaryDOFsWithGlobalIndexFunction = std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int)>;
82+
using FixBoundaryDOFsWithLocalViewFunction =
83+
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&)>;
84+
using FixBoundaryDOFsWithIntersectionFunction =
85+
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&, const Intersection&)>;
10186

10287
cls.def(
10388
"fixBoundaryDOFs",
10489
[&](DirichletValues& self, const pybind11::function& functor) {
105-
using FixBoundaryDOFsWithGlobalIndexFunction = std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int)>;
106-
using FixBoundaryDOFsWithLocalViewFunction =
107-
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&)>;
108-
using FixBoundaryDOFsWithIntersectionFunction =
109-
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&, const Intersection&)>;
110-
11190
// Disambiguate by number of arguments, as casting doesn't properly work with functions
11291
pybind11::module inspect_module = pybind11::module::import("inspect");
11392
pybind11::object result = inspect_module.attr("signature")(functor).attr("parameters");
@@ -145,12 +124,6 @@ void registerDirichletValues(pybind11::handle scope, pybind11::class_<DirichletV
145124

146125
auto fixBoundaryDOFsOfSubSpaceBasis_ = [&]<typename SSB>(DirichletValues& self, const pybind11::function& functor,
147126
const SSB& ssb) {
148-
using FixBoundaryDOFsWithGlobalIndexFunction = std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int)>;
149-
using FixBoundaryDOFsWithLocalViewFunction =
150-
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&)>;
151-
using FixBoundaryDOFsWithIntersectionFunction =
152-
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&, const Intersection&)>;
153-
154127
// Disambiguate by number of arguments, as casting doesn't properly work with functions
155128
pybind11::module inspect_module = pybind11::module::import("inspect");
156129
pybind11::object result = inspect_module.attr("signature")(functor).attr("parameters");

ikarus/python/test/testdirichletvalues.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ def fixTopSide(vec, localIndex, localView, intersection):
8181
dirichletValues2.fixBoundaryDOFsOfSubSpaceBasis(fixTopSide, 1)
8282
assert dirichletValues2.fixedDOFsize == 2 + indicesPerDirection
8383

84-
dirichletValues2.fixIthDOF([1])
84+
dirichletValues2.fixIthDOF(1)
8585
assert dirichletValues2.fixedDOFsize == 2 + indicesPerDirection + 1
86-
assert dirichletValues2.container[2]
86+
assert dirichletValues2.container[1]
87+
8788

8889
if __name__ == "__main__":
8990
testDirichletValues()

0 commit comments

Comments
 (0)