FEM: add GroupID to python mesh API

This commit is contained in:
Bernd Hahnebach 2016-09-25 21:41:14 +02:00 committed by Yorik van Havre
parent 80be790af9
commit 084e163137
2 changed files with 19 additions and 0 deletions

View File

@ -237,6 +237,12 @@
</Documentation>
<Parameter Name="GroupCount" Type="Int"/>
</Attribute>
<Attribute Name="Groups" ReadOnly="true">
<Documentation>
<UserDocu>Tuple of Group IDs.</UserDocu>
</Documentation>
<Parameter Name="Groups" Type="Tuple"/>
</Attribute>
<Attribute Name="Volume" ReadOnly="true">
<Documentation>
<UserDocu>Volume of the mesh.</UserDocu>

View File

@ -1048,6 +1048,19 @@ Py::Int FemMeshPy::getGroupCount(void) const
return Py::Int(getFemMeshPtr()->getSMesh()->NbGroup());
}
Py::Tuple FemMeshPy::getGroups(void) const
{
std::list<int> groupIDs = getFemMeshPtr()->getSMesh()->GetGroupIds();
Py::Tuple tuple(groupIDs.size());
int index = 0;
for (std::list<int>::iterator it = groupIDs.begin(); it != groupIDs.end(); ++it) {
tuple.setItem(index++, Py::Int(*it));
}
return tuple;
}
Py::Object FemMeshPy::getVolume(void) const
{
return Py::Object(new Base::QuantityPy(new Base::Quantity(getFemMeshPtr()->getVolume())));