Fem: Add method to rename pipeline VTK data arrays
This commit is contained in:
committed by
Benjamin Nauck
parent
f1258e36b2
commit
6d376dc77a
@@ -285,6 +285,28 @@ PyObject* FemPostPipelinePy::holdsPostObject(PyObject* args)
|
||||
return Py_BuildValue("O", (ok ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
PyObject* FemPostPipelinePy::renameArrays(PyObject* args)
|
||||
{
|
||||
PyObject* pyObj;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(PyDict_Type), &pyObj)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py::Dict pyNames {pyObj};
|
||||
std::map<std::string, std::string> names {};
|
||||
for (auto&& [key, value] : pyNames) {
|
||||
if (!key.isString() || !value.isString()) {
|
||||
PyErr_SetString(PyExc_TypeError, "Names must be string objects");
|
||||
return nullptr;
|
||||
}
|
||||
names.emplace(key.as_string(), static_cast<Py::Object>(value).as_string());
|
||||
}
|
||||
|
||||
getFemPostPipelinePtr()->renameArrays(names);
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* FemPostPipelinePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user