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

@ -285,22 +285,30 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
self(index) = val; self(index) = val;
})) }))
; ;
py::class_<Element>(m, "Element3D") 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}, int np = vertices.size();
{5, PYRAMID}, ELEMENT_TYPE et;
{6, PRISM}, switch (np)
{8, HEX}, {
{10, TET10}, case 4: et = TET; break;
{13, PYRAMID13}, case 5: et = PYRAMID; break;
{15, PRISM15}, case 6: et = PRISM; break;
{20, HEX20}}; case 8: et = HEX; break;
int np = py::len(vertices); case 10: et = TET10; break;
auto newel = new Element(types[np]); 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++) for(int i=0; i<np; i++)
(*newel)[i] = py::cast<PointIndex>(vertices[i]); (*newel)[i] = vertices[i];
newel->SetIndex(index); newel->SetIndex(index);
return newel; return newel;
}), }),