1 #include "DriverUNV_R_SMDS_Mesh.h"
2 #include "SMDS_Mesh.hxx"
6 #include "UNV2411_Structure.hxx"
7 #include "UNV2412_Structure.hxx"
8 #include "UNV_Utilities.hxx"
14 static int MYDEBUG = 0;
16 static int MYDEBUG = 0;
20 static const SMDS_MeshNode*
21 FindNode(const SMDS_Mesh* theMesh, int theId){
22 const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
23 if(aNode) return aNode;
24 EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
28 Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
30 Status aResult = DRS_OK;
31 std::ifstream in_stream(myFile.c_str());
34 using namespace UNV2411;
35 TDataSet aDataSet2411;
36 UNV2411::Read(in_stream,aDataSet2411);
37 if(MYDEBUG) MESSAGE("Perform - aDataSet2411.size() = "<<aDataSet2411.size());
38 TDataSet::const_iterator anIter = aDataSet2411.begin();
39 for(; anIter != aDataSet2411.end(); anIter++){
40 const TNodeLab& aLabel = anIter->first;
41 const TRecord& aRec = anIter->second;
42 const SMDS_MeshNode* aNode =
43 myMesh->AddNodeWithID(aRec.coord[0],aRec.coord[1],aRec.coord[2],aLabel);
47 using namespace UNV2412;
49 TDataSet aDataSet2412;
50 UNV2412::Read(in_stream,aDataSet2412);
51 TDataSet::const_iterator anIter = aDataSet2412.begin();
52 if(MYDEBUG) MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
53 for(; anIter != aDataSet2412.end(); anIter++){
54 SMDS_MeshElement* anElement = NULL;
55 const TElementLab& aLabel = anIter->first;
56 const TRecord& aRec = anIter->second;
57 int aNbNodes = aRec.node_labels.size();
58 if(IsBeam(aRec.fe_descriptor_id)){
59 anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
62 }else if(IsFace(aRec.fe_descriptor_id)){
63 switch(aRec.fe_descriptor_id){
68 case 41: // Plane Stress Linear Triangle - TRI3
69 case 91: // Thin Shell Linear Triangle - TRI3
71 case 42: // Plane Stress Quadratic Triangle - TRI6
72 case 92: // Thin Shell Quadratic Triangle - TRI6
74 anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
80 case 44: // Plane Stress Linear Quadrilateral - QUAD4
81 case 94: // Thin Shell Linear Quadrilateral - QUAD4
83 case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
84 case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
85 anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
92 }else if(IsVolume(aRec.fe_descriptor_id)){
93 switch(aRec.fe_descriptor_id){
95 case 111: // Solid Linear Tetrahedron - TET4
96 case 118: // Solid Quadratic Tetrahedron - TET10
98 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
105 case 112: // Solid Linear Prism - PRISM6
107 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
116 case 113: // Solid Quadratic Prism - PRISM15
118 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
122 aRec.node_labels[13],
123 aRec.node_labels[11],
127 case 115: // Solid Linear Brick - HEX8
129 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
140 case 116: // Solid Quadratic Brick - HEX20
142 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
146 aRec.node_labels[12],
147 aRec.node_labels[14],
148 aRec.node_labels[16],
149 aRec.node_labels[18],
155 MESSAGE("DriverUNV_R_SMDS_Mesh::Perform - can not add element with ID = "<<aLabel<<" and type = "<<aRec.fe_descriptor_id);
158 }catch(const std::exception& exc){
159 INFOS("Follow exception was cought:\n\t"<<exc.what());
161 INFOS("Unknown exception was cought !!!");