diff --git a/Makefile.in b/Makefile.in
index f3a90dfb5..c01512951 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -131,7 +131,14 @@ mesh_pattern.png \
pattern_sample_2d.png \
pattern_sample_3D.png \
mesh_add.png \
-mesh_remove.png
+mesh_remove.png \
+mesh_quad_edge.png \
+mesh_quad_triangle.png \
+mesh_quad_quadrangle.png \
+mesh_quad_tetrahedron.png \
+mesh_quad_pyramid.png \
+mesh_quad_pentahedron.png \
+mesh_quad_hexahedron.png
BIN_SCRIPT= \
VERSION
diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl
index b6367b75d..7880020e7 100644
--- a/idl/SMESH_BasicHypothesis.idl
+++ b/idl/SMESH_BasicHypothesis.idl
@@ -286,6 +286,20 @@ module StdMeshers
{
};
+ /*!
+ * StdMeshers_QuadraticMesh: interface of "QuadraticMesh" hypothesis.
+ * This is an auxiliary 1D hypothesis whose presence forces construction
+ * of quadratic edges.
+ * If the 2D mesher sees that all boundary edges are quadratic ones,
+ * it generates quadratic faces, else it generates linear faces using
+ * medium nodes as if they were vertex ones.
+ * The 3D mesher generates quadratic volumes only if all boundary faces
+ * are quadratic ones, else it fails.
+ */
+ interface StdMeshers_QuadraticMesh : SMESH::SMESH_Hypothesis
+ {
+ };
+
/*!
* StdMeshers_Regular_1D: interface of "Wire discretisation" algorithm
diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl
index 5a2915c8d..4b7b54707 100644
--- a/idl/SMESH_Mesh.idl
+++ b/idl/SMESH_Mesh.idl
@@ -69,7 +69,14 @@ module SMESH
MOVE_NODE,
CHANGE_ELEMENT_NODES,
CHANGE_POLYHEDRON_NODES,
- RENUMBER
+ RENUMBER,
+ ADD_QUADEDGE,
+ ADD_QUADTRIANGLE,
+ ADD_QUADQUADRANGLE,
+ ADD_QUADTETRAHEDRON,
+ ADD_QUADPYRAMID,
+ ADD_QUADPENTAHEDRON,
+ ADD_QUADHEXAHEDRON
};
struct log_block
@@ -526,6 +533,8 @@ module SMESH
boolean AddFace(in long_array IDsOfNodes);
+ boolean AddPolygonalFace(in long_array IdsOfNodes);
+
boolean AddVolume(in long_array IDsOfNodes);
/*!
diff --git a/resources/StdMeshers.xml b/resources/StdMeshers.xml
index 2c1cd12cc..6daf06253 100644
--- a/resources/StdMeshers.xml
+++ b/resources/StdMeshers.xml
@@ -57,6 +57,12 @@
icon-id="mesh_algo_quad.png"
dim="2"/>
+
+
FindElement( theId );
- if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
+ if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge/* || anEdge->NbNodes() != 2 */)
return 0;
- TColStd_MapOfInteger aMap;
+ // for each pair of nodes in anEdge (there are 2 pairs in a quadratic edge)
+ // count elements containing both nodes of the pair.
+ // Note that there may be such cases for a quadratic edge (a horizontal line):
+ //
+ // Case 1 Case 2
+ // | | | | |
+ // | | | | |
+ // +-----+------+ +-----+------+
+ // | | | |
+ // | | | |
+ // result sould be 2 in both cases
+ //
+ int aResult0 = 0, aResult1 = 0;
+ // last node, it is a medium one in a quadratic edge
+ const SMDS_MeshNode* aLastNode = anEdge->GetNode( anEdge->NbNodes() - 1 );
+ const SMDS_MeshNode* aNode0 = anEdge->GetNode( 0 );
+ const SMDS_MeshNode* aNode1 = anEdge->GetNode( 1 );
+ if ( aNode1 == aLastNode ) aNode1 = 0;
- int aResult = 0;
- SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
- if ( anIter != 0 ) {
- while( anIter->more() ) {
- const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
- if ( aNode == 0 )
- return 0;
- SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
- while( anElemIter->more() ) {
- const SMDS_MeshElement* anElem = anElemIter->next();
- if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
- int anId = anElem->GetID();
-
- if ( anIter->more() ) // i.e. first node
- aMap.Add( anId );
- else if ( aMap.Contains( anId ) )
- aResult++;
- }
- }
+ SMDS_ElemIteratorPtr anElemIter = aLastNode->GetInverseElementIterator();
+ while( anElemIter->more() ) {
+ const SMDS_MeshElement* anElem = anElemIter->next();
+ if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ while ( anIter->more() ) {
+ if ( const SMDS_MeshElement* anElemNode = anIter->next() ) {
+ if ( anElemNode == aNode0 ) {
+ aResult0++;
+ if ( !aNode1 ) break; // not a quadratic edge
+ }
+ else if ( anElemNode == aNode1 )
+ aResult1++;
+ }
+ }
}
}
+ int aResult = max ( aResult0, aResult1 );
+
+// TColStd_MapOfInteger aMap;
+
+// SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+// if ( anIter != 0 ) {
+// while( anIter->more() ) {
+// const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+// if ( aNode == 0 )
+// return 0;
+// SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
+// while( anElemIter->more() ) {
+// const SMDS_MeshElement* anElem = anElemIter->next();
+// if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
+// int anId = anElem->GetID();
+
+// if ( anIter->more() ) // i.e. first node
+// aMap.Add( anId );
+// else if ( aMap.Contains( anId ) )
+// aResult++;
+// }
+// }
+// }
+// }
return aResult;
}
@@ -154,23 +193,41 @@ bool NumericalFunctor::GetPoints(const int theId,
}
bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
- TSequenceOfXYZ& theRes )
+ TSequenceOfXYZ& theRes )
{
theRes.clear();
if ( anElem == 0)
return false;
+ theRes.reserve( anElem->NbNodes() );
+
// Get nodes of the element
- SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
- if ( anIter != 0 )
- {
- while( anIter->more() )
- {
- const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
- if ( aNode != 0 ){
+ SMDS_ElemIteratorPtr anIter;
+
+ if ( anElem->IsQuadratic() ) {
+ switch ( anElem->GetType() ) {
+ case SMDSAbs_Edge:
+ anIter = static_cast
+ (anElem)->interlacedNodesElemIterator();
+ break;
+ case SMDSAbs_Face:
+ anIter = static_cast
+ (anElem)->interlacedNodesElemIterator();
+ break;
+ default:
+ anIter = anElem->nodesIterator();
+ //return false;
+ }
+ }
+ else {
+ anIter = anElem->nodesIterator();
+ }
+
+ if ( anIter ) {
+ while( anIter->more() ) {
+ if ( const SMDS_MeshNode* aNode = static_cast( anIter->next() ))
theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
- }
}
}
@@ -285,6 +342,7 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
// According to "Mesh quality control" by Nadir Bouhamau referring to
// Pascal Jean Frey and Paul-Louis George. Maillages, applications aux elements finis.
// Hermes Science publications, Paris 1999 ISBN 2-7462-0024-4
+ // PAL10872
int nbNodes = P.size();
@@ -840,22 +898,21 @@ SMDSAbs_ElementType Skew::GetType() const
*/
double Area::GetValue( const TSequenceOfXYZ& P )
{
- double aArea = 0;
- if ( P.size() == 3 )
- return getArea( P( 1 ), P( 2 ), P( 3 ) );
- else if (P.size() > 3)
- aArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
- else
- return 0;
-
- for (int i=4; i<=P.size(); i++)
- aArea += getArea(P(1),P(i-1),P(i));
- return aArea;
+ gp_Vec aVec1( P(2) - P(1) );
+ gp_Vec aVec2( P(3) - P(1) );
+ gp_Vec SumVec = aVec1 ^ aVec2;
+ for (int i=4; i<=P.size(); i++) {
+ gp_Vec aVec1( P(i-1) - P(1) );
+ gp_Vec aVec2( P(i) - P(1) );
+ gp_Vec tmp = aVec1 ^ aVec2;
+ SumVec.Add(tmp);
+ }
+ return SumVec.Magnitude() * 0.5;
}
double Area::GetBadRate( double Value, int /*nbNodes*/ ) const
{
- // meaningless as it is not quality control functor
+ // meaningless as it is not a quality control functor
return Value;
}
@@ -871,7 +928,11 @@ SMDSAbs_ElementType Area::GetType() const
*/
double Length::GetValue( const TSequenceOfXYZ& P )
{
- return ( P.size() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0 );
+ switch ( P.size() ) {
+ case 2: return getDistance( P( 1 ), P( 2 ) );
+ case 3: return getDistance( P( 1 ), P( 2 ) ) + getDistance( P( 2 ), P( 3 ) );
+ default: return 0.;
+ }
}
double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
@@ -894,7 +955,10 @@ double Length2D::GetValue( long theElementId)
{
TSequenceOfXYZ P;
+ //cout<<"Length2D::GetValue"<FindElement( theElementId );
@@ -908,7 +972,11 @@ double Length2D::GetValue( long theElementId)
case SMDSAbs_Edge:
if (len == 2){
aVal = getDistance( P( 1 ), P( 2 ) );
- break;
+ break;
+ }
+ else if (len == 3){ // quadratic edge
+ aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
+ break;
}
case SMDSAbs_Face:
if (len == 3){ // triangles
@@ -926,6 +994,22 @@ double Length2D::GetValue( long theElementId)
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
}
+ if (len == 6){ // quadratic triangles
+ double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
+ double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
+ double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
+ aVal = Max(L1,Max(L2,L3));
+ //cout<<"L1="<NbNodes();
/* Combien de mailles, faces ou aretes ? */
- int nb_of_nodes, nb_of_edges, nb_of_faces, nb_of_volumes;
+ int /*nb_of_nodes,*/ nb_of_edges, nb_of_faces, nb_of_volumes;
nb_of_edges = myMesh->NbEdges();
nb_of_faces = myMesh->NbFaces();
nb_of_volumes = myMesh->NbVolumes();
diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
index 9a9a31c23..49c645f47 100644
--- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
+++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx
@@ -311,242 +311,385 @@ DriverMED_R_SMESHDS_Mesh
break;
}
default: {
- PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
- EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
- TInt aNbElems = aCellInfo->GetNbElem();
- if(MYDEBUG) MESSAGE("Perform - anEntity = "<GetFamNum(iElem);
+ }catch(const std::exception& exc){
+ //INFOS("Follow exception was cought:\n\t"<GetFamNum(iElem);
#ifndef _DEXCEPT_
- try{
+ try{
#endif
- //MESSAGE("Try to create element # " << iElem << " with id = "
- // << aCellInfo->GetElemNum(iElem));
- switch(aGeom){
- case eSEG2:
- case eSEG3:
- if(anIsElemNum)
- anElement = myMesh->AddEdgeWithID(aNodeIds[0],
- aNodeIds[1],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddEdge(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]));
- isRenum = anIsElemNum;
- }
- break;
- case eTRIA3:
- case eTRIA6:
- aNbNodes = 3;
- if(anIsElemNum)
- anElement = myMesh->AddFaceWithID(aNodeIds[0],
- aNodeIds[1],
- aNodeIds[2],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]),
- FindNode(myMesh,aNodeIds[2]));
- isRenum = anIsElemNum;
- }
- break;
- case eQUAD4:
- case eQUAD8:
- aNbNodes = 4;
- // There is some differnce between SMDS and MED
- if(anIsElemNum)
- anElement = myMesh->AddFaceWithID(aNodeIds[0],
- aNodeIds[1],
- aNodeIds[2],
- aNodeIds[3],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]),
- FindNode(myMesh,aNodeIds[2]),
- FindNode(myMesh,aNodeIds[3]));
- isRenum = anIsElemNum;
- }
- break;
- case eTETRA4:
- case eTETRA10:
- aNbNodes = 4;
- if(anIsElemNum)
- anElement = myMesh->AddVolumeWithID(aNodeIds[0],
- aNodeIds[1],
- aNodeIds[2],
- aNodeIds[3],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]),
- FindNode(myMesh,aNodeIds[2]),
- FindNode(myMesh,aNodeIds[3]));
- isRenum = anIsElemNum;
- }
- break;
- case ePYRA5:
- case ePYRA13:
- aNbNodes = 5;
- // There is some differnce between SMDS and MED
- if(anIsElemNum)
- anElement = myMesh->AddVolumeWithID(aNodeIds[0],
- aNodeIds[1],
- aNodeIds[2],
- aNodeIds[3],
- aNodeIds[4],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]),
- FindNode(myMesh,aNodeIds[2]),
- FindNode(myMesh,aNodeIds[3]),
- FindNode(myMesh,aNodeIds[4]));
- isRenum = anIsElemNum;
- }
- break;
- case ePENTA6:
- case ePENTA15:
- aNbNodes = 6;
- if(anIsElemNum)
- anElement = myMesh->AddVolumeWithID(aNodeIds[0],
- aNodeIds[1],
- aNodeIds[2],
- aNodeIds[3],
- aNodeIds[4],
- aNodeIds[5],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]),
- FindNode(myMesh,aNodeIds[2]),
- FindNode(myMesh,aNodeIds[3]),
- FindNode(myMesh,aNodeIds[4]),
- FindNode(myMesh,aNodeIds[5]));
- isRenum = anIsElemNum;
- }
- break;
- case eHEXA8:
- case eHEXA20:
- aNbNodes = 8;
- if(anIsElemNum)
- anElement = myMesh->AddVolumeWithID(aNodeIds[0],
- aNodeIds[1],
- aNodeIds[2],
- aNodeIds[3],
- aNodeIds[4],
- aNodeIds[5],
- aNodeIds[6],
- aNodeIds[7],
- aCellInfo->GetElemNum(iElem));
- if (!anElement) {
- anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
- FindNode(myMesh,aNodeIds[1]),
- FindNode(myMesh,aNodeIds[2]),
- FindNode(myMesh,aNodeIds[3]),
- FindNode(myMesh,aNodeIds[4]),
- FindNode(myMesh,aNodeIds[5]),
- FindNode(myMesh,aNodeIds[6]),
- FindNode(myMesh,aNodeIds[7]));
- isRenum = anIsElemNum;
- }
- break;
- }
+ //MESSAGE("Try to create element # " << iElem << " with id = "
+ // << aCellInfo->GetElemNum(iElem));
+ switch(aGeom){
+ case eSEG2:
+ if(anIsElemNum)
+ anElement = myMesh->AddEdgeWithID(aNodeIds[0],
+ aNodeIds[1],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddEdge(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eSEG3:
+ if(anIsElemNum)
+ anElement = myMesh->AddEdgeWithID(aNodeIds[0],
+ aNodeIds[1],
+ aNodeIds[2],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddEdge(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eTRIA3:
+ aNbNodes = 3;
+ if(anIsElemNum)
+ anElement = myMesh->AddFaceWithID(aNodeIds[0],
+ aNodeIds[1],
+ aNodeIds[2],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eTRIA6:
+ aNbNodes = 6;
+ if(anIsElemNum)
+ anElement = myMesh->AddFaceWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eQUAD4:
+ aNbNodes = 4;
+ if(anIsElemNum)
+ anElement = myMesh->AddFaceWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eQUAD8:
+ aNbNodes = 8;
+ if(anIsElemNum)
+ anElement = myMesh->AddFaceWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5],
+ aNodeIds[6], aNodeIds[7],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddFace(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]),
+ FindNode(myMesh,aNodeIds[7]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eTETRA4:
+ aNbNodes = 4;
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eTETRA10:
+ aNbNodes = 10;
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5],
+ aNodeIds[6], aNodeIds[7],
+ aNodeIds[8], aNodeIds[9],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]),
+ FindNode(myMesh,aNodeIds[7]),
+ FindNode(myMesh,aNodeIds[8]),
+ FindNode(myMesh,aNodeIds[9]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case ePYRA5:
+ aNbNodes = 5;
+ // There is some differnce between SMDS and MED
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case ePYRA13:
+ aNbNodes = 13;
+ // There is some differnce between SMDS and MED
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5],
+ aNodeIds[6], aNodeIds[7],
+ aNodeIds[8], aNodeIds[9],
+ aNodeIds[10], aNodeIds[11],
+ aNodeIds[12],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]),
+ FindNode(myMesh,aNodeIds[7]),
+ FindNode(myMesh,aNodeIds[8]),
+ FindNode(myMesh,aNodeIds[9]),
+ FindNode(myMesh,aNodeIds[10]),
+ FindNode(myMesh,aNodeIds[11]),
+ FindNode(myMesh,aNodeIds[12]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case ePENTA6:
+ aNbNodes = 6;
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0],
+ aNodeIds[1],
+ aNodeIds[2],
+ aNodeIds[3],
+ aNodeIds[4],
+ aNodeIds[5],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case ePENTA15:
+ aNbNodes = 15;
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5],
+ aNodeIds[6], aNodeIds[7],
+ aNodeIds[8], aNodeIds[9],
+ aNodeIds[10], aNodeIds[11],
+ aNodeIds[12], aNodeIds[13],
+ aNodeIds[14],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]),
+ FindNode(myMesh,aNodeIds[7]),
+ FindNode(myMesh,aNodeIds[8]),
+ FindNode(myMesh,aNodeIds[9]),
+ FindNode(myMesh,aNodeIds[10]),
+ FindNode(myMesh,aNodeIds[11]),
+ FindNode(myMesh,aNodeIds[12]),
+ FindNode(myMesh,aNodeIds[13]),
+ FindNode(myMesh,aNodeIds[14]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eHEXA8:
+ aNbNodes = 8;
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0],
+ aNodeIds[1],
+ aNodeIds[2],
+ aNodeIds[3],
+ aNodeIds[4],
+ aNodeIds[5],
+ aNodeIds[6],
+ aNodeIds[7],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]),
+ FindNode(myMesh,aNodeIds[7]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ case eHEXA20:
+ aNbNodes = 20;
+ if(anIsElemNum)
+ anElement = myMesh->AddVolumeWithID(aNodeIds[0], aNodeIds[1],
+ aNodeIds[2], aNodeIds[3],
+ aNodeIds[4], aNodeIds[5],
+ aNodeIds[6], aNodeIds[7],
+ aNodeIds[8], aNodeIds[9],
+ aNodeIds[10], aNodeIds[11],
+ aNodeIds[12], aNodeIds[13],
+ aNodeIds[14], aNodeIds[15],
+ aNodeIds[16], aNodeIds[17],
+ aNodeIds[18], aNodeIds[19],
+ aCellInfo->GetElemNum(iElem));
+ if (!anElement) {
+ anElement = myMesh->AddVolume(FindNode(myMesh,aNodeIds[0]),
+ FindNode(myMesh,aNodeIds[1]),
+ FindNode(myMesh,aNodeIds[2]),
+ FindNode(myMesh,aNodeIds[3]),
+ FindNode(myMesh,aNodeIds[4]),
+ FindNode(myMesh,aNodeIds[5]),
+ FindNode(myMesh,aNodeIds[6]),
+ FindNode(myMesh,aNodeIds[7]),
+ FindNode(myMesh,aNodeIds[8]),
+ FindNode(myMesh,aNodeIds[9]),
+ FindNode(myMesh,aNodeIds[10]),
+ FindNode(myMesh,aNodeIds[11]),
+ FindNode(myMesh,aNodeIds[12]),
+ FindNode(myMesh,aNodeIds[13]),
+ FindNode(myMesh,aNodeIds[14]),
+ FindNode(myMesh,aNodeIds[15]),
+ FindNode(myMesh,aNodeIds[16]),
+ FindNode(myMesh,aNodeIds[17]),
+ FindNode(myMesh,aNodeIds[18]),
+ FindNode(myMesh,aNodeIds[19]));
+ isRenum = anIsElemNum;
+ }
+ break;
+ }
#ifndef _DEXCEPT_
- }catch(const std::exception& exc){
- //INFOS("Follow exception was cought:\n\t"<AddElement(anElement);
- myFamilies[aFamNum]->SetType(anElement->GetType());
- }
- }
- }
- }}
- }
- }
+ }catch(const std::exception& exc){
+ //INFOS("Follow exception was cought:\n\t"<AddElement(anElement);
+ myFamilies[aFamNum]->SetType(anElement->GetType());
+ }
+ }
+ }
+ }}
+ }
+ }
}
}
#ifndef _DEXCEPT_
diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
index 22b33cf63..877c24a67 100644
--- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
+++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx
@@ -393,39 +393,90 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
#ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = eARETE;
#endif
+ // count edges of diff types
+ int aNbSeg3 = 0, aNbSeg2 = 0;
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
- TInt aNbConnectivity = MED::GetNbNodes(eSEG2);
- MED::TIntVector anElemNums(aNbElems);
- MED::TIntVector aFamilyNums(aNbElems);
- MED::TIntVector aConnectivity(aNbElems*aNbConnectivity);
+ while ( anIter->more() )
+ if ( anIter->next()->NbNodes() == 3 )
+ ++aNbSeg3;
+ aNbSeg2 = aNbElems - aNbSeg3;
- for(TInt iElem = 0, iConn = 0; anIter->more(); iElem++, iConn+=aNbConnectivity){
+ TInt aNbSeg2Conn = MED::GetNbNodes(eSEG2);
+ MED::TIntVector aSeg2ElemNums, aSeg2FamilyNums, aSeg2Conn;
+ aSeg2ElemNums .reserve( aNbSeg2 );
+ aSeg2FamilyNums.reserve( aNbSeg2 );
+ aSeg2Conn .reserve( aNbSeg2*aNbSeg2Conn );
+
+ TInt aNbSeg3Conn = MED::GetNbNodes(eSEG3);
+ MED::TIntVector aSeg3ElemNums, aSeg3FamilyNums, aSeg3Conn;
+ aSeg3ElemNums .reserve( aNbSeg3 );
+ aSeg3FamilyNums.reserve( aNbSeg3 );
+ aSeg3Conn .reserve( aNbSeg3*aNbSeg3Conn );
+
+ anIter = myMesh->edgesIterator();
+ while ( anIter->more() ) {
const SMDS_MeshEdge* anElem = anIter->next();
- SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- for(TInt iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){
- const SMDS_MeshElement* aNode = aNodesIter->next();
-#ifdef _EDF_NODE_IDS_
- aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
-#else
- aConnectivity[iConn+iNode] = aNode->GetID();
-#endif
- }
- anElemNums[iElem] = anElem->GetID();
+ TInt aNbNodes = anElem->NbNodes();
- if (anElemFamMap.find(anElem) != anElemFamMap.end())
- aFamilyNums[iElem] = anElemFamMap[anElem];
+ TInt aNbConnectivity;
+ MED::TIntVector* anElemNums;
+ MED::TIntVector* aFamilyNums;
+ MED::TIntVector* aConnectivity;
+ switch(aNbNodes){
+ case 2:
+ aNbConnectivity = aNbSeg2Conn;
+ anElemNums = &aSeg2ElemNums;
+ aFamilyNums = &aSeg2FamilyNums;
+ aConnectivity = &aSeg2Conn;
+ break;
+ case 3:
+ aNbConnectivity = aNbSeg3Conn;
+ anElemNums = &aSeg3ElemNums;
+ aFamilyNums = &aSeg3FamilyNums;
+ aConnectivity = &aSeg3Conn;
+ break;
+ default:
+ break;
+ }
+
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++) {
+ const SMDS_MeshElement* aNode = anElem->GetNode( iNode );
+#ifdef _EDF_NODE_IDS_
+ aConnectivity->push_back( aNodeIdMap[aNode->GetID()] );
+#else
+ aConnectivity->push_back( aNode->GetID() );
+#endif
+ }
+
+ anElemNums->push_back(anElem->GetID());
+
+ map::iterator edge_fam = anElemFamMap.find( anElem );
+ if ( edge_fam != anElemFamMap.end() )
+ aFamilyNums->push_back( edge_fam->second );
else
- aFamilyNums[iElem] = myEdgesDefaultFamilyId;
+ aFamilyNums->push_back( myFacesDefaultFamilyId );
}
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eSEG2,
- aConnectivity,
- SMDS_MED_CONNECTIVITY,
- aFamilyNums,
- anElemNums);
- myMed->SetCellInfo(aCellInfo);
+ if ( aNbSeg2 ) {
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eSEG2,
+ aSeg2Conn,
+ SMDS_MED_CONNECTIVITY,
+ aSeg2FamilyNums,
+ aSeg2ElemNums);
+ myMed->SetCellInfo(aCellInfo);
+ }
+ if ( aNbSeg3 ) {
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eSEG3,
+ aSeg3Conn,
+ SMDS_MED_CONNECTIVITY,
+ aSeg3FamilyNums,
+ aSeg3ElemNums);
+ myMed->SetCellInfo(aCellInfo);
+ }
}
// Storing SMDS Faces
@@ -442,6 +493,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aTriaConn;
aTriaConn.reserve(aNbElems*aNbTriaConn);
+ TInt aNbTria6Conn = MED::GetNbNodes(eTRIA6);
+ MED::TIntVector anTria6ElemNums;
+ anTria6ElemNums.reserve(aNbElems);
+ MED::TIntVector aTria6FamilyNums;
+ aTria6FamilyNums.reserve(aNbElems);
+ MED::TIntVector aTria6Conn;
+ aTria6Conn.reserve(aNbElems*aNbTria6Conn);
+
TInt aNbQuadConn = MED::GetNbNodes(eQUAD4);
MED::TIntVector aQuadElemNums;
aQuadElemNums.reserve(aNbElems);
@@ -450,6 +509,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aQuadConn;
aQuadConn.reserve(aNbElems*aNbQuadConn);
+ TInt aNbQuad8Conn = MED::GetNbNodes(eQUAD8);
+ MED::TIntVector aQuad8ElemNums;
+ aQuad8ElemNums.reserve(aNbElems);
+ MED::TIntVector aQuad8FamilyNums;
+ aQuad8FamilyNums.reserve(aNbElems);
+ MED::TIntVector aQuad8Conn;
+ aQuad8Conn.reserve(aNbElems*aNbQuad8Conn);
+
MED::TIntVector aPolygoneElemNums;
aPolygoneElemNums.reserve(aNbElems);
MED::TIntVector aPolygoneInds;
@@ -473,7 +540,8 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
anElemNums = &aPolygoneElemNums;
aFamilyNums = &aPolygoneFamilyNums;
aConnectivity = &aPolygoneConn;
- } else {
+ }
+ else {
switch(aNbNodes){
case 3:
aNbConnectivity = aNbTriaConn;
@@ -487,6 +555,18 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
aFamilyNums = &aQuadFamilyNums;
aConnectivity = &aQuadConn;
break;
+ case 6:
+ aNbConnectivity = aNbTria6Conn;
+ anElemNums = &anTria6ElemNums;
+ aFamilyNums = &aTria6FamilyNums;
+ aConnectivity = &aTria6Conn;
+ break;
+ case 8:
+ aNbConnectivity = aNbQuad8Conn;
+ anElemNums = &aQuad8ElemNums;
+ aFamilyNums = &aQuad8FamilyNums;
+ aConnectivity = &aQuad8Conn;
+ break;
default:
break;
}
@@ -550,6 +630,28 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MESSAGE("Perform - anEntity = "<first;
const TRecord& aRec = anIter->second;
- if(IsBeam(aRec.fe_descriptor_id)){
- anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
- aRec.node_labels[1],
- aLabel);
- }else if(IsFace(aRec.fe_descriptor_id)){
+ if(IsBeam(aRec.fe_descriptor_id)) {
+ if(aRec.fe_descriptor_id == 11) {
+ // edge with two nodes
+ anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aLabel);
+ }
+ else {
+ // quadratic edge (with 3 nodes)
+ anElement = myMesh->AddEdgeWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aLabel);
+ }
+ }
+ else if(IsFace(aRec.fe_descriptor_id)) {
switch(aRec.fe_descriptor_id){
case 71: // TRI3
case 72:
@@ -76,18 +87,31 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
case 41: // Plane Stress Linear Triangle - TRI3
case 91: // Thin Shell Linear Triangle - TRI3
-
- case 42: // Plane Stress Quadratic Triangle - TRI6
- case 92: // Thin Shell Quadratic Triangle - TRI6
-
anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
aRec.node_labels[1],
aRec.node_labels[2],
aLabel);
break;
+ case 42: // Plane Stress Quadratic Triangle - TRI6
+ case 92: // Thin Shell Quadratic Triangle - TRI6
+ anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aRec.node_labels[3],
+ aRec.node_labels[4],
+ aRec.node_labels[5],
+ aLabel);
+ break;
+
case 44: // Plane Stress Linear Quadrilateral - QUAD4
case 94: // Thin Shell Linear Quadrilateral - QUAD4
+ anElement = myMesh->AddFaceWithID(aRec.node_labels[0],
+ aRec.node_labels[1],
+ aRec.node_labels[2],
+ aRec.node_labels[3],
+ aLabel);
+ break;
case 45: // Plane Stress Quadratic Quadrilateral - QUAD8
case 95: // Thin Shell Quadratic Quadrilateral - QUAD8
@@ -95,24 +119,40 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
aRec.node_labels[1],
aRec.node_labels[2],
aRec.node_labels[3],
+ aRec.node_labels[4],
+ aRec.node_labels[5],
+ aRec.node_labels[6],
+ aRec.node_labels[7],
aLabel);
break;
}
- }else if(IsVolume(aRec.fe_descriptor_id)){
+ }
+ else if(IsVolume(aRec.fe_descriptor_id)){
switch(aRec.fe_descriptor_id){
case 111: // Solid Linear Tetrahedron - TET4
- case 118: // Solid Quadratic Tetrahedron - TET10
-
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
aRec.node_labels[2],
aRec.node_labels[1],
aRec.node_labels[3],
aLabel);
break;
+
+ case 118: // Solid Quadratic Tetrahedron - TET10
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[2],
+ aRec.node_labels[1],
+ aRec.node_labels[3],
+ aRec.node_labels[6],
+ aRec.node_labels[5],
+ aRec.node_labels[4],
+ aRec.node_labels[7],
+ aRec.node_labels[9],
+ aRec.node_labels[8],
+ aLabel);
+ break;
case 112: // Solid Linear Prism - PRISM6
-
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
aRec.node_labels[2],
aRec.node_labels[1],
@@ -123,13 +163,21 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
break;
case 113: // Solid Quadratic Prism - PRISM15
-
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
- aRec.node_labels[4],
aRec.node_labels[2],
- aRec.node_labels[9],
- aRec.node_labels[13],
+ aRec.node_labels[1],
+ aRec.node_labels[3],
+ aRec.node_labels[5],
+ aRec.node_labels[4],
+ aRec.node_labels[8],
+ aRec.node_labels[7],
+ aRec.node_labels[6],
aRec.node_labels[11],
+ aRec.node_labels[10],
+ aRec.node_labels[9],
+ aRec.node_labels[12],
+ aRec.node_labels[14],
+ aRec.node_labels[13],
aLabel);
break;
@@ -146,26 +194,57 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
break;
case 116: // Solid Quadratic Brick - HEX20
-
anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
- aRec.node_labels[6],
- aRec.node_labels[4],
+ aRec.node_labels[3],
aRec.node_labels[2],
- aRec.node_labels[12],
- aRec.node_labels[18],
- aRec.node_labels[16],
+ aRec.node_labels[1],
+ aRec.node_labels[4],
+ aRec.node_labels[7],
+ aRec.node_labels[6],
+ aRec.node_labels[5],
+ aRec.node_labels[11],
+ aRec.node_labels[10],
+ aRec.node_labels[9],
+ aRec.node_labels[8],
+ aRec.node_labels[15],
aRec.node_labels[14],
+ aRec.node_labels[13],
+ aRec.node_labels[12],
+ aRec.node_labels[16],
+ aRec.node_labels[19],
+ aRec.node_labels[18],
+ aRec.node_labels[17],
aLabel);
break;
+
+ case 114: // pyramid of 13 nodes (quadratic) - PIRA13
+ anElement = myMesh->AddVolumeWithID(aRec.node_labels[0],
+ aRec.node_labels[3],
+ aRec.node_labels[2],
+ aRec.node_labels[1],
+ aRec.node_labels[4],
+ aRec.node_labels[8],
+ aRec.node_labels[7],
+ aRec.node_labels[6],
+ aRec.node_labels[5],
+ aRec.node_labels[9],
+ aRec.node_labels[12],
+ aRec.node_labels[11],
+ aRec.node_labels[10],
+ aLabel);
+ break;
+
}
}
if(!anElement)
MESSAGE("DriverUNV_R_SMDS_Mesh::Perform - can not add element with ID = "<next();
aRec.node_labels.push_back(aNode->GetID());
}
- aRec.fe_descriptor_id = 11;
+ if(aNbNodes==2)
+ aRec.fe_descriptor_id = 11;
+ else
+ aRec.fe_descriptor_id = 21;
aDataSet2412.insert(TDataSet::value_type(aLabel,aRec));
}
MESSAGE("Perform - aDataSet2412.size() = "<RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
aFilter->RegisterCellsWithType(VTK_QUAD);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
my3DActor = SMESH_DeviceActor::New();
my3DActor->SetUserMatrix(aMatrix);
@@ -164,6 +166,8 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
aFilter->RegisterCellsWithType(VTK_WEDGE);
aFilter->RegisterCellsWithType(VTK_PYRAMID);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
//Definition 1D divice of the actor
@@ -185,6 +189,7 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter = my1DActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_LINE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
my1DProp = vtkProperty::New();
my1DProp->DeepCopy(myEdgeProp);
@@ -210,6 +215,7 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter = my1DExtActor->GetExtractUnstructuredGrid();
aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
aFilter->RegisterCellsWithType(VTK_LINE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
//Definition 0D divice of the actor
@@ -1017,6 +1023,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
if(myEntityMode & eEdges){
if (MYDEBUG) MESSAGE("EDGES");
aFilter->RegisterCellsWithType(VTK_LINE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
}
if(myEntityMode & eFaces){
@@ -1024,6 +1031,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
aFilter->RegisterCellsWithType(VTK_QUAD);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
}
if(myEntityMode & eVolumes){
@@ -1033,6 +1042,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
aFilter->RegisterCellsWithType(VTK_WEDGE);
aFilter->RegisterCellsWithType(VTK_PYRAMID);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
}
aFilter->Update();
diff --git a/src/OBJECT/SMESH_Object.cxx b/src/OBJECT/SMESH_Object.cxx
index 4727832dd..7355e4b2b 100644
--- a/src/OBJECT/SMESH_Object.cxx
+++ b/src/OBJECT/SMESH_Object.cxx
@@ -90,12 +90,16 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
switch( theType )
{
case SMDSAbs_Edge:
- return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
+ if( theNbNodes == 2 ) return VTK_LINE;
+ else if ( theNbNodes == 3 ) return VTK_QUADRATIC_EDGE;
+ else return VTK_EMPTY_CELL;
case SMDSAbs_Face :
if (thePoly && theNbNodes>2 ) return VTK_POLYGON;
else if ( theNbNodes == 3 ) return VTK_TRIANGLE;
else if ( theNbNodes == 4 ) return VTK_QUAD;
+ else if ( theNbNodes == 6 ) return VTK_QUADRATIC_TRIANGLE;
+ else if ( theNbNodes == 8 ) return VTK_QUADRATIC_QUAD;
else return VTK_EMPTY_CELL;
case SMDSAbs_Volume:
@@ -104,6 +108,15 @@ static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
else if ( theNbNodes == 5 ) return VTK_PYRAMID;
else if ( theNbNodes == 6 ) return VTK_WEDGE;
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
+ else if ( theNbNodes == 10 ) {
+ return VTK_QUADRATIC_TETRA;
+ }
+ else if ( theNbNodes == 20 ) {
+ return VTK_QUADRATIC_HEXAHEDRON;
+ }
+ else if ( theNbNodes==13 || theNbNodes==15 ) {
+ return VTK_CONVEX_POINT_SET;
+ }
else return VTK_EMPTY_CELL;
default: return VTK_EMPTY_CELL;
@@ -391,11 +404,34 @@ void SMESH_VisualObjDef::buildElemPrs()
static int anIds[] = {0,1,2,3,4,5};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- } else if (aNbNodes == 8) {
+ }
+ else if (aNbNodes == 8) {
static int anIds[] = {0,3,2,1,4,7,6,5};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
- } else {
+ }
+ else if (aNbNodes == 10) {
+ static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
+ else if (aNbNodes == 13) {
+ static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ }
+ else if (aNbNodes == 15) {
+ static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
+ for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
+ //for (int k = 0; k < aNbNodes; k++) {
+ // int nn = aConnectivities[k];
+ // const SMDS_MeshNode* N = static_cast (aConnect[nn]);
+ // cout<<"k="<X()<<","<Y()<<","<Z()<<")"< 0) {
diff --git a/src/SMDS/Makefile.in b/src/SMDS/Makefile.in
index e066e25e0..7ecaf313a 100644
--- a/src/SMDS/Makefile.in
+++ b/src/SMDS/Makefile.in
@@ -59,21 +59,10 @@ LIB_SRC = \
SMDS_FaceOfEdges.cxx \
SMDS_FaceOfNodes.cxx \
SMDS_PolygonalFaceOfNodes.cxx \
- SMDS_VolumeTool.cxx
-# SMDS_Tria3OfNodes.cxx \
-# SMDS_HexahedronOfNodes.cxx
-
-#SMDSControl_BoundaryEdges.cxx \
-#SMDSControl_BoundaryFaces.cxx \
-#SMDSControl.cxx \
-#SMDSControl_MeshBoundary.cxx \
-#SMDSEdit_Transform.cxx \
-#SMDS_MeshNodeIDFactory.cxx \
-#SMDS_MeshPrism.cxx \
-#SMDS_MeshPyramid.cxx \
-#SMDS_MeshQuadrangle.cxx \
-#SMDS_MeshTetrahedron.cxx \
-#SMDS_MeshTriangle.cxx \
+ SMDS_VolumeTool.cxx \
+ SMDS_QuadraticEdge.cxx \
+ SMDS_QuadraticFaceOfNodes.cxx \
+ SMDS_QuadraticVolumeOfNodes.cxx
LIB_CLIENT_IDL =
@@ -113,21 +102,11 @@ EXPORT_HEADERS= \
SMDS_FaceOfEdges.hxx \
SMDS_FaceOfNodes.hxx \
SMDS_PolygonalFaceOfNodes.hxx \
- SMDS_VolumeTool.hxx
-# SMDS_Tria3OfNodes.hxx \
-# SMDS_HexahedronOfNodes.hxx
-
-#SMDSControl_BoundaryEdges.hxx \
-#SMDSControl_BoundaryFaces.hxx \
-#SMDSControl.hxx \
-#SMDSControl_MeshBoundary.hxx \
-#SMDSEdit_Transform.hxx \
-#SMDS_MeshPrism.hxx \
-#SMDS_MeshPyramid.hxx \
-#SMDS_MeshQuadrangle.hxx \
-#SMDS_MeshTetrahedron.hxx \
-#SMDS_MeshTriangle.hxx \
-#SMDS_MeshNodeIDFactory.hxx
+ SMDS_VolumeTool.hxx \
+ SMDS_QuadraticEdge.hxx \
+ SMDS_QuadraticFaceOfNodes.hxx \
+ SMDS_QuadraticVolumeOfNodes.hxx \
+ SMDS_SetIterator.hxx
# additionnal information to compil and link file
CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
diff --git a/src/SMDS/SMDS_ElemIterator.hxx b/src/SMDS/SMDS_ElemIterator.hxx
index c8432afdd..6ff098644 100755
--- a/src/SMDS/SMDS_ElemIterator.hxx
+++ b/src/SMDS/SMDS_ElemIterator.hxx
@@ -33,8 +33,24 @@
#include
class SMDS_MeshElement;
+class SMDS_MeshNode;
+class SMDS_MeshEdge;
+class SMDS_MeshFace;
+class SMDS_MeshVolume;
typedef SMDS_Iterator SMDS_ElemIterator;
typedef boost::shared_ptr > SMDS_ElemIteratorPtr;
+typedef SMDS_Iterator SMDS_NodeIterator;
+typedef boost::shared_ptr > SMDS_NodeIteratorPtr;
+
+typedef SMDS_Iterator SMDS_EdgeIterator;
+typedef boost::shared_ptr > SMDS_EdgeIteratorPtr;
+
+typedef SMDS_Iterator SMDS_FaceIterator;
+typedef boost::shared_ptr > SMDS_FaceIteratorPtr;
+
+typedef SMDS_Iterator SMDS_VolumeIterator;
+typedef boost::shared_ptr > SMDS_VolumeIteratorPtr;
+
#endif
diff --git a/src/SMDS/SMDS_FaceOfEdges.cxx b/src/SMDS/SMDS_FaceOfEdges.cxx
index 640c55d30..7a014afb8 100644
--- a/src/SMDS/SMDS_FaceOfEdges.cxx
+++ b/src/SMDS/SMDS_FaceOfEdges.cxx
@@ -155,3 +155,29 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
}*/
+
+int SMDS_FaceOfEdges::NbNodes() const
+{
+ return myEdges[0]->NbNodes() + myEdges[1]->NbNodes() + myEdges[2]->NbNodes() +
+ ( myNbEdges == 4 ? myEdges[3]->NbNodes() : 0 ) - myNbEdges;
+}
+
+/*!
+ * \brief Return node by its index
+ * \param ind - node index
+ * \retval const SMDS_MeshNode* - the node
+ *
+ * Index is wrapped if it is out of a valid range
+ */
+const SMDS_MeshNode* SMDS_FaceOfEdges::GetNode(const int ind) const
+{
+ int index = WrappedIndex( ind );
+ for ( int i = 0; i < myNbEdges; ++i ) {
+ if ( index >= myEdges[ i ]->NbNodes() )
+ index -= myEdges[ i ]->NbNodes();
+ else
+ return myEdges[ i ]->GetNode( index );
+ }
+ return 0;
+}
+
diff --git a/src/SMDS/SMDS_FaceOfEdges.hxx b/src/SMDS/SMDS_FaceOfEdges.hxx
index cd8e5dd8f..54a9a688f 100644
--- a/src/SMDS/SMDS_FaceOfEdges.hxx
+++ b/src/SMDS/SMDS_FaceOfEdges.hxx
@@ -42,10 +42,21 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace
const SMDS_MeshEdge* edge4);
SMDSAbs_ElementType GetType() const;
+ int NbNodes() const;
int NbEdges() const;
int NbFaces() const;
// friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2);
+
+ /*!
+ * \brief Return node by its index
+ * \param ind - node index
+ * \retval const SMDS_MeshNode* - the node
+ *
+ * Index is wrapped if it is out of a valid range
+ */
+ virtual const SMDS_MeshNode* GetNode(const int ind) const;
+
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
diff --git a/src/SMDS/SMDS_FaceOfNodes.cxx b/src/SMDS/SMDS_FaceOfNodes.cxx
index aa6870824..018bd88a0 100644
--- a/src/SMDS/SMDS_FaceOfNodes.cxx
+++ b/src/SMDS/SMDS_FaceOfNodes.cxx
@@ -23,6 +23,7 @@
#pragma warning(disable:4786)
#endif
+#include "SMDS_SetIterator.hxx"
#include "SMDS_FaceOfNodes.hxx"
#include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx"
@@ -68,25 +69,11 @@ void SMDS_FaceOfNodes::Print(ostream & OS) const
//purpose :
//=======================================================================
-class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
+class SMDS_FaceOfNodes_MyIterator:public SMDS_NodeArrayElemIterator
{
- const SMDS_MeshNode* const *mySet;
- int myLength;
- int index;
public:
SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
- mySet(s),myLength(l),index(0) {}
-
- bool more()
- {
- return index set1,set2;
diff --git a/src/SMDS/SMDS_FaceOfNodes.hxx b/src/SMDS/SMDS_FaceOfNodes.hxx
index 290195107..8cbdf6f33 100644
--- a/src/SMDS/SMDS_FaceOfNodes.hxx
+++ b/src/SMDS/SMDS_FaceOfNodes.hxx
@@ -44,6 +44,16 @@ class SMDS_FaceOfNodes:public SMDS_MeshFace
int NbEdges() const;
int NbFaces() const;
int NbNodes() const;
+
+ /*!
+ * \brief Return node by its index
+ * \param ind - node index
+ * \retval const SMDS_MeshNode* - the node
+ *
+ * Index is wrapped if it is out of a valid range
+ */
+ virtual const SMDS_MeshNode* GetNode(const int ind) const;
+
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx
index 58f3e52c2..5df2090e9 100644
--- a/src/SMDS/SMDS_Mesh.cxx
+++ b/src/SMDS/SMDS_Mesh.cxx
@@ -31,6 +31,9 @@
#include "SMDS_FaceOfEdges.hxx"
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
#include "SMDS_PolygonalFaceOfNodes.hxx"
+#include "SMDS_QuadraticEdge.hxx"
+#include "SMDS_QuadraticFaceOfNodes.hxx"
+#include "SMDS_QuadraticVolumeOfNodes.hxx"
#include
#include