diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index bfe934015..1d6b26431 100755 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -152,7 +152,7 @@ SET(FemBase_SRCS FemConstraint.h FemMeshProperty.cpp FemMeshProperty.h - ) + ) SOURCE_GROUP("Base types" FILES ${FemBase_SRCS}) @@ -167,7 +167,7 @@ SET(FemSet_SRCS FemSetFacesObject.h FemSetGeometryObject.cpp FemSetGeometryObject.h - ) + ) SOURCE_GROUP("Set objects" FILES ${FemSet_SRCS}) SET(FemConstraints_SRCS @@ -185,18 +185,18 @@ SET(FemConstraints_SRCS FemConstraintPulley.h FemConstraintDisplacement.h FemConstraintDisplacement.cpp - ) + ) SOURCE_GROUP("Constraints" FILES ${FemConstraints_SRCS}) SET(FemResult_SRCS - ) + ) SOURCE_GROUP("ResultObjects" FILES ${FemResult_SRCS}) SET(Fem_SRCS - ${FemBase_SRCS} - ${FemSet_SRCS} - ${FemConstraints_SRCS} - ${FemResult_SRCS} + ${FemBase_SRCS} + ${FemSet_SRCS} + ${FemConstraints_SRCS} + ${FemResult_SRCS} ${Mod_SRCS} ${Python_SRCS} ) @@ -208,7 +208,7 @@ target_link_libraries(Fem ${Fem_LIBS}) fc_target_copy_resource(Fem ${CMAKE_SOURCE_DIR}/src/Mod/Fem ${CMAKE_BINARY_DIR}/Mod/Fem - Init.py + Init.py ${FemScripts_SRCS} ${FemTests_SRCS} ) diff --git a/src/Mod/Fem/App/FemConstraintDisplacement.cpp b/src/Mod/Fem/App/FemConstraintDisplacement.cpp index 0ced37e6a..57ad752ec 100644 --- a/src/Mod/Fem/App/FemConstraintDisplacement.cpp +++ b/src/Mod/Fem/App/FemConstraintDisplacement.cpp @@ -78,7 +78,7 @@ App::DocumentObjectExecReturn *ConstraintDisplacement::execute(void) const char* ConstraintDisplacement::getViewProviderName(void) const { - return "FemGui::ViewProviderFemConstraintDisplacement"; + return "FemGui::ViewProviderFemConstraintDisplacement"; } void ConstraintDisplacement::onChanged(const App::Property* prop) diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index ab7df1f5e..a468bbae5 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -683,53 +683,53 @@ void FemMesh::readNastran(const std::string &Filename) _Mtrx = Base::Matrix4D(); - std::ifstream inputfile; - inputfile.open(Filename.c_str()); - inputfile.seekg(std::ifstream::beg); - std::string line1,line2,temp; - std::vector token_results; - token_results.clear(); - Base::Vector3d current_node; - std::vector vertices; - vertices.clear(); - std::vector nodal_id; - nodal_id.clear(); - std::vector tetra_element; - std::vector > all_elements; - std::vector element_id; - element_id.clear(); - bool nastran_free_format = false; - do - { - std::getline(inputfile,line1); - if (line1.size() == 0) continue; - 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 - current_node.y = atof(line1.substr(56,72).c_str()); - //Extract Z Value - current_node.z = atof(line2.substr(8,24).c_str()); + std::ifstream inputfile; + inputfile.open(Filename.c_str()); + inputfile.seekg(std::ifstream::beg); + std::string line1,line2,temp; + std::vector token_results; + token_results.clear(); + Base::Vector3d current_node; + std::vector vertices; + vertices.clear(); + std::vector nodal_id; + nodal_id.clear(); + std::vector tetra_element; + std::vector > all_elements; + std::vector element_id; + element_id.clear(); + bool nastran_free_format = false; + do + { + std::getline(inputfile,line1); + if (line1.size() == 0) continue; + 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 + current_node.y = atof(line1.substr(56,72).c_str()); + //Extract Z Value + current_node.z = atof(line2.substr(8,24).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); + 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); unsigned int id = atoi(line1.substr(8,16).c_str()); int offset = 0; @@ -741,111 +741,111 @@ void FemMesh::readNastran(const std::string &Filename) offset = 2; - element_id.push_back(id); - tetra_element.push_back(atoi(line1.substr(24,32).c_str())); - tetra_element.push_back(atoi(line1.substr(32,40).c_str())); - tetra_element.push_back(atoi(line1.substr(40,48).c_str())); - tetra_element.push_back(atoi(line1.substr(48,56).c_str())); - tetra_element.push_back(atoi(line1.substr(56,64).c_str())); - tetra_element.push_back(atoi(line1.substr(64,72).c_str())); - tetra_element.push_back(atoi(line2.substr(8+offset,16+offset).c_str())); - tetra_element.push_back(atoi(line2.substr(16+offset,24+offset).c_str())); - tetra_element.push_back(atoi(line2.substr(24+offset,32+offset).c_str())); - tetra_element.push_back(atoi(line2.substr(32+offset,40+offset).c_str())); + element_id.push_back(id); + tetra_element.push_back(atoi(line1.substr(24,32).c_str())); + tetra_element.push_back(atoi(line1.substr(32,40).c_str())); + tetra_element.push_back(atoi(line1.substr(40,48).c_str())); + tetra_element.push_back(atoi(line1.substr(48,56).c_str())); + tetra_element.push_back(atoi(line1.substr(56,64).c_str())); + tetra_element.push_back(atoi(line1.substr(64,72).c_str())); + tetra_element.push_back(atoi(line2.substr(8+offset,16+offset).c_str())); + tetra_element.push_back(atoi(line2.substr(16+offset,24+offset).c_str())); + tetra_element.push_back(atoi(line2.substr(24+offset,32+offset).c_str())); + tetra_element.push_back(atoi(line2.substr(32+offset,40+offset).c_str())); - all_elements.push_back(tetra_element); - } - else if (nastran_free_format && line1.find("GRID")!= std::string::npos ) //We found a Grid line - { - char_separator sep(","); - tokenizer > 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 sep(","); - tokenizer > 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); + } + else if (nastran_free_format && line1.find("GRID")!= std::string::npos ) //We found a Grid line + { + char_separator sep(","); + tokenizer > 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 sep(","); + tokenizer > 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); - } + all_elements.push_back(tetra_element); + } - } - while (inputfile.good()); - inputfile.close(); + } + while (inputfile.good()); + inputfile.close(); Base::Console().Log(" %f: File read, start building mesh\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo())); - //Now fill the SMESH datastructure - std::vector::const_iterator anodeiterator; - SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS(); - meshds->ClearMesh(); - unsigned int j=0; - for(anodeiterator=vertices.begin(); anodeiterator!=vertices.end(); anodeiterator++) - { - meshds->AddNodeWithID((*anodeiterator).x,(*anodeiterator).y,(*anodeiterator).z,nodal_id[j]); - j++; - } + //Now fill the SMESH datastructure + std::vector::const_iterator anodeiterator; + SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS(); + meshds->ClearMesh(); + unsigned int j=0; + for(anodeiterator=vertices.begin(); anodeiterator!=vertices.end(); anodeiterator++) + { + meshds->AddNodeWithID((*anodeiterator).x,(*anodeiterator).y,(*anodeiterator).z,nodal_id[j]); + j++; + } - for(unsigned int i=0;iAddVolumeWithID - //( - // meshds->FindNode(all_elements[i][0]), - // meshds->FindNode(all_elements[i][2]), - // meshds->FindNode(all_elements[i][1]), - // meshds->FindNode(all_elements[i][3]), - // meshds->FindNode(all_elements[i][6]), - // meshds->FindNode(all_elements[i][5]), - // meshds->FindNode(all_elements[i][4]), - // meshds->FindNode(all_elements[i][9]), - // meshds->FindNode(all_elements[i][7]), - // meshds->FindNode(all_elements[i][8]), - // element_id[i] - //); - meshds->AddVolumeWithID - ( - meshds->FindNode(all_elements[i][1]), - meshds->FindNode(all_elements[i][0]), - meshds->FindNode(all_elements[i][2]), - meshds->FindNode(all_elements[i][3]), - meshds->FindNode(all_elements[i][4]), - meshds->FindNode(all_elements[i][6]), - meshds->FindNode(all_elements[i][5]), - meshds->FindNode(all_elements[i][8]), - meshds->FindNode(all_elements[i][7]), - meshds->FindNode(all_elements[i][9]), - element_id[i] - ); - } + for(unsigned int i=0;iAddVolumeWithID + //( + // meshds->FindNode(all_elements[i][0]), + // meshds->FindNode(all_elements[i][2]), + // meshds->FindNode(all_elements[i][1]), + // meshds->FindNode(all_elements[i][3]), + // meshds->FindNode(all_elements[i][6]), + // meshds->FindNode(all_elements[i][5]), + // meshds->FindNode(all_elements[i][4]), + // meshds->FindNode(all_elements[i][9]), + // meshds->FindNode(all_elements[i][7]), + // meshds->FindNode(all_elements[i][8]), + // element_id[i] + //); + meshds->AddVolumeWithID + ( + meshds->FindNode(all_elements[i][1]), + meshds->FindNode(all_elements[i][0]), + meshds->FindNode(all_elements[i][2]), + meshds->FindNode(all_elements[i][3]), + meshds->FindNode(all_elements[i][4]), + meshds->FindNode(all_elements[i][6]), + meshds->FindNode(all_elements[i][5]), + meshds->FindNode(all_elements[i][8]), + meshds->FindNode(all_elements[i][7]), + meshds->FindNode(all_elements[i][9]), + element_id[i] + ); + } Base::Console().Log(" %f: Done \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo())); } @@ -922,8 +922,8 @@ void FemMesh::writeABAQUS(const std::string &Filename) const // dimension 3 // - //std::vector c3d4 = boost::assign::list_of(0)(3)(1)(2); - //std::vector c3d10 = boost::assign::list_of(0)(2)(1)(3)(6)(5)(4)(7)(9)(8); + //std::vector c3d4 = boost::assign::list_of(0)(3)(1)(2); + //std::vector c3d10 = boost::assign::list_of(0)(2)(1)(3)(6)(5)(4)(7)(9)(8); std::vector c3d4 = boost::assign::list_of(1)(0)(2)(3); std::vector c3d10 = boost::assign::list_of(1)(0)(2)(3)(4)(6)(5)(8)(7)(9); // FIXME: get the right order @@ -1222,16 +1222,16 @@ void FemMesh::RestoreDocFile(Base::Reader &reader) void FemMesh::transformGeometry(const Base::Matrix4D& rclTrf) { - //We perform a translation and rotation of the current active Mesh object - Base::Matrix4D clMatrix(rclTrf); - SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator(); - Base::Vector3d current_node; - for (;aNodeIter->more();) { - const SMDS_MeshNode* aNode = aNodeIter->next(); - current_node.Set(aNode->X(),aNode->Y(),aNode->Z()); - current_node = clMatrix * current_node; - myMesh->GetMeshDS()->MoveNode(aNode,current_node.x,current_node.y,current_node.z); - } + //We perform a translation and rotation of the current active Mesh object + Base::Matrix4D clMatrix(rclTrf); + SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator(); + Base::Vector3d current_node; + for (;aNodeIter->more();) { + const SMDS_MeshNode* aNode = aNodeIter->next(); + current_node.Set(aNode->X(),aNode->Y(),aNode->Z()); + current_node = clMatrix * current_node; + myMesh->GetMeshDS()->MoveNode(aNode,current_node.x,current_node.y,current_node.z); + } } void FemMesh::setTransform(const Base::Matrix4D& rclTrf) @@ -1251,14 +1251,14 @@ Base::BoundBox3d FemMesh::getBoundBox(void) const SMESHDS_Mesh* data = const_cast(getSMesh())->GetMeshDS(); - SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator(); - for (;aNodeIter->more();) { - const SMDS_MeshNode* aNode = aNodeIter->next(); + SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator(); + for (;aNodeIter->more();) { + const SMDS_MeshNode* aNode = aNodeIter->next(); Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z()); // Apply the matrix to hold the BoundBox in absolute space. vec = _Mtrx * vec; box.Add(vec); - } + } return box; } @@ -1294,8 +1294,8 @@ struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo(void) const{ struct FemMeshInfo rtrn; SMESHDS_Mesh* data = const_cast(getSMesh())->GetMeshDS(); - const SMDS_MeshInfo& info = data->GetMeshInfo(); - rtrn.numFaces = data->NbFaces(); + const SMDS_MeshInfo& info = data->GetMeshInfo(); + rtrn.numFaces = data->NbFaces(); rtrn.numNode = info.NbNodes(); rtrn.numTria = info.NbTriangles(); rtrn.numQuad = info.NbQuadrangles(); @@ -1310,37 +1310,37 @@ struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo(void) const{ return rtrn; } -// for(unsigned int i=0;iAddVolumeWithID( -// meshds->FindNode(all_elements[i][0]), -// meshds->FindNode(all_elements[i][2]), -// meshds->FindNode(all_elements[i][1]), -// meshds->FindNode(all_elements[i][3]), -// meshds->FindNode(all_elements[i][6]), -// meshds->FindNode(all_elements[i][5]), -// meshds->FindNode(all_elements[i][4]), -// meshds->FindNode(all_elements[i][9]), -// meshds->FindNode(all_elements[i][7]), -// meshds->FindNode(all_elements[i][8]), -// element_id[i] -// ); -// } +// for(unsigned int i=0;iAddVolumeWithID( +// meshds->FindNode(all_elements[i][0]), +// meshds->FindNode(all_elements[i][2]), +// meshds->FindNode(all_elements[i][1]), +// meshds->FindNode(all_elements[i][3]), +// meshds->FindNode(all_elements[i][6]), +// meshds->FindNode(all_elements[i][5]), +// meshds->FindNode(all_elements[i][4]), +// meshds->FindNode(all_elements[i][9]), +// meshds->FindNode(all_elements[i][7]), +// meshds->FindNode(all_elements[i][8]), +// element_id[i] +// ); +// } Base::Quantity FemMesh::getVolume(void)const { - SMDS_VolumeIteratorPtr aVolIter = myMesh->GetMeshDS()->volumesIterator(); + SMDS_VolumeIteratorPtr aVolIter = myMesh->GetMeshDS()->volumesIterator(); - //Calculate Mesh Volume - //For an accurate Volume Calculation of a quadratic Tetrahedron - //we have to calculate the Volume of 8 Sub-Tetrahedrons - Base::Vector3d a,b,c,a_b_product; - double volume = 0.0; + //Calculate Mesh Volume + //For an accurate Volume Calculation of a quadratic Tetrahedron + //we have to calculate the Volume of 8 Sub-Tetrahedrons + Base::Vector3d a,b,c,a_b_product; + double volume = 0.0; - for (;aVolIter->more();) - { + for (;aVolIter->more();) + { const SMDS_MeshVolume* aVol = aVolIter->next(); if ( aVol->NbNodes() != 10 ) continue; @@ -1357,56 +1357,56 @@ Base::Quantity FemMesh::getVolume(void)const Base::Vector3d v9(aVol->GetNode(9)->X(),aVol->GetNode(9)->Y(),aVol->GetNode(9)->Z()); - //1,5,8,7 - a = v4 -v0 ; - b = v7 -v0 ; - c = v6 -v0 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //5,9,8,7 - a = v8 -v4 ; - b = v7 -v4 ; - c = v6 -v4 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //5,2,9,7 - a = v1 -v4 ; - b = v8 -v4 ; - c = v6 -v4 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //2,6,9,7 - a = v5 -v1 ; - b = v8 -v1 ; - c = v6 -v1 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //9,6,10,7 - a = v5 -v8 ; - b = v9 -v8 ; - c = v6 -v8 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //6,3,10,7 - a = v2 -v5 ; - b = v9 -v5 ; - c = v6 -v5 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //8,9,10,7 - a = v8 -v7 ; - b = v9 -v7 ; - c = v6 -v7 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - //8,9,10,4 - a = v8 -v7 ; - b = v9 -v7 ; - c = v3 -v7 ; - a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; - volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //1,5,8,7 + a = v4 -v0 ; + b = v7 -v0 ; + c = v6 -v0 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //5,9,8,7 + a = v8 -v4 ; + b = v7 -v4 ; + c = v6 -v4 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //5,2,9,7 + a = v1 -v4 ; + b = v8 -v4 ; + c = v6 -v4 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //2,6,9,7 + a = v5 -v1 ; + b = v8 -v1 ; + c = v6 -v1 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //9,6,10,7 + a = v5 -v8 ; + b = v9 -v8 ; + c = v6 -v8 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //6,3,10,7 + a = v2 -v5 ; + b = v9 -v5 ; + c = v6 -v5 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //8,9,10,7 + a = v8 -v7 ; + b = v9 -v7 ; + c = v6 -v7 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); + //8,9,10,4 + a = v8 -v7 ; + b = v9 -v7 ; + c = v3 -v7 ; + a_b_product.x = a.y*b.z-b.y*a.z;a_b_product.y = a.z*b.x-b.z*a.x;a_b_product.z = a.x*b.y-b.x*a.y; + volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z)); - } + } return Base::Quantity(volume,Unit::Volume); diff --git a/src/Mod/Fem/App/FemMeshPy.xml b/src/Mod/Fem/App/FemMeshPy.xml index 706d2df91..186b6e46a 100755 --- a/src/Mod/Fem/App/FemMeshPy.xml +++ b/src/Mod/Fem/App/FemMeshPy.xml @@ -1,242 +1,242 @@ - - - - FemMesh class - - - - set the Part shape to mesh - - - - - Update the internal mesh structure - - - - - Add hypothesis - - - - - Set some standard hypotheses for the whole shape - - - - - Add a node by setting (x,y,z). - - - - - Add an edge by setting two node indices. - - - - - Add a face by setting three node indices. - - - - - Add a quad by setting four node indices. - - - - - Add a volume by setting an arbitrary number of node indices. - - - - - Read in an DAT, UNV, MED or STL file. - - - - - write out an DAT, UNV, MED or STL file. - - - - - write out as ABAQUS. - - - - - Use a Placement object to perform a translation or rotation - - - - - Make a copy of this FEM mesh. - - - - - Return a dict of volume IDs and face IDs which belong to a TopoFace - - - - - Return a dict of volume IDs and ccx face numbers which belong to a TopoFace - - - - - Get the node position vector by an Node-ID - - - - - Return a list of node IDs which belong to a TopoSolid - - - - - Return a list of node IDs which belong to a TopoFace - - - - - Return a list of node IDs which belong to a TopoEdge - - - - - Return a list of node IDs which belong to a TopoVertex - - - - - Return a tuple of node IDs to a given element ID - - - - - Dictionary of Nodes by ID (int ID:Vector()) - - - - - - Number of nodes in the Mesh. - - - - - - Tuple of edge IDs - - - - - - Number of edges in the Mesh. - - - - - - Tuple of face IDs - - - - - - Number of Faces in the Mesh. - - - - - - Number of Triangles in the Mesh. - - - - - - Number of Quadrangles in the Mesh. - - - - - - Number of Quadrangles in the Mesh. - - - - - - Tuple of volume IDs - - - - - - Number of Volumes in the Mesh. - - - - - - Number of Tetras in the Mesh. - - - - - - Number of Hexas in the Mesh. - - - - - - Number of Pyramids in the Mesh. - - - - - - Number of Prisms in the Mesh. - - - - - - Number of Polyhedrons in the Mesh. - - - - - - Number of SubMeshs in the Mesh. - - - - - - Number of Groups in the Mesh. - - - - - - Volume of the mesh. - - - - + + + + FemMesh class + + + + set the Part shape to mesh + + + + + Update the internal mesh structure + + + + + Add hypothesis + + + + + Set some standard hypotheses for the whole shape + + + + + Add a node by setting (x,y,z). + + + + + Add an edge by setting two node indices. + + + + + Add a face by setting three node indices. + + + + + Add a quad by setting four node indices. + + + + + Add a volume by setting an arbitrary number of node indices. + + + + + Read in an DAT, UNV, MED or STL file. + + + + + write out an DAT, UNV, MED or STL file. + + + + + write out as ABAQUS. + + + + + Use a Placement object to perform a translation or rotation + + + + + Make a copy of this FEM mesh. + + + + + Return a dict of volume IDs and face IDs which belong to a TopoFace + + + + + Return a dict of volume IDs and ccx face numbers which belong to a TopoFace + + + + + Get the node position vector by an Node-ID + + + + + Return a list of node IDs which belong to a TopoSolid + + + + + Return a list of node IDs which belong to a TopoFace + + + + + Return a list of node IDs which belong to a TopoEdge + + + + + Return a list of node IDs which belong to a TopoVertex + + + + + Return a tuple of node IDs to a given element ID + + + + + Dictionary of Nodes by ID (int ID:Vector()) + + + + + + Number of nodes in the Mesh. + + + + + + Tuple of edge IDs + + + + + + Number of edges in the Mesh. + + + + + + Tuple of face IDs + + + + + + Number of Faces in the Mesh. + + + + + + Number of Triangles in the Mesh. + + + + + + Number of Quadrangles in the Mesh. + + + + + + Number of Quadrangles in the Mesh. + + + + + + Tuple of volume IDs + + + + + + Number of Volumes in the Mesh. + + + + + + Number of Tetras in the Mesh. + + + + + + Number of Hexas in the Mesh. + + + + + + Number of Pyramids in the Mesh. + + + + + + Number of Prisms in the Mesh. + + + + + + Number of Polyhedrons in the Mesh. + + + + + + Number of SubMeshs in the Mesh. + + + + + + Number of Groups in the Mesh. + + + + + + Volume of the mesh. + + + + diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp index 95acb7e31..1fa9bd287 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp @@ -203,94 +203,94 @@ void ViewProviderFemConstraintDisplacement::updateData(const App::Property* prop //OvG: Translation indication if(!xFree) { - SbMatrix mx; - mx.setTransform(base, rotx, SbVec3f(1,1,1)); - matricesx[idx] = mx; - idx++; - } - if(!yFree) + SbMatrix mx; + mx.setTransform(base, rotx, SbVec3f(1,1,1)); + matricesx[idx] = mx; + idx++; + } + if(!yFree) { - SbMatrix my; - my.setTransform(base, roty, SbVec3f(1,1,1)); - matricesy[idy] = my; - idy++; - } - if(!zFree) + SbMatrix my; + my.setTransform(base, roty, SbVec3f(1,1,1)); + matricesy[idy] = my; + idy++; + } + if(!zFree) { - SbMatrix mz; - mz.setTransform(base, rotz, SbVec3f(1,1,1)); - matricesz[idz] = mz; - idz++; - } + SbMatrix mz; + mz.setTransform(base, rotz, SbVec3f(1,1,1)); + matricesz[idz] = mz; + idz++; + } - //OvG: Rotation indication - if(!rotxFree) + //OvG: Rotation indication + if(!rotxFree) { - SbMatrix mrotx; - mrotx.setTransform(base, rotx, SbVec3f(1,1,1)); - matricesrotx[idrotx] = mrotx; - idrotx++; - } - if(!rotyFree) + SbMatrix mrotx; + mrotx.setTransform(base, rotx, SbVec3f(1,1,1)); + matricesrotx[idrotx] = mrotx; + idrotx++; + } + if(!rotyFree) { - SbMatrix mroty; - mroty.setTransform(base, roty, SbVec3f(1,1,1)); - matricesroty[idroty] = mroty; - idroty++; - } - if(!rotzFree) + SbMatrix mroty; + mroty.setTransform(base, roty, SbVec3f(1,1,1)); + matricesroty[idroty] = mroty; + idroty++; + } + if(!rotzFree) { - SbMatrix mrotz; - mrotz.setTransform(base, rotz, SbVec3f(1,1,1)); - matricesrotz[idrotz] = mrotz; - idrotz++; - } + SbMatrix mrotz; + mrotz.setTransform(base, rotz, SbVec3f(1,1,1)); + matricesrotz[idrotz] = mrotz; + idrotz++; + } #else - //OvG: Translation indication - if(!xFree) + //OvG: Translation indication + if(!xFree) { - SoSeparator* sepx = new SoSeparator(); - createPlacement(sepx, base, rotx); - createDisplacement(sepx, scaledheight, scaledwidth); //OvG: Scaling - pShapeSep->addChild(sepx); - } - if(!yFree) + SoSeparator* sepx = new SoSeparator(); + createPlacement(sepx, base, rotx); + createDisplacement(sepx, scaledheight, scaledwidth); //OvG: Scaling + pShapeSep->addChild(sepx); + } + if(!yFree) { - SoSeparator* sepy = new SoSeparator(); - createPlacement(sepy, base, roty); - createDisplacement(sepy, scaledheight, scaledwidth); //OvG: Scaling - pShapeSep->addChild(sepy); - } - if(!zFree) + SoSeparator* sepy = new SoSeparator(); + createPlacement(sepy, base, roty); + createDisplacement(sepy, scaledheight, scaledwidth); //OvG: Scaling + pShapeSep->addChild(sepy); + } + if(!zFree) { - SoSeparator* sepz = new SoSeparator(); - createPlacement(sepz, base, rotz); - createDisplacement(sepz, scaledheight, scaledwidth); //OvG: Scaling - pShapeSep->addChild(sepz); - } + SoSeparator* sepz = new SoSeparator(); + createPlacement(sepz, base, rotz); + createDisplacement(sepz, scaledheight, scaledwidth); //OvG: Scaling + pShapeSep->addChild(sepz); + } - //OvG: Rotation indication - if(!rotxFree) + //OvG: Rotation indication + if(!rotxFree) { - SoSeparator* sepx = new SoSeparator(); - createPlacement(sepx, base, rotx); - createRotation(sepx, scaledheight, scaledwidth); //OvG: Scaling - pShapeSep->addChild(sepx); - } - if(!rotyFree) + SoSeparator* sepx = new SoSeparator(); + createPlacement(sepx, base, rotx); + createRotation(sepx, scaledheight, scaledwidth); //OvG: Scaling + pShapeSep->addChild(sepx); + } + if(!rotyFree) { - SoSeparator* sepy = new SoSeparator(); - createPlacement(sepy, base, roty); - createRotation(sepy, scaledheight, scaledwidth); //OvG: Scaling - pShapeSep->addChild(sepy); - } - if(!rotzFree) + SoSeparator* sepy = new SoSeparator(); + createPlacement(sepy, base, roty); + createRotation(sepy, scaledheight, scaledwidth); //OvG: Scaling + pShapeSep->addChild(sepy); + } + if(!rotzFree) { - SoSeparator* sepz = new SoSeparator(); - createPlacement(sepz, base, rotz); - createRotation(sepz, scaledheight, scaledwidth); //OvG: Scaling - pShapeSep->addChild(sepz); - } + SoSeparator* sepz = new SoSeparator(); + createPlacement(sepz, base, rotz); + createRotation(sepz, scaledheight, scaledwidth); //OvG: Scaling + pShapeSep->addChild(sepz); + } #endif n++; } diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml b/src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml index 41a34f02a..75814be5f 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml @@ -1,64 +1,64 @@ - - - - ViewProviderFemMesh class - - - - - - - - - Sets mesh node colors using element list and value list. - - - - - - - - - - Postprocessing color of the nodes. The faces between the nodes gets interpolated. - - - - - - Postprocessing color of the elements. All faces of the element get the same color. - - - - - - Postprocessing color of the the nodes. The faces between the nodes gets interpolated. - - - - - - List of nodes which gets highlighted - - - - - - A List of elements and faces which are actually shown. This are all surface faces of the mesh - - - - + + + + ViewProviderFemMesh class + + + + + + + + + Sets mesh node colors using element list and value list. + + + + + + + + + + Postprocessing color of the nodes. The faces between the nodes gets interpolated. + + + + + + Postprocessing color of the elements. All faces of the element get the same color. + + + + + + Postprocessing color of the the nodes. The faces between the nodes gets interpolated. + + + + + + List of nodes which gets highlighted + + + + + + A List of elements and faces which are actually shown. This are all surface faces of the mesh + + + +