mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-10 23:37:28 +05:00
[Bug PAL7850] REGRESSION: The imported mesh from .unv file has inversion orientation.
This commit is contained in:
parent
8cc5e7af94
commit
2c23c066a7
@ -17,14 +17,6 @@ static int MYDEBUG = 0;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const SMDS_MeshNode*
|
|
||||||
FindNode(const SMDS_Mesh* theMesh, int theId){
|
|
||||||
const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
|
|
||||||
if(aNode) return aNode;
|
|
||||||
EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
|
Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
|
||||||
{
|
{
|
||||||
Status aResult = DRS_OK;
|
Status aResult = DRS_OK;
|
||||||
@ -39,7 +31,6 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
|
|||||||
for(; anIter != aDataSet2411.end(); anIter++){
|
for(; anIter != aDataSet2411.end(); anIter++){
|
||||||
const TNodeLab& aLabel = anIter->first;
|
const TNodeLab& aLabel = anIter->first;
|
||||||
const TRecord& aRec = anIter->second;
|
const TRecord& aRec = anIter->second;
|
||||||
const SMDS_MeshNode* aNode =
|
|
||||||
myMesh->AddNodeWithID(aRec.coord[0],aRec.coord[1],aRec.coord[2],aLabel);
|
myMesh->AddNodeWithID(aRec.coord[0],aRec.coord[1],aRec.coord[2],aLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +45,6 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
|
|||||||
SMDS_MeshElement* anElement = NULL;
|
SMDS_MeshElement* anElement = NULL;
|
||||||
const TElementLab& aLabel = anIter->first;
|
const TElementLab& aLabel = anIter->first;
|
||||||
const TRecord& aRec = anIter->second;
|
const TRecord& aRec = anIter->second;
|
||||||
int aNbNodes = aRec.node_labels.size();
|
|
||||||
if(IsBeam(aRec.fe_descriptor_id)){
|
if(IsBeam(aRec.fe_descriptor_id)){
|
||||||
anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
|
anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
|
||||||
aRec.node_labels[1],
|
aRec.node_labels[1],
|
||||||
@ -96,8 +86,8 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
|
|||||||
case 118: // Solid Quadratic Tetrahedron - TET10
|
case 118: // Solid Quadratic Tetrahedron - TET10
|
||||||
|
|
||||||
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
|
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
|
||||||
aRec.node_labels[1],
|
|
||||||
aRec.node_labels[2],
|
aRec.node_labels[2],
|
||||||
|
aRec.node_labels[1],
|
||||||
aRec.node_labels[3],
|
aRec.node_labels[3],
|
||||||
aLabel);
|
aLabel);
|
||||||
break;
|
break;
|
||||||
@ -125,28 +115,27 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 115: // Solid Linear Brick - HEX8
|
case 115: // Solid Linear Brick - HEX8
|
||||||
|
|
||||||
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
|
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
|
||||||
aRec.node_labels[1],
|
|
||||||
aRec.node_labels[2],
|
|
||||||
aRec.node_labels[3],
|
aRec.node_labels[3],
|
||||||
|
aRec.node_labels[2],
|
||||||
|
aRec.node_labels[1],
|
||||||
aRec.node_labels[4],
|
aRec.node_labels[4],
|
||||||
aRec.node_labels[5],
|
|
||||||
aRec.node_labels[6],
|
|
||||||
aRec.node_labels[7],
|
aRec.node_labels[7],
|
||||||
|
aRec.node_labels[6],
|
||||||
|
aRec.node_labels[5],
|
||||||
aLabel);
|
aLabel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 116: // Solid Quadratic Brick - HEX20
|
case 116: // Solid Quadratic Brick - HEX20
|
||||||
|
|
||||||
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
|
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
|
||||||
aRec.node_labels[2],
|
|
||||||
aRec.node_labels[4],
|
|
||||||
aRec.node_labels[6],
|
aRec.node_labels[6],
|
||||||
|
aRec.node_labels[4],
|
||||||
|
aRec.node_labels[2],
|
||||||
aRec.node_labels[12],
|
aRec.node_labels[12],
|
||||||
aRec.node_labels[14],
|
|
||||||
aRec.node_labels[16],
|
|
||||||
aRec.node_labels[18],
|
aRec.node_labels[18],
|
||||||
|
aRec.node_labels[16],
|
||||||
|
aRec.node_labels[14],
|
||||||
aLabel);
|
aLabel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,22 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace{
|
||||||
|
typedef std::vector<size_t> TConnect;
|
||||||
|
|
||||||
|
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
|
||||||
|
TConnect& theConnect)
|
||||||
|
{
|
||||||
|
theConnect.clear();
|
||||||
|
for(; theNodesIter->more();){
|
||||||
|
const SMDS_MeshElement* anElem = theNodesIter->next();
|
||||||
|
theConnect.push_back(anElem->GetID());
|
||||||
|
}
|
||||||
|
return theConnect.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||||
{
|
{
|
||||||
Status aResult = DRS_OK;
|
Status aResult = DRS_OK;
|
||||||
@ -58,13 +74,15 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
|||||||
{
|
{
|
||||||
using namespace UNV2412;
|
using namespace UNV2412;
|
||||||
TDataSet aDataSet2412;
|
TDataSet aDataSet2412;
|
||||||
|
TConnect aConnect;
|
||||||
|
|
||||||
// Storing SMDS Edges
|
// Storing SMDS Edges
|
||||||
MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());
|
MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());
|
||||||
if(myMesh->NbEdges()){
|
if(myMesh->NbEdges()){
|
||||||
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
|
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
|
||||||
for(; anIter->more();){
|
for(; anIter->more();){
|
||||||
const SMDS_MeshEdge* anElem = anIter->next();
|
const SMDS_MeshEdge* anElem = anIter->next();
|
||||||
const TElementLab& aLabel = anElem->GetID();
|
TElementLab aLabel = anElem->GetID();
|
||||||
int aNbNodes = anElem->NbNodes();
|
int aNbNodes = anElem->NbNodes();
|
||||||
TRecord aRec;
|
TRecord aRec;
|
||||||
aRec.node_labels.reserve(aNbNodes);
|
aRec.node_labels.reserve(aNbNodes);
|
||||||
@ -78,12 +96,13 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
|||||||
}
|
}
|
||||||
MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
|
MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
MESSAGE("Perform - myMesh->NbFaces() = "<<myMesh->NbFaces());
|
MESSAGE("Perform - myMesh->NbFaces() = "<<myMesh->NbFaces());
|
||||||
if(myMesh->NbFaces()){
|
if(myMesh->NbFaces()){
|
||||||
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
|
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
|
||||||
for(; anIter->more();){
|
for(; anIter->more();){
|
||||||
const SMDS_MeshFace* anElem = anIter->next();
|
const SMDS_MeshFace* anElem = anIter->next();
|
||||||
const TElementLab& aLabel = anElem->GetID();
|
TElementLab aLabel = anElem->GetID();
|
||||||
int aNbNodes = anElem->NbNodes();
|
int aNbNodes = anElem->NbNodes();
|
||||||
TRecord aRec;
|
TRecord aRec;
|
||||||
aRec.node_labels.reserve(aNbNodes);
|
aRec.node_labels.reserve(aNbNodes);
|
||||||
@ -106,37 +125,54 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
|||||||
}
|
}
|
||||||
MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
|
MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
MESSAGE("Perform - myMesh->NbVolumes() = "<<myMesh->NbVolumes());
|
MESSAGE("Perform - myMesh->NbVolumes() = "<<myMesh->NbVolumes());
|
||||||
if(myMesh->NbVolumes()){
|
if(myMesh->NbVolumes()){
|
||||||
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
|
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
|
||||||
for(; anIter->more();){
|
for(; anIter->more();){
|
||||||
const SMDS_MeshVolume* anElem = anIter->next();
|
const SMDS_MeshVolume* anElem = anIter->next();
|
||||||
const TElementLab& aLabel = anElem->GetID();
|
TElementLab aLabel = anElem->GetID();
|
||||||
|
|
||||||
int aNbNodes = anElem->NbNodes();
|
int aNbNodes = anElem->NbNodes();
|
||||||
TRecord aRec;
|
aConnect.resize(aNbNodes);
|
||||||
aRec.node_labels.reserve(aNbNodes);
|
|
||||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||||
for(; aNodesIter->more();){
|
GetConnect(aNodesIter,aConnect);
|
||||||
const SMDS_MeshElement* aNode = aNodesIter->next();
|
|
||||||
aRec.node_labels.push_back(aNode->GetID());
|
int anId = -1;
|
||||||
}
|
int* aConn = NULL;
|
||||||
switch(aNbNodes){
|
switch(aNbNodes){
|
||||||
case 4:
|
case 4: {
|
||||||
aRec.fe_descriptor_id = 111;
|
static int anIds[] = {0,2,1,3};
|
||||||
|
aConn = anIds;
|
||||||
|
anId = 111;
|
||||||
break;
|
break;
|
||||||
case 6:
|
}
|
||||||
aRec.fe_descriptor_id = 112;
|
case 6: {
|
||||||
swap(aRec.node_labels[1],aRec.node_labels[2]);
|
static int anIds[] = {0,2,1,3,5,4};
|
||||||
swap(aRec.node_labels[4],aRec.node_labels[5]);
|
aConn = anIds;
|
||||||
|
anId = 112;
|
||||||
break;
|
break;
|
||||||
case 8:
|
}
|
||||||
aRec.fe_descriptor_id = 115;
|
case 8: {
|
||||||
|
static int anIds[] = {0,3,2,1,4,7,6,5};
|
||||||
|
aConn = anIds;
|
||||||
|
anId = 115;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(aConn){
|
||||||
|
TRecord aRec;
|
||||||
|
aRec.fe_descriptor_id = anId;
|
||||||
|
aRec.node_labels.resize(aNbNodes);
|
||||||
|
for(int aNodeId = 0; aNodeId < aNbNodes; aNodeId++){
|
||||||
|
aRec.node_labels[aConn[aNodeId]] = aConnect[aNodeId];
|
||||||
|
}
|
||||||
aDataSet2412.insert(TDataSet::value_type(aLabel,aRec));
|
aDataSet2412.insert(TDataSet::value_type(aLabel,aRec));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
|
MESSAGE("Perform - aDataSet2412.size() = "<<aDataSet2412.size());
|
||||||
}
|
}
|
||||||
UNV2412::Write(out_stream,aDataSet2412);
|
UNV2412::Write(out_stream,aDataSet2412);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user