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 Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
22 Status aResult = DRS_OK;
23 std::ifstream in_stream(myFile.c_str());
26 using namespace UNV2411;
27 TDataSet aDataSet2411;
28 UNV2411::Read(in_stream,aDataSet2411);
29 if(MYDEBUG) MESSAGE("Perform - aDataSet2411.size() = "<<aDataSet2411.size());
30 TDataSet::const_iterator anIter = aDataSet2411.begin();
31 for(; anIter != aDataSet2411.end(); anIter++){
32 const TNodeLab& aLabel = anIter->first;
33 const TRecord& aRec = anIter->second;
34 myMesh->AddNodeWithID(aRec.coord[0],aRec.coord[1],aRec.coord[2],aLabel);
38 using namespace UNV2412;
40 TDataSet aDataSet2412;
41 UNV2412::Read(in_stream,aDataSet2412);
42 TDataSet::const_iterator anIter = aDataSet2412.begin();
43 if(MYDEBUG) MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
44 for(; anIter != aDataSet2412.end(); anIter++){
45 SMDS_MeshElement* anElement = NULL;
46 const TElementLab& aLabel = anIter->first;
47 const TRecord& aRec = anIter->second;
48 if(IsBeam(aRec.fe_descriptor_id)){
49 anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
52 }else if(IsFace(aRec.fe_descriptor_id)){
53 switch(aRec.fe_descriptor_id){
58 case 41: // Plane Stress Linear Triangle - TRI3
59 case 91: // Thin Shell Linear Triangle - TRI3
61 case 42: // Plane Stress Quadratic Triangle - TRI6
62 case 92: // Thin Shell Quadratic Triangle - TRI6
64 anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
70 case 44: // Plane Stress Linear Quadrilateral - QUAD4
71 case 94: // Thin Shell Linear Quadrilateral - QUAD4
73 case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
74 case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
75 anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
82 }else if(IsVolume(aRec.fe_descriptor_id)){
83 switch(aRec.fe_descriptor_id){
85 case 111: // Solid Linear Tetrahedron - TET4
86 case 118: // Solid Quadratic Tetrahedron - TET10
88 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
95 case 112: // Solid Linear Prism - PRISM6
97 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
106 case 113: // Solid Quadratic Prism - PRISM15
108 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
112 aRec.node_labels[13],
113 aRec.node_labels[11],
117 case 115: // Solid Linear Brick - HEX8
118 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
129 case 116: // Solid Quadratic Brick - HEX20
131 anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
135 aRec.node_labels[12],
136 aRec.node_labels[18],
137 aRec.node_labels[16],
138 aRec.node_labels[14],
144 MESSAGE("DriverUNV_R_SMDS_Mesh::Perform - can not add element with ID = "<<aLabel<<" and type = "<<aRec.fe_descriptor_id);
147 }catch(const std::exception& exc){
148 INFOS("Follow exception was cought:\n\t"<<exc.what());
150 INFOS("Unknown exception was cought !!!");