From f53579f671ab28a6065f0dccf0cbb4a02d1effee Mon Sep 17 00:00:00 2001 From: jriegel Date: Fri, 6 Dec 2013 23:25:45 +0100 Subject: [PATCH] Starting Calculix integration --- src/Mod/Fem/App/FemResultObject.cpp | 1 + src/Mod/Fem/App/FemResultObject.h | 4 +- src/Mod/Fem/CalculixLib.py | 62 +++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/Mod/Fem/CalculixLib.py diff --git a/src/Mod/Fem/App/FemResultObject.cpp b/src/Mod/Fem/App/FemResultObject.cpp index 0ec3da001..b7db4b7ec 100644 --- a/src/Mod/Fem/App/FemResultObject.cpp +++ b/src/Mod/Fem/App/FemResultObject.cpp @@ -39,6 +39,7 @@ FemResultObject::FemResultObject() { ADD_PROPERTY_TYPE(DataType,(""), "General",Prop_None,"Type identifier of the result data"); ADD_PROPERTY_TYPE(Unit,(Base::Quantity()), "General",Prop_None,"Unit of the data"); + ADD_PROPERTY_TYPE(ElementNumbers,(0), "Data",Prop_None,"Numbers of the result elements"); } FemResultObject::~FemResultObject() diff --git a/src/Mod/Fem/App/FemResultObject.h b/src/Mod/Fem/App/FemResultObject.h index 0397a5346..3db4b065b 100644 --- a/src/Mod/Fem/App/FemResultObject.h +++ b/src/Mod/Fem/App/FemResultObject.h @@ -26,6 +26,7 @@ #include #include +#include #include #include "FemResultObject.h" @@ -45,7 +46,8 @@ public: App::PropertyString DataType; /// Unit and factor of the values App::PropertyQuantity Unit; - + /// List of element numbers in this result object + App::PropertyIntegerList ElementNumbers; /// returns the type name of the ViewProvider //virtual const char* getViewProviderName(void) const { // return "FemGui::ViewProviderFemSet"; diff --git a/src/Mod/Fem/CalculixLib.py b/src/Mod/Fem/CalculixLib.py new file mode 100644 index 000000000..9b66195cf --- /dev/null +++ b/src/Mod/Fem/CalculixLib.py @@ -0,0 +1,62 @@ +#*************************************************************************** +#* * +#* Copyright (c) 2013 - Juergen Riegel * +#* * +#* This program is free software; you can redistribute it and/or modify * +#* it under the terms of the GNU Lesser General Public License (LGPL) * +#* as published by the Free Software Foundation; either version 2 of * +#* the License, or (at your option) any later version. * +#* for detail see the LICENCE text file. * +#* * +#* This program 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 program; if not, write to the Free Software * +#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +#* USA * +#* * +#*************************************************************************** + + + + +def readResult(frd_input) : + input = open(frd_input,"r") + nodes_x = [] + nodes_y = [] + nodes_z = [] + disp_x = [] + disp_y = [] + disp_z = [] + displaced_nodes_x = [] + displaced_nodes_y = [] + displaced_nodes_z = [] + + disp_found = False + nodes_found = True + while True: + line=input.readline() + if not line: break + #first lets extract the node and coordinate information from the results file + if nodes_found and (line[1:3] == "-1"): + nodes_x.append(float(line[13:25])) + nodes_y.append(float(line[25:37])) + nodes_z.append(float(line[37:49])) + #Check if we found displacement section + if line[5:9] == "DISP": + disp_found = True + #we found a displacement line in the frd file + if disp_found and (line[1:3] == "-1"): + disp_x.append(float(line[13:25])) + disp_y.append(float(line[25:37])) + disp_z.append(float(line[37:49])) + #Check for the end of a section + if line[1:3] == "-3": + #the section with the displacements and the nodes ended + disp_found = False + nodes_found = False + + input.close()