FEM: add SMESH supported volumes to Python API of FemMesh
This commit is contained in:
@@ -399,18 +399,41 @@ PyObject* FemMeshPy::addVolume(PyObject *args)
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Tet4 volume");
|
||||
break;
|
||||
case 5:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Pyra5 volume");
|
||||
break;
|
||||
case 6:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Penta6 volume");
|
||||
break;
|
||||
case 8:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Tet10 volume");
|
||||
throw std::runtime_error("Failed to add Hexa8 volume");
|
||||
break;
|
||||
case 10:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Tet10 volume");
|
||||
break;
|
||||
case 13:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],Nodes[10],Nodes[11],Nodes[12],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Pyra13 volume");
|
||||
case 15:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],Nodes[10],Nodes[11],Nodes[12],Nodes[13],Nodes[14],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Penta15 volume");
|
||||
case 20:
|
||||
vol = meshDS->AddVolumeWithID(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],Nodes[10],Nodes[11],Nodes[12],Nodes[13],Nodes[14],Nodes[15],Nodes[16],Nodes[17],Nodes[18],Nodes[19],ElementId);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Hexa20 volume");
|
||||
break;
|
||||
|
||||
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|18] are allowed"); //unknown face type
|
||||
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|15|20] are allowed"); //unknown volume type
|
||||
}
|
||||
}else{
|
||||
switch(Nodes.size()){
|
||||
@@ -419,18 +442,43 @@ PyObject* FemMeshPy::addVolume(PyObject *args)
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Tet4 volume");
|
||||
break;
|
||||
case 5:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Pyra5 volume");
|
||||
break;
|
||||
case 6:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Penta6 volume");
|
||||
break;
|
||||
case 8:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Tet10 volume");
|
||||
throw std::runtime_error("Failed to add Hexa8 volume");
|
||||
break;
|
||||
case 10:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Tet10 volume");
|
||||
break;
|
||||
case 13:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],Nodes[10],Nodes[11],Nodes[12]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Pyra13 volume");
|
||||
break;
|
||||
case 15:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],Nodes[10],Nodes[11],Nodes[12],Nodes[13],Nodes[14]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Penta15 volume");
|
||||
break;
|
||||
case 20:
|
||||
vol = meshDS->AddVolume(Nodes[0],Nodes[1],Nodes[2],Nodes[3],Nodes[4],Nodes[5],Nodes[6],Nodes[7],Nodes[8],Nodes[9],Nodes[10],Nodes[11],Nodes[12],Nodes[13],Nodes[14],Nodes[15],Nodes[16],Nodes[17],Nodes[18],Nodes[19]);
|
||||
if (!vol)
|
||||
throw std::runtime_error("Failed to add Hexa20 volume");
|
||||
break;
|
||||
|
||||
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|18] are allowed"); //unknown face type
|
||||
default: throw std::runtime_error("Unknown node count, [4|5|6|8|10|13|15|20] are allowed"); //unknown volume type
|
||||
}
|
||||
|
||||
}
|
||||
@@ -441,7 +489,7 @@ PyObject* FemMeshPy::addVolume(PyObject *args)
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "addVolume accepts:\n"
|
||||
"-- int,int,int,int\n"
|
||||
"-- [4|8|10 int],[int]\n");
|
||||
"-- [4|5|6|8|10|13|15|20 int],[int]\n");
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user