FEM: Add getccxVolumesByFace and write_face_load functions
getccxVolumesByFace returns std::map<int, int> with ID of volume and a number of face as per CalculiX definition. The same function is accessible for python and returns list with the same information, like this: [[229, 3], [230, 3], [233, 2], [238, 2]] write_face_load produces something like this in the .inp file: *********************************************************** ** element + CalculiX face + load in [MPa] ** written by write_face_load function *DLOAD ** Load on face Face2 229,P3,10.0 230,P3,10.0 233,P2,10.0 238,P2,10.0 Optimised by wmayer Signed-off-by: wmayer Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
@@ -514,6 +514,38 @@ PyObject* FemMeshPy::setTransform(PyObject *args)
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* FemMeshPy::getccxVolumesByFace(PyObject *args)
|
||||
{
|
||||
PyObject *pW;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapeFacePy::Type), &pW))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
const TopoDS_Shape& sh = static_cast<Part::TopoShapeFacePy*>(pW)->getTopoShapePtr()->_Shape;
|
||||
const TopoDS_Face& fc = TopoDS::Face(sh);
|
||||
if (sh.IsNull()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Face is empty");
|
||||
return 0;
|
||||
}
|
||||
Py::List ret;
|
||||
std::map<int, int> resultSet = getFemMeshPtr()->getccxVolumesByFace(fc);
|
||||
for (std::map<int, int>::const_iterator it = resultSet.begin();it!=resultSet.end();++it) {
|
||||
Py::List vol_face;
|
||||
vol_face.append(Py::Int(it->first));
|
||||
vol_face.append(Py::Int(it->second));
|
||||
ret.append(vol_face);
|
||||
}
|
||||
|
||||
return Py::new_reference_to(ret);
|
||||
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* FemMeshPy::getNodeById(PyObject *args)
|
||||
{
|
||||
int id;
|
||||
|
||||
Reference in New Issue
Block a user