Merge branch 'use_segmentindex' into 'master'

use segmentindex as index for mesh.segments array

See merge request jschoeberl/netgen!348
This commit is contained in:
Joachim Schöberl 2020-11-17 16:10:09 +00:00
commit c58659883d
3 changed files with 8 additions and 4 deletions

View File

@ -38,7 +38,7 @@ namespace netgen
NgMPI_Comm comm; NgMPI_Comm comm;
/// line-segments at edges /// line-segments at edges
Array<Segment> segments; Array<Segment, SegmentIndex> segments;
/// surface elements, 2d-inner elements /// surface elements, 2d-inner elements
Array<Element2d, SurfaceElementIndex> surfelements; Array<Element2d, SurfaceElementIndex> surfelements;
/// volume elements /// volume elements

View File

@ -306,13 +306,17 @@ namespace netgen
SegmentIndex & operator= (const SegmentIndex & ai) SegmentIndex & operator= (const SegmentIndex & ai)
{ i = ai.i; return *this; } { i = ai.i; return *this; }
SegmentIndex & operator= (int ai) { i = ai; return *this; } SegmentIndex & operator= (int ai) { i = ai; return *this; }
operator int () const { return i; } constexpr operator int () const { return i; }
SegmentIndex& operator++ () { ++i; return *this; } SegmentIndex& operator++ () { ++i; return *this; }
SegmentIndex& operator-- () { --i; return *this; } SegmentIndex& operator-- () { --i; return *this; }
SegmentIndex operator++ (int) { return i++; } SegmentIndex operator++ (int) { return i++; }
SegmentIndex operator-- (int) { return i--; } SegmentIndex operator-- (int) { return i--; }
}; };
inline void SetInvalid (SegmentIndex & id) { id = -1; }
inline bool IsInvalid (SegmentIndex & id) { return id == -1; }
inline istream & operator>> (istream & ist, SegmentIndex & pi) inline istream & operator>> (istream & ist, SegmentIndex & pi)
{ {
int i; ist >> i; pi = i; return ist; int i; ist >> i; pi = i; return ist;

View File

@ -603,7 +603,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
ExportArray<Element,size_t>(m); ExportArray<Element,size_t>(m);
ExportArray<Element2d,SurfaceElementIndex>(m); ExportArray<Element2d,SurfaceElementIndex>(m);
ExportArray<Segment,size_t>(m); ExportArray<Segment,SegmentIndex>(m);
ExportArray<Element0d>(m); ExportArray<Element0d>(m);
ExportArray<MeshPoint,PointIndex>(m); ExportArray<MeshPoint,PointIndex>(m);
ExportArray<FaceDescriptor>(m); ExportArray<FaceDescriptor>(m);
@ -823,7 +823,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
py::return_value_policy::reference) py::return_value_policy::reference)
.def("Elements1D", .def("Elements1D",
static_cast<Array<Segment>&(Mesh::*)()> (&Mesh::LineSegments), static_cast<Array<Segment, SegmentIndex>&(Mesh::*)()> (&Mesh::LineSegments),
py::return_value_policy::reference) py::return_value_policy::reference)
.def("Elements0D", FunctionPointer([] (Mesh & self) -> Array<Element0d>& .def("Elements0D", FunctionPointer([] (Mesh & self) -> Array<Element0d>&