mesh.AddElements also for 1D segments

This commit is contained in:
Joachim Schoeberl 2023-05-07 17:45:20 +02:00
parent 8a79f91cb1
commit 9c0eeb5370

View File

@ -1075,6 +1075,21 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
// throw std::runtime_error("AddPoints needs buffer of type int"); // throw std::runtime_error("AddPoints needs buffer of type int");
int * ptr = static_cast<int*> (info.ptr); int * ptr = static_cast<int*> (info.ptr);
if (dim == 1)
{
ELEMENT_TYPE type;
int np = info.shape[1];
self.LineSegments().SetAllocSize(self.LineSegments().Size()+info.shape[0]);
for (auto i : Range(info.shape[0]))
{
Segment el;
for (int j = 0; j < np; j++)
el[j] = ptr[j]+PointIndex::BASE-base;
el.si = index;
self.AddSegment(el);
ptr += info.strides[0]/sizeof(int);
}
}
if (dim == 2) if (dim == 2)
{ {
ELEMENT_TYPE type; ELEMENT_TYPE type;