mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
use pointindex
This commit is contained in:
parent
93116f253c
commit
3e6f4b9472
@ -42,11 +42,9 @@ namespace ngcore
|
|||||||
[](TFlat & self, TIND i) -> T&
|
[](TFlat & self, TIND i) -> T&
|
||||||
{
|
{
|
||||||
static constexpr int base = IndexBASE<TIND>();
|
static constexpr int base = IndexBASE<TIND>();
|
||||||
static_assert(base==0 || base==1, "IndexBASE not in [0,1]");
|
if (i < base || i >= self.Size()+base)
|
||||||
if (i < 0 || i >= self.Size())
|
|
||||||
throw py::index_error();
|
throw py::index_error();
|
||||||
if(base==1) i++;
|
return self[i];
|
||||||
return self[i]; // Access from Python is always 0-based
|
|
||||||
},
|
},
|
||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
.def("__iter__", [] ( TFlat & self) {
|
.def("__iter__", [] ( TFlat & self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user