AppFem.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de)              *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 #ifndef _PreComp_
00026 # include <Python.h>
00027 #endif
00028 
00029 #include <Base/Console.h>
00030 #include <Base/Interpreter.h>
00031 #include <CXX/Extensions.hxx>
00032 
00033 #include "FemMeshPy.h"
00034 #include "FemMesh.h"
00035 #include "FemMeshProperty.h"
00036 #include "FemMeshObject.h"
00037 #include "HypothesisPy.h"
00038 
00039 extern struct PyMethodDef Fem_methods[];
00040 
00041 PyDoc_STRVAR(module_Fem_doc,
00042 "This module is the FEM module.");
00043 
00044 /* Python entry */
00045 extern "C" {
00046 void AppFemExport initFem()
00047 {
00048     // load dependend module
00049     try {
00050         Base::Interpreter().loadModule("Part");
00051         //Base::Interpreter().loadModule("Mesh");
00052     }
00053     catch(const Base::Exception& e) {
00054         PyErr_SetString(PyExc_ImportError, e.what());
00055         return;
00056     }
00057     PyObject* femModule = Py_InitModule3("Fem", Fem_methods, module_Fem_doc);   /* mod name, table ptr */
00058     Base::Console().Log("Loading Fem module... done\n");
00059 
00060     Fem::StdMeshers_Arithmetic1DPy              ::init_type(femModule);
00061     Fem::StdMeshers_AutomaticLengthPy           ::init_type(femModule);
00062     Fem::StdMeshers_NotConformAllowedPy         ::init_type(femModule);
00063     Fem::StdMeshers_MaxLengthPy                 ::init_type(femModule);
00064     Fem::StdMeshers_LocalLengthPy               ::init_type(femModule);
00065     Fem::StdMeshers_QuadranglePreferencePy      ::init_type(femModule);
00066     Fem::StdMeshers_Quadrangle_2DPy             ::init_type(femModule);
00067     Fem::StdMeshers_MaxElementAreaPy            ::init_type(femModule);
00068     Fem::StdMeshers_Regular_1DPy                ::init_type(femModule);
00069     Fem::StdMeshers_UseExisting_1DPy            ::init_type(femModule);
00070     Fem::StdMeshers_UseExisting_2DPy            ::init_type(femModule);
00071     Fem::StdMeshers_CompositeSegment_1DPy       ::init_type(femModule);
00072     Fem::StdMeshers_Deflection1DPy              ::init_type(femModule);
00073     Fem::StdMeshers_LayerDistributionPy         ::init_type(femModule);
00074     Fem::StdMeshers_LengthFromEdgesPy           ::init_type(femModule);
00075     Fem::StdMeshers_MaxElementVolumePy          ::init_type(femModule);
00076     Fem::StdMeshers_MEFISTO_2DPy                ::init_type(femModule);
00077     Fem::StdMeshers_NumberOfLayersPy            ::init_type(femModule);
00078     Fem::StdMeshers_NumberOfSegmentsPy          ::init_type(femModule);
00079     Fem::StdMeshers_Prism_3DPy                  ::init_type(femModule);
00080     Fem::StdMeshers_Projection_1DPy             ::init_type(femModule);
00081     Fem::StdMeshers_Projection_2DPy             ::init_type(femModule);
00082     Fem::StdMeshers_Projection_3DPy             ::init_type(femModule);
00083     Fem::StdMeshers_ProjectionSource1DPy        ::init_type(femModule);
00084     Fem::StdMeshers_ProjectionSource2DPy        ::init_type(femModule);
00085     Fem::StdMeshers_ProjectionSource3DPy        ::init_type(femModule);
00086     Fem::StdMeshers_QuadraticMeshPy             ::init_type(femModule);
00087     Fem::StdMeshers_RadialPrism_3DPy            ::init_type(femModule);
00088     Fem::StdMeshers_SegmentAroundVertex_0DPy    ::init_type(femModule);
00089     Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule);
00090     Fem::StdMeshers_StartEndLengthPy            ::init_type(femModule);
00091     Fem::StdMeshers_TrianglePreferencePy        ::init_type(femModule);
00092     Fem::StdMeshers_Hexa_3DPy                   ::init_type(femModule);
00093 
00094     // Add Types to module
00095     Base::Interpreter().addType(&Fem::FemMeshPy::Type,femModule,"FemMesh");
00096 
00097 
00098     // NOTE: To finish the initialization of our own type objects we must
00099     // call PyType_Ready, otherwise we run into a segmentation fault, later on.
00100     // This function is responsible for adding inherited slots from a type's base class.
00101  
00102     Fem::FemMesh            ::init();
00103     Fem::FemMeshObject      ::init();
00104     Fem::PropertyFemMesh    ::init();
00105 }
00106 
00107 } // extern "C"

Generated on Wed Nov 23 18:59:55 2011 for FreeCAD by  doxygen 1.6.1