[FEM] remove unused headers from WBs main files
- also some code style fixes by MSVC
This commit is contained in:
@@ -20,20 +20,14 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Python.h>
|
||||
# include <Standard_math.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/WidgetFactory.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#include "PropertyFemMeshItem.h"
|
||||
|
||||
#include "DlgSettingsFemCcxImp.h"
|
||||
#include "DlgSettingsFemElmerImp.h"
|
||||
#include "DlgSettingsFemExportAbaqusImp.h"
|
||||
@@ -43,44 +37,45 @@
|
||||
#include "DlgSettingsFemMaterialImp.h"
|
||||
#include "DlgSettingsFemMystranImp.h"
|
||||
#include "DlgSettingsFemZ88Imp.h"
|
||||
#include "PropertyFemMeshItem.h"
|
||||
#include "ViewProviderAnalysis.h"
|
||||
#include "ViewProviderFemMesh.h"
|
||||
#include "ViewProviderFemMeshShape.h"
|
||||
#include "ViewProviderFemMeshShapeNetgen.h"
|
||||
#include "ViewProviderAnalysis.h"
|
||||
#include "ViewProviderSolver.h"
|
||||
#include "ViewProviderSetNodes.h"
|
||||
#include "ViewProviderSetElements.h"
|
||||
#include "ViewProviderSetFaces.h"
|
||||
#include "ViewProviderSetGeometry.h"
|
||||
#include "ViewProviderSetNodes.h"
|
||||
#include "ViewProviderSolver.h"
|
||||
#include "ViewProviderFemConstraint.h"
|
||||
#include "ViewProviderFemConstraintOnBoundary.h"
|
||||
#include "ViewProviderFemConstraintBearing.h"
|
||||
#include "ViewProviderFemConstraintContact.h"
|
||||
#include "ViewProviderFemConstraintDisplacement.h"
|
||||
#include "ViewProviderFemConstraintFixed.h"
|
||||
#include "ViewProviderFemConstraintForce.h"
|
||||
#include "ViewProviderFemConstraintFluidBoundary.h"
|
||||
#include "ViewProviderFemConstraintPressure.h"
|
||||
#include "ViewProviderFemConstraintSpring.h"
|
||||
#include "ViewProviderFemConstraintGear.h"
|
||||
#include "ViewProviderFemConstraintPulley.h"
|
||||
#include "ViewProviderFemConstraintDisplacement.h"
|
||||
#include "ViewProviderFemConstraintTemperature.h"
|
||||
#include "ViewProviderFemConstraintHeatflux.h"
|
||||
#include "ViewProviderFemConstraintInitialTemperature.h"
|
||||
#include "ViewProviderFemConstraintOnBoundary.h"
|
||||
#include "ViewProviderFemConstraintPlaneRotation.h"
|
||||
#include "ViewProviderFemConstraintContact.h"
|
||||
#include "ViewProviderFemConstraintPressure.h"
|
||||
#include "ViewProviderFemConstraintPulley.h"
|
||||
#include "ViewProviderFemConstraintSpring.h"
|
||||
#include "ViewProviderFemConstraintTemperature.h"
|
||||
#include "ViewProviderFemConstraintTransform.h"
|
||||
#include "ViewProviderResult.h"
|
||||
#include "Workbench.h"
|
||||
|
||||
#ifdef FC_USE_VTK
|
||||
#include "ViewProviderFemPostFilter.h"
|
||||
#include "ViewProviderFemPostFunction.h"
|
||||
#include "ViewProviderFemPostObject.h"
|
||||
#include "ViewProviderFemPostPipeline.h"
|
||||
#include "ViewProviderFemPostFunction.h"
|
||||
#include "ViewProviderFemPostFilter.h"
|
||||
#endif
|
||||
|
||||
|
||||
// use a different name to CreateCommand()
|
||||
// use a different name to CreateCommand()
|
||||
void CreateFemCommands(void);
|
||||
|
||||
void loadFemResource()
|
||||
@@ -91,7 +86,7 @@ void loadFemResource()
|
||||
}
|
||||
|
||||
namespace FemGui {
|
||||
extern PyObject* initModule();
|
||||
extern PyObject* initModule();
|
||||
}
|
||||
|
||||
|
||||
@@ -171,19 +166,19 @@ PyMOD_INIT_FUNC(FemGui)
|
||||
|
||||
|
||||
// register preferences pages on FEM, the order here will be the order of the tabs in pref widget
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemGeneralImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemGmshImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemCcxImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemElmerImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMystranImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemZ88Imp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMaterialImp> (QT_TRANSLATE_NOOP("QObject","FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemGeneralImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemGmshImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemCcxImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemElmerImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMystranImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemZ88Imp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemMaterialImp>(QT_TRANSLATE_NOOP("QObject", "FEM"));
|
||||
|
||||
// register preferences pages on Import-Export
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemExportAbaqusImp> (QT_TRANSLATE_NOOP("QObject","Import-Export"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemInOutVtkImp> (QT_TRANSLATE_NOOP("QObject","Import-Export"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemExportAbaqusImp>(QT_TRANSLATE_NOOP("QObject", "Import-Export"));
|
||||
new Gui::PrefPageProducer<FemGui::DlgSettingsFemInOutVtkImp>(QT_TRANSLATE_NOOP("QObject", "Import-Export"));
|
||||
|
||||
// add resources and reloads the translators
|
||||
// add resources and reloads the translators
|
||||
loadFemResource();
|
||||
|
||||
PyMOD_Return(mod);
|
||||
|
||||
@@ -20,28 +20,21 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Python.h>
|
||||
# include <QFileInfo>
|
||||
#endif
|
||||
|
||||
#include <CXX/Extensions.hxx>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/ViewProviderDocumentObject.h>
|
||||
#include <Gui/EditorView.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/TextEdit.h>
|
||||
#include <Gui/EditorView.h>
|
||||
|
||||
#include <Mod/Fem/App/FemAnalysis.h>
|
||||
#include "ActiveAnalysisObserver.h"
|
||||
|
||||
#include "AbaqusHighlighter.h"
|
||||
#include "ActiveAnalysisObserver.h"
|
||||
|
||||
|
||||
namespace FemGui {
|
||||
@@ -50,16 +43,16 @@ class Module : public Py::ExtensionModule<Module>
|
||||
public:
|
||||
Module() : Py::ExtensionModule<Module>("FemGui")
|
||||
{
|
||||
add_varargs_method("setActiveAnalysis",&Module::setActiveAnalysis,
|
||||
add_varargs_method("setActiveAnalysis", &Module::setActiveAnalysis,
|
||||
"setActiveAnalysis(AnalysisObject) -- Set the Analysis object in work."
|
||||
);
|
||||
add_varargs_method("getActiveAnalysis",&Module::getActiveAnalysis,
|
||||
add_varargs_method("getActiveAnalysis", &Module::getActiveAnalysis,
|
||||
"getActiveAnalysis() -- Returns the Analysis object in work."
|
||||
);
|
||||
add_varargs_method("open",&Module::open,
|
||||
add_varargs_method("open", &Module::open,
|
||||
"open(string) -- Opens an Abaqus file in a text editor."
|
||||
);
|
||||
add_varargs_method("insert",&Module::open,
|
||||
add_varargs_method("insert", &Module::open,
|
||||
"insert(string,string) -- Opens an Abaqus file in a text editor."
|
||||
);
|
||||
initialize("This module is the FemGui module."); // register with Python
|
||||
@@ -68,35 +61,35 @@ public:
|
||||
virtual ~Module() {}
|
||||
|
||||
private:
|
||||
virtual Py::Object invoke_method_varargs(void *method_def, const Py::Tuple &args)
|
||||
virtual Py::Object invoke_method_varargs(void* method_def, const Py::Tuple& args)
|
||||
{
|
||||
try {
|
||||
return Py::ExtensionModule<Module>::invoke_method_varargs(method_def, args);
|
||||
}
|
||||
catch (const Base::Exception &e) {
|
||||
catch (const Base::Exception& e) {
|
||||
throw Py::RuntimeError(e.what());
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
catch (const std::exception& e) {
|
||||
throw Py::RuntimeError(e.what());
|
||||
}
|
||||
}
|
||||
Py::Object setActiveAnalysis(const Py::Tuple& args)
|
||||
{
|
||||
if (FemGui::ActiveAnalysisObserver::instance()->hasActiveObject()) {
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::HighlightMode::Blue,false);
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::HighlightMode::Blue, false);
|
||||
FemGui::ActiveAnalysisObserver::instance()->setActiveObject(0);
|
||||
}
|
||||
|
||||
PyObject *object=0;
|
||||
if (PyArg_ParseTuple(args.ptr(),"|O!",&(App::DocumentObjectPy::Type), &object)&& object) {
|
||||
PyObject* object = 0;
|
||||
if (PyArg_ParseTuple(args.ptr(), "|O!", &(App::DocumentObjectPy::Type), &object) && object) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(object)->getDocumentObjectPtr();
|
||||
if (!obj || !obj->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){
|
||||
if (!obj || !obj->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())) {
|
||||
throw Py::Exception(Base::PyExc_FC_GeneralError, "Active Analysis object have to be of type Fem::FemAnalysis!");
|
||||
}
|
||||
|
||||
// get the gui document of the Analysis Item
|
||||
FemGui::ActiveAnalysisObserver::instance()->setActiveObject(static_cast<Fem::FemAnalysis*>(obj));
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::HighlightMode::Blue,true);
|
||||
FemGui::ActiveAnalysisObserver::instance()->highlightActiveObject(Gui::HighlightMode::Blue, true);
|
||||
}
|
||||
|
||||
return Py::None();
|
||||
@@ -114,7 +107,7 @@ private:
|
||||
{
|
||||
char* Name;
|
||||
const char* DocName;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|s", "utf-8", &Name, &DocName))
|
||||
throw Py::Exception();
|
||||
|
||||
std::string EncodedName = std::string(Name);
|
||||
|
||||
@@ -20,55 +20,46 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Standard_math.hxx>
|
||||
# include <QAction>
|
||||
# include <QApplication>
|
||||
# include <QMessageBox>
|
||||
# include <QAction>
|
||||
|
||||
# include <Inventor/nodes/SoEventCallback.h>
|
||||
# include <Inventor/nodes/SoCamera.h>
|
||||
# include <Inventor/events/SoMouseButtonEvent.h>
|
||||
|
||||
# include <Inventor/nodes/SoCamera.h>
|
||||
# include <Inventor/nodes/SoEventCallback.h>
|
||||
# include <SMESH_Mesh.hxx>
|
||||
# include <SMESHDS_Mesh.hxx>
|
||||
# include <SMDSAbs_ElementType.hxx>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/Action.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/FileDialog.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/SelectionFilter.h>
|
||||
#include <Gui/SelectionObject.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
#include <Gui/Utilities.h>
|
||||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
#include <Gui/Utilities.h>
|
||||
#include <Gui/Action.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Fem/App/FemAnalysis.h>
|
||||
#include <Mod/Fem/App/FemConstraint.h>
|
||||
#include <Mod/Fem/App/FemMeshObject.h>
|
||||
#include <Mod/Fem/App/FemSetNodesObject.h>
|
||||
#include <Mod/Fem/App/FemConstraint.h>
|
||||
#include <Mod/Fem/App/FemAnalysis.h>
|
||||
|
||||
#include "ActiveAnalysisObserver.h"
|
||||
|
||||
#ifdef FC_USE_VTK
|
||||
#include <Mod/Fem/App/FemPostPipeline.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace std;
|
||||
|
||||
//================================================================================================
|
||||
//================================================================================================
|
||||
|
||||
@@ -4,24 +4,19 @@
|
||||
#ifndef _PreComp_
|
||||
# include <SMESH_Mesh.hxx>
|
||||
# include <SMESHDS_Mesh.hxx>
|
||||
# include <SMDSAbs_ElementType.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
|
||||
#include <App/DocumentObjectPy.h>
|
||||
|
||||
#include <Mod/Fem/Gui/ViewProviderFemMesh.h>
|
||||
#include <Mod/Fem/App/FemResultObject.h>
|
||||
#include <Mod/Fem/App/FemMeshObject.h>
|
||||
#include <Mod/Fem/App/FemMesh.h>
|
||||
|
||||
#include "ViewProviderFemMesh.h"
|
||||
|
||||
// inclusion of the generated files (generated out of ViewProviderFemMeshPy.xml)
|
||||
#include "ViewProviderFemMeshPy.h"
|
||||
#include "ViewProviderFemMeshPy.cpp"
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
@@ -31,7 +26,7 @@ std::string ViewProviderFemMeshPy::representation(void) const
|
||||
}
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::applyDisplacement(PyObject * args)
|
||||
PyObject* ViewProviderFemMeshPy::applyDisplacement(PyObject* args)
|
||||
{
|
||||
double factor;
|
||||
if (!PyArg_ParseTuple(args, "d", &factor))
|
||||
@@ -43,37 +38,37 @@ PyObject* ViewProviderFemMeshPy::applyDisplacement(PyObject * args)
|
||||
}
|
||||
|
||||
|
||||
App::Color calcColor(double value,double min, double max)
|
||||
App::Color calcColor(double value, double min, double max)
|
||||
{
|
||||
if (max < 0) max = 0;
|
||||
if (min > 0) min = 0;
|
||||
|
||||
if (value < min)
|
||||
return App::Color (0.0,0.0,1.0);
|
||||
return App::Color(0.0, 0.0, 1.0);
|
||||
if (value > max)
|
||||
return App::Color (1.0,0.0,0.0);
|
||||
return App::Color(1.0, 0.0, 0.0);
|
||||
if (value == 0.0)
|
||||
return App::Color (0.0,1.0,0.0);
|
||||
if ( value > max/2.0 )
|
||||
return App::Color (1.0,1-((value-(max/2.0)) / (max/2.0)),0.0);
|
||||
if ( value > 0.0 )
|
||||
return App::Color (value/(max/2.0),1.0,0.0) ;
|
||||
if ( value < min/2.0 )
|
||||
return App::Color (0.0,1-((value-(min/2.0)) / (min/2.0)),1.0);
|
||||
if ( value < 0.0 )
|
||||
return App::Color (0.0,1.0,value/(min/2.0)) ;
|
||||
return App::Color (0,0,0);
|
||||
return App::Color(0.0, 1.0, 0.0);
|
||||
if (value > max / 2.0)
|
||||
return App::Color(1.0, 1 - ((value - (max / 2.0)) / (max / 2.0)), 0.0);
|
||||
if (value > 0.0)
|
||||
return App::Color(value / (max / 2.0), 1.0, 0.0);
|
||||
if (value < min / 2.0)
|
||||
return App::Color(0.0, 1 - ((value - (min / 2.0)) / (min / 2.0)), 1.0);
|
||||
if (value < 0.0)
|
||||
return App::Color(0.0, 1.0, value / (min / 2.0));
|
||||
return App::Color(0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::setNodeColorByScalars(PyObject *args)
|
||||
PyObject* ViewProviderFemMeshPy::setNodeColorByScalars(PyObject* args)
|
||||
{
|
||||
double max = -1e12;
|
||||
double min = +1e12;
|
||||
PyObject *node_ids_py;
|
||||
PyObject *values_py;
|
||||
PyObject* node_ids_py;
|
||||
PyObject* values_py;
|
||||
|
||||
if (PyArg_ParseTuple(args,"O!O!",&PyList_Type, &node_ids_py, &PyList_Type, &values_py)) {
|
||||
if (PyArg_ParseTuple(args, "O!O!", &PyList_Type, &node_ids_py, &PyList_Type, &values_py)) {
|
||||
std::vector<long> ids;
|
||||
std::vector<double> values;
|
||||
int num_items = PyList_Size(node_ids_py);
|
||||
@@ -82,23 +77,24 @@ PyObject* ViewProviderFemMeshPy::setNodeColorByScalars(PyObject *args)
|
||||
Py_Return;
|
||||
}
|
||||
std::vector<App::Color> node_colors(num_items);
|
||||
for (int i=0; i<num_items; i++){
|
||||
PyObject *id_py = PyList_GetItem(node_ids_py, i);
|
||||
for (int i = 0; i < num_items; i++) {
|
||||
PyObject* id_py = PyList_GetItem(node_ids_py, i);
|
||||
long id = PyLong_AsLong(id_py);
|
||||
ids.push_back(id);
|
||||
PyObject *value_py = PyList_GetItem(values_py, i);
|
||||
PyObject* value_py = PyList_GetItem(values_py, i);
|
||||
double val = PyFloat_AsDouble(value_py);
|
||||
values.push_back(val);
|
||||
if(val > max)
|
||||
if (val > max)
|
||||
max = val;
|
||||
if(val < min)
|
||||
if (val < min)
|
||||
min = val;
|
||||
}
|
||||
long i=0;
|
||||
for(std::vector<double>::const_iterator it=values.begin(); it!=values.end(); ++it, i++)
|
||||
long i = 0;
|
||||
for (std::vector<double>::const_iterator it = values.begin(); it != values.end(); ++it, i++)
|
||||
node_colors[i] = calcColor(*it, min, max);
|
||||
this->getViewProviderFemMeshPtr()->setColorByNodeId(ids, node_colors);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "PyArg_ParseTuple failed. Invalid arguments used with setNodeByScalars");
|
||||
return 0;
|
||||
}
|
||||
@@ -106,7 +102,7 @@ PyObject* ViewProviderFemMeshPy::setNodeColorByScalars(PyObject *args)
|
||||
}
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::resetNodeColor(PyObject *args)
|
||||
PyObject* ViewProviderFemMeshPy::resetNodeColor(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
@@ -115,11 +111,11 @@ PyObject* ViewProviderFemMeshPy::resetNodeColor(PyObject *args)
|
||||
}
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::setNodeDisplacementByVectors(PyObject *args)
|
||||
PyObject* ViewProviderFemMeshPy::setNodeDisplacementByVectors(PyObject* args)
|
||||
{
|
||||
PyObject *node_ids_py;
|
||||
PyObject *vectors_py;
|
||||
if (PyArg_ParseTuple(args,"O!O!",&PyList_Type, &node_ids_py, &PyList_Type, &vectors_py)) {
|
||||
PyObject* node_ids_py;
|
||||
PyObject* vectors_py;
|
||||
if (PyArg_ParseTuple(args, "O!O!", &PyList_Type, &node_ids_py, &PyList_Type, &vectors_py)) {
|
||||
std::vector<long> ids;
|
||||
std::vector<Base::Vector3d> vectors;
|
||||
int num_items = PyList_Size(node_ids_py);
|
||||
@@ -127,16 +123,17 @@ PyObject* ViewProviderFemMeshPy::setNodeDisplacementByVectors(PyObject *args)
|
||||
PyErr_SetString(PyExc_ValueError, "PyList_Size < 0. That is not a valid list!");
|
||||
Py_Return;
|
||||
}
|
||||
for (int i=0; i<num_items; i++){
|
||||
PyObject *id_py = PyList_GetItem(node_ids_py, i);
|
||||
for (int i = 0; i < num_items; i++) {
|
||||
PyObject* id_py = PyList_GetItem(node_ids_py, i);
|
||||
long id = PyLong_AsLong(id_py);
|
||||
ids.push_back(id);
|
||||
PyObject *vector_py = PyList_GetItem(vectors_py, i);
|
||||
PyObject* vector_py = PyList_GetItem(vectors_py, i);
|
||||
Base::Vector3d vec = Base::getVectorFromTuple<double>(vector_py);
|
||||
vectors.push_back(vec);
|
||||
}
|
||||
this->getViewProviderFemMeshPtr()->setDisplacementByNodeId(ids, vectors);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "PyArg_ParseTuple failed. Invalid arguments used with setNodeDisplacementByVectors");
|
||||
return 0;
|
||||
}
|
||||
@@ -144,7 +141,7 @@ PyObject* ViewProviderFemMeshPy::setNodeDisplacementByVectors(PyObject *args)
|
||||
}
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::resetNodeDisplacement(PyObject *args)
|
||||
PyObject* ViewProviderFemMeshPy::resetNodeDisplacement(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
@@ -163,7 +160,7 @@ Py::Dict ViewProviderFemMeshPy::getNodeColor(void) const
|
||||
void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg)
|
||||
{
|
||||
long size = arg.size();
|
||||
if(size == 0)
|
||||
if (size == 0)
|
||||
this->getViewProviderFemMeshPtr()->resetColorByNodeId();
|
||||
else {
|
||||
Base::TimeInfo Start;
|
||||
@@ -179,17 +176,17 @@ void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg)
|
||||
std::vector<App::Color> NodeColors(size);
|
||||
|
||||
long i = 0;
|
||||
for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it,i++){
|
||||
for (Py::Dict::iterator it = arg.begin(); it != arg.end(); ++it, i++) {
|
||||
Py::Long id((*it).first);
|
||||
Py::Tuple color((*it).second);
|
||||
NodeIds[i] = id;
|
||||
NodeColors[i] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0);
|
||||
NodeIds[i] = id;
|
||||
NodeColors[i] = App::Color(Py::Float(color[0]), Py::Float(color[1]), Py::Float(color[2]), 0);
|
||||
}
|
||||
Base::Console().Log(" %f: Start ViewProviderFemMeshPy::setNodeColor() call \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||
Base::Console().Log(" %f: Start ViewProviderFemMeshPy::setNodeColor() call \n", Base::TimeInfo::diffTimeF(Start, Base::TimeInfo()));
|
||||
|
||||
//this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeColorMap);
|
||||
this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeIds,NodeColors);
|
||||
Base::Console().Log(" %f: Finish ViewProviderFemMeshPy::setNodeColor() call \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||
this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeIds, NodeColors);
|
||||
Base::Console().Log(" %f: Finish ViewProviderFemMeshPy::setNodeColor() call \n", Base::TimeInfo::diffTimeF(Start, Base::TimeInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,15 +200,15 @@ Py::Dict ViewProviderFemMeshPy::getElementColor(void) const
|
||||
|
||||
void ViewProviderFemMeshPy::setElementColor(Py::Dict arg)
|
||||
{
|
||||
if(arg.size() == 0)
|
||||
if (arg.size() == 0)
|
||||
this->getViewProviderFemMeshPtr()->resetColorByNodeId();
|
||||
else {
|
||||
std::map<long,App::Color> NodeColorMap;
|
||||
std::map<long, App::Color> NodeColorMap;
|
||||
|
||||
for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it){
|
||||
for (Py::Dict::iterator it = arg.begin(); it != arg.end(); ++it) {
|
||||
Py::Long id((*it).first);
|
||||
Py::Tuple color((*it).second);
|
||||
NodeColorMap[id] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0);
|
||||
NodeColorMap[id] = App::Color(Py::Float(color[0]), Py::Float(color[1]), Py::Float(color[2]), 0);
|
||||
}
|
||||
this->getViewProviderFemMeshPtr()->setColorByElementId(NodeColorMap);
|
||||
}
|
||||
@@ -227,14 +224,14 @@ Py::Dict ViewProviderFemMeshPy::getNodeDisplacement(void) const
|
||||
|
||||
void ViewProviderFemMeshPy::setNodeDisplacement(Py::Dict arg)
|
||||
{
|
||||
if(arg.size() == 0)
|
||||
if (arg.size() == 0)
|
||||
this->getViewProviderFemMeshPtr()->resetColorByNodeId();
|
||||
else {
|
||||
std::map<long,Base::Vector3d> NodeDispMap;
|
||||
union PyType_Object pyType = {&(Base::VectorPy::Type)};
|
||||
std::map<long, Base::Vector3d> NodeDispMap;
|
||||
union PyType_Object pyType = { &(Base::VectorPy::Type) };
|
||||
Py::Type vType(pyType.o);
|
||||
|
||||
for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it){
|
||||
for (Py::Dict::iterator it = arg.begin(); it != arg.end(); ++it) {
|
||||
Py::Long id((*it).first);
|
||||
if ((*it).second.isType(vType)) {
|
||||
Py::Vector p((*it).second);
|
||||
@@ -265,9 +262,9 @@ void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg)
|
||||
(vp->getObject())->FemMesh).getValue().getSMesh())->GetMeshDS();
|
||||
|
||||
std::set<long> res;
|
||||
for (Py::List::iterator it = arg.begin(); it!= arg.end();++it) {
|
||||
for (Py::List::iterator it = arg.begin(); it != arg.end(); ++it) {
|
||||
long id = static_cast<long>(Py::Long(*it));
|
||||
const SMDS_MeshNode *node = data->FindNode(id);
|
||||
const SMDS_MeshNode* node = data->FindNode(id);
|
||||
if (node)
|
||||
res.insert(id);
|
||||
}
|
||||
@@ -276,7 +273,7 @@ void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg)
|
||||
}
|
||||
|
||||
|
||||
PyObject* ViewProviderFemMeshPy::resetHighlightedNodes(PyObject *args)
|
||||
PyObject* ViewProviderFemMeshPy::resetHighlightedNodes(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
@@ -287,41 +284,41 @@ PyObject* ViewProviderFemMeshPy::resetHighlightedNodes(PyObject *args)
|
||||
|
||||
Py::List ViewProviderFemMeshPy::getVisibleElementFaces(void) const
|
||||
{
|
||||
const std::vector<unsigned long> & visElmFc = this->getViewProviderFemMeshPtr()->getVisibleElementFaces();
|
||||
const std::vector<unsigned long>& visElmFc = this->getViewProviderFemMeshPtr()->getVisibleElementFaces();
|
||||
std::vector<unsigned long> trans;
|
||||
|
||||
// sorting out double faces through higher order elements and null entries
|
||||
long elementOld =0, faceOld=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = visElmFc.begin();it!=visElmFc.end();++it){
|
||||
if(*it == 0)
|
||||
long elementOld = 0, faceOld = 0;
|
||||
for (std::vector<unsigned long>::const_iterator it = visElmFc.begin(); it != visElmFc.end(); ++it) {
|
||||
if (*it == 0)
|
||||
continue;
|
||||
|
||||
long element = *it>>3;
|
||||
long face = (*it&7)+1;
|
||||
if(element == elementOld && face==faceOld)
|
||||
long element = *it >> 3;
|
||||
long face = (*it & 7) + 1;
|
||||
if (element == elementOld && face == faceOld)
|
||||
continue;
|
||||
|
||||
trans.push_back(*it);
|
||||
elementOld = element;
|
||||
faceOld = face;
|
||||
faceOld = face;
|
||||
}
|
||||
|
||||
Py::List result( trans.size() );
|
||||
Py::List result(trans.size());
|
||||
int i = 0;
|
||||
for (std::vector<unsigned long>::const_iterator it = trans.begin();it!=trans.end();++it,i++){
|
||||
for (std::vector<unsigned long>::const_iterator it = trans.begin(); it != trans.end(); ++it, i++) {
|
||||
Py::Tuple tup(2);
|
||||
long element = *it>>3;
|
||||
long face = (*it&7)+1;
|
||||
tup.setItem( 0,Py::Long( element ) );
|
||||
tup.setItem( 1,Py::Long( face ) );
|
||||
result.setItem(i,tup);
|
||||
long element = *it >> 3;
|
||||
long face = (*it & 7) + 1;
|
||||
tup.setItem(0, Py::Long(element));
|
||||
tup.setItem(1, Py::Long(face));
|
||||
result.setItem(i, tup);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
PyObject *ViewProviderFemMeshPy::getCustomAttributes(const char* /*attr*/) const
|
||||
PyObject* ViewProviderFemMeshPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -331,5 +328,3 @@ int ViewProviderFemMeshPy::setCustomAttributes(const char* /*attr*/, PyObject* /
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <qobject.h>
|
||||
#endif
|
||||
|
||||
#include "Workbench.h"
|
||||
#include <Gui/ToolBarManager.h>
|
||||
#include <Gui/MenuManager.h>
|
||||
#include <Gui/ToolBarManager.h>
|
||||
|
||||
#include "Workbench.h"
|
||||
|
||||
|
||||
using namespace FemGui;
|
||||
@@ -73,6 +73,7 @@ using namespace FemGui;
|
||||
qApp->translate("Workbench", "Utilities");
|
||||
#endif
|
||||
|
||||
|
||||
/// @namespace FemGui @class Workbench
|
||||
TYPESYSTEM_SOURCE(FemGui::Workbench, Gui::StdWorkbench)
|
||||
|
||||
@@ -86,7 +87,7 @@ Workbench::~Workbench()
|
||||
|
||||
void Workbench::setupContextMenu(const char* recipient, Gui::MenuItem* item) const
|
||||
{
|
||||
StdWorkbench::setupContextMenu( recipient, item );
|
||||
StdWorkbench::setupContextMenu(recipient, item);
|
||||
*item
|
||||
<< "Separator"
|
||||
<< "FEM_MeshClear"
|
||||
@@ -155,8 +156,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "FEM_ConstraintTemperature"
|
||||
<< "FEM_ConstraintBodyHeatSource";
|
||||
|
||||
Gui::ToolBarItem* mesh = new Gui::ToolBarItem(root);
|
||||
mesh->setCommand("Mesh");
|
||||
Gui::ToolBarItem* mesh = new Gui::ToolBarItem(root);
|
||||
mesh->setCommand("Mesh");
|
||||
#ifdef FCWithNetgen
|
||||
*mesh
|
||||
<< "FEM_MeshNetgenFromShape";
|
||||
@@ -170,8 +171,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "Separator"
|
||||
<< "FEM_FEMMesh2Mesh";
|
||||
|
||||
Gui::ToolBarItem* solve = new Gui::ToolBarItem(root);
|
||||
solve->setCommand("Solve");
|
||||
Gui::ToolBarItem* solve = new Gui::ToolBarItem(root);
|
||||
solve->setCommand("Solve");
|
||||
*solve
|
||||
<< "FEM_SolverCalculixCxxtools"
|
||||
<< "FEM_SolverCalculiX"
|
||||
@@ -187,8 +188,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "FEM_SolverControl"
|
||||
<< "FEM_SolverRun";
|
||||
|
||||
Gui::ToolBarItem* results = new Gui::ToolBarItem(root);
|
||||
results->setCommand("Results");
|
||||
Gui::ToolBarItem* results = new Gui::ToolBarItem(root);
|
||||
results->setCommand("Results");
|
||||
*results
|
||||
<< "FEM_ResultsPurge"
|
||||
<< "FEM_ResultShow";
|
||||
@@ -209,8 +210,8 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "FEM_PostCreateFunctions";
|
||||
#endif
|
||||
|
||||
Gui::ToolBarItem* utils = new Gui::ToolBarItem(root);
|
||||
utils->setCommand("Utilities");
|
||||
Gui::ToolBarItem* utils = new Gui::ToolBarItem(root);
|
||||
utils->setCommand("Utilities");
|
||||
*utils
|
||||
<< "FEM_ClippingPlaneAdd"
|
||||
<< "FEM_ClippingPlaneRemoveAll"
|
||||
|
||||
Reference in New Issue
Block a user