FEM Post: Fix rebase errors

This commit is contained in:
Stefan Tröger
2016-05-14 07:59:10 +02:00
committed by wmayer
parent 4c9d4e1fdc
commit 836d5b1525
11 changed files with 1 additions and 5596 deletions

View File

@@ -1,339 +0,0 @@
<<<<<<< 43b51b168bc838480fd6a0a4b9f67e0bf864a560
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <CXX/Extensions.hxx>
#include "FemMeshPy.h"
#include "FemMesh.h"
#include "FemMeshProperty.h"
#include "FemAnalysis.h"
#include "FemMeshObject.h"
#include "FemMeshShapeObject.h"
#include "FemMeshShapeNetgenObject.h"
#include "FemSetElementsObject.h"
#include "FemSetFacesObject.h"
#include "FemSetGeometryObject.h"
#include "FemSetNodesObject.h"
#include "HypothesisPy.h"
#include "FemConstraintBearing.h"
#include "FemConstraintFixed.h"
#include "FemConstraintForce.h"
#include "FemConstraintPressure.h"
#include "FemConstraintGear.h"
#include "FemConstraintPulley.h"
#include "FemConstraintDisplacement.h"
#include "FemResultObject.h"
#include "FemSolverObject.h"
#ifdef FC_USE_VTK
#include "FemPostPipeline.h"
#include "FemPostFilter.h"
#include "FemPostFunction.h"
#endif
namespace Fem {
extern PyObject* initModule();
}
/* Python entry */
PyMODINIT_FUNC initFem()
{
// load dependend module
try {
Base::Interpreter().loadModule("Part");
//Base::Interpreter().loadModule("Mesh");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
}
PyObject* femModule = Fem::initModule();
Base::Console().Log("Loading Fem module... done\n");
Fem::StdMeshers_Arithmetic1DPy ::init_type(femModule);
Fem::StdMeshers_AutomaticLengthPy ::init_type(femModule);
Fem::StdMeshers_NotConformAllowedPy ::init_type(femModule);
Fem::StdMeshers_MaxLengthPy ::init_type(femModule);
Fem::StdMeshers_LocalLengthPy ::init_type(femModule);
Fem::StdMeshers_QuadranglePreferencePy ::init_type(femModule);
Fem::StdMeshers_Quadrangle_2DPy ::init_type(femModule);
Fem::StdMeshers_MaxElementAreaPy ::init_type(femModule);
Fem::StdMeshers_Regular_1DPy ::init_type(femModule);
Fem::StdMeshers_UseExisting_1DPy ::init_type(femModule);
Fem::StdMeshers_UseExisting_2DPy ::init_type(femModule);
Fem::StdMeshers_CompositeSegment_1DPy ::init_type(femModule);
Fem::StdMeshers_Deflection1DPy ::init_type(femModule);
Fem::StdMeshers_LayerDistributionPy ::init_type(femModule);
Fem::StdMeshers_LengthFromEdgesPy ::init_type(femModule);
Fem::StdMeshers_MaxElementVolumePy ::init_type(femModule);
Fem::StdMeshers_MEFISTO_2DPy ::init_type(femModule);
Fem::StdMeshers_NumberOfLayersPy ::init_type(femModule);
Fem::StdMeshers_NumberOfSegmentsPy ::init_type(femModule);
Fem::StdMeshers_Prism_3DPy ::init_type(femModule);
Fem::StdMeshers_Projection_1DPy ::init_type(femModule);
Fem::StdMeshers_Projection_2DPy ::init_type(femModule);
Fem::StdMeshers_Projection_3DPy ::init_type(femModule);
Fem::StdMeshers_ProjectionSource1DPy ::init_type(femModule);
Fem::StdMeshers_ProjectionSource2DPy ::init_type(femModule);
Fem::StdMeshers_ProjectionSource3DPy ::init_type(femModule);
Fem::StdMeshers_QuadraticMeshPy ::init_type(femModule);
Fem::StdMeshers_RadialPrism_3DPy ::init_type(femModule);
Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule);
Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule);
Fem::StdMeshers_StartEndLengthPy ::init_type(femModule);
Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule);
Fem::StdMeshers_Hexa_3DPy ::init_type(femModule);
// Add Types to module
Base::Interpreter().addType(&Fem::FemMeshPy::Type,femModule,"FemMesh");
// NOTE: To finish the initialization of our own type objects we must
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
// This function is responsible for adding inherited slots from a type's base class.
Fem::FemAnalysis ::init();
Fem::FemAnalysisPython ::init();
Fem::DocumentObject ::init();
Fem::FeaturePython ::init();
Fem::FemMesh ::init();
Fem::FemMeshObject ::init();
Fem::FemMeshShapeObject ::init();
Fem::FemMeshShapeNetgenObject ::init();
Fem::PropertyFemMesh ::init();
Fem::FemSetObject ::init();
Fem::FemSetElementsObject ::init();
Fem::FemSetFacesObject ::init();
Fem::FemSetGeometryObject ::init();
Fem::FemSetNodesObject ::init();
Fem::Constraint ::init();
Fem::ConstraintBearing ::init();
Fem::ConstraintFixed ::init();
Fem::ConstraintForce ::init();
Fem::ConstraintPressure ::init();
Fem::ConstraintGear ::init();
Fem::ConstraintPulley ::init();
Fem::ConstraintDisplacement ::init();
Fem::FemResultObject ::init();
Fem::FemSolverObject ::init();
Fem::FemSolverObjectPython ::init();
#ifdef FC_USE_VTK
Fem::FemPostObject ::init();
Fem::FemPostPipeline ::init();
Fem::FemPostFilter ::init();
Fem::FemPostClipFilter ::init();
Fem::FemPostScalarClipFilter ::init();
Fem::FemPostWarpVectorFilter ::init();
Fem::FemPostCutFilter ::init();
Fem::FemPostFunction ::init();
Fem::FemPostFunctionProvider ::init();
Fem::FemPostPlaneFunction ::init();
Fem::FemPostSphereFunction ::init();
#endif
}
=======
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <CXX/Extensions.hxx>
#include "FemMeshPy.h"
#include "FemMesh.h"
#include "FemMeshProperty.h"
#include "FemAnalysis.h"
#include "FemMeshObject.h"
#include "FemMeshShapeObject.h"
#include "FemMeshShapeNetgenObject.h"
#include "FemSetElementsObject.h"
#include "FemSetFacesObject.h"
#include "FemSetGeometryObject.h"
#include "FemSetNodesObject.h"
#include "HypothesisPy.h"
#include "FemConstraintBearing.h"
#include "FemConstraintFixed.h"
#include "FemConstraintForce.h"
#include "FemConstraintPressure.h"
#include "FemConstraintGear.h"
#include "FemConstraintPulley.h"
#include "FemConstraintDisplacement.h"
#include "FemResultObject.h"
#include "FemSolverObject.h"
#ifdef FC_USE_VTK
#include "FemPostPipeline.h"
#include "FemPostFilter.h"
#include "FemPostFunction.h"
#include "PropertyPostDataObject.h"
#endif
namespace Fem {
extern PyObject* initModule();
}
/* Python entry */
PyMODINIT_FUNC initFem()
{
// load dependend module
try {
Base::Interpreter().loadModule("Part");
//Base::Interpreter().loadModule("Mesh");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
}
PyObject* femModule = Fem::initModule();
Base::Console().Log("Loading Fem module... done\n");
Fem::StdMeshers_Arithmetic1DPy ::init_type(femModule);
Fem::StdMeshers_AutomaticLengthPy ::init_type(femModule);
Fem::StdMeshers_NotConformAllowedPy ::init_type(femModule);
Fem::StdMeshers_MaxLengthPy ::init_type(femModule);
Fem::StdMeshers_LocalLengthPy ::init_type(femModule);
Fem::StdMeshers_QuadranglePreferencePy ::init_type(femModule);
Fem::StdMeshers_Quadrangle_2DPy ::init_type(femModule);
Fem::StdMeshers_MaxElementAreaPy ::init_type(femModule);
Fem::StdMeshers_Regular_1DPy ::init_type(femModule);
Fem::StdMeshers_UseExisting_1DPy ::init_type(femModule);
Fem::StdMeshers_UseExisting_2DPy ::init_type(femModule);
Fem::StdMeshers_CompositeSegment_1DPy ::init_type(femModule);
Fem::StdMeshers_Deflection1DPy ::init_type(femModule);
Fem::StdMeshers_LayerDistributionPy ::init_type(femModule);
Fem::StdMeshers_LengthFromEdgesPy ::init_type(femModule);
Fem::StdMeshers_MaxElementVolumePy ::init_type(femModule);
Fem::StdMeshers_MEFISTO_2DPy ::init_type(femModule);
Fem::StdMeshers_NumberOfLayersPy ::init_type(femModule);
Fem::StdMeshers_NumberOfSegmentsPy ::init_type(femModule);
Fem::StdMeshers_Prism_3DPy ::init_type(femModule);
Fem::StdMeshers_Projection_1DPy ::init_type(femModule);
Fem::StdMeshers_Projection_2DPy ::init_type(femModule);
Fem::StdMeshers_Projection_3DPy ::init_type(femModule);
Fem::StdMeshers_ProjectionSource1DPy ::init_type(femModule);
Fem::StdMeshers_ProjectionSource2DPy ::init_type(femModule);
Fem::StdMeshers_ProjectionSource3DPy ::init_type(femModule);
Fem::StdMeshers_QuadraticMeshPy ::init_type(femModule);
Fem::StdMeshers_RadialPrism_3DPy ::init_type(femModule);
Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule);
Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule);
Fem::StdMeshers_StartEndLengthPy ::init_type(femModule);
Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule);
Fem::StdMeshers_Hexa_3DPy ::init_type(femModule);
// Add Types to module
Base::Interpreter().addType(&Fem::FemMeshPy::Type,femModule,"FemMesh");
// NOTE: To finish the initialization of our own type objects we must
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
// This function is responsible for adding inherited slots from a type's base class.
Fem::FemAnalysis ::init();
Fem::FemAnalysisPython ::init();
Fem::DocumentObject ::init();
Fem::FeaturePython ::init();
Fem::FemMesh ::init();
Fem::FemMeshObject ::init();
Fem::FemMeshShapeObject ::init();
Fem::FemMeshShapeNetgenObject ::init();
Fem::PropertyFemMesh ::init();
Fem::FemSetObject ::init();
Fem::FemSetElementsObject ::init();
Fem::FemSetFacesObject ::init();
Fem::FemSetGeometryObject ::init();
Fem::FemSetNodesObject ::init();
Fem::Constraint ::init();
Fem::ConstraintBearing ::init();
Fem::ConstraintFixed ::init();
Fem::ConstraintForce ::init();
Fem::ConstraintPressure ::init();
Fem::ConstraintGear ::init();
Fem::ConstraintPulley ::init();
Fem::ConstraintDisplacement ::init();
Fem::FemResultObject ::init();
Fem::FemSolverObject ::init();
Fem::FemSolverObjectPython ::init();
#ifdef FC_USE_VTK
Fem::FemPostObject ::init();
Fem::FemPostPipeline ::init();
Fem::FemPostFilter ::init();
Fem::FemPostClipFilter ::init();
Fem::FemPostScalarClipFilter ::init();
Fem::FemPostWarpVectorFilter ::init();
Fem::FemPostCutFilter ::init();
Fem::FemPostFunction ::init();
Fem::FemPostFunctionProvider ::init();
Fem::FemPostPlaneFunction ::init();
Fem::FemPostSphereFunction ::init();
Fem::PropertyPostDataObject ::init();
#endif
}
>>>>>>> FreeCADify the vtk post processing

View File

@@ -1,535 +0,0 @@
<<<<<<< 9049674212e3b4f1429e82bfa203304100632838
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
# include <memory>
#endif
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
#include <Base/Console.h>
#include <Base/Tools.h>
#include <Base/VectorPy.h>
#include <Base/PlacementPy.h>
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/DocumentObjectPy.h>
//#include <Mod/Mesh/App/Core/MeshKernel.h>
//#include <Mod/Mesh/App/Core/Evaluation.h>
//#include <Mod/Mesh/App/Core/Iterator.h>
#include <SMESH_Gen.hxx>
#include <SMESH_Group.hxx>
#include <SMESHDS_Mesh.hxx>
#include <SMDS_MeshNode.hxx>
#include <StdMeshers_MaxLength.hxx>
#include <StdMeshers_LocalLength.hxx>
#include <StdMeshers_NumberOfSegments.hxx>
#include <StdMeshers_AutomaticLength.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#include <StdMeshers_MEFISTO_2D.hxx>
#include <StdMeshers_Deflection1D.hxx>
#include <StdMeshers_MaxElementArea.hxx>
#include <StdMeshers_Regular_1D.hxx>
#include <StdMeshers_QuadranglePreference.hxx>
#include <StdMeshers_Quadrangle_2D.hxx>
#include <StdMeshers_LengthFromEdges.hxx>
#include <StdMeshers_NotConformAllowed.hxx>
#include <StdMeshers_Arithmetic1D.hxx>
#include "FemMesh.h"
#include "FemMeshObject.h"
#include "FemPostPipeline.h"
#include "FemMeshPy.h"
#include <cstdlib>
#include <Standard_Real.hxx>
#include <Base/Vector3D.h>
#include <Mod/Part/App/OCCError.h>
namespace Fem {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("Fem")
{
add_varargs_method("open",&Module::open,
"open(string) -- Create a new document and a Mesh::Import feature to load the file into the document."
);
add_varargs_method("insert",&Module::insert,
"insert(string|mesh,[string]) -- Load or insert a mesh into the given or active document."
);
add_varargs_method("export",&Module::exporter,
"export(list,string) -- Export a list of objects into a single file."
);
add_varargs_method("read",&Module::read,
"Read a mesh from a file and returns a Mesh object."
);
add_varargs_method("show",&Module::show,
"show(shape) -- Add the shape to the active document or create one if no document exists."
);
initialize("This module is the Fem module."); // register with Python
}
virtual ~Module() {}
private:
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 Standard_Failure &e) {
std::string str;
Standard_CString msg = e.GetMessageString();
str += typeid(e).name();
str += " ";
if (msg) {str += msg;}
else {str += "No OCCT Exception Message";}
throw Py::Exception(Part::PartExceptionOCCError, str);
}
catch (const Base::Exception &e) {
throw Py::RuntimeError(e.what());
}
catch (const std::exception &e) {
throw Py::RuntimeError(e.what());
}
}
Py::Object open(const Py::Tuple& args)
{
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// create new document and add Import feature
App::Document *pcDoc = App::GetApplication().newDocument("Unnamed");
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.get());
(void)mesh.release();
pcFeature->purgeTouched();
return Py::None();
}
Py::Object insert(const Py::Tuple& args)
{
char* Name;
const char* DocName = 0;
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
App::Document *pcDoc = 0;
if (DocName)
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument(DocName);
}
Base::FileInfo file(EncodedName.c_str());
try {
std::auto_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.get());
(void)mesh.release();
pcFeature->purgeTouched();
}
catch(Base::Exception& e) {
#ifdef FC_USE_VTK
if( FemPostPipeline::canRead(file) ) {
FemPostPipeline *pcFeature = static_cast<FemPostPipeline *>
(pcDoc->addObject("Fem::FemPostPipeline", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->read(file);
pcFeature->touch();
pcDoc->recomputeFeature(pcFeature);
}
else
throw e;
#else
throw e;
#endif
}
return Py::None();
}
Py::Object exporter(const Py::Tuple& args)
{
PyObject* object;
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "Oet",&object,"utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
Py::Sequence list(object);
Base::Type meshId = Base::Type::fromName("Fem::FemMeshObject");
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
PyObject* item = (*it).ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
if (obj->getTypeId().isDerivedFrom(meshId)) {
static_cast<FemMeshObject*>(obj)->FemMesh.getValue().write(EncodedName.c_str());
break;
}
}
}
return Py::None();
}
Py::Object read(const Py::Tuple& args)
{
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
return Py::asObject(new FemMeshPy(mesh.release()));
}
Py::Object show(const Py::Tuple& args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args.ptr(), "O!", &(FemMeshPy::Type), &pcObj))
throw Py::Exception();
App::Document *pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc)
pcDoc = App::GetApplication().newDocument();
FemMeshPy* pShape = static_cast<FemMeshPy*>(pcObj);
Fem::FemMeshObject *pcFeature = (Fem::FemMeshObject *)pcDoc->addObject("Fem::FemMeshObject", "Mesh");
// copy the data
//TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr());
pcFeature->FemMesh.setValue(*(pShape->getFemMeshPtr()));
pcDoc->recompute();
return Py::None();
}
};
PyObject* initModule()
{
return (new Module)->module().ptr();
}
} // namespace Fem
=======
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
# include <memory>
#endif
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
#include <Base/Console.h>
#include <Base/Tools.h>
#include <Base/VectorPy.h>
#include <Base/PlacementPy.h>
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/DocumentObjectPy.h>
//#include <Mod/Mesh/App/Core/MeshKernel.h>
//#include <Mod/Mesh/App/Core/Evaluation.h>
//#include <Mod/Mesh/App/Core/Iterator.h>
#include <SMESH_Gen.hxx>
#include <SMESH_Group.hxx>
#include <SMESHDS_Mesh.hxx>
#include <SMDS_MeshNode.hxx>
#include <StdMeshers_MaxLength.hxx>
#include <StdMeshers_LocalLength.hxx>
#include <StdMeshers_NumberOfSegments.hxx>
#include <StdMeshers_AutomaticLength.hxx>
#include <StdMeshers_TrianglePreference.hxx>
#include <StdMeshers_MEFISTO_2D.hxx>
#include <StdMeshers_Deflection1D.hxx>
#include <StdMeshers_MaxElementArea.hxx>
#include <StdMeshers_Regular_1D.hxx>
#include <StdMeshers_QuadranglePreference.hxx>
#include <StdMeshers_Quadrangle_2D.hxx>
#include <StdMeshers_LengthFromEdges.hxx>
#include <StdMeshers_NotConformAllowed.hxx>
#include <StdMeshers_Arithmetic1D.hxx>
#include "FemMesh.h"
#include "FemMeshObject.h"
#include "FemMeshPy.h"
#ifdef FC_USE_VTK
#include "FemPostPipeline.h"
#endif
#include <cstdlib>
#include <Standard_Real.hxx>
#include <Base/Vector3D.h>
#include <Mod/Part/App/OCCError.h>
namespace Fem {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("Fem")
{
add_varargs_method("open",&Module::open,
"open(string) -- Create a new document and a Mesh::Import feature to load the file into the document."
);
add_varargs_method("insert",&Module::insert,
"insert(string|mesh,[string]) -- Load or insert a mesh into the given or active document."
);
add_varargs_method("export",&Module::exporter,
"export(list,string) -- Export a list of objects into a single file."
);
add_varargs_method("read",&Module::read,
"Read a mesh from a file and returns a Mesh object."
);
add_varargs_method("show",&Module::show,
"show(shape) -- Add the shape to the active document or create one if no document exists."
);
initialize("This module is the Fem module."); // register with Python
}
virtual ~Module() {}
private:
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 Standard_Failure &e) {
std::string str;
Standard_CString msg = e.GetMessageString();
str += typeid(e).name();
str += " ";
if (msg) {str += msg;}
else {str += "No OCCT Exception Message";}
throw Py::Exception(Part::PartExceptionOCCError, str);
}
catch (const Base::Exception &e) {
throw Py::RuntimeError(e.what());
}
catch (const std::exception &e) {
throw Py::RuntimeError(e.what());
}
}
Py::Object open(const Py::Tuple& args)
{
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// create new document and add Import feature
App::Document *pcDoc = App::GetApplication().newDocument("Unnamed");
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.get());
(void)mesh.release();
pcFeature->purgeTouched();
return Py::None();
}
Py::Object insert(const Py::Tuple& args)
{
char* Name;
const char* DocName = 0;
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
App::Document *pcDoc = 0;
if (DocName)
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument(DocName);
}
Base::FileInfo file(EncodedName.c_str());
try {
std::auto_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
FemMeshObject *pcFeature = static_cast<FemMeshObject *>
(pcDoc->addObject("Fem::FemMeshObject", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->FemMesh.setValuePtr(mesh.get());
(void)mesh.release();
pcFeature->purgeTouched();
}
catch(Base::Exception& e) {
#ifdef FC_USE_VTK
if( FemPostPipeline::canRead(file) ) {
FemPostPipeline *pcFeature = static_cast<FemPostPipeline *>
(pcDoc->addObject("Fem::FemPostPipeline", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->read(file);
pcFeature->touch();
pcDoc->recomputeFeature(pcFeature);
}
else
throw e;
#else
throw e;
#endif
}
return Py::None();
}
Py::Object exporter(const Py::Tuple& args)
{
PyObject* object;
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "Oet",&object,"utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
Py::Sequence list(object);
Base::Type meshId = Base::Type::fromName("Fem::FemMeshObject");
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
PyObject* item = (*it).ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
if (obj->getTypeId().isDerivedFrom(meshId)) {
static_cast<FemMeshObject*>(obj)->FemMesh.getValue().write(EncodedName.c_str());
break;
}
}
}
return Py::None();
}
Py::Object read(const Py::Tuple& args)
{
char* Name;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8",&Name))
throw Py::Exception();
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
std::auto_ptr<FemMesh> mesh(new FemMesh);
mesh->read(EncodedName.c_str());
return Py::asObject(new FemMeshPy(mesh.release()));
}
Py::Object show(const Py::Tuple& args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args.ptr(), "O!", &(FemMeshPy::Type), &pcObj))
throw Py::Exception();
App::Document *pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc)
pcDoc = App::GetApplication().newDocument();
FemMeshPy* pShape = static_cast<FemMeshPy*>(pcObj);
Fem::FemMeshObject *pcFeature = (Fem::FemMeshObject *)pcDoc->addObject("Fem::FemMeshObject", "Mesh");
// copy the data
//TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr());
pcFeature->FemMesh.setValue(*(pShape->getFemMeshPtr()));
pcDoc->recompute();
return Py::None();
}
};
PyObject* initModule()
{
return (new Module)->module().ptr();
}
} // namespace Fem
>>>>>>> Fem Post: fix vtk include wthout guard

View File

@@ -122,7 +122,6 @@ SET(FemScripts_SRCS
FemSelectionObserver.py
TestFem.py
z88DispReader.py
TaskPanelFemBeamSection.ui
TaskPanelFemShellThickness.ui
TaskPanelFemSolverCalculix.ui
@@ -222,7 +221,7 @@ SET(Fem_SRCS
${FemSet_SRCS}
${FemConstraints_SRCS}
${FemResult_SRCS}
....${FemPost_SRCS}
${FemPost_SRCS}
${Mod_SRCS}
${Python_SRCS}
)

View File

@@ -1,236 +0,0 @@
if(MSVC)
add_definitions(-DFCAppFem -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH)
else(MSVC)
add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H)
endif(MSVC)
if(BUILD_FEM_NETGEN)
add_definitions(-DFCWithNetgen ${NETGEN_DEFINITIONS})
endif(BUILD_FEM_NETGEN)
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src/3rdParty/ANN/include
${Boost_INCLUDE_DIRS}
${QT_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
${XercesC_INCLUDE_DIRS}
${SMESH_INCLUDE_DIR}
)
link_directories(${OCC_LIBRARY_DIR})
set(Fem_LIBS
Part
FreeCADApp
StdMeshers
SMESH
SMDS
SMESHDS
)
if(BUILD_FEM_NETGEN)
set(Fem_LIBS
${Fem_LIBS}
NETGENPlugin
)
endif(BUILD_FEM_NETGEN)
if(BUILD_FEM_VTK)
set(Fem_LIBS
${Fem_LIBS}
${VTK_LIBRARIES}
)
endif(BUILD_FEM_VTK)
generate_from_xml(FemMeshPy)
SET(Python_SRCS
FemMeshPy.xml
FemMeshPyImp.cpp
HypothesisPy.cpp
HypothesisPy.h
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
SET(Mod_SRCS
AppFem.cpp
AppFemPy.cpp
FemTools.cpp
FemTools.h
PreCompiled.cpp
PreCompiled.h
)
SOURCE_GROUP("Module" FILES ${Mod_SRCS})
SET(FemScripts_SRCS
_CommandFemBeamSection.py
_CommandFemFromShape.py
_CommandFemShellThickness.py
_CommandFemSolverCalculix.py
_CommandMechanicalMaterial.py
_CommandMechanicalShowResult.py
_CommandNewMechanicalAnalysis.py
_CommandPurgeFemResults.py
_CommandQuickAnalysis.py
_CommandSolverJobControl.py
_FemAnalysis.py
_FemBeamSection.py
_FemShellThickness.py
_FemSolverCalculix.py
_MechanicalMaterial.py
_TaskPanelFemBeamSection.py
_TaskPanelFemShellThickness.py
_TaskPanelFemSolverCalculix.py
_TaskPanelMechanicalMaterial.py
_TaskPanelResultControl.py
_ViewProviderFemAnalysis.py
_ViewProviderFemBeamSection.py
_ViewProviderFemShellThickness.py
_ViewProviderFemSolverCalculix.py
_ViewProviderMechanicalMaterial.py
ccxDatReader.py
ccxFrdReader.py
ccxInpWriter.py
convert2TetGen.py
Init.py
InitGui.py
FemAnalysis.py
FemCommands.py
FemBeamSection.py
FemShellThickness.py
FemSolverCalculix.py
FemTools.py
MechanicalMaterial.py
SelectionObserverFem.py
TestFem.py
TaskPanelFemBeamSection.ui
TaskPanelFemShellThickness.ui
TaskPanelFemSolverCalculix.ui
TaskPanelMechanicalMaterial.ui
TaskPanelShowDisplacement.ui
)
#SOURCE_GROUP("Scripts" FILES ${FemScripts_SRCS})
SET(FemTests_SRCS
test_files/ccx/mesh_points.csv
test_files/ccx/mesh_volumes.csv
test_files/ccx/cube_frequency.inp
test_files/ccx/cube_frequency.dat
test_files/ccx/cube_frequency.frd
test_files/ccx/cube_frequency_expected_values
test_files/ccx/cube_static.inp
test_files/ccx/cube_static.dat
test_files/ccx/cube_static.frd
test_files/ccx/cube_static_expected_values
test_files/ccx/cube.fcstd
)
SET(FemBase_SRCS
FemMeshObject.cpp
FemMeshObject.h
FemMeshShapeObject.cpp
FemMeshShapeObject.h
FemMeshShapeNetgenObject.cpp
FemMeshShapeNetgenObject.h
FemAnalysis.cpp
FemAnalysis.h
FemMesh.cpp
FemMesh.h
FemResultObject.cpp
FemResultObject.h
FemSolverObject.cpp
FemSolverObject.h
FemConstraint.cpp
FemConstraint.h
FemMeshProperty.cpp
FemMeshProperty.h
)
SOURCE_GROUP("Base types" FILES ${FemBase_SRCS})
SET(FemSet_SRCS
FemSetObject.cpp
FemSetObject.h
FemSetNodesObject.cpp
FemSetNodesObject.h
FemSetElementsObject.cpp
FemSetElementsObject.h
FemSetFacesObject.cpp
FemSetFacesObject.h
FemSetGeometryObject.cpp
FemSetGeometryObject.h
)
SOURCE_GROUP("Set objects" FILES ${FemSet_SRCS})
SET(FemConstraints_SRCS
FemConstraintBearing.h
FemConstraintBearing.cpp
FemConstraintFixed.cpp
FemConstraintFixed.h
FemConstraintForce.cpp
FemConstraintForce.h
FemConstraintPressure.cpp
FemConstraintPressure.h
FemConstraintGear.cpp
FemConstraintGear.h
FemConstraintPulley.cpp
FemConstraintPulley.h
FemConstraintDisplacement.h
FemConstraintDisplacement.cpp
)
SOURCE_GROUP("Constraints" FILES ${FemConstraints_SRCS})
if(BUILD_FEM_VTK)
SET(FemPost_SRCS
FemPostObject.h
FemPostObject.cpp
FemPostPipeline.h
FemPostPipeline.cpp
FemPostFilter.h
FemPostFilter.cpp
<<<<<<< eec6f7aee8b6e5979a799358e2ae69bdc5a7af5b
)
=======
FemPostFunction.h
FemPostFunction.cpp
)
>>>>>>> Basic implementation of filter framework
SOURCE_GROUP("PostObjects" FILES ${FemPost_SRCS})
endif(BUILD_FEM_VTK)
SET(Fem_SRCS
${FemBase_SRCS}
${FemSet_SRCS}
${FemConstraints_SRCS}
${FemResult_SRCS}
....${FemPost_SRCS}
${Mod_SRCS}
${Python_SRCS}
)
add_library(Fem SHARED ${Fem_SRCS})
target_link_libraries(Fem ${Fem_LIBS})
fc_target_copy_resource(Fem
${CMAKE_SOURCE_DIR}/src/Mod/Fem
${CMAKE_BINARY_DIR}/Mod/Fem
Init.py
${FemScripts_SRCS}
${FemTests_SRCS}
)
SET_BIN_DIR(Fem Fem /Mod/Fem)
SET_PYTHON_PREFIX_SUFFIX(Fem)
INSTALL(TARGETS Fem DESTINATION ${CMAKE_INSTALL_LIBDIR})

File diff suppressed because it is too large Load Diff

View File

@@ -1,123 +0,0 @@
<<<<<<< f24874396c47b854461779051d98df0c6567b0a2
<RCC>
<qresource>
<file>icons/fem-fem-mesh-from-shape.svg</file>
<file>icons/fem-fem-mesh-create-node-by-poly.svg</file>
<file>icons/fem-analysis.svg</file>
<file>icons/fem-solver.svg</file>
<file>icons/fem-constraint-displacement.svg</file>
<file>icons/fem-constraint-force.svg</file>
<file>icons/fem-constraint-fixed.svg</file>
<file>icons/fem-constraint-pressure.svg</file>
<file>icons/fem-constraint-bearing.svg</file>
<file>icons/fem-constraint-gear.svg</file>
<file>icons/fem-constraint-pulley.svg</file>
<file>icons/fem-add-fem-mesh.svg</file>
<file>icons/fem-add-material.svg</file>
<file>icons/fem-add-part.svg</file>
<file>icons/fem-inp-editor.svg</file>
<file>icons/fem-material.svg</file>
<file>icons/fem-new-analysis.svg</file>
<file>icons/fem-purge-results.svg</file>
<file>icons/fem-quick-analysis.svg</file>
<file>icons/fem-frequency-analysis.svg</file>
<file>icons/fem-result.svg</file>
<file>icons/fem-shell-thickness.svg</file>
<file>icons/fem-beam-section.svg</file>
<file>icons/preferences-fem.svg</file>
<file>icons/FemWorkbench.svg</file>
<file>translations/Fem_af.qm</file>
<file>translations/Fem_de.qm</file>
<file>translations/Fem_fi.qm</file>
<file>translations/Fem_fr.qm</file>
<file>translations/Fem_hr.qm</file>
<file>translations/Fem_it.qm</file>
<file>translations/Fem_nl.qm</file>
<file>translations/Fem_no.qm</file>
<file>translations/Fem_pl.qm</file>
<file>translations/Fem_ru.qm</file>
<file>translations/Fem_uk.qm</file>
<file>translations/Fem_tr.qm</file>
<file>translations/Fem_sv-SE.qm</file>
<file>translations/Fem_zh-TW.qm</file>
<file>translations/Fem_pt-BR.qm</file>
<file>translations/Fem_cs.qm</file>
<file>translations/Fem_sk.qm</file>
<file>translations/Fem_es-ES.qm</file>
<file>translations/Fem_zh-CN.qm</file>
<file>translations/Fem_ja.qm</file>
<file>translations/Fem_ro.qm</file>
<file>translations/Fem_hu.qm</file>
<file>translations/Fem_pt-PT.qm</file>
<file>translations/Fem_sr.qm</file>
<file>translations/Fem_el.qm</file>
<file>translations/Fem_sl.qm</file>
</qresource>
</RCC>
=======
<RCC>
<qresource>
<file>icons/fem-fem-mesh-from-shape.svg</file>
<file>icons/fem-fem-mesh-create-node-by-poly.svg</file>
<file>icons/fem-analysis.svg</file>
<file>icons/fem-solver.svg</file>
<file>icons/fem-constraint-displacement.svg</file>
<file>icons/fem-constraint-force.svg</file>
<file>icons/fem-constraint-fixed.svg</file>
<file>icons/fem-constraint-pressure.svg</file>
<file>icons/fem-constraint-bearing.svg</file>
<file>icons/fem-constraint-gear.svg</file>
<file>icons/fem-constraint-pulley.svg</file>
<file>icons/fem-add-fem-mesh.svg</file>
<file>icons/fem-add-material.svg</file>
<file>icons/fem-add-part.svg</file>
<file>icons/fem-inp-editor.svg</file>
<file>icons/fem-material.svg</file>
<file>icons/fem-new-analysis.svg</file>
<file>icons/fem-purge-results.svg</file>
<file>icons/fem-quick-analysis.svg</file>
<file>icons/fem-frequency-analysis.svg</file>
<file>icons/fem-result.svg</file>
<file>icons/fem-shell-thickness.svg</file>
<file>icons/fem-beam-section.svg</file>
<file>icons/preferences-fem.svg</file>
<file>icons/FemWorkbench.svg</file>
<file>icons/fem-clip.png</file>
<file>icons/fem-clip-scalar.png</file>
<file>icons/fem-cut.png</file>
<file>icons/fem-isosurface.png</file>
<file>icons/fem-warp.png</file>
<file>icons/fem-data.png</file>
<file>icons/fem-plane.svg</file>
<file>icons/fem-box.svg</file>
<file>icons/fem-sphere.svg</file>
<file>icons/fem-cylinder.svg</file>
<file>translations/Fem_af.qm</file>
<file>translations/Fem_de.qm</file>
<file>translations/Fem_fi.qm</file>
<file>translations/Fem_fr.qm</file>
<file>translations/Fem_hr.qm</file>
<file>translations/Fem_it.qm</file>
<file>translations/Fem_nl.qm</file>
<file>translations/Fem_no.qm</file>
<file>translations/Fem_pl.qm</file>
<file>translations/Fem_ru.qm</file>
<file>translations/Fem_uk.qm</file>
<file>translations/Fem_tr.qm</file>
<file>translations/Fem_sv-SE.qm</file>
<file>translations/Fem_zh-TW.qm</file>
<file>translations/Fem_pt-BR.qm</file>
<file>translations/Fem_cs.qm</file>
<file>translations/Fem_sk.qm</file>
<file>translations/Fem_es-ES.qm</file>
<file>translations/Fem_zh-CN.qm</file>
<file>translations/Fem_ja.qm</file>
<file>translations/Fem_ro.qm</file>
<file>translations/Fem_hu.qm</file>
<file>translations/Fem_pt-PT.qm</file>
<file>translations/Fem_sr.qm</file>
<file>translations/Fem_el.qm</file>
<file>translations/Fem_sl.qm</file>
</qresource>
</RCC>
>>>>>>> Add icons for fem post processing