avoid size_t-int narrowing in nginterfacev2 - GetElement

This commit is contained in:
Joachim Schöberl 2017-04-01 20:59:47 +02:00
parent 8e7c043ef4
commit 240a132078
3 changed files with 9 additions and 6 deletions

View File

@ -116,7 +116,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
template <>
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
{
const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr));
// const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr));
const Element2d & el = mesh->SurfaceElements()[nr];
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());
@ -155,7 +156,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
template <>
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (size_t nr) const
{
const Element & el = mesh->VolumeElement (ElementIndex (nr));
// const Element & el = mesh->VolumeElement (ElementIndex (nr));
const Element & el = mesh->VolumeElements()[nr];
Ng_Element ret;
ret.type = NG_ELEMENT_TYPE(el.GetType());

View File

@ -24,8 +24,9 @@ namespace netgen
{
public:
typedef ::netgen::T_POINTS T_POINTS;
typedef Array<Element, 0, ElementIndex> T_VOLELEMENTS;
typedef Array<Element2d, 0, SurfaceElementIndex> T_SURFELEMENTS;
typedef Array<Element, 0, size_t> T_VOLELEMENTS;
// typedef Array<Element2d, 0, SurfaceElementIndex> T_SURFELEMENTS;
typedef Array<Element2d, 0, size_t> T_SURFELEMENTS;
private:
/// point coordinates

View File

@ -458,11 +458,11 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
.def_property("dim", &Mesh::GetDimension, &Mesh::SetDimension)
.def("Elements3D",
static_cast<Array<Element,0,ElementIndex>&(Mesh::*)()> (&Mesh::VolumeElements),
static_cast<Array<Element,0,size_t>&(Mesh::*)()> (&Mesh::VolumeElements),
py::return_value_policy::reference)
.def("Elements2D",
static_cast<Array<Element2d,0,SurfaceElementIndex>&(Mesh::*)()> (&Mesh::SurfaceElements),
static_cast<Array<Element2d,0,size_t>&(Mesh::*)()> (&Mesh::SurfaceElements),
py::return_value_policy::reference)
.def("Elements1D",