use std::vector for binding PointIndex, avoid map

This commit is contained in:
Joachim Schöberl 2019-02-15 14:32:57 +01:00
parent 0a14f5b5e1
commit fa3f89d337
2 changed files with 21 additions and 62 deletions

View File

@ -1,49 +0,0 @@
gibt's nicht mehr
#ifndef FILE_PARALLELINTERFACE
#define FILE_PARALLELINTERFACE
#ifdef PARALLEL
#ifdef __cplusplus
extern "C" {
#endif
// this interface is 0-base !!
int NgPar_GetLoc2Glob_VolEl ( int locnum );
// int NgPar_GetDistantNodeNums ( int nt, int locnum, int * procs, int * distnum);
// number on distant processor
// gibt anzahl an distant pnums zurueck
// * pnums entspricht ARRAY<int[2] >
int NgPar_GetDistantNodeNums ( int nodetype, int locnum, int * pnums );
int NgPar_GetNDistantNodeNums ( int nodetype, int locnum );
int NgPar_GetDistantPNum ( int proc, int locnum ) ;
int NgPar_GetDistantEdgeNum ( int proc, int locnum ) ;
int NgPar_GetDistantFaceNum ( int proc, int locnum ) ;
int NgPar_GetDistantElNum ( int proc, int locnum );
bool NgPar_IsExchangeFace ( int fnr ) ;
bool NgPar_IsExchangeVert ( int vnum );
bool NgPar_IsExchangeEdge ( int ednum );
bool NgPar_IsExchangeElement ( int elnum );
void NgPar_PrintParallelMeshTopology ();
bool NgPar_IsElementInPartition ( int elnum, int dest );
bool NgPar_IsGhostFace ( int facenum );
bool NgPar_IsGhostEdge ( int edgenum );
#ifdef __cplusplus
}
#endif
#endif
#endif

View File

@ -287,20 +287,28 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
;
py::class_<Element>(m, "Element3D")
.def(py::init([](int index, py::list vertices)
.def(py::init([](int index, std::vector<PointIndex> vertices)
{
std::map<int, ELEMENT_TYPE> types = {{4, TET},
{5, PYRAMID},
{6, PRISM},
{8, HEX},
{10, TET10},
{13, PYRAMID13},
{15, PRISM15},
{20, HEX20}};
int np = py::len(vertices);
auto newel = new Element(types[np]);
int np = vertices.size();
ELEMENT_TYPE et;
switch (np)
{
case 4: et = TET; break;
case 5: et = PYRAMID; break;
case 6: et = PRISM; break;
case 8: et = HEX; break;
case 10: et = TET10; break;
case 13: et = PYRAMID13; break;
case 15: et = PRISM15; break;
case 20: et = HEX20; break;
default:
throw Exception ("no Element3D with " + ToString(np) +
" points");
}
auto newel = new Element(et);
for(int i=0; i<np; i++)
(*newel)[i] = py::cast<PointIndex>(vertices[i]);
(*newel)[i] = vertices[i];
newel->SetIndex(index);
return newel;
}),