diff --git a/src/Doc/CMakeLists.txt b/src/Doc/CMakeLists.txt index 9f2c220b5d..8814adc3de 100644 --- a/src/Doc/CMakeLists.txt +++ b/src/Doc/CMakeLists.txt @@ -81,7 +81,6 @@ if(DOXYGEN_FOUND) set( DOXYGEN_EXCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/Tools) list(APPEND DOXYGEN_EXCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/Doc/sphinx) # deprecated modules - list(APPEND DOXYGEN_EXCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/Mod/Assembly) list(APPEND DOXYGEN_EXCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/Mod/Complete) STRING(REGEX REPLACE ";" " " DOXYGEN_EXCLUDE_LIST "${DOXYGEN_EXCLUDE_DIR}") diff --git a/src/Mod/Assembly/App/AppAssembly.cpp b/src/Mod/Assembly/App/AppAssembly.cpp deleted file mode 100644 index 3878b3c44c..0000000000 --- a/src/Mod/Assembly/App/AppAssembly.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * 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" - -#include -#include - -#include "Item.h" -#include "Product.h" -#include "ProductRef.h" - -#include "Constraint.h" -#include "ConstraintGroup.h" - - -extern struct PyMethodDef Assembly_methods[]; - -PyDoc_STRVAR(module_Assembly_doc, -"This module is the Assembly module."); - - -/* Python entry */ -extern "C" { -void AssemblyExport initAssembly() -{ - // load dependent module - try { - Base::Interpreter().runString("import Part"); - //Base::Interpreter().runString("import PartDesign"); - } - catch(const Base::Exception& e) { - PyErr_SetString(PyExc_ImportError, e.what()); - return; - } - static struct PyModuleDef AssemblyAPIDef = { - PyModuleDef_HEAD_INIT, - "Assembly", module_Assembly_doc, -1, Assembly_methods, - NULL, NULL, NULL, NULL - }; - PyModule_Create(&AssemblyAPIDef); - Base::Console().Log("Loading Assembly module... done\n"); - - - //dWorldID id = dWorldCreate(); - //dWorldDestroy(id); - - // 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. - - // Item hierarchy - Assembly::Item ::init(); - Assembly::Product ::init(); - Assembly::ProductRef ::init(); - - // constraint hierarchy - Assembly::Constraint ::init(); - Assembly::ConstraintGroup ::init(); -} - -} // extern "C" diff --git a/src/Mod/Assembly/App/AppAssemblyPy.cpp b/src/Mod/Assembly/App/AppAssemblyPy.cpp deleted file mode 100644 index 46661a7d9d..0000000000 --- a/src/Mod/Assembly/App/AppAssemblyPy.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * 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" - -#include -#include - -//#include - -//#include -//#include -//#include - -//#include - -//#include "ViewProviderBody.h" -//#include "Utils.h" - - -//static PyObject * setActiveBody(PyObject *self, PyObject *args) -//{ -// PyObject *object=0; -// if (PyArg_ParseTuple(args,"|O!",&(PartDesign::BodyPy::Type), &object)&& object) { -// PartDesign::Body* Item = static_cast(object)->getBodyPtr(); -// // Should be set! -// assert(Item); -// -// // Set old body inactive if we are activating another body in the same document -// if ((PartDesignGui::ActivePartObject != NULL) && -// (PartDesignGui::ActivePartObject->getDocument() == Item->getDocument())) -// PartDesignGui::ActivePartObject->IsActive.setValue(false); -// PartDesignGui::ActivePartObject = Item; -// PartDesignGui::ActiveAppDoc = Item->getDocument(); -// PartDesignGui::ActiveGuiDoc = Gui::Application::Instance->getDocument(PartDesignGui::ActiveAppDoc); -// PartDesignGui::ActiveVp = dynamic_cast (PartDesignGui::ActiveGuiDoc->getViewProvider(Item)); -// PartDesignGui::ActiveVp->show(); -// Item->IsActive.setValue(true); -// } else { -// // This handles the case of deactivating the workbench -// PartDesignGui::ActivePartObject=0; -// PartDesignGui::ActiveGuiDoc =0; -// PartDesignGui::ActiveAppDoc =0; -// PartDesignGui::ActiveVp =0; -// } -// -// Py_Return; -//} -// -//static PyObject * getActiveBody(PyObject *, PyObject *) -//{ -// if (PartDesignGui::ActivePartObject == NULL) { -// return Py::_None(); -// } -// -// return PartDesignGui::ActivePartObject->getPyObject(); -//} - -/* registration table */ -struct PyMethodDef Assembly_methods[] = { - //{"setActiveBody" ,setActiveBody ,METH_VARARGS, - // "setActiveBody(BodyObject) -- Set the PartBody object in work."}, - - //{"getActiveBody" ,getActiveBody ,METH_NOARGS, - // "getActiveBody() -- Get the PartBody object in work."}, - - {NULL, NULL} /* end of table marker */ -}; diff --git a/src/Mod/Assembly/App/CMakeLists.txt b/src/Mod/Assembly/App/CMakeLists.txt deleted file mode 100644 index f291823c92..0000000000 --- a/src/Mod/Assembly/App/CMakeLists.txt +++ /dev/null @@ -1,124 +0,0 @@ -if(MSVC) - add_definitions(-DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH) -else(MSVC) - add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H) -endif(MSVC) - -add_definitions(-DBOOST_${Boost_VERSION}) - -include_directories( - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_BINARY_DIR}/src - ${CMAKE_SOURCE_DIR}/src/Mod/Assembly/App - ${CMAKE_CURRENT_BINARY_DIR} - ${Boost_INCLUDE_DIRS} - ${OCC_INCLUDE_DIR} - ${PYTHON_INCLUDE_DIRS} - ${ZLIB_INCLUDE_DIR} - #${ODE_INCLUDE_DIRS} - ${EIGEN3_INCLUDE_DIR} - -) - -link_directories(${OCC_LIBRARY_DIR}) - -set(Assembly_LIBS - #${ODE_LIBRARIES} - ${OCC_LIBRARIES} - ${Boost_LIBRARIES} - ${Boost_LOG_LIBRARY_RELEASE} - Part - FreeCADApp -) - -generate_from_xml(ItemPy) -generate_from_xml(ProductRefPy) -#generate_from_xml(PartRefPy) -generate_from_xml(ConstraintPy) -generate_from_xml(ConstraintGroupPy) - -SET(Features_SRCS - Item.cpp - Item.h - #PartRef.cpp - #PartRef.h - Product.cpp - Product.h - ProductRef.cpp - ProductRef.h - Constraint.cpp - Constraint.h - ConstraintGroup.cpp - ConstraintGroup.h -) -SOURCE_GROUP("Features" FILES ${Features_SRCS}) - -SET(Module_SRCS - AppAssembly.cpp - AppAssemblyPy.cpp - PreCompiled.cpp - PreCompiled.h -) -SOURCE_GROUP("Module" FILES ${Module_SRCS}) - -#externalization is not possible for msvc as a stupid bug prevents the function definition resolving -if(MSVC) - set(Solver_SRC ) -else(MSVC) - set(Solver_SRC Solver/solver_3d_ext1.cpp - Solver/solver_3d_ext2.cpp - Solver/solver_3d_ext3.cpp - ) - - if(FREECAD_ASSEMBLY_DEBUG_FACILITIES) - set(Solver_SRC ${Solver_SRC} - Solver/solver_state_ext1.cpp - Solver/solver_state_ext2.cpp - ) - endif(FREECAD_ASSEMBLY_DEBUG_FACILITIES) -endif(MSVC) - -SOURCE_GROUP("Solver" FILES ${Solver_SRC}) - -SET(Python_SRCS - ItemPy.xml - ItemPyImp.cpp - ProductRefPy.xml - ProductRefPyImp.cpp - #PartRefPy.xml - #PartRefPyImp.cpp - ConstraintPy.xml - ConstraintPyImp.cpp - ConstraintGroupPy.xml - ConstraintGroupPyImp.cpp -) -SOURCE_GROUP("Python" FILES ${Python_SRCS}) - -SET(Assembly_SRCS - ${Features_SRCS} - ${Python_SRCS} - ${Module_SRCS} - ${Solver_SRC} -) - -SET(Assembly_Scripts - ../Init.py - ../AssemblyLib.py -) - -add_library(Assembly SHARED ${Assembly_SRCS} ${Assembly_Scripts}) -if(CMAKE_COMPILER_IS_GNUCXX) - set_target_properties(Assembly PROPERTIES COMPILE_FLAGS "-fext-numeric-literals") -endif() -target_link_libraries(Assembly ${Assembly_LIBS} ${log_LIB}) - - -fc_target_copy_resource_flat(Assembly - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR}/Mod/Assembly - ${Assembly_Scripts}) - -SET_BIN_DIR(Assembly Assembly /Mod/Assembly) -SET_PYTHON_PREFIX_SUFFIX(Assembly) - -INSTALL(TARGETS Assembly DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/Assembly/App/Constraint.cpp b/src/Mod/Assembly/App/Constraint.cpp deleted file mode 100644 index b851c105f8..0000000000 --- a/src/Mod/Assembly/App/Constraint.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * This file is part of the FreeCAD CAx development m_solvertem. * - * * - * 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_ -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "Constraint.h" -#include "ConstraintPy.h" -#include "Item.h" -#include "Product.h" - - -using namespace Assembly; - -namespace Assembly { - -struct ConstraintInitException : std::exception { - const char* what() const throw() { - return "Constraint cout not be initialised: unsoported geometry"; - } -}; -struct ConstraintPartException : std::exception { - const char* what() const throw() { - return "Constraint cout not be initialised: parts are invalid"; - } -}; -struct ConstraintLinkException : std::exception { - const char* what() const throw() { - return "Constraint cout not be initialised: unsoported link type"; - } -}; - -PROPERTY_SOURCE(Assembly::Constraint, App::DocumentObject) - -const char* Constraint::OrientationEnums[] = {"Parallel","Equal","Opposite","Perpendicular",NULL}; -const char* Constraint::TypeEnums[] = {"Fix","Distance","Orientation","Angle","Align","Coincident","None",NULL}; -const char* Constraint::SolutionSpaceEnums[] = {"Bidirectional","PositivDirectional","NegativeDirectional",NULL}; - -Constraint::Constraint() -{ - ADD_PROPERTY(First, (0)); - ADD_PROPERTY(Second,(0)); - ADD_PROPERTY(Value,(0)); - ADD_PROPERTY(Orientation, (long(0))); - Orientation.setEnums(OrientationEnums); - ADD_PROPERTY(Type, (long(6))); - Type.setEnums(TypeEnums); - ADD_PROPERTY(SolutionSpace, (long(0))); - SolutionSpace.setEnums(SolutionSpaceEnums); -} - -short Constraint::mustExecute() const -{ - //if (Sketch.isTouched() || - // Length.isTouched()) - // return 1; - return 0; -} - -App::DocumentObjectExecReturn* Constraint::execute(void) -{ - return App::DocumentObject::StdReturn; -} - - -PyObject* Constraint::getPyObject(void) -{ - if(PythonObject.is(Py::_None())) { - // ref counter is set to 1 - PythonObject = Py::Object(new ConstraintPy(this),true); - } - - return Py::new_reference_to(PythonObject); -} - - -} - - - diff --git a/src/Mod/Assembly/App/Constraint.h b/src/Mod/Assembly/App/Constraint.h deleted file mode 100644 index b40f9f8866..0000000000 --- a/src/Mod/Assembly/App/Constraint.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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 * - * * - ***************************************************************************/ - - -#ifndef Assembly_Constraint_H -#define Assembly_Constraint_H - -#include -#include - -#include - -#include "Solver/Solver.h" -#include "Product.h" - - -namespace Assembly -{ - -class AssemblyExport Constraint : public App::DocumentObject -{ - PROPERTY_HEADER(Assembly::Constraint); - -public: - Constraint(); - - App::PropertyLinkSub First; - App::PropertyLinkSub Second; - App::PropertyFloat Value; - App::PropertyEnumeration Orientation; - App::PropertyEnumeration SolutionSpace; - App::PropertyEnumeration Type; - - /** @name methods override feature */ - //@{ - /// recalculate the feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - /// returns the type name of the view provider - const char* getViewProviderName(void) const { - return "AssemblyGui::ViewProviderConstraint"; - } - PyObject *getPyObject(void); - -private: - static const char* OrientationEnums[]; - static const char* TypeEnums[]; - static const char* SolutionSpaceEnums[]; -}; - -} //namespace Assembly - - -#endif // Assembly_Constraint_H diff --git a/src/Mod/Assembly/App/ConstraintGroup.cpp b/src/Mod/Assembly/App/ConstraintGroup.cpp deleted file mode 100644 index fe9894a535..0000000000 --- a/src/Mod/Assembly/App/ConstraintGroup.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2010 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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_ -#endif - -#include -#include - -#include "ConstraintGroupPy.h" -#include "ConstraintGroup.h" -#include "Product.h" - - -using namespace Assembly; - -namespace Assembly { - - -PROPERTY_SOURCE(Assembly::ConstraintGroup, App::DocumentObject) - -ConstraintGroup::ConstraintGroup() -{ - ADD_PROPERTY(Constraints,(0)); -} - -PyObject *ConstraintGroup::getPyObject(void) -{ - if (PythonObject.is(Py::_None())){ - // ref counter is set to 1 - PythonObject = Py::Object(new ConstraintGroupPy(this),true); - } - return Py::new_reference_to(PythonObject); -} - - -short ConstraintGroup::mustExecute() const -{ - //if (Sketch.isTouched() || - // Length.isTouched()) - // return 1; - return 0; -} - -App::DocumentObjectExecReturn *ConstraintGroup::execute(void) -{ - - touch(); - return App::DocumentObject::StdReturn; -} - - - -} diff --git a/src/Mod/Assembly/App/ConstraintGroup.h b/src/Mod/Assembly/App/ConstraintGroup.h deleted file mode 100644 index 1fa281cd79..0000000000 --- a/src/Mod/Assembly/App/ConstraintGroup.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2010 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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 * - * * - ***************************************************************************/ - - -#ifndef Assembly_ConstraintGroup_H -#define Assembly_ConstraintGroup_H - -#include -#include -#include - -#include "Constraint.h" -#include "Solver/Solver.h" - -namespace Assembly -{ - -class AssemblyExport ConstraintGroup : public App::DocumentObject -{ - PROPERTY_HEADER(Assembly::ConstraintGroup); - -public: - ConstraintGroup(); - - PyObject *getPyObject(void); - - App::PropertyLinkList Constraints; - - /** @name methods override feature */ - //@{ - /// recalculate the feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - /// returns the type name of the view provider - const char* getViewProviderName(void) const { - return "AssemblyGui::ViewProviderConstraintGroup"; - } - //@} - -}; - -} //namespace Assembly - - -#endif // Assembly_ConstraintGroup_H diff --git a/src/Mod/Assembly/App/ConstraintGroupPy.xml b/src/Mod/Assembly/App/ConstraintGroupPy.xml deleted file mode 100644 index fbc07d2f82..0000000000 --- a/src/Mod/Assembly/App/ConstraintGroupPy.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Base class of all objects in Assembly - - - - - diff --git a/src/Mod/Assembly/App/ConstraintGroupPyImp.cpp b/src/Mod/Assembly/App/ConstraintGroupPyImp.cpp deleted file mode 100644 index 470390bc08..0000000000 --- a/src/Mod/Assembly/App/ConstraintGroupPyImp.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2010 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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" - -#include "Mod/Assembly/App/ConstraintGroup.h" -#include "Mod/Assembly/App/ConstraintPy.h" - -// inclusion of the generated files (generated out of ConstraintGroupPy.xml) -#include "ConstraintGroupPy.h" -#include "ConstraintGroupPy.cpp" - -using namespace Assembly; - -// returns a string which represents the object e.g. when printed in python -std::string ConstraintGroupPy::representation(void) const -{ - return std::string(""); -} - -PyObject *ConstraintGroupPy::getCustomAttributes(const char* /*attr*/) const -{ - return 0; -} - -int ConstraintGroupPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) -{ - return 0; -} - - diff --git a/src/Mod/Assembly/App/ConstraintPy.xml b/src/Mod/Assembly/App/ConstraintPy.xml deleted file mode 100644 index 4995027614..0000000000 --- a/src/Mod/Assembly/App/ConstraintPy.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Base class of all objects in Assembly - - - diff --git a/src/Mod/Assembly/App/ConstraintPyImp.cpp b/src/Mod/Assembly/App/ConstraintPyImp.cpp deleted file mode 100644 index 3c835334cd..0000000000 --- a/src/Mod/Assembly/App/ConstraintPyImp.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * This file is part of the FreeCAD CAx development m_solvertem. * - * * - * 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" - -#include "Mod/Assembly/App/Constraint.h" - -// inclusion of the generated files (generated out of ItemAssemblyPy.xml) -#include "ConstraintPy.h" -#include "ConstraintPy.cpp" - -using namespace Assembly; - -// returns a string which represents the object e.g. when printed in python -std::string ConstraintPy::representation(void) const -{ - return std::string(""); -} - - -PyObject *ConstraintPy::getCustomAttributes(const char* /*attr*/) const -{ - return 0; -} - -int ConstraintPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) -{ - return 0; -} - - diff --git a/src/Mod/Assembly/App/Item.cpp b/src/Mod/Assembly/App/Item.cpp deleted file mode 100644 index b9b743a6e1..0000000000 --- a/src/Mod/Assembly/App/Item.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2010 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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_ -#endif - -#include -#include -#include - -#include "Item.h" -#include "ItemPy.h" -#include - -using namespace Assembly; - -namespace Assembly { - - -PROPERTY_SOURCE_ABSTRACT(Assembly::Item, App::GeoFeature) - -Item::Item() -{ - ADD_PROPERTY_TYPE(Meta, (), 0, App::Prop_None, "Map with additional meta information"); - -} - -short Item::mustExecute() const -{ - //if (Sketch.isTouched() || - // Length.isTouched()) - // return 1; - return 0; -} - -App::DocumentObjectExecReturn *Item::execute(void) -{ - - Base::Console().Message("Recalculate Assembly::Item\n"); - return App::DocumentObject::StdReturn; -} - -PyObject *Item::getPyObject(void) -{ - if (PythonObject.is(Py::_None())){ - // ref counter is set to 1 - PythonObject = Py::Object(new ItemPy(this),true); - } - return Py::new_reference_to(PythonObject); -} - -} \ No newline at end of file diff --git a/src/Mod/Assembly/App/Item.h b/src/Mod/Assembly/App/Item.h deleted file mode 100644 index b85edd2bea..0000000000 --- a/src/Mod/Assembly/App/Item.h +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2010 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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 * - * * - ***************************************************************************/ - - -#ifndef Assembly_Item_H -#define Assembly_Item_H - -#include -#include -#include - -namespace Assembly -{ - -/// Base class of all Assembly objects -class AssemblyExport Item : public App::GeoFeature -{ - PROPERTY_HEADER(Assembly::Item); - -public: - Item(); - ~Item() {}; - - /// Meta descriptions - App::PropertyMap Meta; - - /** @name methods override feature */ - //@{ - /// recalculate the feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - /// returns the type name of the view provider - const char* getViewProviderName(void) const { - return "AssemblyGui::ViewProviderItem"; - } - //@} - - PyObject *getPyObject(void); - -}; - -} //namespace Assembly - - -#endif // ASSEMBLY_Item_H diff --git a/src/Mod/Assembly/App/ItemPy.xml b/src/Mod/Assembly/App/ItemPy.xml deleted file mode 100644 index d9bca2eea4..0000000000 --- a/src/Mod/Assembly/App/ItemPy.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Base class of all objects in Assembly - - - diff --git a/src/Mod/Assembly/App/ItemPyImp.cpp b/src/Mod/Assembly/App/ItemPyImp.cpp deleted file mode 100644 index bdab3e715c..0000000000 --- a/src/Mod/Assembly/App/ItemPyImp.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2010 Juergen Riegel * - * Copyright (c) 2013 Stefan Tröger * - * * - * 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" - -#include "Mod/Assembly/App/Item.h" - -// inclusion of the generated files (generated out of ItemPy.xml) -#include "ItemPy.h" -#include "ItemPy.cpp" - -using namespace Assembly; - -// returns a string which represents the object e.g. when printed in python -std::string ItemPy::representation(void) const -{ - return std::string(""); -} - - - - - - - -PyObject *ItemPy::getCustomAttributes(const char* /*attr*/) const -{ - return 0; -} - -int ItemPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) -{ - return 0; -} - - diff --git a/src/Mod/Assembly/App/PartRef.cpp b/src/Mod/Assembly/App/PartRef.cpp deleted file mode 100644 index a1199636fd..0000000000 --- a/src/Mod/Assembly/App/PartRef.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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_ -#endif - -#include -#include - -#include "PartRef.h" -#include "Product.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace Assembly; - -namespace Assembly { - -struct AssemblyItemException : std::exception { - const char* what() const throw() { return "Assembly items are in wrong structure";} -}; - - -PROPERTY_SOURCE(Assembly::PartRef, App::GeoFeature) - -PartRef::PartRef() { - ADD_PROPERTY(Model, (0)); - ADD_PROPERTY(Annotation,(0)); -} - -short PartRef::mustExecute() const { - //if (Sketch.isTouched() || - // Length.isTouched()) - // return 1; - return 0; -} - -App::DocumentObjectExecReturn* PartRef::execute(void) { - - this->touch(); - return App::DocumentObject::StdReturn; -} - -TopoDS_Shape PartRef::getShape(void) const { - App::DocumentObject* obj = Model.getValue(); - - if(obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { - return static_cast(obj)->Shape.getValue(); - } - - return TopoDS_Shape(); -} - -PyObject* PartRef::getPyObject(void) { - if(PythonObject.is(Py::_None())) { - // ref counter is set to 1 - PythonObject = Py::Object(new PartRefPy(this),true); - } - return Py::new_reference_to(PythonObject); -} - -bool PartRef::holdsObject(App::DocumentObject* obj) const { - - //get the body object and the relevant model list - Part::BodyBase* base = static_cast(Model.getValue()); - const std::vector& vector = base->Model.getValues(); - - //check if it holds the relevant document object - return std::find(vector.begin(), vector.end(), obj)!=vector.end(); -} - -void PartRef::setCalculatedPlacement(std::shared_ptr< Part3D > part) { - - //part is the same as m_part, so it doesn't matter which one we use - Base::Placement p = dcm::get(part); - - Product* ass = getParentAssembly(); - if(!ass) - throw AssemblyItemException(); - - if(ass->Rigid.getValue()) - Placement.setValue(p); - else - Placement.setValue(ass->m_downstream_placement.inverse()*p); -} - -Product* PartRef::getParentAssembly() { - - typedef std::vector::const_iterator iter; - - const std::vector& vector = getInList(); - for(iter it=vector.begin(); it != vector.end(); it++) { - - if((*it)->getTypeId() == Assembly::Product::getClassTypeId()) - return static_cast(*it); - }; - - return (Product*)NULL; -} - -void PartRef::ensureInitialisation() { - - Product* ass = getParentAssembly(); - if(!ass) - throw AssemblyItemException(); - - std::shared_ptr solver = ass->m_solver; - if(!solver) - throw AssemblyItemException(); - - if(!solver->hasPart(Uid.getValueStr())) { - - //if the assembly is not rigid it was not added to the solver, so we need to incorporate its placement - if(ass->Rigid.getValue()) { - m_part = solver->createPart(Placement.getValue(), Uid.getValueStr()); - } - else { - m_part = solver->createPart(ass->m_downstream_placement*Placement.getValue(), Uid.getValueStr()); - } - m_part->connectSignal(boost::bind(&PartRef::setCalculatedPlacement, this, _1)); - }; -} - - -std::shared_ptr< Geometry3D > PartRef::getGeometry3D(const char* Type) { - - //check if the item is initialized - if(!m_part) - return std::shared_ptr< Geometry3D >(); - - std::shared_ptr geometry; - if(m_part->hasGeometry3D(Type)) { - return m_part->getGeometry3D(Type); - } - else { - Part::TopoShape ts; - App::DocumentObject* obj = Model.getValue(); - - if(obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { - ts = static_cast(obj)->Shape.getShape(); - } - else - return std::shared_ptr< Geometry3D >(); - - TopoDS_Shape s = ts.getSubShape(Type); - if(s.ShapeType() == TopAbs_FACE) { - TopoDS_Face face = TopoDS::Face(s); - BRepAdaptor_Surface surface(face); - switch(surface.GetType()) { - case GeomAbs_Plane: { - gp_Pln plane = surface.Plane(); - if(face.Orientation()==TopAbs_REVERSED) { - gp_Dir dir = plane.Axis().Direction(); - plane = gp_Pln(plane.Location(), dir.Reversed()); - } - geometry = m_part->addGeometry3D(plane, Type, dcm::Local); - break; - } - case GeomAbs_Cylinder: { - gp_Cylinder cyl = surface.Cylinder(); - geometry = m_part->addGeometry3D(cyl, Type, dcm::Local); - break; - } - default: - Base::Console().Message("Unsupported Surface Geometry Type at selection\n"); - return std::shared_ptr< Geometry3D >(); - } - - } - else - if(s.ShapeType() == TopAbs_EDGE) { - TopoDS_Edge edge = TopoDS::Edge(s); - BRepAdaptor_Curve curve(edge); - switch(curve.GetType()) { - case GeomAbs_Line: { - gp_Lin line = curve.Line(); - geometry = m_part->addGeometry3D(line, Type, dcm::Local); - break; - } - default: - Base::Console().Message("Unsupported Curve Geometry Type at selection \n"); - return std::shared_ptr< Geometry3D >(); - } - - } - else - if(s.ShapeType() == TopAbs_VERTEX) { - TopoDS_Vertex v1 = TopoDS::Vertex(s); - gp_Pnt point = BRep_Tool::Pnt(v1); - geometry = m_part->addGeometry3D(point, Type, dcm::Local); - - } - else { - Base::Console().Message("Unsupported Topology Type at selection\n"); - return std::shared_ptr< Geometry3D >(); - } - }; - - return geometry; -} - -} diff --git a/src/Mod/Assembly/App/PartRef.h b/src/Mod/Assembly/App/PartRef.h deleted file mode 100644 index b9dacda3d4..0000000000 --- a/src/Mod/Assembly/App/PartRef.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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 * - * * - ***************************************************************************/ - - -#ifndef Assembly_ItemPart_H -#define Assembly_ItemPart_H - -#include -#include - -#include "Solver/Solver.h" - - -namespace Assembly -{ - -class Product; - -class AssemblyExport PartRef : public App::GeoFeature -{ - PROPERTY_HEADER(Assembly::PartRef); - -public: - PartRef(); - - App::PropertyLink Item; - //App::PropertyLinkList Annotation; - - /** @name methods override feature */ - //@{ - /// recalculate the feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - // returns the type name of the view provider - const char* getViewProviderName(void) const { - return "AssemblyGui::ViewProviderItemPart"; - } - PyObject *getPyObject(void); - //@} - - //virtual TopoDS_Shape getShape(void) const; - - bool holdsObject(App::DocumentObject* obj) const; - Product* getParentAssembly(); - void ensureInitialisation(); - - std::shared_ptr m_part; - virtual std::shared_ptr getGeometry3D(const char* Type ); - void setCalculatedPlacement( std::shared_ptr part ); -}; - -} //namespace Assembly - - -#endif // Assembly_ItemPart_H diff --git a/src/Mod/Assembly/App/PartRefPy.xml b/src/Mod/Assembly/App/PartRefPy.xml deleted file mode 100644 index 7b03125805..0000000000 --- a/src/Mod/Assembly/App/PartRefPy.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Base class of all objects in Assembly - - - diff --git a/src/Mod/Assembly/App/PartRefPyImp.cpp b/src/Mod/Assembly/App/PartRefPyImp.cpp deleted file mode 100644 index 75a5c63c0f..0000000000 --- a/src/Mod/Assembly/App/PartRefPyImp.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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" - -#include "Mod/Assembly/App/PartRef.h" - -// inclusion of the generated files (generated out of PartRefPy.xml) -#include "PartRefPy.h" -#include "PartRefPy.cpp" - -using namespace Assembly; - -// returns a string which represents the object e.g. when printed in python -std::string PartRefPy::representation(void) const -{ - return std::string(""); -} - - - - - - - -PyObject *PartRefPy::getCustomAttributes(const char* /*attr*/) const -{ - return 0; -} - -int PartRefPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) -{ - return 0; -} - - diff --git a/src/Mod/Assembly/App/PreCompiled.cpp b/src/Mod/Assembly/App/PreCompiled.cpp deleted file mode 100644 index 46269e9671..0000000000 --- a/src/Mod/Assembly/App/PreCompiled.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/*************************************************************************** - * 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" diff --git a/src/Mod/Assembly/App/PreCompiled.h b/src/Mod/Assembly/App/PreCompiled.h deleted file mode 100644 index b7c175278d..0000000000 --- a/src/Mod/Assembly/App/PreCompiled.h +++ /dev/null @@ -1,242 +0,0 @@ -/*************************************************************************** - * 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 * - * * - ***************************************************************************/ - - -#ifndef ASSEMBLY_PRECOMPILED_H -#define ASSEMBLY_PRECOMPILED_H - -#include - -// Exporting of App classes -#ifdef FC_OS_WIN32 -# define AssemblyExport __declspec(dllexport) -# define PartExport __declspec(dllimport) -# define MeshExport __declspec(dllimport) -#else // for Linux -# define AssemblyExport -# define PartExport -# define MeshExport -#endif - -#ifdef _PreComp_ - -// standard -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// OpenCasCade ===================================================================================== -// Base -#include -#include -#include -#include -#include -//#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -//#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// --- ODE ---------- -#include - - -#endif // _PreComp_ -#endif - diff --git a/src/Mod/Assembly/App/Product.cpp b/src/Mod/Assembly/App/Product.cpp deleted file mode 100644 index de988c57e1..0000000000 --- a/src/Mod/Assembly/App/Product.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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 -# include -#include -#endif - -#include -#include -#include - -#include "Product.h" -#include "ConstraintGroup.h" - - -using namespace Assembly; - -namespace Assembly { - - -PROPERTY_SOURCE(Assembly::Product, Assembly::Item) - -Product::Product() { - ADD_PROPERTY(Items,(0)); - ADD_PROPERTY_TYPE(Material,(),0,App::Prop_None,"Map with material properties"); - // create the uuid for the document - Base::Uuid id; - ADD_PROPERTY_TYPE(Id,(""),0,App::Prop_None,"ID (Part-Number) of the Item"); - ADD_PROPERTY_TYPE(Uid,(id),0,App::Prop_None,"UUID of the Item"); - - // license stuff - ADD_PROPERTY_TYPE(License,("CC BY 3.0"),0,App::Prop_None,"License string of the Item"); - ADD_PROPERTY_TYPE(LicenseURL,("http://creativecommons.org/licenses/by/3.0/"),0,App::Prop_None,"URL to the license text/contract"); - // color and appearance - ADD_PROPERTY(Color,(1.0,1.0,1.0,1.0)); // set transparent -> not used - ADD_PROPERTY(Visibility,(true)); - -} - -short Product::mustExecute() const { - return 0; -} - -App::DocumentObjectExecReturn* Product::execute(void) { - - Base::Console().Message("Execute\n"); - - return App::DocumentObject::StdReturn; -} - - -//PyObject* Product::getPyObject(void) { -// if(PythonObject.is(Py::_None())) { -// // ref counter is set to 1 -// PythonObject = Py::Object(new ProductPy(this),true); -// } -// -// return Py::new_reference_to(PythonObject); -//} - - - -} //assembly - - - diff --git a/src/Mod/Assembly/App/Product.h b/src/Mod/Assembly/App/Product.h deleted file mode 100644 index 4c0068a446..0000000000 --- a/src/Mod/Assembly/App/Product.h +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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 * - * * - ***************************************************************************/ - - -#ifndef ItemAssembly_ItemAssembly_H -#define ItemAssembly_ItemAssembly_H - -#include - -#include "Item.h" -#include "Solver/Solver.h" - -namespace Assembly -{ - - -class AssemblyExport Product : public Assembly::Item -{ - PROPERTY_HEADER(Assembly::Product); - -public: - Product(); - - /// Items of the Product - App::PropertyLinkList Items; - - /** @name base properties of all Assembly Items - * This properties correspond mostly to the meta information - * in the App::Document class - */ - //@{ - /// Id e.g. Part number - App::PropertyString Id; - /// unique identifier of the Item - App::PropertyUUID Uid; - /// material descriptions - App::PropertyMap Material; - - /** License string - * Holds the short license string for the Item, e.g. CC-BY - * for the Creative Commons license suit. - */ - App::PropertyString License; - /// License description/contract URL - App::PropertyString LicenseURL; - //@} - - /** @name Visual properties */ - //@{ - /** Base color of the Item - If the transparency value is 1.0 - the color or the next hierarchy is used - */ - App::PropertyColor Color; - /// Visibility - App::PropertyBool Visibility; - //@} - - - /** @name methods override feature */ - //@{ - /// recalculate the feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - /// returns the type name of the view provider - const char* getViewProviderName(void) const { - return "AssemblyGui::ViewProviderProduct"; - } - //PyObject *getPyObject(void); - //@} - -}; - -} //namespace Assembly - - -#endif // Assembly_ItemAssembly_H diff --git a/src/Mod/Assembly/App/ProductRef.cpp b/src/Mod/Assembly/App/ProductRef.cpp deleted file mode 100644 index e4b7b85a93..0000000000 --- a/src/Mod/Assembly/App/ProductRef.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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 -# include -#include -#endif - -#include -#include -#include - -#include "ProductRef.h" -#include "ConstraintGroup.h" -#include "ProductRefPy.h" - -using namespace Assembly; - -namespace Assembly { - - -PROPERTY_SOURCE(Assembly::ProductRef, Assembly::Item) - -ProductRef::ProductRef() { - ADD_PROPERTY(Item,(0)); -} - -short ProductRef::mustExecute() const { - return 0; -} - -App::DocumentObjectExecReturn* ProductRef::execute(void) -{ - return App::DocumentObject::StdReturn; -} - -PyObject* ProductRef::getPyObject(void) { - if(PythonObject.is(Py::_None())) { - // ref counter is set to 1 - PythonObject = Py::Object(new ProductRefPy(this),true); - } - - return Py::new_reference_to(PythonObject); -} - - -} //assembly - - - diff --git a/src/Mod/Assembly/App/ProductRef.h b/src/Mod/Assembly/App/ProductRef.h deleted file mode 100644 index 10665bcd9d..0000000000 --- a/src/Mod/Assembly/App/ProductRef.h +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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 * - * * - ***************************************************************************/ - - -#ifndef ProductRef_ProductRef_H -#define ProductRef_ProductRef_H - -#include - -#include "Item.h" -#include "Solver/Solver.h" - -namespace Assembly -{ - - - -class AssemblyExport ProductRef : public Assembly::Item -{ - PROPERTY_HEADER(Assembly::ProductRef); - -public: - ProductRef(); - - /// The one and only GeomtricObject referenced - App::PropertyLink Item; - - /** @name methods override feature */ - //@{ - /// recalculate the feature - App::DocumentObjectExecReturn *execute(void); - short mustExecute() const; - /// returns the type name of the view provider - const char* getViewProviderName(void) const { - return "AssemblyGui::ViewProviderProductRef"; - } - PyObject *getPyObject(void); - //@} - -}; - -} //namespace Assembly - - -#endif // Assembly_ProductRef_H diff --git a/src/Mod/Assembly/App/ProductRefPy.xml b/src/Mod/Assembly/App/ProductRefPy.xml deleted file mode 100644 index ba3bb3d8f6..0000000000 --- a/src/Mod/Assembly/App/ProductRefPy.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Base class of all objects in Assembly - - - diff --git a/src/Mod/Assembly/App/ProductRefPyImp.cpp b/src/Mod/Assembly/App/ProductRefPyImp.cpp deleted file mode 100644 index 65db8ce713..0000000000 --- a/src/Mod/Assembly/App/ProductRefPyImp.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2012 Juergen Riegel * - * * - * 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" - -#include "Mod/Assembly/App/ProductRef.h" - -// inclusion of the generated files (generated out of ProductRefPy.xml) -#include "ProductRefPy.h" -#include "ProductRefPy.cpp" - -using namespace Assembly; - -// returns a string which represents the object e.g. when printed in python -std::string ProductRefPy::representation(void) const -{ - return std::string(""); -} - - -PyObject *ProductRefPy::getCustomAttributes(const char* /*attr*/) const -{ - return 0; -} - -int ProductRefPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) -{ - return 0; -} diff --git a/src/Mod/Assembly/App/Solver/Solver.h b/src/Mod/Assembly/App/Solver/Solver.h deleted file mode 100644 index 4a8137ff93..0000000000 --- a/src/Mod/Assembly/App/Solver/Solver.h +++ /dev/null @@ -1,412 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2013 Stefan Tröger * - * * - * 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 * - * * - ***************************************************************************/ - -#ifndef SOLVER_H -#define SOLVER_H - -#include "opendcm/core.hpp" - -#ifdef ASSEMBLY_DEBUG_FACILITIES -#include "opendcm/modulestate.hpp" -#endif -#include "opendcm/module3d.hpp" -#include "opendcm/modulepart.hpp" - -#include -#include - -#include -#include -#include -#include - -struct gp_pnt_accessor { - - template - Scalar get(T& t) { - switch(ID) { - case 0: - return t.X(); - - case 1: - return t.Y(); - - case 2: - return t.Z(); - - default: - return 0; - }; - }; - template - void set(Scalar value, T& t) { - switch(ID) { - case 0: - t.SetX(value); - break; - - case 1: - t.SetY(value); - break; - - case 2: - t.SetZ(value); - break; - }; - }; - template - void finalize(T& t) {}; -}; - -struct gp_lin_accessor { - - gp_Pnt pnt; - double dx,dy,dz; - - template - Scalar get(T& t) { - switch(ID) { - case 0: - return t.Location().X(); - - case 1: - return t.Location().Y(); - - case 2: - return t.Location().Z(); - - case 3: - return t.Direction().X(); - - case 4: - return t.Direction().Y(); - - case 5: - return t.Direction().Z(); - - default: - return 0; - }; - }; - template - void set(Scalar value, T& t) { - - switch(ID) { - case 0: - pnt.SetX(value); - break; - - case 1: - pnt.SetY(value); - break; - - case 2: - pnt.SetZ(value); - break; - - case 3: - dx=(value); - break; - - case 4: - dy=(value); - break; - - case 5: - dz=(value); - break; - }; - }; - template - void finalize(T& t) { - t.SetLocation(pnt); - t.SetDirection(gp_Dir(dx,dy,dz)); - }; -}; - -struct gp_pln_accessor { - - gp_Pnt pnt; - double dx,dy,dz; - - template - Scalar get(T& t) { - switch(ID) { - case 0: - return t.Axis().Location().X(); - - case 1: - return t.Axis().Location().Y(); - - case 2: - return t.Axis().Location().Z(); - - case 3: - return t.Axis().Direction().X(); - - case 4: - return t.Axis().Direction().Y(); - - case 5: - return t.Axis().Direction().Z(); - - default: - return 0; - }; - }; - template - void set(Scalar value, T& t) { - switch(ID) { - case 0: - pnt.SetX(value); - break; - - case 1: - pnt.SetY(value); - break; - - case 2: - pnt.SetZ(value); - break; - - case 3: - dx=value; - break; - - case 4: - dy=value; - break; - - case 5: - dz=value; - break; - }; - }; - template - void finalize(T& t) { - t.SetAxis(gp_Ax1(pnt,gp_Dir(dx,dy,dz))); - }; -}; - -struct gp_cylinder_accessor { - - gp_Pnt pnt; - double dx,dy,dz; - - template - Scalar get(T& t) { - switch(ID) { - case 0: - return t.Axis().Location().X(); - - case 1: - return t.Axis().Location().Y(); - - case 2: - return t.Axis().Location().Z(); - - case 3: - return t.Axis().Direction().X(); - - case 4: - return t.Axis().Direction().Y(); - - case 5: - return t.Axis().Direction().Z(); - - case 6: - return t.Radius(); - - default: - return 0; - }; - }; - template - void set(Scalar value, T& t) { - - switch(ID) { - case 0: - pnt.SetX(value); - break; - - case 1: - pnt.SetY(value); - break; - - case 2: - pnt.SetZ(value); - break; - - case 3: - dx=value; - break; - - case 4: - dy=value; - break; - - case 5: - dz=value; - break; - - case 6: - t.SetRadius(value); - break; - }; - - }; - - template - void finalize(T& t) { - t.SetAxis(gp_Ax1(pnt,gp_Dir(dx,dy,dz))); - }; -}; - -struct placement_accessor { - - double q0, q1, q2, q3; - Base::Vector3d vec; - - template - Scalar get(T& t) { - t.getRotation().getValue(q0,q1,q2,q3); - - switch(ID) { - case 0: - return q3; - - case 1: - return q0; - - case 2: - return q1; - - case 3: - return q2; - - case 4: - return t.getPosition()[0]; - - case 5: - return t.getPosition()[1]; - - case 6: - return t.getPosition()[2]; - - default: - return 0; - }; - }; - template - void set(Scalar value, T& t) { - switch(ID) { - case 0: - q3 = value; - break; - - case 1: - q0 = value; - break; - - case 2: - q1 = value; - break; - - case 3: - q2 = value; - break; - - case 4: - vec[0] = value; - break; - - case 5: - vec[1] = value; - break; - - case 6: - vec[2] = value; - break; - }; - }; - - template - void finalize(T& t) { - //need to do it at once as setting every value step by step would always normalize the rotation and - //therefore give a false value - Base::Rotation rot(q0,q1,q2,q3); - t.setRotation(rot); - t.setPosition(vec); - }; -}; - -//geometry_traits for opencascade -namespace dcm { -template<> -struct geometry_traits { - typedef tag::point3D tag; - typedef modell::XYZ modell; - typedef gp_pnt_accessor accessor; -}; -template<> -struct geometry_traits { - typedef tag::line3D tag; - typedef modell::XYZ2 modell; - typedef gp_lin_accessor accessor; -}; -template<> -struct geometry_traits { - typedef tag::plane3D tag; - typedef modell::XYZ2 modell; - typedef gp_pln_accessor accessor; -}; -template<> -struct geometry_traits { - typedef tag::cylinder3D tag; - typedef modell::XYZ2P modell; - typedef gp_cylinder_accessor accessor; -}; -template<> -struct geometry_traits { - typedef tag::part tag; - typedef modell::quaternion_wxyz_vec3 modell; - typedef placement_accessor accessor; -}; -} - -//our constraint solving system -typedef dcm::Kernel Kernel; -typedef dcm::Module3D< mpl::vector4< gp_Pnt, gp_Lin, gp_Pln, gp_Cylinder>, std::string > Module3D; -typedef dcm::ModulePart< mpl::vector1< Base::Placement >, std::string > ModulePart; - -#ifdef ASSEMBLY_DEBUG_FACILITIES -typedef dcm::System Solver; -#else -typedef dcm::System Solver; -#endif - -typedef ModulePart::type::Part Part3D; -typedef Module3D::type::Geometry3D Geometry3D; -typedef Module3D::type::Constraint3D Constraint3D; - - -#endif //SOLVER_H diff --git a/src/Mod/Assembly/App/Solver/solver_3d_ext1.cpp b/src/Mod/Assembly/App/Solver/solver_3d_ext1.cpp deleted file mode 100644 index abc4ca4969..0000000000 --- a/src/Mod/Assembly/App/Solver/solver_3d_ext1.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2013 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "Solver.h" - -#ifdef DCM_EXTERNAL_CORE -#include DCM_EXTERNAL_CORE_INCLUDE_01 -DCM_EXTERNAL_CORE_01( Solver ) -#endif - -#ifdef DCM_EXTERNAL_3D -#include DCM_EXTERNAL_3D_INCLUDE_01 -DCM_EXTERNAL_3D_01( Solver ) -#endif diff --git a/src/Mod/Assembly/App/Solver/solver_3d_ext2.cpp b/src/Mod/Assembly/App/Solver/solver_3d_ext2.cpp deleted file mode 100644 index 1267d1e78c..0000000000 --- a/src/Mod/Assembly/App/Solver/solver_3d_ext2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2013 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "Solver.h" - -#ifdef DCM_EXTERNAL_3D -#include DCM_EXTERNAL_3D_INCLUDE_02 -DCM_EXTERNAL_3D_02(Solver) -#endif diff --git a/src/Mod/Assembly/App/Solver/solver_3d_ext3.cpp b/src/Mod/Assembly/App/Solver/solver_3d_ext3.cpp deleted file mode 100644 index 80f73acc71..0000000000 --- a/src/Mod/Assembly/App/Solver/solver_3d_ext3.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2013 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "Solver.h" - -#ifdef DCM_EXTERNAL_3D -#include DCM_EXTERNAL_3D_INCLUDE_03 -DCM_EXTERNAL_3D_03(Solver) -#endif \ No newline at end of file diff --git a/src/Mod/Assembly/App/Solver/solver_state_ext1.cpp b/src/Mod/Assembly/App/Solver/solver_state_ext1.cpp deleted file mode 100644 index e1f6d0e861..0000000000 --- a/src/Mod/Assembly/App/Solver/solver_state_ext1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2013 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "Solver.h" - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_001 -DCM_EXTERNAL_STATE_001( Solver ) -#endif - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_002 -DCM_EXTERNAL_STATE_002( Solver ) -#endif - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_003 -DCM_EXTERNAL_STATE_003( Solver ) - -#include DCM_EXTERNAL_STATE_INCLUDE_009 -DCM_EXTERNAL_STATE_009( Solver ) -#endif - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_004 -DCM_EXTERNAL_STATE_004( Solver ) -#endif - diff --git a/src/Mod/Assembly/App/Solver/solver_state_ext2.cpp b/src/Mod/Assembly/App/Solver/solver_state_ext2.cpp deleted file mode 100644 index fec3b13c63..0000000000 --- a/src/Mod/Assembly/App/Solver/solver_state_ext2.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2013 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "Solver.h" - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_005 -DCM_EXTERNAL_STATE_005( Solver ) -#endif - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_006 -DCM_EXTERNAL_STATE_006( Solver ) -#endif - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_007 -DCM_EXTERNAL_STATE_007( Solver ) -#endif - -#ifdef DCM_EXTERNAL_STATE -#include DCM_EXTERNAL_STATE_INCLUDE_008 -DCM_EXTERNAL_STATE_008( Solver ) -#endif \ No newline at end of file diff --git a/src/Mod/Assembly/App/opendcm/.kdev_include_paths b/src/Mod/Assembly/App/opendcm/.kdev_include_paths deleted file mode 100644 index a973905722..0000000000 --- a/src/Mod/Assembly/App/opendcm/.kdev_include_paths +++ /dev/null @@ -1,3 +0,0 @@ -/usr/include/eigen3 -/home/stefan/Projects/openDCM/opendcm/ -/home/stefan/Projects/openDCM/ diff --git a/src/Mod/Assembly/App/opendcm/core.hpp b/src/Mod/Assembly/App/opendcm/core.hpp deleted file mode 100644 index efffb69835..0000000000 --- a/src/Mod/Assembly/App/opendcm/core.hpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2012 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef DCM_CORE_H -#define DCM_CORE_H - -#ifdef _WIN32 - //warning about excessively long decorated names, won't affect the code correctness - #pragma warning( disable : 4503 ) - //warning about changed pod initialising behaviour (boost blank in variant) - #pragma warning( disable : 4345 ) - //warning about multiple assignment operators in Equation - #pragma warning( disable : 4522 ) - - //disable boost concept checks, as some of them have alignment problems which bring msvc to an error - //(for example DFSvisitor check in boost::graph::depht_first_search) - //this has no runtime effect as these are only compile time checks - #include - #undef BOOST_CONCEPT_ASSERT - #define BOOST_CONCEPT_ASSERT(Model) - #include - -#endif - -#include "core/defines.hpp" -#include "core/geometry.hpp" -#include "core/kernel.hpp" -#include "core/system.hpp" - - -#ifdef DCM_EXTERNAL_CORE - -#define DCM_EXTERNAL_CORE_INCLUDE_01 "opendcm/core/imp/system_imp.hpp" -#define DCM_EXTERNAL_CORE_01( Sys )\ - template class dcm::System; \ - template struct dcm::Equation, 1>; \ - template struct dcm::Equation; \ - template struct dcm::Equation, 3, dcm::rotation>; - -#endif //external - -#endif //DCM_CORE_H - diff --git a/src/Mod/Assembly/App/opendcm/core/clustergraph.hpp b/src/Mod/Assembly/App/opendcm/core/clustergraph.hpp deleted file mode 100644 index 55e2c32b48..0000000000 --- a/src/Mod/Assembly/App/opendcm/core/clustergraph.hpp +++ /dev/null @@ -1,1093 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2012 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef CLUSTERGRAPH_HPP -#define CLUSTERGRAPH_HPP - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include "property.hpp" - -#include - -namespace mpl = boost::mpl; -namespace fusion = boost::fusion; - -namespace dcm { - -/** @addtogroup Core - * @{ - * */ - -/** @addtogroup ClusterGraph - * @{*/ - -namespace details { - -/** @addtogroup Metafunctions - * @{*/ - -/** - * @brief Creates a fusion::vector of boost shared_ptr's from the given types - * - * Creates a shared pointer sequence (sps) of the supplied types by converting them to - * std::shared_ptr's first and creating a fusion::vector of all pointers afterwards which can be - * accessed by the type typedef. Usage: @code sps::type @endcode - * - * @tparam seq the mpl::sequence with the types to convert to shared_ptr's - **/ -template -struct sps { //shared_ptr sequence - typedef typename mpl::transform >::type spv; - typedef typename fusion::result_of::as_vector::type type; -}; -/**@}*/ - -//Define vertex and edge properties which are always added for use in the boost graph library algorithms -//which are used in the ClusterGraph implementation -typedef mpl::vector1 bgl_v_props; -typedef mpl::vector1 bgl_e_props; - -typedef boost::adjacency_list_traits list_traits; - - -/** - * @brief A type to be used as identifier for vertices and edges - * - * Vertices and edges need to be identified in a stable(safe/load), unique(over multiple clusters) and - * comparable manner. The bgl vertex and edge descriptors don't fulfill this need as they have a direct - * relation to the graphs storage. Therefore they change value on moving entities to different clusters or - * clone actions. This class is used to overcome this problem. - **/ -typedef int universalID; - -/** - * @brief Generator for unique identifiers - * - * The universalID used to identify vertices and edges globaly need to be unique and therefore can't be - * created at good will. This generator creates universalID's in a incremental manner and is intended to - * to be shared between all graphs of a system, so that all created ID's are unique. - **/ -struct IDgen { - universalID* counter; - - IDgen() { - counter = new universalID(10); - }; - IDgen(universalID id) { - counter = new universalID(id); - }; - ~IDgen() { - delete counter; - }; - /** - * @brief Generates a new unique ID - * - * @return :details::universalID - **/ - universalID generate() { - return ++ (*counter); - }; - /** - * @brief Returns the amount if generated ID's - * - * As universalID's are integers the returned count is a ID and can therefore also be used as the last - * created ID. - * - * @return :details::universalID - **/ - universalID count() { - return (*counter); - }; - /** - * @brief Set the current value for incremental creation - * - * ID's are created incrementally and if a specific startingpoint is wished, it can be set here by - * supplying the last created ID or the amount of totally created ID's - * - * @param id The last created ID - * @return void - **/ - void setCount(universalID id) { - *counter = id; - }; -}; - -/** - * @brief Exception thrown from the graph at any occurring error - **/ -struct cluster_error : virtual boost::exception {}; - -/** - * @brief Pointer type to share a common ID generator @ref IDgen - **/ -typedef std::shared_ptr IDpointer; - -} - -/** @name Descriptors */ -/**@{ - * @brief Identifier for local vertices - * - * The boost graph library works with identifiers for vertices which directly relate to there storage. - * Therefore they can be used only in the relevant cluster, they are local. These are the descriptors - * which need to be used for all bgl algorithms. - **/ -typedef details::list_traits::vertex_descriptor LocalVertex; - -/** - * @brief Identifier for local edge - * - * The boost graph library works with identifiers for edges which directly relate to there storage. - * Therefore they can be used only in the relevant cluster, they are local. These are the descriptors - * which need to be used for all bgl algorithms. - **/ -typedef details::list_traits::edge_descriptor LocalEdge; - -/** - * @brief Identifier for global vertex - * - * To overcome the locality of the bgl vertex descriptors a global alternative is introduced. This descriptor - * is unique over clusters and stable on moves and clones. - **/ -typedef details::universalID GlobalVertex; - -/** - * @brief Identifier for global edge - * - * To overcome the locality of the bgl edge descriptors a global alternative is introduced. This descriptor - * is unique over clusters and stable on moves and clones. It holds its source and target also as global - * descriptors of type GlobalVertex and has a unique ID in form of a universalID assigned. - **/ -struct GlobalEdge { - GlobalVertex source; - GlobalVertex target; - details::universalID ID; - - bool operator== (const GlobalEdge& second) const { - return ID == second.ID; - }; - bool operator!= (const GlobalEdge& second) const { - return ID != second.ID; - }; - bool valid() { - return ID > 9; - }; -}; -/**@}*/ - - -/** - * @brief A graph that can be stacked in a tree-like manner without losing it connections - * - * This is basically a boost adjacency_list with single linked lists 'listS' as storage for vertices and - * edges. The edges are undirected. This allows to use all boost graph algorithms and provides therefore - * an comprehensive way for analysing and manipulating its content. It further extends the class with the - * possibility to cluster its content and to add properties and objects to all entities. For more - * information, see the module ClusterGraph - * - * @tparam edge_prop a mpl::vector with properties which are added to local edges - * @tparam vertex_prop a mpl::vector with properties which are added to vertices - * @tparam cluster_prop a mpl::vector with properties which are added to all clusters - * @tparam objects a mpl::vector with all object types which shall be stored at vertices and edges - **/ -template< typename edge_prop, typename vertex_prop, typename cluster_prop, typename objects> -class ClusterGraph : public boost::adjacency_list < boost::listS, boost::listS, - boost::undirectedS, - fusion::vector < GlobalVertex, - typename details::pts< typename details::ensure_properties::type >::type, - typename details::sps::type > , - fusion::vector < typename details::pts< typename details::ensure_properties::type >::type, - std::vector< fusion::vector< typename details::sps::type, GlobalEdge > > > > , -public PropertyOwner::type>, -public boost::noncopyable, - public boost::enable_shared_from_this > { - -public: - /** - * @brief mpl::vector with all edge properties - * - * The edge properties supplied as template argument to the ClusterGraph are extended with graph - * specific properties, for example a edge_index_prop. These extra properties are intended to be - * used with boost graph algorithms as property maps. They need to be in specified by the ClusterGraph - * as they are used within its implementation. If the graph specific properties are already a part - * of the given property sequence, nothing happens, they are not added twice. - **/ - typedef typename details::ensure_properties::type edge_properties; - /** - * @brief mpl::vector with all vertex properties - * - * The vertex properties supplied as template argument to the ClusterGraph are extended with graph - * specific properties as vertex_index_prop. These extra properties are intended to be - * used with boost graph algorithms as property maps. They need to be in specified by the ClusterGraph - * as they are used within its implementation.If the graph specific properties are already a part - * of the given property sequence, nothing happens, they are not added twice. - **/ - typedef typename details::ensure_properties::type vertex_properties; - - /** - * @brief The property bundle for GlobalEdges - * - * A local edge in a cluster can hold multiple global ones. Therefore we need an extra bundle for - * the GlobalEdges. This bundle holds the objects which are added to that global edge and its identifier. - * Note that global edges don't have properties, these are only for local ones. - **/ - typedef fusion::vector< typename details::sps::type, GlobalEdge > edge_bundle_single; - /** - * @brief The property bundle for local edges - * - * Local edges can hold multiple global ones, we therefore need a std::vector of global edges. As - * they are fully described by a edge_bundle_single we store those. Also local edges can have properties, - * so store a fusion sequence of them too. - **/ - typedef fusion::vector< typename details::pts::type, std::vector< edge_bundle_single > > edge_bundle; - /** - * @brief Iterator to access all edge_bundle_single stored in a edge_bundle - **/ - typedef typename std::vector< edge_bundle_single >::iterator edge_single_iterator; - /** - * @brief Property bundle for local vertices - * - * This bundle is simpler than the edge one, as every vertex has on single bundle. We therefore - * store the global descriptor for identification, the fusion sequence with the properties and - * the objects all in one bundle. - **/ - typedef fusion::vector < GlobalVertex, typename details::pts::type, - typename details::sps::type > vertex_bundle; - - /** - * @brief The adjacency_list type ClusterGraph inherited from - **/ - typedef boost::adjacency_list < boost::listS, boost::listS, - boost::undirectedS, vertex_bundle, edge_bundle > Graph; - - typedef boost::enable_shared_from_this > sp_base; - - //if changed_prop is not a property we have to add it now - typedef typename details::ensure_property::type cluster_properties; - - typedef typename boost::graph_traits::vertex_iterator local_vertex_iterator; - typedef typename boost::graph_traits::edge_iterator local_edge_iterator; - typedef typename boost::graph_traits::out_edge_iterator local_out_edge_iterator; - - typedef std::map > ClusterMap; - - - struct global_extractor { - typedef GlobalEdge& result_type; - template - result_type operator()(T& bundle) const; - }; - - struct global_vertex_extractor { - typedef GlobalVertex result_type; - ClusterGraph& graph; - global_vertex_extractor(ClusterGraph& g); - result_type operator()(LocalVertex& v) const; - }; - - template - struct object_extractor { - - typedef std::shared_ptr base_type; - typedef base_type& result_type; - typedef typename mpl::find::type iterator; - typedef typename mpl::distance::type, iterator>::type distance; - BOOST_MPL_ASSERT((mpl::not_::type > >)); - - result_type operator()(vertex_bundle& bundle) const; - result_type operator()(edge_bundle_single& bundle) const; - }; - - //iterators - /** - * @brief Iterator for global edge descriptors \ref GlobalEdge - **/ - typedef boost::transform_iterator global_edge_iterator; - - /** - * @brief Iterator for global vertex descriptor \ref GlobalVertex - **/ - typedef boost::transform_iterator global_vertex_iterator; - - /** - * @brief Iterator for objects of given type - * - * Allows to iterate over all objects of given type, dereferencing gives the std::shared_ptr - * - * @tparam Obj the object type to iterate over - **/ - template - struct object_iterator : public boost::transform_iterator, edge_single_iterator> { - object_iterator(edge_single_iterator it, object_extractor f) - : boost::transform_iterator, edge_single_iterator> (it, f) {}; - }; - - /** - * @brief Iterator for clusters - * - * Allows to iterate over all subclusters. - **/ - typedef typename ClusterMap::iterator cluster_iterator; - /** - * @brief Const equivalent to \ref cluster_iterator - **/ - typedef typename ClusterMap::const_iterator const_cluster_iterator; - - /** - * @brief Basic constructor - * - * This constructor creates a empty cluster with a new ID generator. This is to be used on initial - * clustergraph creation, so only for the very first cluster. - **/ - ClusterGraph() : m_id(new details::IDgen) {}; - - /** - * @brief Dependent constructor - * - * This constructor creates a new cluster, but uses the given cluster as parent. It will therefore - * create a tree-like relationship. Be aware, that the new cluster is not added to the parents - * subcluster list, that has to be done manually. The new cluster shares the parents ID generator. - * - * @param g the parent cluster graph - **/ - ClusterGraph(std::shared_ptr g) : m_parent(g), m_id(new details::IDgen) { - if(g) - m_id = g->m_id; - }; - - ~ClusterGraph() {}; - - /** - * @brief Copies the Clustergraph into a new one - * - * Copies this cluster and all subclusters into the given one, which is cleared before copying. Be - * aware that all objects and properties are only copied, and as some are shared pointers (namely - * all objects) you may have to clone them. If needed this can be done with the supplied functor, - * which receives all copied objects to its function operator which returns the new object. - * @param into The Graph that should be a copy of this - * @param functor The function objects which gets the graph objects and returns the ones for the - * copied graph - */ - template - void copyInto(std::shared_ptr into, Functor& functor) const; - - /** - * @brief Compare by address, not by content - * @param other the cluster to compare with - * @return bool if this is the same cluster in memory - **/ - template - bool operator== (const T& other) const; - - /** - * @brief Compare by address, not by content - * @param other the cluster to compare with - * @return bool if this is the not same cluster in memory - **/ - template - bool operator!= (const T& other) const; - - /** - * @brief Set different behaviour for changed markers - * - * Some methods of the ClusterGraph set its changed_prop to true. That's sensible, as they change - * the graph. However, there are situations where you want to use the methods but don't want the change - * marked. For example recreations while cloning. This method can be used to disable the changed setting. - * @param on Turn change markers on or off - * @return void - **/ - void setCopyMode(bool on); - - //Make sure the compiler finds the base class setters even with equal named functions in this class - using PropertyOwner::getProperty; - using PropertyOwner::setProperty; - - /** - * @brief Set the property of a owned cluster - * - * Makes it easy to set a property of a subcluster without retrieving it first - * - * @tparam P the property type which shall be set - * @param v the local vertex which describes the subcluster - **/ - template - typename P::type& getSubclusterProperty(LocalVertex v); - - /** - * @brief Mark if the cluster was changed - * - * @return void - **/ - void setChanged(); - - - /* ******************************************************* - * Subclustering - * *******************************************************/ - - /** - * @brief Creates a new subcluster - * - * As clusters can be stacked in a tree-like manner, this function can be used to create new - * children. It automatically adds it to the subcluster list and adds it to the graph. The new - * subcluster is fully defined by its object and the vertex descriptor which is its position - * in the current cluster. - * - * @return :pair< std::shared_ptr< ClusterGraph >, LocalVertex > Subcluster and its descriptor - **/ - std::pair, LocalVertex> createCluster(); - - /** - * @brief Returns the parent cluster - * - * In the stacked cluster hierarchy, most clusters have a parent which can be accessed with this function. - * However, the toplevel cluster doesn't have a parent and an empty shared_ptr is returned. - * - * @return :shared_ptr< ClusterGraph > the parent cluster or empty pointer - **/ - std::shared_ptr parent(); - - /** - * @brief const version of \ref parent() - * - * @return :shared_ptr< ClusterGraph > - **/ - const std::shared_ptr parent() const; - - /** - * @brief Is this the toplevel cluster? - * - * @return bool if it is - **/ - bool isRoot() const; - - /** - * @brief Returns the toplevel cluster - * - * @return :shared_ptr< ClusterGraph > - **/ - std::shared_ptr root(); - - /** - * @brief const equivalent of \ref root() - * - * @return :shared_ptr< ClusterGraph > - **/ - const std::shared_ptr root() const; - - /** - * @brief Iterators for all subclusters - * - * A pair with two \ref cluster_iterator is returned which point to the first cluster and - * to one after the last. This allows full iteration over all subclusters - * - * @return :pair< cluster_iterator, cluster_iterator > - **/ - std::pair clusters(); - - /** - * @brief const equivalent to \ref clusters() - * - * @return :pair< const_cluster_iterator, const_cluster_iterator > - **/ - std::pair clusters() const; - - /** - * @brief The amount of all subclusters - * - * @return :size_t - **/ - std::size_t numClusters() const; - - /** - * @brief Check if this vertex is a cluster - * - * A subcluster is added as normal vertex to the parent cluster. There is no way to distinguish - * between clusters and normal vertices with global or local descriptors only. Therefore this - * function can be used to get information about the type. If it is a cluster, it can be accessed - * with \ref getVertexCluster - * - * @param v The vertex to be checked - * @return bool is cluster or not - **/ - bool isCluster(const dcm::LocalVertex v) const; - - /** - * @brief Get the cluster corresponding the descriptor - * - * A subcluster is added as normal vertex to the parent cluster. There is no way to access - * the clusters object with global or local descriptors only. Therefore this - * function can be used to get the object belonging to the descriptor. If the vertex is not - * a cluster an empty pointer is returned. - * - * @param v The vertex for which the cluster is wanted - * @return std::shared_ptr the corresponding cluster or empty pointer - **/ - std::shared_ptr getVertexCluster(LocalVertex v); - - /** - * @brief Get the vertex descriptor which describes the clusters position in the graph - * - * This function is the inverse to \ref getVertexCluster - * - * @param g the graph for which the vertex is searched - * @return :LocalVertex - **/ - LocalVertex getClusterVertex(std::shared_ptr g); - - /** - * @brief Convenience function for \ref removeCluster - **/ - template - void removeCluster(std::shared_ptr g, Functor& f); - /** - * @brief Convenience function for \ref removeCluster - **/ - void removeCluster(std::shared_ptr g); - /** - * @brief Delete all subcluster - * - * @return void - **/ - - void clearClusters(); - - /** - * @brief Remove a subcluster and applies the functor to all removed edges and vertices - * - * All downstream elements of the local vertex v will be removed after the functor is applied to their - * edges and vertices. Note that the LocalVertex which represents the cluster to delete is not passed - * to the functor. When ever the cluster is changed it will be passed to the functor, so that it needs - * to have three overloads: operator()(GlobalEdge), operator()(GlobalVertex), operator()(ClusterGraph&) - * - * @param v Local vertex which is a cluster and which should be deleted - * @param f Functor to apply on all graph elements - */ - template - void removeCluster(LocalVertex v, Functor& f); - void removeCluster(LocalVertex v); - -protected: - template - void remove_vertices(Functor& f, bool recursive = false); - - - /* ******************************************************* - * Creation Handling - * *******************************************************/ - -public: - /** - * @brief Add a vertex to the local cluster - * - * @return fusion::vector the local and global vertex descriptor - **/ - fusion::vector addVertex(); - - /** - * @brief Add a vertex to the local cluster with given global identifier - * - * Sometimes it is needed to add a vertex with given global identifier. As the global vertex can not - * be changed after creation, this method can be used to specify the global vertex by which this - * graph vertex can be identified. The given global vertex is not checked, you need to ensure that - * it is a unique id or the already existing vertex is returned. - * The ID generator is changed so that it creates only identifier bigger than v. - * - * @return fusion::vector the local and global vertex descriptor - **/ - fusion::vector addVertex(GlobalVertex v); - - /** - * @brief Iterators of all global vertices in this cluster - * - * Returns the iterator for the first global vertex and the end() iterator as reference for - * iterating - * - * @return std::pair< global_vertex_iterator, global_vertex_iterator > global vertex iterators - **/ - std::pair globalVertices(); - - /** - * @brief Returns the edge between the local vertices - * - * This function is the same as boost::edge(source, target, Graph) and only added for convenience. - * - * @param source LocalEdge as edge source - * @param target LocalEdge as edge target - * @return std::pair with the local edge descriptor if existing. The bool value shows if the - * edge exists or not - **/ - std::pair edge(LocalVertex source, LocalVertex target); - - /** - * @brief Add a edge between two vertices, defined by local descriptors. - * - * Add an edge that connects the two vertices and in the local clustergraph and assign the GlobalEdge to it. The - * LocalVertex parameters should not represent a cluster which would result in the functions failure. If there's - * already a local edge between the vertices, a new global edge will be added and returned. Failure will be - * recognizable by a false value in the returned type sequence. - * - * @param source The first vertex the edge should connect - * @param target The second vertex the edge should connect - * @return fusion::vector with the local and global descriptors of the edge and - * a bool value indicating the successful creation. - **/ - fusion::vector addEdge(LocalVertex source, LocalVertex target); - - /** - * @brief Add a edge between two vertices, defined by global descriptors. - * - * Adds an edge between vertices which are not necessarily in this local cluster and have therefore to be - * identified with global descriptors. The only condition for source and target vertex is that both must be - * in the local cluster or any of its subclusters. If that's not the case, the function will fail. On success - * a new GlobalEdge will be created, but not necessarily a local one. If the vertices are in different cluster - * which are already connected the global edge will be added to this connecting local edge. That's the one returned - * in the sequence. Note that it's possible that the local edge belongs to another subcluster and therefore can't be - * used in the local cluster. This case is indicated by the scope return value. - * - * @param source The first vertex the edge should connect - * @param target The second vertex the edge should connect - * @return fusion:vector< LocalEdge, GlobalEdge, success, scope > with the new global edge descriptor and the local - * one where it was added. Success indicates if the function was successful and scope shows the validy of the local - * descriptor in this cluster (true means the edge is in this cluster). - **/ - fusion::vector addEdge(GlobalVertex source, GlobalVertex target); - - fusion::vector addEdgeGlobal(GlobalVertex source, GlobalVertex target); - - /** - * @brief Get an iterator to all the global edges hold by this local edge - * - * Local edges can hold multiple global ones, for example when they connect at least one cluster. Therefore a direct - * LocalEdge - GlobalEdge mapping is not possible. Instead you can access all GlobalEdge's hold by this local one in - * a normal iterating manner. - * - * @param e the local edge for which the global descriptors are wanted - * @return std::pair with the global_edge_iterator's pointing to the vector's start - * and end - **/ - std::pair getGlobalEdges(LocalEdge e); - - /** - * @brief Get the count of all global edges - * - * Local edges can hold multiple global ones, for example when they connect at least one cluster. To get the - * number of all global edges in this local one you can use this function. - * - * @param e the local edge for which the global descriptors are wanted - * @return std::pair with the global_edge_iterator's pointing to the vector's start - * and end - **/ - int getGlobalEdgeCount(LocalEdge e); - - /** - * @brief Get the local edge which holds the specified global edge. - * - * Note that GlobalEdge must be in a local edge of this cluster, means the connected vertices must be in this - * or one of its subclusters (but not the same). Also if the containing LocalEdge is not in this cluster, but in one - * of its subclusters, the function fails and the returned edge is invalid. - * - * @param e GlobalEdge for which the containing local one is wanted - * @return std:pair< LocalEdge, bool > with the containing LocalEdge and a bool indicator if function was successful. - **/ - std::pair getLocalEdge(GlobalEdge e); - - /** - * @brief Get the local edge which holds the specified global one and the subcluster in which it is valid. - * - * The function only fails when the global edge is hold by a local one upstream in the cluster - * hierarchy. - * - * @param e GlobalEdge for which the containing local one is wanted - * @return fusion::vector with the containing LocalEdge, the cluster which holds it and a bool indicator if function was successful. - **/ - fusion::vector getLocalEdgeGraph(GlobalEdge e); - - /** - * @brief Get the GlobalVertex associated with this local one. - * - * @param v LocalVertex - * @return GlobalVertex - **/ - GlobalVertex getGlobalVertex(LocalVertex v) const; - - /** - * @brief Get the LocalVertex which corresponds to the global one - * - * The GlobalVertex has to be in this cluster or any of its subclusters. If it's in a subcluster, the returned - * LocalVertex will represent this cluster. If the GlobalVertex isn't in this cluster's scope, the function fails. - * - * @param vertex GlobalVertex for which the local one shall be returned - * @return std::pair< LocalVertex, bool > The LocalVertex containing the global one and a success indicator - **/ - std::pair getLocalVertex(GlobalVertex vertex); - - /** - * @brief Get the local vertex which holds the specified global one and the subcluster in which it is valid. - * - * The function only fails when the global vertex is held by a local one upstream in the cluster - * hierarchy. - * - * @param v GlobalVertex for which the containing local one is wanted - * @return fusion::vector with the containing LocalVertex, the cluster which holds it and a bool indicator if function was successful. - **/ - fusion::vector, bool> getLocalVertexGraph(GlobalVertex v); - - - /* ******************************************************* - * Remove Handling - * *******************************************************/ -private: - - template - void downstreamRemoveVertex(GlobalVertex v, Functor& f); - - void simpleRemoveEdge(LocalEdge e); - - -public: - /** - * @brief Removes a vertex from the local cluster and applies functor to removed edges - * - * Removes the vertex from the local graph and invalidates the global vertex id. Also all edges connecting - * to this vertex will be removed after the functor was applied to them. The functor needs to implement - * operato()(GlobalEdge e). Remark that there is no checking done if the vertex is a cluster, so you - * need to make sure it's not, as removing a clustervertex will not delete the corresponding cluster. - * - * @param id Local Vertex which should be removed from the graph - * @param f functor whose operator(GlobalEdge) is called for every removed edge - **/ - template - void removeVertex(LocalVertex id, Functor& f); - //no default template arguments for template functions allowed before c++0x, so a little workaround - void removeVertex(LocalVertex id) ; - - /** - * @brief Removes a vertex from the cluster or its subclusters and applies functor to removed edges - * - * Removes the vertex from the graph or subclusters and invalidates the global vertex id. Also all edges connecting - * to this vertex will be removed (upstream and downstream) after the functor was applied to them. The functor - * needs to implement operator()(LocalEdge edge). - * - * @param id Global Vertex which should be removed from the graph - * @param f functor whose operator(LocalEdge) is called on every removed edge - **/ - template - void removeVertex(GlobalVertex id, Functor& f); - //no default template arguments for template functions allowed before c++0x, so a little workaround - void removeVertex(GlobalVertex id); - - /** - * @brief Removes a global Edge from the cluster or its subclusters - * - * Removes the edge from the graph or subclusters and invalidates the global edge id. If the local edge holds - * only this global one it will be removed also. - * - * @param id Global Edge which should be removed from the graph - * @return bool indicates if the global id could be removed - **/ - void removeEdge(GlobalEdge id); - - /** - * @brief Removes a local edge from the cluster and calls the functor for all removed global edges - * - * Removes the edge from the graph and invalidates the global edges. The Functor needs to provide - * operator()(GlobalEdge). If no functor is needed just use boost::remove_edge. - * - * @param id Global Edge which should be removed from the graph - * @param f functor whose operator(GlobalEdge) is called - * @return bool indicates if the global id could be removed - **/ - template - void removeEdge(LocalEdge id, Functor& f); - - - /* ******************************************************* - * Object Handling - * *******************************************************/ -public: - - /** - * @brief Get the desired object at the specified vertex or edge - * - * This function allows to access the objects stored in the graph. If no object of the desired type - * was set before, an empty shared_ptr will be returned. Accessing the object at a local edge is a special - * case, as it can hold many global edges, each with its own objects. Using a LocalEdge as key will - * always return the object for the first GlobalEdge. - * - * @tparam Obj the object type which shall be returned - * @param k local or global Vertex/Edge descriptor for which the object is desired - * @return shared_ptr< Obj > the pointer to the desired object - **/ - template - std::shared_ptr getObject(key k); - - /** - * @brief Set a object at the specified vertex or edge - * - * Sets the given value at the given key. Note that every entity can hold only one object, so setting - * a new value resets all other objects which were set before. Setting the object at a local edge is a special - * case, as it can hold many global edges, each with its own objects. Using a LocalEdge as key will - * always set the object for the first GlobalEdge. - * - * @tparam Obj the object type which shall be set - * @param k local or global Vertex/Edge descriptor for which the object should be set - * @param val the object which should be stored - * @return void - **/ - template - void setObject(key k, std::shared_ptr val); - - /** - * @brief Get iterator range for all GlobalEdge objects hold by this local edge - * - * LocalEdge's can hold multiple global ones and the iterators can be used to access a specific object type in - * all global edges held by this local edge. - * - * @tparam Obj the object type over which it shall be iterated - * @param k the LocalEdge over which all Objects should be iterated. - * @return pair< begin, end > the iterator range from begin (first element) to end (first undefined element) - **/ - template - std::pair< object_iterator, object_iterator > getObjects(LocalEdge k); - - /** - * @brief Applies the functor to each occurrence of an object - * - * Each valid object of the given type is extracted and passed to the function object. Vertices - * and edges are searched for valid object pointers, it happens in this order. When a recursive - * search is specified, all subclusters are searched too, but the cluster is passed to the Functor - * first. So make sure a function overload for clusters exists in this case. - * - * @tparam Obj the object type for which the functor shall be used - * @param f the functor to which all valid objects get passed to. - * @param recursive specifies if the subclusters should be searched for objects too - **/ - template - void for_each(Functor& f, bool recursive = false); - - /** - * @brief Applies the functor to each object - * - * Each valid object of any type is extracted and passed to the function object. Vertices - * and edges are searched for valid object pointers, it happens in this order. When a recursive - * search is specified, all subclusters are searched too, but the cluster is passed to the Functor - * first. So make sure a function overload for clusters exist in this case. - * - * @param f the functor to which all valid objects get passed to. - * @param recursive specifies if the subclusters should be searched for objects too - **/ - template - void for_each_object(Functor& f, bool recursive = false); - - /* ******************************************************* - * Property Handling - * *******************************************************/ - - /** - * @brief Get the desired property at the specified vertex or edge - * - * This function allows to access the properties stored in the graph. If no property of the desired type - * was set before, a default construct will be returned. Accessing the property at a global edge will return - * the property of the holding local edge. - * - * @tparam property the property type which shall be returned - * @param k local or global Vertex/Edge descriptor for which the property is desired - * @return property::type& the reference to the desired property - **/ - template - typename property::type& getProperty(key k); - - /** - * @brief Set a property at the specified vertex or edge - * - * Sets the given value at the given key. Note that every entity can hold one of each property, as opposed - * to objects. Setting the property at a local edge is a special case, as it can hold many global edges, - * each with its own properties. Using a LocalEdge as key will always set the property for the first GlobalEdge. - * - * @tparam property the property type which shall be set - * @param k local or global Vertex/Edge descriptor for which the property should be set - * @param val the property value which should be stored - * @return void - **/ - template - void setProperty(key k, typename property::type val); - - /** - * @brief recreate the internal index maps for edges and vertices - * - * Quite many boost graph algorithms need the indices for vertices and edges which are provided by property - * maps. As we use list, and not vector, as underlying storage we don't get that property for free and - * need to create it ourself. To ease that procedure the internal property vertex_index_prop and edge_index_prop - * can be used as property maps and can be initialized by calling this function. - * - * @return void - **/ - void initIndexMaps(); - - - - /******************************************************** - * Vertex and Cluster moving - * *******************************************************/ - - /** - * @brief Move a vertex to a subcluster - * - * Overloaded convenience function which fetches the local descriptor for the cluster reference and calls - * the full parameter equivalent. Both cluster and vertex must be in the local cluster. - * - * @param v the LocalVertex to be moved - * @param cg reference to the subcluster to which v should be moved - * @return LocalVertex the local descriptor of the moved vertex in the subcluster - **/ - LocalVertex moveToSubcluster(LocalVertex v, std::shared_ptr cg); - - /** - * @brief Move a vertex to a subcluster - * - * Overloaded convenience function which fetches the the cluster reference for the local descriptor and calls - * the full parameter equivalent. Both cluster and vertex must be in the local cluster. - * - * @param v the LocalVertex to be moved - * @param Cluster the local vertex descriptor representing the subcluster to which v should be moved - * @return LocalVertex the local descriptor of the moved vertex in the subcluster - **/ - LocalVertex moveToSubcluster(LocalVertex v, LocalVertex Cluster); - - /** - * @brief Move a vertex to a subcluster - * - * This function moves the LocalVertex to the subcluster and reconnects all other vertices and clusters. The - * moved vertex will hold its global descriptor but get a new local one assigned (the one returned). The same - * stands for all edges which use the moved vertex: global descriptors stay the same, but they are moved to new - * local edges. It's allowed to move cluster vertices with this function. - * The specified cluster has of course to be a valid and direct subcluster, the move vertex also has to be in the - * local cluster. - * - * @param v the LocalVertex to be moved - * @param Cluster the local vertex descriptor representing the subcluster to which v should be moved - * @param cg reference to the subcluster to which v should be moved - * @return LocalVertex the local descriptor of the moved vertex in the subcluster - **/ - LocalVertex moveToSubcluster(LocalVertex v, LocalVertex Cluster, std::shared_ptr cg); - - - /** - * @brief Move a vertex to the parent cluster. - * - * This function moves a vertex one step up in the subcluster hierarchy and reconnects all other vertices and clusters. - * The moved vertex will hold its global descriptor but get a new local one assigned (the one returned). The same - * stands for all edges which use the moved vertex: global descriptors stay the same, but they are moved to new - * local edges. Note that this function is the inverse of moveToSubcluster, and doing Pseudocode: - * moveToParent(moveToSubcluster(v)) does nothing (only the local descriptor of the moved vertex is - * different afterwards). - * - * @param v Local vertex which should be moved to the parents cluster - * @return LocalVertex the local descriptor of the moved vertex, valid in the parent cluster only. - **/ - LocalVertex moveToParent(LocalVertex v); - - - /******************************************************** - * Stuff - * *******************************************************/ - - ClusterMap m_clusters; - int test; - -protected: - boost::weak_ptr m_parent; - details::IDpointer m_id; - bool copy_mode; //no changing itself when copying - - - /* Searches the global vertex in all local vertices of this graph, and returns the local - * one which holds the global vertex. If not successful the local vertex returned will be - * invalid and the bool parameter will be false. If recursive = true, all subclusters will - * be searched too, however, if found there the returned local vertex will be the vertex - * representing the toplevel cluster holding the global vertex in the initial graph. - * */ - std::pair getContainingVertex(GlobalVertex id, bool recursive = true); - - /* Searches the local vertex holding the specified global one in this and all its subclusters. - * If found, the holding local vertex and the graph in which it is valid will be returned. - * */ - fusion::vector, bool> getContainingVertexGraph(GlobalVertex id); - - /* Searches the global edge in all local edges of this graph, and returns the local - * one which holds the global edge. If not successful the local edge returned will be - * invalid and the bool parameter will be false. - * */ - std::pair getContainingEdge(GlobalEdge id); - - /* Searches the local edge holding the specified global one in this and all its subclusters. - * If found, the holding local edge and the graph in which it is valid will be returned. - * */ - fusion::vector getContainingEdgeGraph(GlobalEdge id); - - template - typename functor::result_type apply_to_bundle(LocalVertex k, functor f); - - template - typename functor::result_type apply_to_bundle(LocalEdge k, functor f); - - template - typename functor::result_type apply_to_bundle(GlobalVertex k, functor f); - - template - typename functor::result_type apply_to_bundle(GlobalEdge k, functor f); - -public: - //may hold cluster properties which have Eigen3 objects and therefore need alignment - EIGEN_MAKE_ALIGNED_OPERATOR_NEW -}; - -/** @} */ -/** @} */ - -} //namespace dcm - - -#ifndef DCM_EXTERNAL_CORE -#include "imp/clustergraph_imp.hpp" -#endif - -#endif // CLUSTERGRAPH_HPP - - - - diff --git a/src/Mod/Assembly/App/opendcm/core/constraint.hpp b/src/Mod/Assembly/App/opendcm/core/constraint.hpp deleted file mode 100644 index cd4918b8f4..0000000000 --- a/src/Mod/Assembly/App/opendcm/core/constraint.hpp +++ /dev/null @@ -1,326 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2012 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more detemplate tails. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef GCM_CONSTRAINT_H -#define GCM_CONSTRAINT_H - - -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "traits.hpp" -#include "object.hpp" -#include "equations.hpp" -#include "geometry.hpp" - -namespace mpl = boost::mpl; -namespace fusion = boost::fusion; - -namespace dcm { - -namespace detail { - -//metafunction to avoid ot-of-range access of mpl sequences -template -struct in_range_value { - typedef typename mpl::prior >::type last_id; - typedef typename mpl::min< mpl::int_, last_id>::type type; -}; - -//type erasure container for constraints -template -class Constraint { - - typedef typename Sys::Kernel Kernel; - typedef typename Kernel::number_type Scalar; - typedef typename Kernel::DynStride DS; - typedef typename Kernel::MappedEquationSystem MES; - - typedef std::shared_ptr > geom_ptr; - typedef std::vector > Vec; - - //metafunction to create equation from consraint and tags - template - struct equation { - typedef typename C::template type type; - }; - -public: - Constraint(geom_ptr f, geom_ptr s); - ~Constraint(); - - //workaround until better analysing class is created - // TODO: remove diasable once analyser is available - void disable() { - content->disable(); - }; - - std::vector getGenericEquations(); - std::vector getGenericConstraints(); - std::vector getEquationTypes(); - std::vector getConstraintTypes(); - - template - void initializeFromTags(ConstraintVector& obj); - template - void initialize(ConstraintVector& obj); - -protected: - //initialising from geometry functions - template - void initializeFirstGeometry(ConstraintVector& cv, boost::mpl::false_); - template - void initializeFirstGeometry(ConstraintVector& cv, boost::mpl::true_); - template - void initializeSecondGeometry(ConstraintVector& cv, boost::mpl::false_); - template - void initializeSecondGeometry(ConstraintVector& cv, boost::mpl::true_); - template - inline void intitalizeFinalize(ConstraintVector& cv, boost::mpl::false_); - template - inline void intitalizeFinalize(ConstraintVector& cv, boost::mpl::true_); - - - int equationCount(); - void calculate(Scalar scale, AccessType access = general); - void treatLGZ(); - void setMaps(MES& mes); - void collectPseudoPoints(Vec& vec1, Vec& vec2); - - //Equation is the constraint with types, the EquationSet hold all needed Maps for calculation - template - struct EquationSet { - EquationSet() : m_diff_first(NULL,0,DS(0,0)), m_diff_first_rot(NULL,0,DS(0,0)), - m_diff_second(NULL,0,DS(0,0)), m_diff_second_rot(NULL,0,DS(0,0)), - m_residual(NULL,0,DS(0,0)), enabled(true) {}; - - Equation m_eq; - typename Kernel::VectorMap m_diff_first, m_diff_first_rot; //first geometry diff - typename Kernel::VectorMap m_diff_second, m_diff_second_rot; //second geometry diff - typename Kernel::VectorMap m_residual; - - bool enabled; - AccessType access; - - typedef Equation eq_type; - }; - - struct placeholder { - virtual ~placeholder() {} - virtual placeholder* resetConstraint(geom_ptr first, geom_ptr second) const = 0; - virtual void calculate(geom_ptr first, geom_ptr second, Scalar scale, AccessType access = general) = 0; - virtual void treatLGZ(geom_ptr first, geom_ptr second) = 0; - virtual int equationCount() = 0; - virtual void setMaps(MES& mes, geom_ptr first, geom_ptr second) = 0; - virtual void collectPseudoPoints(geom_ptr first, geom_ptr second, Vec& vec1, Vec& vec2) = 0; - virtual void disable() = 0; - virtual placeholder* clone() = 0; - - //some runtime type infos are needed, as we can't access the contents with arbitrary functors - virtual std::vector getGenericEquations() = 0; - virtual std::vector getGenericConstraints() = 0; - virtual std::vector getEquationTypes() = 0; - virtual std::vector getConstraintTypes() = 0; - }; - int value; - -public: - template< typename ConstraintVector, typename tag1, typename tag2> - struct holder : public placeholder { - - //transform the constraints into eqautions with the now known types - typedef typename mpl::fold< ConstraintVector, mpl::vector<>, - mpl::push_back > >::type EquationVector; - - //create a vector of EquationSets with some mpl trickery - typedef typename mpl::fold< EquationVector, mpl::vector<>, - mpl::push_back > >::type eq_set_vector; - typedef typename fusion::result_of::as_vector::type EquationSets; - - typedef ConstraintVector Objects; - - template - struct has_option { - //we get the index of the eqaution in the eqaution vector, and as it is the same - //as the index of the constraint in the constraint vector we can extract the - //option type and check if it is no_option - typedef typename mpl::find::type iterator; - typedef typename mpl::distance::type, iterator>::type distance; - BOOST_MPL_ASSERT((mpl::not_::type > >)); - typedef typename fusion::result_of::at::type option_type; - typedef mpl::not_ > type; - }; - - struct OptionSetter { - - Objects& objects; - - OptionSetter(Objects& val); - - //only set the value if the equation has a option - template< typename T > - typename boost::enable_if::type, void>::type - operator()(EquationSet& val) const; - //if the equation has no option we do nothing! - template< typename T > - typename boost::enable_if::type>, void>::type - operator()(EquationSet& val) const; - }; - - struct Calculator { - - geom_ptr first, second; - Scalar scale; - AccessType access; - - Calculator(geom_ptr f, geom_ptr s, Scalar sc, AccessType a = general); - - template< typename T > - void operator()(T& val) const; - }; - - struct MapSetter { - MES& mes; - geom_ptr first, second; - - MapSetter(MES& m, geom_ptr f, geom_ptr s); - - template< typename T > - void operator()(T& val) const; - }; - - struct PseudoCollector { - Vec& points1; - Vec& points2; - geom_ptr first,second; - - PseudoCollector(geom_ptr f, geom_ptr s, Vec& vec1, Vec& vec2); - - template< typename T > - void operator()(T& val) const; - }; - - struct LGZ { - geom_ptr first,second; - - LGZ(geom_ptr f, geom_ptr s); - - template< typename T > - void operator()(T& val) const; - }; - - - struct EquationCounter { - int& count; - - EquationCounter(int& c) : count(c) {}; - - template< typename T > - void operator()(T& val) const { - if(val.enabled) - count++; - }; - }; - - //workaround until we have a better analyser class - struct disabler { - template - void operator()(T& val) const { - val.enabled = false; - }; - }; - - struct GenericEquations { - std::vector& vec; - GenericEquations(std::vector& v); - - template - void operator()(T& val) const; - }; - - struct GenericConstraints { - std::vector& vec; - GenericConstraints(std::vector& v); - - template - void operator()(T& val) const; - }; - - struct Types { - std::vector& vec; - Types(std::vector& v); - - template - void operator()(T& val) const; - }; - - - holder(Objects& obj); - - virtual void calculate(geom_ptr first, geom_ptr second, Scalar scale, AccessType a = general); - virtual void treatLGZ(geom_ptr first, geom_ptr second); - virtual placeholder* resetConstraint(geom_ptr first, geom_ptr second) const; - virtual void setMaps(MES& mes, geom_ptr first, geom_ptr second); - virtual void collectPseudoPoints(geom_ptr f, geom_ptr s, Vec& vec1, Vec& vec2); - virtual placeholder* clone(); - virtual int equationCount(); - virtual void disable(); - - virtual std::vector getGenericEquations(); - virtual std::vector getGenericConstraints(); - virtual std::vector getEquationTypes(); - virtual std::vector getConstraintTypes(); - - EquationSets m_sets; - Objects m_objects; - protected: - void for_each(EquationSets m_sets, Calculator Calculator); - }; - - placeholder* content; - Connection cf, cs; -public: - geom_ptr first, second; -}; - -};//detail -};//dcm - -#ifndef DCM_EXTERNAL_CORE -#include "imp/constraint_imp.hpp" -#include "imp/constraint_holder_imp.hpp" -#endif - -#endif //GCM_CONSTRAINT_H - - - diff --git a/src/Mod/Assembly/App/opendcm/core/defines.hpp b/src/Mod/Assembly/App/opendcm/core/defines.hpp deleted file mode 100644 index b6547533bb..0000000000 --- a/src/Mod/Assembly/App/opendcm/core/defines.hpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2013 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef GCM_DEFINES_CORE_H -#define GCM_DEFINES_CORE_H - - -#include -#include - -namespace dcm { - -//all solving related errors -typedef boost::error_info error_message; -typedef boost::error_info error_type_first_geometry; -typedef boost::error_info error_type_second_geometry; - -//exception codes are needed by the user -struct creation_error : virtual boost::exception {}; -struct solving_error : virtual boost::exception {}; -struct constraint_error : virtual boost::exception {}; - -} //dcm - -#endif //GCM_DEFINES_CORE_H \ No newline at end of file diff --git a/src/Mod/Assembly/App/opendcm/core/equations.hpp b/src/Mod/Assembly/App/opendcm/core/equations.hpp deleted file mode 100644 index 839a3c89ee..0000000000 --- a/src/Mod/Assembly/App/opendcm/core/equations.hpp +++ /dev/null @@ -1,422 +0,0 @@ -/* - openDCM, dimensional constraint manager - Copyright (C) 2012 Stefan Troeger - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 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 Lesser General Public License for more detemplate tails. - - You should have received a copy of the GNU Lesser General Public License along - with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef DCM_EQUATIONS_H -#define DCM_EQUATIONS_H - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace fusion = boost::fusion; -namespace mpl = boost::mpl; - -#include "kernel.hpp" - -namespace dcm { - -//the possible directions -enum Direction { parallel, equal, opposite, perpendicular }; - -//the possible solution spaces -enum SolutionSpace {bidirectional, positiv_directional, negative_directional}; - -struct no_option {}; - -template -struct Pseudo { - typedef std::vector > Vec; - - template - void calculatePseudo(const E::MatrixBase& param1, Vec& v1, const E::MatrixBase& param2, Vec& v2) {}; -}; - -template -struct Scale { - void setScale(typename Kernel::number_type scale) {}; -}; - -template -struct PseudoScale { - typedef std::vector > Vec; - - template - void calculatePseudo(const E::MatrixBase& param1, Vec& v1, const E::MatrixBase& param2, Vec& v2) {}; - void setScale(typename Kernel::number_type scale) {}; -}; - -//type to allow a metaprogramming check for a Equation -struct EQ {}; - -//template -//struct pushed_seq; - -//metafunctions to retrieve the options of an equation -template -struct options { - typedef typename T::options type; -}; -template<> -struct options< mpl::arg<-1> > { - typedef fusion::map<> type; -}; -template -struct has_option : public mpl::if_::type, Opt>, boost::true_type, boost::false_type>::type { - typedef typename mpl::has_key::type, Opt>::type type; -}; -template -struct seq_has_option { - typedef typename mpl::transform >::type bool_seq; - typedef typename mpl::not_::type, mpl::end > >::type type; -}; - -template -struct constraint_sequence : public seq { - - template - void pretty(T type) { - std::cout<<"pretty: "<<__PRETTY_FUNCTION__< - typename boost::enable_if< boost::is_base_of< dcm::EQ, T>, typename pushed_seq::type >::type operator &(T& val); - - //an sequence gets added to this sequence (happens only if sequenced equations like coincident are used) - template - typename boost::enable_if< mpl::is_sequence, typename pushed_seq::type >::type operator &(T& val); - */ - //we also allow to set values directly into the equation, as this makes it more compftable for multi constraints - //as align. Note that this only works if all option types of all equations in this sequence are distinguishable - template - typename boost::enable_if::type, Derived&>::type - operator=(const T& val) { - - fusion::filter_view > view(*this); - fusion::front(view) = val; - return *((Derived*)this); - }; - -}; - -/* -template -struct get_equation_id { - typedef typename T::ID type; -}; - -template -struct pushed_seq { - typedef typename mpl::if_, Seq, fusion::vector1 >::type S1; - typedef typename mpl::if_, T, fusion::vector1 >::type S2; - - typedef typename mpl::fold< S2, S1, mpl::if_< boost::is_same< - mpl::find, mpl::end >, mpl::push_back, mpl::_1> >::type unique_vector; - typedef typename mpl::sort, get_equation_id > >::type sorted_vector; - - typedef typename fusion::result_of::as_vector< sorted_vector >::type vec; - typedef constraint_sequence type; -};*/ - -template -struct Equation : public EQ { - - typedef typename mpl::if_, Option, mpl::vector