Changes on Machining Distortion to account for Centos 5.6 compilation

This commit is contained in:
Joachim Zettler 2012-03-26 10:06:16 +02:00
parent ef6528b372
commit ec1b0d8720
72 changed files with 138 additions and 8 deletions

0
src/Mod/Fem/App/AppFem.cpp Normal file → Executable file
View File

81
src/Mod/Fem/App/AppFemPy.cpp Normal file → Executable file
View File

@ -149,7 +149,82 @@ static PyObject * SMESH_PCA(PyObject *self, PyObject *args)
Base::Matrix4D Trafo = pca.Transform();
/*Let´s transform the input mesh with the PCA Matrix*/
inputMesh->getFemMeshPtr()->transformGeometry(Trafo);
//inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/PCA_alignment.unv");
//inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/Temp/PCA_alignment.unv");
//Now lets check if the smallest dimension of the BBox is oriented towards the Z-Axis. If not, lets rotate it around the X or Y axis
//Use the SMESH structure for that
// aMesh.Transform(Trafo);
//Base::Rotation rotatex,rotatey,rotatez;
//const Base::Vector3d rotate_axis_x(1.0,0.0,0.0),rotate_axis_y(0.0,1.0,0.0),rotate_axis_z(0.0,0.0,1.0);
//double bbox_length_x,bbox_length_y,bbox_length_z;
////Rotate around the each axes and choose the settings for the min bbox
//Base::Matrix4D final_trafo;
//Base::BoundBox3f aBBox;
////Get the current BBOX and look for the size
//aBBox = aMesh.GetBoundBox();
//bbox_length_x = aBBox.LengthX();bbox_length_y = aBBox.LengthY();bbox_length_z = aBBox.LengthZ();
////Now do the rotation stuff
//if (bbox_length_z < bbox_length_x && bbox_length_z < bbox_length_y)
// Py_Return;
//else if (
//MeshCore::MeshKernel atempkernel;
//float it_steps=10.0;
//double step_size;
//double alpha_x=0.0,alpha_y=0.0,alpha_z=0.0;
//double perfect_ax=0.0,perfect_ay=0.0,perfect_az=0.0;
////Do a Monte Carlo approach and start from the Principal Axis System
////and rotate +/- 60° around each axis in a first iteration
//double angle_range_min_x=-PI/3.0,angle_range_max_x=PI/3.0,
// angle_range_min_y=-PI/3.0,angle_range_max_y=PI/3.0,
// angle_range_min_z=-PI/3.0,angle_range_max_z=PI/3.0;
////We rotate until we are 0.1° sure to be in the right position
//for (step_size = (2.0*PI/it_steps);step_size>(2.0*PI/3600.0);step_size=(2.0*PI/it_steps))
//{
// for(alpha_x=angle_range_min_x;alpha_x<angle_range_max_x;alpha_x=alpha_x+step_size)
// {
// rotatex.setValue(rotate_axis_x,alpha_x);
// for(alpha_y=angle_range_min_y;alpha_y<angle_range_max_y;alpha_y=alpha_y+step_size)
// {
// rotatey.setValue(rotate_axis_y,alpha_y);
// for(alpha_z=angle_range_min_z;alpha_z<angle_range_max_z;alpha_z=alpha_z+step_size)
// {
// rotatez.setValue(rotate_axis_z,alpha_z);
// (rotatex*rotatey*rotatez).getValue(final_trafo);
// atempkernel = aMesh;
} PY_CATCH;
Py_Return;
@ -316,7 +391,7 @@ static PyObject * checkBB(PyObject *self, PyObject *args)
const SMDS_MeshNode* aNode = aNodeIter->next();
current_node.Set(float(aNode->X()),float(aNode->Y()),float(aNode->Z()));
current_node = matrix * current_node;
if(current_node.z > billet_thickness || current_node.z < 0.0)
if(current_node.z > billet_thickness || current_node.z < -0.1)
{
//lets jump out of the function as soon as we find a
//Node that is higher or lower than billet thickness
@ -563,7 +638,7 @@ static PyObject * minBoundingBox(PyObject *self, PyObject *args)
float(0.0),float(0.0),float(0.0),float(1.0));
inputMesh->getFemMeshPtr()->transformGeometry(trans_matrix);
//inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/fine_tuning.unv");
//inputMesh->getFemMeshPtr()->getSMesh()->ExportUNV("C:/temp/fine_tuning.unv");
} PY_CATCH;

0
src/Mod/Fem/App/CMakeLists.txt Normal file → Executable file
View File

65
src/Mod/Fem/App/FemMesh.cpp Normal file → Executable file
View File

@ -58,9 +58,13 @@
#include <StdMeshers_Quadrangle_2D.hxx>
#include <StdMeshers_QuadraticMesh.hxx>
//to simplify parsing input files we use the boost lib
#include <boost/tokenizer.hpp>
using namespace Fem;
using namespace Base;
using namespace boost;
TYPESYSTEM_SOURCE(Fem::FemMesh , Base::Persistence);
@ -374,23 +378,32 @@ void FemMesh::readNastran(const std::string &Filename)
inputfile.open(Filename.c_str());
inputfile.seekg(std::ifstream::beg);
std::string line1,line2,temp;
std::vector<string> token_results;
token_results.clear();
Base::Vector3d current_node;
std::vector<Base::Vector3d> vertices;
vertices.clear();
std::vector<unsigned int> nodal_id;
nodal_id.clear();
std::vector<unsigned int> tetra_element;
std::vector<std::vector<unsigned int> > all_elements;
std::vector<unsigned int> element_id;
element_id.clear();
bool nastran_free_format = false;
do
{
std::getline(inputfile,line1);
if (line1.size() == 0) continue;
if (line1.find("GRID*")!= std::string::npos) //We found a Grid line
if (!nastran_free_format && line1.find(",")!= std::string::npos)
nastran_free_format = true;
if (!nastran_free_format && line1.find("GRID*")!= std::string::npos ) //We found a Grid line
{
//Now lets extract the GRID Points = Nodes
//As each GRID Line consists of two subsequent lines we have to
//take care of that as well
std::getline(inputfile,line2);
//Get the Nodal ID
nodal_id.push_back(atoi(line1.substr(8,24).c_str()));
//Extract X Value
current_node.x = atof(line1.substr(40,56).c_str());
//Extract Y Value
@ -400,7 +413,7 @@ void FemMesh::readNastran(const std::string &Filename)
vertices.push_back(current_node);
}
else if (line1.find("CTETRA")!= std::string::npos)
else if (!nastran_free_format && line1.find("CTETRA")!= std::string::npos)
{
tetra_element.clear();
//Lets extract the elements
@ -422,6 +435,46 @@ void FemMesh::readNastran(const std::string &Filename)
all_elements.push_back(tetra_element);
}
else if (nastran_free_format && line1.find("GRID")!= std::string::npos ) //We found a Grid line
{
char_separator<char> sep(",");
tokenizer<char_separator<char> > tokens(line1, sep);
token_results.assign(tokens.begin(),tokens.end());
if (token_results.size() < 3)
continue;//Line does not include Nodal coordinates
nodal_id.push_back(atoi(token_results[1].c_str()));
current_node.x = atof(token_results[3].c_str());
current_node.y = atof(token_results[4].c_str());
current_node.z = atof(token_results[5].c_str());
vertices.push_back(current_node);
}
else if (nastran_free_format && line1.find("CTETRA")!= std::string::npos)
{
tetra_element.clear();
//Lets extract the elements
//As each Element Line consists of two subsequent lines as well
//we have to take care of that
//At a first step we only extract Quadratic Tetrahedral Elements
std::getline(inputfile,line2);
char_separator<char> sep(",");
tokenizer<char_separator<char> > tokens(line1.append(line2), sep);
token_results.assign(tokens.begin(),tokens.end());
if (token_results.size() < 11)
continue;//Line does not include enough nodal IDs
element_id.push_back(atoi(token_results[1].c_str()));
tetra_element.push_back(atoi(token_results[3].c_str()));
tetra_element.push_back(atoi(token_results[4].c_str()));
tetra_element.push_back(atoi(token_results[5].c_str()));
tetra_element.push_back(atoi(token_results[6].c_str()));
tetra_element.push_back(atoi(token_results[7].c_str()));
tetra_element.push_back(atoi(token_results[8].c_str()));
tetra_element.push_back(atoi(token_results[10].c_str()));
tetra_element.push_back(atoi(token_results[11].c_str()));
tetra_element.push_back(atoi(token_results[12].c_str()));
tetra_element.push_back(atoi(token_results[13].c_str()));
all_elements.push_back(tetra_element);
}
}
while (inputfile.good());
@ -431,10 +484,10 @@ void FemMesh::readNastran(const std::string &Filename)
std::vector<Base::Vector3d>::const_iterator anodeiterator;
SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS();
meshds->ClearMesh();
int j=1;
unsigned int j=0;
for(anodeiterator=vertices.begin(); anodeiterator!=vertices.end(); anodeiterator++)
{
meshds->AddNodeWithID((*anodeiterator).x,(*anodeiterator).y,(*anodeiterator).z,j);
meshds->AddNodeWithID((*anodeiterator).x,(*anodeiterator).y,(*anodeiterator).z,nodal_id[j]);
j++;
}
@ -442,7 +495,8 @@ void FemMesh::readNastran(const std::string &Filename)
{
//Die Reihenfolge wie hier die Elemente hinzugefügt werden ist sehr wichtig.
//Ansonsten ist eine konsistente Datenstruktur nicht möglich
meshds->AddVolumeWithID(
meshds->AddVolumeWithID
(
meshds->FindNode(all_elements[i][0]),
meshds->FindNode(all_elements[i][2]),
meshds->FindNode(all_elements[i][1]),
@ -458,6 +512,7 @@ void FemMesh::readNastran(const std::string &Filename)
}
}
void FemMesh::read(const char *FileName)
{
Base::FileInfo File(FileName);

0
src/Mod/Fem/App/FemMesh.h Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshObject.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshObject.h Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshProperty.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshProperty.h Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshPy.xml Normal file → Executable file
View File

0
src/Mod/Fem/App/FemMeshPyImp.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/HypothesisPy.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/HypothesisPy.h Normal file → Executable file
View File

0
src/Mod/Fem/App/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/App/PreCompiled.cpp Normal file → Executable file
View File

0
src/Mod/Fem/App/PreCompiled.h Normal file → Executable file
View File

0
src/Mod/Fem/CMakeLists.txt Normal file → Executable file
View File

0
src/Mod/Fem/FemExample.py Normal file → Executable file
View File

0
src/Mod/Fem/Gui/AppFemGui.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/AppFemGuiPy.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/CMakeLists.txt Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Command.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/Gui/PreCompiled.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/PreCompiled.h Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/Fem.qrc Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/UpdateResources.bat Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/icons/Fem_FemMesh.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

0
src/Mod/Fem/Gui/Resources/translations/Fem_af.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_af.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_de.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_de.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_es.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_es.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fi.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fi.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fr.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_fr.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hr.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hr.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hu.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_hu.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_it.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_it.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ja.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ja.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_nl.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_nl.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_no.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_no.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pl.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pl.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pt.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_pt.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ru.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_ru.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_se.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_se.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_uk.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_uk.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_zh.qm Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Resources/translations/Fem_zh.ts Normal file → Executable file
View File

0
src/Mod/Fem/Gui/ViewProviderFemMesh.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/ViewProviderFemMesh.h Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Workbench.cpp Normal file → Executable file
View File

0
src/Mod/Fem/Gui/Workbench.h Normal file → Executable file
View File

0
src/Mod/Fem/Init.py Normal file → Executable file
View File

0
src/Mod/Fem/InitGui.py Normal file → Executable file
View File

0
src/Mod/Fem/Makefile.am Normal file → Executable file
View File

0
src/Mod/Fem/convert2TetGen.py Normal file → Executable file
View File

0
src/Mod/Fem/fem.dox Normal file → Executable file
View File