Merge from OCC_Quadric_Mesh_2006

This commit is contained in:
eap 2006-03-06 13:36:18 +00:00
parent 269e202f6b
commit da32f68aa4
87 changed files with 7959 additions and 2501 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
/*!

View File

@ -57,6 +57,12 @@
icon-id="mesh_algo_quad.png"
dim="2"/>
<hypothesis type="QuadraticMesh"
label-id="Quadratic Mesh"
icon-id="mesh_algo_quad.png"
dim="1"
auxiliary="true"/>
<hypothesis type="MaxElementArea"
label-id="Max. Element Area"
icon-id="mesh_hypo_area.png"

View File

@ -46,6 +46,8 @@
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_VolumeTool.hxx"
#include "SMDS_QuadraticFaceOfNodes.hxx"
#include "SMDS_QuadraticEdge.hxx"
/*
@ -87,32 +89,69 @@ namespace{
return 0;
const SMDS_MeshElement* anEdge = theMesh->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<const SMDS_QuadraticEdge*>
(anElem)->interlacedNodesElemIterator();
break;
case SMDSAbs_Face:
anIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
(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<const SMDS_MeshNode*>( 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"<<endl;
if (GetPoints(theElementId,P)){
//for(int jj=1; jj<=P.size(); jj++)
// cout<<"jj="<<jj<<" P("<<P(jj).X()<<","<<P(jj).Y()<<","<<P(jj).Z()<<")"<<endl;
double aVal;// = GetValue( P );
const SMDS_MeshElement* aElem = myMesh->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="<<L1<<" L2="<<L2<<"L3="<<L3<<" aVal="<<aVal<<endl;
break;
}
else if (len == 8){ // quadratic quadrangles
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( 7 ));
double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
}
case SMDSAbs_Volume:
if (len == 4){ // tetraidrs
double L1 = getDistance(P( 1 ),P( 2 ));
@ -987,6 +1071,63 @@ double Length2D::GetValue( long theElementId)
}
if (len == 10){ // quadratic tetraidrs
double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
}
else if (len == 13){ // quadratic piramids
double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
}
else if (len == 15){ // quadratic pentaidres
double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
}
else if (len == 20){ // quadratic hexaider
double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
break;
}
default: aVal=-1;
}
@ -1038,38 +1179,81 @@ void Length2D::GetValues(TValues& theValues){
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
for(; anIter->more(); ){
const SMDS_MeshFace* anElem = anIter->next();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
long aNodeId[2];
gp_Pnt P[3];
double aLength;
const SMDS_MeshElement* aNode;
if(aNodesIter->more()){
aNode = aNodesIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
aNodeId[0] = aNodeId[1] = aNode->GetID();
aLength = 0;
if(anElem->IsQuadratic()) {
const SMDS_QuadraticFaceOfNodes* F =
static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem);
// use special nodes iterator
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
long aNodeId[4];
gp_Pnt P[4];
double aLength;
const SMDS_MeshElement* aNode;
if(anIter->more()){
aNode = anIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
aNodeId[0] = aNodeId[1] = aNode->GetID();
aLength = 0;
}
for(; anIter->more(); ){
const SMDS_MeshNode* N1 = static_cast<const SMDS_MeshNode*> (anIter->next());
P[2] = gp_Pnt(N1->X(),N1->Y(),N1->Z());
aNodeId[2] = N1->GetID();
aLength = P[1].Distance(P[2]);
if(!anIter->more()) break;
const SMDS_MeshNode* N2 = static_cast<const SMDS_MeshNode*> (anIter->next());
P[3] = gp_Pnt(N2->X(),N2->Y(),N2->Z());
aNodeId[3] = N2->GetID();
aLength += P[2].Distance(P[3]);
Value aValue1(aLength,aNodeId[1],aNodeId[2]);
Value aValue2(aLength,aNodeId[2],aNodeId[3]);
P[1] = P[3];
aNodeId[1] = aNodeId[3];
theValues.insert(aValue1);
theValues.insert(aValue2);
}
aLength += P[2].Distance(P[0]);
Value aValue1(aLength,aNodeId[1],aNodeId[2]);
Value aValue2(aLength,aNodeId[2],aNodeId[0]);
theValues.insert(aValue1);
theValues.insert(aValue2);
}
for(; aNodesIter->more(); ){
aNode = aNodesIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
long anId = aNode->GetID();
else {
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
long aNodeId[2];
gp_Pnt P[3];
P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
double aLength;
const SMDS_MeshElement* aNode;
if(aNodesIter->more()){
aNode = aNodesIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
aNodeId[0] = aNodeId[1] = aNode->GetID();
aLength = 0;
}
for(; aNodesIter->more(); ){
aNode = aNodesIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
long anId = aNode->GetID();
P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
aLength = P[1].Distance(P[2]);
Value aValue(aLength,aNodeId[1],anId);
aNodeId[1] = anId;
P[1] = P[2];
theValues.insert(aValue);
}
aLength = P[1].Distance(P[2]);
aLength = P[0].Distance(P[1]);
Value aValue(aLength,aNodeId[1],anId);
aNodeId[1] = anId;
P[1] = P[2];
Value aValue(aLength,aNodeId[0],aNodeId[1]);
theValues.insert(aValue);
}
aLength = P[0].Distance(P[1]);
Value aValue(aLength,aNodeId[0],aNodeId[1]);
theValues.insert(aValue);
}
}
@ -1207,7 +1391,7 @@ void MultiConnection2D::GetValues(MValues& theValues){
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode1;
aNodeId[0] = aNodeId[1] = aNodes->GetID();
}
for(; aNodesIter->more(); ){
for(; aNodesIter->more(); ) {
aNode2 = (SMDS_MeshNode*) aNodesIter->next();
long anId = aNode2->GetID();
aNodeId[2] = anId;
@ -1217,7 +1401,8 @@ void MultiConnection2D::GetValues(MValues& theValues){
if (aItr != theValues.end()){
aItr->second += 1;
//aNbConnects = nb;
} else {
}
else {
theValues[aValue] = 1;
//aNbConnects = 1;
}
@ -1227,10 +1412,11 @@ void MultiConnection2D::GetValues(MValues& theValues){
}
Value aValue(aNodeId[0],aNodeId[2]);
MValues::iterator aItr = theValues.find(aValue);
if (aItr != theValues.end()){
if (aItr != theValues.end()) {
aItr->second += 1;
//aNbConnects = nb;
} else {
}
else {
theValues[aValue] = 1;
//aNbConnects = 1;
}
@ -1346,41 +1532,33 @@ bool FreeEdges::IsSatisfy( long theId )
if ( aFace == 0 || aFace->GetType() != SMDSAbs_Face || aFace->NbNodes() < 3 )
return false;
int nbNodes = aFace->NbNodes();
//const SMDS_MeshNode* aNodes[ nbNodes ];
#ifndef WNT
const SMDS_MeshNode* aNodes [nbNodes];
#else
const SMDS_MeshNode** aNodes = (const SMDS_MeshNode **)new SMDS_MeshNode*[nbNodes];
#endif
int i = 0;
SMDS_ElemIteratorPtr anIter = aFace->nodesIterator();
if ( anIter != 0 )
{
while( anIter->more() )
{
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
if ( aNode == 0 )
return false;
aNodes[ i++ ] = aNode;
}
SMDS_ElemIteratorPtr anIter;
if ( aFace->IsQuadratic() ) {
anIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
(aFace)->interlacedNodesElemIterator();
}
else {
anIter = aFace->nodesIterator();
}
if ( anIter != 0 )
return false;
for ( int i = 0; i < nbNodes - 1; i++ )
if ( IsFreeEdge( &aNodes[ i ], theId ) ) {
#ifdef WNT
delete [] aNodes;
#endif
int i = 0, nbNodes = aFace->NbNodes();
vector <const SMDS_MeshNode*> aNodes( nbNodes+1 );
while( anIter->more() )
{
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
if ( aNode == 0 )
return false;
aNodes[ i++ ] = aNode;
}
aNodes[ nbNodes ] = aNodes[ 0 ];
for ( i = 0; i < nbNodes; i++ )
if ( IsFreeEdge( &aNodes[ i ], theId ) )
return true;
}
aNodes[ 1 ] = aNodes[ nbNodes - 1 ];
const Standard_Boolean isFree = IsFreeEdge( &aNodes[ 0 ], theId );
#ifdef WNT
delete [] aNodes;
#endif
// return
return isFree;
return false;
}
SMDSAbs_ElementType FreeEdges::GetType() const
@ -2088,8 +2266,7 @@ static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
TColgp_Array1OfXYZ anArrOfXYZ(1,4);
SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
int i = 1;
for ( ; aNodeItr->more() && i <= 4; i++ )
{
for ( ; aNodeItr->more() && i <= 4; i++ ) {
SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
anArrOfXYZ.SetValue(i, gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
}
@ -2097,8 +2274,7 @@ static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
gp_XYZ q1 = anArrOfXYZ.Value(2) - anArrOfXYZ.Value(1);
gp_XYZ q2 = anArrOfXYZ.Value(3) - anArrOfXYZ.Value(1);
n = q1 ^ q2;
if ( aNbNode > 3 )
{
if ( aNbNode > 3 ) {
gp_XYZ q3 = anArrOfXYZ.Value(4) - anArrOfXYZ.Value(1);
n += q2 ^ q3;
}

View File

@ -32,7 +32,7 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
Status aResult = DRS_OK;
int nbNodes, nbCells;
int i;
//int i;
char *file2Read = (char *)myFile.c_str();
FILE* aFileId = fopen(file2Read, "w+");
@ -52,7 +52,7 @@ Driver_Mesh::Status DriverDAT_W_SMDS_Mesh::Perform()
nbNodes = myMesh->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();

View File

@ -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 = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
if(MYDEBUG) MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){
TInt aNbNodes = -1;
switch(aGeom){
case eSEG2:
case eSEG3:
aNbNodes = 2;
break;
case eTRIA3:
case eTRIA6:
aNbNodes = 3;
break;
break;
case eQUAD4:
case eQUAD8:
aNbNodes = 4;
break;
case eTETRA4:
case eTETRA10:
aNbNodes = 4;
break;
case ePYRA5:
case ePYRA13:
aNbNodes = 5;
break;
case ePENTA6:
case ePENTA15:
aNbNodes = 6;
break;
case eHEXA8:
case eHEXA20:
aNbNodes = 8;
break;
}
TNodeIds aNodeIds(aNbNodes);
bool anIsValidConnect = false;
TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
TInt aNbElems = aCellInfo->GetNbElem();
if(MYDEBUG) MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
if(MYDEBUG) MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){
TInt aNbNodes = -1;
switch(aGeom){
case eSEG2: aNbNodes = 2; break;
case eSEG3: aNbNodes = 3; break;
case eTRIA3: aNbNodes = 3; break;
case eTRIA6: aNbNodes = 6; break;
case eQUAD4: aNbNodes = 4; break;
case eQUAD8: aNbNodes = 8; break;
case eTETRA4: aNbNodes = 4; break;
case eTETRA10: aNbNodes = 10; break;
case ePYRA5: aNbNodes = 5; break;
case ePYRA13: aNbNodes = 13; break;
case ePENTA6: aNbNodes = 6; break;
case ePENTA15: aNbNodes = 15; break;
case eHEXA8: aNbNodes = 8; break;
case eHEXA20: aNbNodes = 20; break;
default:;
}
vector<TInt> aNodeIds(aNbNodes);
bool anIsValidConnect = false;
TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
#ifndef _DEXCEPT_
try{
try{
#endif
#ifdef _EDF_NODE_IDS_
if(anIsNodeNum)
for(int iNode = 0; iNode < aNbNodes; iNode++)
aNodeIds[iNode] = aNodeInfo->GetElemNum(aConnSlice[iNode] - 1);
else
for(int iNode = 0; iNode < aNbNodes; iNode++)
aNodeIds[iNode] = aConnSlice[iNode];
if(anIsNodeNum)
for(int iNode = 0; iNode < aNbNodes; iNode++)
aNodeIds[iNode] = aNodeInfo->GetElemNum(aConnSlice[iNode] - 1);
else
for(int iNode = 0; iNode < aNbNodes; iNode++)
aNodeIds[iNode] = aConnSlice[iNode];
#else
for(int iNode = 0; iNode < aNbNodes; iNode++)
aNodeIds[iNode] = aConnSlice[iNode];
for(int iNode = 0; iNode < aNbNodes; iNode++)
aNodeIds[iNode] = aConnSlice[iNode];
#endif
anIsValidConnect = true;
anIsValidConnect = true;
#ifndef _DEXCEPT_
}catch(const std::exception& exc){
//INFOS("Follow exception was cought:\n\t"<<exc.what());
aResult = DRS_FAIL;
}catch(...){
//INFOS("Unknown exception was cought !!!");
aResult = DRS_FAIL;
}
#endif
if(!anIsValidConnect)
continue;
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
TInt aFamNum = aCellInfo->GetFamNum(iElem);
}catch(const std::exception& exc){
//INFOS("Follow exception was cought:\n\t"<<exc.what());
aResult = DRS_FAIL;
}catch(...){
//INFOS("Unknown exception was cought !!!");
aResult = DRS_FAIL;
}
#endif
if(!anIsValidConnect)
continue;
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
TInt aFamNum = aCellInfo->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"<<exc.what());
aResult = DRS_FAIL;
}catch(...){
//INFOS("Unknown exception was cought !!!");
aResult = DRS_FAIL;
}
#endif
if (!anElement) {
aResult = DRS_WARN_SKIP_ELEM;
}
else {
if (isRenum) {
anIsElemNum = eFAUX;
takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
if ( checkFamilyID ( aFamily, aFamNum )) {
// Save reference to this element from its family
myFamilies[aFamNum]->AddElement(anElement);
myFamilies[aFamNum]->SetType(anElement->GetType());
}
}
}
}}
}
}
}catch(const std::exception& exc){
//INFOS("Follow exception was cought:\n\t"<<exc.what());
aResult = DRS_FAIL;
}catch(...){
//INFOS("Unknown exception was cought !!!");
aResult = DRS_FAIL;
}
#endif
if (!anElement) {
aResult = DRS_WARN_SKIP_ELEM;
}
else {
if (isRenum) {
anIsElemNum = eFAUX;
takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
}
if ( checkFamilyID ( aFamily, aFamNum )) {
// Save reference to this element from its family
myFamilies[aFamNum]->AddElement(anElement);
myFamilies[aFamNum]->SetType(anElement->GetType());
}
}
}
}}
}
}
}
}
#ifndef _DEXCEPT_

View File

@ -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<const SMDS_MeshElement*,int>::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 = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = anTria6ElemNums.size()){
PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY,
eTRIA6,
aTria6Conn,
SMDS_MED_CONNECTIVITY,
aTria6FamilyNums,
anTria6ElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTRIA6<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = aQuad8ElemNums.size()){
PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY,
eQUAD8,
aQuad8Conn,
SMDS_MED_CONNECTIVITY,
aQuad8FamilyNums,
aQuad8ElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD8<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = aPolygoneElemNums.size()){
// add one element in connectivities,
// referenced by the last element in indices
@ -606,6 +708,38 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aHexaConn;
aHexaConn.reserve(aNbElems*aNbHexaConn);
TInt aNbTetra10Conn = MED::GetNbNodes(eTETRA10);
MED::TIntVector anTetra10ElemNums;
anTetra10ElemNums.reserve(aNbElems);
MED::TIntVector aTetra10FamilyNums;
aTetra10FamilyNums.reserve(aNbElems);
MED::TIntVector aTetra10Conn;
aTetra10Conn.reserve(aNbElems*aNbTetra10Conn);
TInt aNbPyra13Conn = MED::GetNbNodes(ePYRA13);
MED::TIntVector anPyra13ElemNums;
anPyra13ElemNums.reserve(aNbElems);
MED::TIntVector aPyra13FamilyNums;
aPyra13FamilyNums.reserve(aNbElems);
MED::TIntVector aPyra13Conn;
aPyra13Conn.reserve(aNbElems*aNbPyra13Conn);
TInt aNbPenta15Conn = MED::GetNbNodes(ePENTA15);
MED::TIntVector anPenta15ElemNums;
anPenta15ElemNums.reserve(aNbElems);
MED::TIntVector aPenta15FamilyNums;
aPenta15FamilyNums.reserve(aNbElems);
MED::TIntVector aPenta15Conn;
aPenta15Conn.reserve(aNbElems*aNbPenta15Conn);
TInt aNbHexa20Conn = MED::GetNbNodes(eHEXA20);
MED::TIntVector aHexa20ElemNums;
aHexa20ElemNums.reserve(aNbElems);
MED::TIntVector aHexa20FamilyNums;
aHexa20FamilyNums.reserve(aNbElems);
MED::TIntVector aHexa20Conn;
aHexa20Conn.reserve(aNbElems*aNbHexa20Conn);
MED::TIntVector aPolyedreElemNums;
aPolyedreElemNums.reserve(aNbElems);
MED::TIntVector aPolyedreInds;
@ -653,7 +787,8 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
TInt aPrevPos = aPolyedreInds.back();
aPolyedreInds.push_back(aPrevPos + aNbFaces);
} else {
}
else {
TInt aNbNodes = anElem->NbNodes();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
TInt aNbConnectivity;
@ -682,6 +817,29 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
anElemNums = &aHexaElemNums;
aFamilyNums = &aHexaFamilyNums;
aConnectivity = &aHexaConn;
case 10:
aNbConnectivity = aNbTetra10Conn;
anElemNums = &anTetra10ElemNums;
aFamilyNums = &aTetra10FamilyNums;
aConnectivity = &aTetra10Conn;
break;
case 13:
aNbConnectivity = aNbPyra13Conn;
anElemNums = &anPyra13ElemNums;
aFamilyNums = &aPyra13FamilyNums;
aConnectivity = &aPyra13Conn;
break;
case 15:
aNbConnectivity = aNbPenta15Conn;
anElemNums = &anPenta15ElemNums;
aFamilyNums = &aPenta15FamilyNums;
aConnectivity = &aPenta15Conn;
break;
case 20:
aNbConnectivity = aNbHexa20Conn;
anElemNums = &aHexa20ElemNums;
aFamilyNums = &aHexa20FamilyNums;
aConnectivity = &aHexa20Conn;
}
TInt aSize = aConnectivity->size();
@ -762,6 +920,51 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = anTetra10ElemNums.size()){
PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY,
eTETRA10,
aTetra10Conn,
SMDS_MED_CONNECTIVITY,
aTetra10FamilyNums,
anTetra10ElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTETRA10<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = anPyra13ElemNums.size()){
PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY,
ePYRA13,
aPyra13Conn,
SMDS_MED_CONNECTIVITY,
aPyra13FamilyNums,
anPyra13ElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePYRA13<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = anPenta15ElemNums.size()){
PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY,
ePENTA15,
aPenta15Conn,
SMDS_MED_CONNECTIVITY,
aPenta15FamilyNums,
anPenta15ElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePENTA15<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = aHexa20ElemNums.size()){
PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY,
eHEXA20,
aHexa20Conn,
SMDS_MED_CONNECTIVITY,
aHexa20FamilyNums,
aHexa20ElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA20<<"; aNbElems = "<<aNbElems);
myMed->SetCellInfo(aCellInfo);
}
if(TInt aNbElems = aPolyedreElemNums.size()){
// add one element in connectivities,
// referenced by the last element in faces
@ -780,9 +983,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
myMed->SetPolyedreInfo(aCellInfo);
}
}
}catch(const std::exception& exc){
}
catch(const std::exception& exc) {
INFOS("Follow exception was cought:\n\t"<<exc.what());
}catch(...){
}
catch(...) {
INFOS("Unknown exception was cought !!!");
}

View File

@ -228,7 +228,7 @@ Driver_Mesh::Status DriverSTL_W_SMDS_Mesh::writeBinary() const
}
// write number of triangles
unsigned int NBT = nbTri;
//unsigned int NBT = nbTri;
aFile.Write((Standard_Address)sval,LABEL_SIZE);
writeInteger(nbTri,aFile);

View File

@ -64,11 +64,22 @@ Driver_Mesh::Status DriverUNV_R_SMDS_Mesh::Perform()
SMDS_MeshElement* anElement = NULL;
const TElementLab& aLabel = anIter->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 = "<<aLabel<<" and type = "<<aRec.fe_descriptor_id);
}
}
}catch(const std::exception& exc){
}
catch(const std::exception& exc){
INFOS("Follow exception was cought:\n\t"<<exc.what());
}catch(...){
}
catch(...){
INFOS("Unknown exception was cought !!!");
}
return aResult;

View File

@ -91,7 +91,10 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
const SMDS_MeshElement* aNode = aNodesIter->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() = "<<aDataSet2412.size());
@ -118,6 +121,12 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
case 4:
aRec.fe_descriptor_id = 44;
break;
case 6:
aRec.fe_descriptor_id = 42;
break;
case 8:
aRec.fe_descriptor_id = 45;
break;
default:
continue;
}
@ -160,6 +169,30 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
anId = 115;
break;
}
case 10: {
static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
aConn = anIds;
anId = 118;
break;
}
case 13: {
static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
aConn = anIds;
anId = 114;
break;
}
case 15: {
static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
aConn = anIds;
anId = 113;
break;
}
case 20: {
static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
aConn = anIds;
anId = 116;
break;
}
default:
continue;
}
@ -177,9 +210,11 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
}
UNV2412::Write(out_stream,aDataSet2412);
}
}catch(const std::exception& exc){
}
catch(const std::exception& exc){
INFOS("Follow exception was cought:\n\t"<<exc.what());
}catch(...){
}
catch(...){
INFOS("Unknown exception was cought !!!");
}
return aResult;

View File

@ -142,8 +142,8 @@ void UNV2412::Write(std::ofstream& out_stream, const TDataSet& theDataSet)
bool UNV2412::IsBeam(int theFeDescriptorId){
switch (theFeDescriptorId){
case 11:
case 21:
case 11: // edge with 2 nodes
case 21: // edge with 3 nodes (quadratic)
case 22:
case 24:
case 25:
@ -197,6 +197,8 @@ bool UNV2412::IsVolume(int theFeDescriptorId){
case 116: // Solid Quadratic Brick - HEX20
case 117: // Solid Cubic Brick
case 114: // pyramid of 13 nodes (quadratic)
return true;
}
return false;

View File

@ -150,6 +150,8 @@ SMESH_ActorDef::SMESH_ActorDef()
aFilter->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();

View File

@ -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<const SMDS_MeshNode*> (aConnect[nn]);
// cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
//}
}
else if (aNbNodes == 20) {
static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
}
else {
}
if (aConnectivities.size() > 0) {

View File

@ -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)

View File

@ -33,8 +33,24 @@
#include <boost/shared_ptr.hpp>
class SMDS_MeshElement;
class SMDS_MeshNode;
class SMDS_MeshEdge;
class SMDS_MeshFace;
class SMDS_MeshVolume;
typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshFace *> SMDS_FaceIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
#endif

View File

@ -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;
}

View File

@ -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;

View File

@ -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<myLength;
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
SMDS_NodeArrayElemIterator( s, & s[ l ] ) {}
};
SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
@ -147,6 +134,18 @@ bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
return true;
}
/*!
* \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_FaceOfNodes::GetNode(const int ind) const
{
return myNodes[ WrappedIndex( ind )];
}
/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
{
set<SMDS_MeshNode> set1,set2;

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -50,15 +50,6 @@
#include <set>
#include <list>
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshFace *> SMDS_FaceIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{
public:
@ -84,6 +75,16 @@ public:
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -120,6 +121,44 @@ public:
const SMDS_MeshEdge * e3,
const SMDS_MeshEdge * e4);
// 2d order triangle of 6 nodes
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31);
// 2d order quadrangle
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n34,int n41, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -214,6 +253,153 @@ public:
const SMDS_MeshFace * f5,
const SMDS_MeshFace * f6);
// 2d order tetrahedron of 10 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n31,
int n14,int n24,int n34, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34);
// 2d order pyramid of 13 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
int n12,int n23,int n34,int n41,
int n15,int n25,int n35,int n45,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45);
// 2d order Pentahedron with 15 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
int n4, int n5, int n6,
int n12,int n23,int n31,
int n45,int n56,int n64,
int n14,int n25,int n36,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36);
// 2d oreder Hexahedrons with 20 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8,
int n12,int n23,int n34,int n41,
int n56,int n67,int n78,int n85,
int n15,int n26,int n37,int n48,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48);
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
const int ID);
@ -267,11 +453,19 @@ public:
const SMDS_MeshNode *FindNode(int idnode) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3,
int idnode4, int idnode5, int idnode6) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8) const;
const SMDS_MeshElement *FindElement(int IDelem) const;
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3);
@ -279,6 +473,20 @@ public:
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4);
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4,
const SMDS_MeshNode *n5,
const SMDS_MeshNode *n6);
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4,
const SMDS_MeshNode *n5,
const SMDS_MeshNode *n6,
const SMDS_MeshNode *n7,
const SMDS_MeshNode *n8);
const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);

View File

@ -135,6 +135,18 @@ bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2)
else return false;
}
/*!
* \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_MeshEdge::GetNode(const int ind) const
{
return myNodes[ WrappedIndex( ind )];
}
//=======================================================================
//function : ChangeNodes
//purpose :

View File

@ -44,12 +44,22 @@ class SMDS_MeshEdge:public SMDS_MeshElement
int NbNodes() const;
int NbEdges() const;
friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& 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;
private:
const SMDS_MeshNode* myNodes[2];
protected:
const SMDS_MeshNode* myNodes[3];
};
#endif

View File

@ -192,3 +192,29 @@ bool operator<(const SMDS_MeshElement& e1, const SMDS_MeshElement& e2)
}
return false;
}
bool SMDS_MeshElement::IsValidIndex(const int ind) const
{
return ( ind>-1 && ind<NbNodes() );
}
const SMDS_MeshNode* SMDS_MeshElement::GetNode(const int ind) const
{
SMDS_ElemIteratorPtr it = nodesIterator();
int i = 0, index = WrappedIndex( ind );
while ( index != i++ )
it->next();
if ( it->more() )
return static_cast<const SMDS_MeshNode*> (it->next());
return 0;
}
bool SMDS_MeshElement::IsQuadratic() const
{
return false;
}
bool SMDS_MeshElement::IsMediumNode(const SMDS_MeshNode* node) const
{
return false;
}

View File

@ -56,32 +56,64 @@ class SMDS_MeshFace;
///////////////////////////////////////////////////////////////////////////////
class SMDS_WNT_EXPORT SMDS_MeshElement:public SMDS_MeshObject
{
public:
public:
SMDS_ElemIteratorPtr nodesIterator() const;
SMDS_ElemIteratorPtr edgesIterator() const;
SMDS_ElemIteratorPtr facesIterator() const;
virtual SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;
SMDS_ElemIteratorPtr nodesIterator() const;
SMDS_ElemIteratorPtr edgesIterator() const;
SMDS_ElemIteratorPtr facesIterator() const;
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
virtual int NbNodes() const;
virtual int NbEdges() const;
virtual int NbFaces() const;
int GetID() const;
virtual int NbNodes() const;
virtual int NbEdges() const;
virtual int NbFaces() const;
int GetID() const;
///Return the type of the current element
virtual SMDSAbs_ElementType GetType() const = 0;
virtual bool IsPoly() const { return false; };
///Return the type of the current element
virtual SMDSAbs_ElementType GetType() const = 0;
virtual bool IsPoly() const { return false; };
virtual bool IsQuadratic() const;
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
protected:
SMDS_MeshElement(int ID=-1);
virtual void Print(std::ostream & OS) const;
private:
int myID;
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
// ===========================
// Access to nodes by index
// ===========================
/*!
* \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;
/*!
* \brief Return true if index of node is valid (0 <= ind < NbNodes())
* \param ind - node index
* \retval bool - index check result
*/
virtual bool IsValidIndex(const int ind) const;
/*!
* \brief Return a valid node index, fixing the given one if necessary
* \param ind - node index
* \retval int - valid node index
*/
int WrappedIndex(const int ind) const {
if ( ind < 0 ) return -( ind % NbNodes());
if ( ind >= NbNodes() ) return ind % NbNodes();
return ind;
}
protected:
SMDS_MeshElement(int ID=-1);
virtual void Print(std::ostream & OS) const;
private:
int myID;
};
#endif

View File

@ -64,6 +64,15 @@ class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement
void setXYZ(double x, double y, double z);
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& 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) const { return this; }
protected:
SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const;

View File

@ -26,7 +26,7 @@
#include "SMDS_PolygonalFaceOfNodes.hxx"
#include "SMDS_IteratorOfElements.hxx"
//#include "SMDS_MeshNode.hxx"
#include "SMDS_SetIterator.hxx"
#include "utilities.h"
using namespace std;
@ -128,28 +128,11 @@ void SMDS_PolygonalFaceOfNodes::Print(ostream & OS) const
//function : elementsIterator
//purpose :
//=======================================================================
class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_ElemIterator
class SMDS_PolygonalFaceOfNodes_MyIterator:public SMDS_NodeVectorElemIterator
{
//const SMDS_MeshNode* const *mySet;
const std::vector<const SMDS_MeshNode *> mySet;
//int myLength;
int index;
public:
//SMDS_PolygonalFaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
// mySet(s),myLength(l),index(0) {}
SMDS_PolygonalFaceOfNodes_MyIterator(const std::vector<const SMDS_MeshNode *> s):
mySet(s),index(0) {}
bool more()
{
return index < mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
SMDS_PolygonalFaceOfNodes_MyIterator(const vector<const SMDS_MeshNode *>& s):
SMDS_NodeVectorElemIterator( s.begin(), s.end() ) {}
};
SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
@ -172,3 +155,16 @@ SMDS_ElemIteratorPtr SMDS_PolygonalFaceOfNodes::elementsIterator
}
return SMDS_ElemIteratorPtr();
}
/*!
* \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_PolygonalFaceOfNodes::GetNode(const int ind) const
{
return myNodes[ WrappedIndex( ind )];
}

View File

@ -50,6 +50,15 @@ class SMDS_PolygonalFaceOfNodes:public SMDS_MeshFace
virtual void Print (std::ostream & OS) 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:
virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;

View File

@ -25,6 +25,7 @@
#include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_SetIterator.hxx"
#include "utilities.h"
using namespace std;
@ -170,29 +171,14 @@ int SMDS_VolumeOfNodes::NbEdges() const
return 0;
}
class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
class SMDS_VolumeOfNodes_MyIterator:public SMDS_NodeArrayElemIterator
{
const SMDS_MeshNode* const* mySet;
int myLength;
int index;
public:
SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
mySet(s),myLength(l),index(0) {}
bool more()
{
return index<myLength;
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
SMDS_NodeArrayElemIterator( s, & s[ l ]) {}
};
SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
elementsIterator(SMDSAbs_ElementType type) const
SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::elementsIterator(SMDSAbs_ElementType type) const
{
switch(type)
{
@ -210,3 +196,15 @@ SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const
{
return SMDSAbs_Volume;
}
/*!
* \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_VolumeOfNodes::GetNode(const int ind) const
{
return myNodes[ WrappedIndex( ind )];
}

View File

@ -70,6 +70,16 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
int NbNodes() const;
int NbEdges() const;
SMDSAbs_ElementType GetType() 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;

View File

@ -185,6 +185,184 @@ static int Hexa_RE [6][5] = { // REVERSED -> EXTERNAL
{ 1, 2, 6, 5, 1 }};
static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
/*
// N3
// +
// /|\
// 7/ | \8
// / |4 \ QUADRATIC
// N0 +---|---+ N1 TETRAHEDRON
// \ +9 /
// \ | /
// 6\ | /5
// \|/
// +
// N2
*/
static int QuadTetra_F [4][7] = { // FORWARD == EXTERNAL
{ 0, 4, 1, 5, 2, 6, 0 }, // All faces have external normals
{ 0, 7, 3, 8, 1, 4, 0 },
{ 1, 8, 3, 9, 2, 5, 1 },
{ 0, 6, 2, 9, 3, 7, 0 }};
static int QuadTetra_R [4][7] = { // REVERSED
{ 0, 4, 1, 5, 2, 6, 0 }, // All faces but a bottom have external normals
{ 0, 4, 1, 8, 3, 7, 0 },
{ 1, 5, 2, 9, 3, 8, 1 },
{ 0, 7, 3, 9, 2, 6, 0 }};
static int QuadTetra_RE [4][7] = { // REVERSED -> FORWARD (EXTERNAL)
{ 0, 6, 2, 5, 1, 4, 0 }, // All faces have external normals
{ 0, 4, 1, 8, 3, 7, 0 },
{ 1, 5, 2, 9, 3, 8, 1 },
{ 0, 7, 3, 9, 2, 6, 0 }};
static int QuadTetra_nbN [] = { 6, 6, 6, 6 };
//
// QUADRATIC
// PYRAMID
//
// +4
//
//
// 10+-----+11
// | | 9 - middle point for (0,4) etc.
// | |
// 9+-----+12
//
// 6
// 1+----+----+2
// | |
// | |
// 5+ +7
// | |
// | |
// 0+----+----+3
// 8
static int QuadPyram_F [5][9] = { // FORWARD == EXTERNAL
{ 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces have external normals
{ 0, 9, 4, 10,1, 5, 0, 4, 4 },
{ 1, 10,4, 11,2, 6, 1, 4, 4 },
{ 2, 11,4, 12,3, 7, 2, 4, 4 },
{ 3, 12,4, 9, 0, 8, 3, 4, 4 }};
static int QuadPyram_R [5][9] = { // REVERSED
{ 0, 5, 1, 6, 2, 7, 3, 8, 0 }, // All faces but a bottom have external normals
{ 0, 5, 1, 10,4, 9, 0, 4, 4 },
{ 1, 6, 2, 11,4, 10,1, 4, 4 },
{ 2, 7, 3, 12,4, 11,2, 4, 4 },
{ 3, 8, 0, 9, 4, 12,3, 4, 4 }};
static int QuadPyram_RE [5][9] = { // REVERSED -> FORWARD (EXTERNAL)
{ 0, 8, 3, 7, 2, 6, 1, 5, 0 }, // All faces but a bottom have external normals
{ 0, 5, 1, 10,4, 9, 0, 4, 4 },
{ 1, 6, 2, 11,4, 10,1, 4, 4 },
{ 2, 7, 3, 12,4, 11,2, 4, 4 },
{ 3, 8, 0, 9, 4, 12,3, 4, 4 }};
static int QuadPyram_nbN [] = { 8, 6, 6, 6, 6 };
/*
// + N4
// /|\
// 9/ | \10
// / | \
// / | \
// N3 +----+----+ N5
// | |11 |
// | | |
// | +13 | QUADRATIC
// | | | PENTAHEDRON
// | | |
// | | |
// | | |
// 12+ | +14
// | | |
// | | |
// | + N1 |
// | / \ |
// | 6/ \7 |
// | / \ |
// |/ \|
// N0 +---------+ N2
// 8
*/
static int QuadPenta_F [5][9] = { // FORWARD
{ 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Top face has an internal normal, other - external
{ 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
{ 0, 8, 2, 14,5, 11,3, 12,0 },
{ 1, 13,4, 10,5, 14,2, 7, 1 },
{ 0, 12,3, 9, 4, 13,1, 6, 0 }};
static int QuadPenta_R [5][9] = { // REVERSED
{ 0, 6, 1, 7, 2, 8, 0, 0, 0 }, // Bottom face has an internal normal, other - external
{ 3, 9, 4, 10,5, 11,3, 3, 3 }, // 0 is bottom, 1 is top face
{ 0, 12,3, 11,5, 14,2, 8, 0 },
{ 1, 7, 2, 14,5, 10,4, 13,1 },
{ 0, 6, 1, 13,4, 9, 3, 12,0 }};
static int QuadPenta_FE [5][9] = { // FORWARD -> EXTERNAL
{ 0, 6, 1, 7, 2, 8, 0, 0, 0 },
{ 3,11, 5, 10,4, 9, 3, 3, 3 },
{ 0, 8, 2, 14,5, 11,3, 12,0 },
{ 1, 13,4, 10,5, 14,2, 7, 1 },
{ 0, 12,3, 9, 4, 13,1, 6, 0 }};
static int QuadPenta_RE [5][9] = { // REVERSED -> EXTERNAL
{ 0, 8, 2, 7, 1, 6, 0, 0, 0 },
{ 3, 9, 4, 10,5, 11,3, 3, 3 },
{ 0, 12,3, 11,5, 14,2, 8, 0 },
{ 1, 7, 2, 14,5, 10,4, 13,1 },
{ 0, 6, 1, 13,4, 9, 3, 12,0 }};
static int QuadPenta_nbN [] = { 6, 6, 8, 8, 8 };
/*
// 13
// N5+-----+-----+N6
// /| /|
// 12+ | 14+ |
// / | / |
// N4+-----+-----+N7 | QUADRATIC
// | | 15 | | HEXAHEDRON
// | | | |
// | 17+ | +18
// | | | |
// | | | |
// | | | |
// 16+ | +19 |
// | | | |
// | | 9 | |
// | N1+-----+-|---+N2
// | / | /
// | +8 | +10
// |/ |/
// N0+-----+-----+N3
// 11
*/
static int QuadHexa_F [6][9] = { // FORWARD
{ 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
{ 4, 12,5, 13,6, 14,7, 15,4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
{ 1, 8, 0, 16,4, 12,5, 17,1 }, // same index nodes of opposite faces are linked
{ 2, 10,3, 19,7, 14,6, 18,2 },
{ 0, 11,3, 19,7, 15,4, 16,0 },
{ 1, 9, 2, 18,6, 13,5, 17,1 }};
// static int Hexa_R [6][5] = { // REVERSED
// { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
// { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
// { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
// { 2, 6, 7, 3, 2 },
// { 0, 4, 7, 3, 0 },
// { 1, 5, 6, 2, 1 }};
static int QuadHexa_FE [6][9] = { // FORWARD -> EXTERNAL
{ 0, 8, 1, 9, 2, 10,3, 11,0 }, // opposite faces are neighbouring,
{ 4, 15,7, 14,6, 13,5, 12,4 }, // all face normals are external,
{ 0, 16,4, 12,5, 17,1, 8, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
{ 3, 10,2, 18,6, 14,7, 19,3 },
{ 0, 11,3, 19,7, 15,4, 16,0 },
{ 1, 17,5, 13,6, 18,2, 9, 1 }};
static int QuadHexa_RE [6][9] = { // REVERSED -> EXTERNAL
{ 0, 11,3, 10,2, 9, 1, 8, 0 }, // opposite faces are neighbouring,
{ 4, 12,5, 13,6, 14,7, 15,4 }, // all face normals are external,
{ 0, 8, 1, 17,5, 12,4, 16,0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
{ 3, 19,7, 14,6, 18,2, 10,3 },
{ 0, 16,4, 15,7, 19,3, 11,0 },
{ 1, 9, 2, 18,6, 13,5, 17,1 }};
static int QuadHexa_nbN [] = { 8, 8, 8, 8, 8, 8 };
// ========================================================
// to perform some calculations without linkage to CASCADE
// ========================================================
@ -323,12 +501,17 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
MESSAGE("Warning: bad volumic element");
return false;
}
} else {
}
else {
switch ( myVolumeNbNodes ) {
case 4:
case 5:
case 6:
case 8: {
case 8:
case 10:
case 13:
case 15:
case 20: {
// define volume orientation
XYZ botNormal;
GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
@ -387,6 +570,34 @@ void SMDS_VolumeTool::Inverse ()
SWAP_NODES( myVolumeNodes, 1, 3 );
SWAP_NODES( myVolumeNodes, 5, 7 );
break;
case 10:
SWAP_NODES( myVolumeNodes, 1, 2 );
SWAP_NODES( myVolumeNodes, 4, 6 );
SWAP_NODES( myVolumeNodes, 8, 9 );
break;
case 13:
SWAP_NODES( myVolumeNodes, 1, 3 );
SWAP_NODES( myVolumeNodes, 5, 8 );
SWAP_NODES( myVolumeNodes, 6, 7 );
SWAP_NODES( myVolumeNodes, 10, 12 );
break;
case 15:
SWAP_NODES( myVolumeNodes, 1, 2 );
SWAP_NODES( myVolumeNodes, 4, 5 );
SWAP_NODES( myVolumeNodes, 6, 8 );
SWAP_NODES( myVolumeNodes, 9, 11 );
SWAP_NODES( myVolumeNodes, 13, 14 );
break;
case 20:
SWAP_NODES( myVolumeNodes, 1, 3 );
SWAP_NODES( myVolumeNodes, 5, 7 );
SWAP_NODES( myVolumeNodes, 8, 11 );
SWAP_NODES( myVolumeNodes, 9, 10 );
SWAP_NODES( myVolumeNodes, 12, 15 );
SWAP_NODES( myVolumeNodes, 13, 14 );
SWAP_NODES( myVolumeNodes, 17, 19 );
break;
default:;
}
}
@ -402,14 +613,25 @@ SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetVolumeType() const
return POLYHEDA;
if ( myVolume ) {
static const VolumeType types[] = {
TETRA, // myVolumeNbNodes = 4
PYRAM, // myVolumeNbNodes = 5
PENTA, // myVolumeNbNodes = 6
UNKNOWN, // myVolumeNbNodes = 7
HEXA // myVolumeNbNodes = 8
};
return types[ myVolumeNbNodes - 4 ];
// static const VolumeType types[] = {
// TETRA, // myVolumeNbNodes = 4
// PYRAM, // myVolumeNbNodes = 5
// PENTA, // myVolumeNbNodes = 6
// UNKNOWN, // myVolumeNbNodes = 7
// HEXA // myVolumeNbNodes = 8
// };
// return types[ myVolumeNbNodes - 4 ];
switch(myVolumeNbNodes) {
case 4: return TETRA; break;
case 5: return PYRAM; break;
case 6: return PENTA; break;
case 8: return HEXA; break;
case 10: return QUAD_TETRA; break;
case 13: return QUAD_PYRAM; break;
case 15: return QUAD_PENTA; break;
case 20: return QUAD_HEXA; break;
default: break;
}
}
return UNKNOWN;
@ -491,7 +713,7 @@ double SMDS_VolumeTool::GetSize() const
else
{
const static int ind[] = {
0, 1, 3, 6, 11 };
0, 1, 3, 6, 11, 19, 32, 46, 66};
const static int vtab[][4] = {
// tetrahedron
{ 0, 1, 2, 3 },
@ -507,15 +729,80 @@ double SMDS_VolumeTool::GetSize() const
{ 4, 1, 6, 5 },
{ 1, 3, 6, 2 },
{ 4, 6, 3, 7 },
{ 1, 4, 6, 3 }
{ 1, 4, 6, 3 },
// quadratic tetrahedron
{ 0, 4, 6, 7 },
{ 1, 5, 4, 8 },
{ 2, 6, 5, 9 },
{ 7, 8, 9, 3 },
{ 4, 6, 7, 9 },
{ 4, 5, 6, 9 },
{ 4, 7, 8, 9 },
{ 4, 5, 9, 8 },
// quadratic pyramid
{ 0, 5, 8, 9 },
{ 1, 5,10, 6 },
{ 2, 6,11, 7 },
{ 3, 7,12, 8 },
{ 4, 9,11,10 },
{ 4, 9,12,11 },
{ 10, 5, 9, 8 },
{ 10, 8, 9,12 },
{ 10, 8,12, 7 },
{ 10, 7,12,11 },
{ 10, 7,11, 6 },
{ 10, 5, 8, 6 },
{ 10, 6, 8, 7 },
// quadratic pentahedron
{ 12, 0, 8, 6 },
{ 12, 8, 7, 6 },
{ 12, 8, 2, 7 },
{ 12, 6, 7, 1 },
{ 12, 1, 7,13 },
{ 12, 7, 2,13 },
{ 12, 2,14,13 },
{ 12, 3, 9,11 },
{ 12,11, 9,10 },
{ 12,11,10, 5 },
{ 12, 9, 4,10 },
{ 12,14, 5,10 },
{ 12,14,10, 4 },
{ 12,14, 4,13 },
// quadratic hexahedron
{ 16, 0,11, 8 },
{ 16,11, 9, 8 },
{ 16, 8, 9, 1 },
{ 16,11, 3,10 },
{ 16,11,10, 9 },
{ 16,10, 2, 9 },
{ 16, 3,19, 2 },
{ 16, 2,19,18 },
{ 16, 2,18,17 },
{ 16, 2,17, 1 },
{ 16, 4,12,15 },
{ 16,12, 5,13 },
{ 16,12,13,15 },
{ 16,13, 6,14 },
{ 16,13,14,15 },
{ 16,14, 7,15 },
{ 16, 6, 5,17 },
{ 16,18, 6,17 },
{ 16,18, 7, 6 },
{ 16,18,19, 7 },
};
int type = GetVolumeType();
int n1 = ind[type];
int n2 = ind[type+1];
for (int i = n1; i < n2; i++)
{
for (int i = n1; i < n2; i++) {
V -= getTetraVolume( myVolumeNodes[ vtab[i][0] ],
myVolumeNodes[ vtab[i][1] ],
myVolumeNodes[ vtab[i][2] ],
@ -647,12 +934,16 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
switch ( myVolumeNbNodes ) {
case 4:
case 5:
case 10:
case 13:
// only the bottom of a reversed tetrahedron can be internal
return ( myVolForward || faceIndex != 0 );
case 6:
case 15:
// in a forward pentahedron, the top is internal, in a reversed one - bottom
return ( myVolForward ? faceIndex != 1 : faceIndex != 0 );
case 8: {
case 8:
case 20: {
// in a forward hexahedron, even face normal is external, odd - internal
bool odd = faceIndex % 2;
return ( myVolForward ? !odd : odd );
@ -679,7 +970,8 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
XYZ aVec13( p3 - p1 );
XYZ cross = aVec12.Crossed( aVec13 );
if ( myFaceNbNodes == 4 ) {
//if ( myFaceNbNodes == 4 ) {
if ( myFaceNbNodes >3 ) {
XYZ p4 ( myFaceNodes[3] );
XYZ aVec14( p4 - p1 );
XYZ cross2 = aVec13.Crossed( aVec14 );
@ -815,7 +1107,7 @@ bool SMDS_VolumeTool::IsLinked (const SMDS_MeshNode* theNode1,
bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
const int theNode2Index) const
{
if (myVolume->IsPoly()) {
if ( myVolume->IsPoly() ) {
return IsLinked(myVolumeNodes[theNode1Index], myVolumeNodes[theNode2Index]);
}
@ -853,6 +1145,57 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
default:;
}
break;
case 10:
{
switch ( minInd ) {
case 0: if( maxInd==4 || maxInd==6 || maxInd==7 ) return true;
case 1: if( maxInd==4 || maxInd==5 || maxInd==8 ) return true;
case 2: if( maxInd==5 || maxInd==6 || maxInd==9 ) return true;
case 3: if( maxInd==7 || maxInd==8 || maxInd==9 ) return true;
default:;
}
break;
}
case 13:
{
switch ( minInd ) {
case 0: if( maxInd==5 || maxInd==8 || maxInd==9 ) return true;
case 1: if( maxInd==5 || maxInd==6 || maxInd==10 ) return true;
case 2: if( maxInd==6 || maxInd==7 || maxInd==11 ) return true;
case 3: if( maxInd==7 || maxInd==8 || maxInd==12 ) return true;
case 4: if( maxInd==9 || maxInd==10 || maxInd==11 || maxInd==12 ) return true;
default:;
}
break;
}
case 15:
{
switch ( minInd ) {
case 0: if( maxInd==6 || maxInd==8 || maxInd==12 ) return true;
case 1: if( maxInd==6 || maxInd==7 || maxInd==13 ) return true;
case 2: if( maxInd==7 || maxInd==8 || maxInd==14 ) return true;
case 3: if( maxInd==9 || maxInd==11 || maxInd==12 ) return true;
case 4: if( maxInd==9 || maxInd==10 || maxInd==13 ) return true;
case 5: if( maxInd==10 || maxInd==11 || maxInd==14 ) return true;
default:;
}
break;
}
case 20:
{
switch ( minInd ) {
case 0: if( maxInd==8 || maxInd==11 || maxInd==16 ) return true;
case 1: if( maxInd==8 || maxInd==9 || maxInd==17 ) return true;
case 2: if( maxInd==9 || maxInd==10 || maxInd==18 ) return true;
case 3: if( maxInd==10 || maxInd==11 || maxInd==19 ) return true;
case 4: if( maxInd==12 || maxInd==15 || maxInd==16 ) return true;
case 5: if( maxInd==12 || maxInd==13 || maxInd==17 ) return true;
case 6: if( maxInd==13 || maxInd==14 || maxInd==18 ) return true;
case 7: if( maxInd==14 || maxInd==15 || maxInd==19 ) return true;
default:;
}
break;
}
default:;
}
return false;
@ -894,8 +1237,7 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
typedef map< const SMDS_MeshElement*, int > TElemIntMap;
TElemIntMap volNbShared;
TElemIntMap::iterator vNbIt;
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
{
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
const SMDS_MeshNode* n = nodes[ iNode ];
SMDS_ElemIteratorPtr eIt = n->GetInverseElementIterator();
while ( eIt->more() ) {
@ -903,10 +1245,12 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
if ( elem != myVolume && elem->GetType() == SMDSAbs_Volume ) {
int nbShared = 1;
vNbIt = volNbShared.find( elem );
if ( vNbIt == volNbShared.end() )
if ( vNbIt == volNbShared.end() ) {
volNbShared.insert ( TElemIntMap::value_type( elem, nbShared ));
else
}
else {
nbShared = ++(*vNbIt).second;
}
if ( nbShared > maxNbShared )
maxNbShared = nbShared;
}
@ -922,8 +1266,7 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
if ( IsFaceExternal( faceIndex ))
intNormal = XYZ( -intNormal.x, -intNormal.y, -intNormal.z );
XYZ p0 ( nodes[0] ), baryCenter;
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ )
{
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
int nbShared = (*vNbIt).second;
if ( nbShared >= 3 ) {
SMDS_VolumeTool volume( (*vNbIt).first );
@ -935,20 +1278,20 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex )
// remove a volume from volNbShared map
volNbShared.erase( vNbIt );
}
// here volNbShared contains only volumes laying on the
// opposite side of the face
if ( volNbShared.empty() )
if ( volNbShared.empty() ) {
return free; // is free
}
// check if the whole area of a face is shared
bool isShared[] = { false, false, false, false }; // 4 triangle parts of a quadrangle
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ )
{
for ( vNbIt = volNbShared.begin(); vNbIt != volNbShared.end(); vNbIt++ ) {
SMDS_VolumeTool volume( (*vNbIt).first );
bool prevLinkShared = false;
int nbSharedLinks = 0;
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
{
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ ) {
bool linkShared = volume.IsLinked( nodes[ iNode ], nodes[ iNode + 1] );
if ( linkShared )
nbSharedLinks++;
@ -1059,7 +1402,8 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
}
myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first
} else {
}
else {
// choose face node indices
switch ( myVolumeNbNodes ) {
case 4:
@ -1090,6 +1434,34 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
else
myFaceNodeIndices = Hexa_F[ faceIndex ];
break;
case 10:
myFaceNbNodes = QuadTetra_nbN[ faceIndex ];
if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? QuadTetra_F[ faceIndex ] : QuadTetra_RE[ faceIndex ];
else
myFaceNodeIndices = myVolForward ? QuadTetra_F[ faceIndex ] : QuadTetra_R[ faceIndex ];
break;
case 13:
myFaceNbNodes = QuadPyram_nbN[ faceIndex ];
if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? QuadPyram_F[ faceIndex ] : QuadPyram_RE[ faceIndex ];
else
myFaceNodeIndices = myVolForward ? QuadPyram_F[ faceIndex ] : QuadPyram_R[ faceIndex ];
break;
case 15:
myFaceNbNodes = QuadPenta_nbN[ faceIndex ];
if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? QuadPenta_FE[ faceIndex ] : QuadPenta_RE[ faceIndex ];
else
myFaceNodeIndices = myVolForward ? QuadPenta_F[ faceIndex ] : QuadPenta_R[ faceIndex ];
break;
case 20:
myFaceNbNodes = QuadHexa_nbN[ faceIndex ];
if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? QuadHexa_FE[ faceIndex ] : QuadHexa_RE[ faceIndex ];
else
myFaceNodeIndices = QuadHexa_F[ faceIndex ];
break;
default:
return false;
}
@ -1118,6 +1490,10 @@ SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
case 5: return PYRAM;
case 6: return PENTA;
case 8: return HEXA;
case 10: return QUAD_TETRA;
case 13: return QUAD_PYRAM;
case 15: return QUAD_PENTA;
case 20: return QUAD_HEXA;
default:return UNKNOWN;
}
}
@ -1130,10 +1506,14 @@ SMDS_VolumeTool::VolumeType SMDS_VolumeTool::GetType(int nbNodes)
int SMDS_VolumeTool::NbFaces( VolumeType type )
{
switch ( type ) {
case TETRA: return 4;
case PYRAM: return 5;
case PENTA: return 5;
case HEXA : return 6;
case TETRA :
case QUAD_TETRA: return 4;
case PYRAM :
case QUAD_PYRAM: return 5;
case PENTA :
case QUAD_PENTA: return 5;
case HEXA :
case QUAD_HEXA : return 6;
default: return 0;
}
}
@ -1155,6 +1535,10 @@ const int* SMDS_VolumeTool::GetFaceNodesIndices(VolumeType type,
case PYRAM: return Pyramid_F[ faceIndex ];
case PENTA: return external ? Penta_FE[ faceIndex ] : Penta_F[ faceIndex ];
case HEXA: return external ? Hexa_FE[ faceIndex ] : Hexa_F[ faceIndex ];
case QUAD_TETRA: return QuadTetra_F[ faceIndex ];
case QUAD_PYRAM: return QuadPyram_F[ faceIndex ];
case QUAD_PENTA: return external ? QuadPenta_FE[ faceIndex ] : QuadPenta_F[ faceIndex ];
case QUAD_HEXA: return external ? QuadHexa_FE[ faceIndex ] : QuadHexa_F[ faceIndex ];
default:;
}
return 0;
@ -1173,6 +1557,10 @@ int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
case PYRAM: return Pyramid_nbN[ faceIndex ];
case PENTA: return Penta_nbN[ faceIndex ];
case HEXA: return Hexa_nbN[ faceIndex ];
case QUAD_TETRA: return QuadTetra_nbN[ faceIndex ];
case QUAD_PYRAM: return QuadPyram_nbN[ faceIndex ];
case QUAD_PENTA: return QuadPenta_nbN[ faceIndex ];
case QUAD_HEXA: return QuadHexa_nbN[ faceIndex ];
default:;
}
return 0;

View File

@ -61,7 +61,8 @@ class SMDS_WNT_EXPORT SMDS_VolumeTool
{
public:
enum VolumeType { UNKNOWN = -1, TETRA = 0, PYRAM, PENTA, HEXA, POLYHEDA };
enum VolumeType { UNKNOWN = -1, TETRA = 0, PYRAM, PENTA, HEXA, QUAD_TETRA,
QUAD_PYRAM, QUAD_PENTA, QUAD_HEXA, POLYHEDA };
SMDS_VolumeTool ();
~SMDS_VolumeTool ();

View File

@ -39,6 +39,7 @@ EXPORT_HEADERS= \
SMESH_Mesh.hxx \
SMESH_subMesh.hxx \
SMESH_Hypothesis.hxx \
SMESH_HypoFilter.hxx \
SMESH_Algo.hxx \
SMESH_1D_Algo.hxx \
SMESH_2D_Algo.hxx \

View File

@ -29,7 +29,7 @@
using namespace std;
#include "SMESH_2D_Algo.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_subMesh.hxx"
#include <TopExp.hxx>
#include "utilities.h"
@ -80,13 +80,14 @@ int SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S)
int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
{
int nbPoints = 0;
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next())
{
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
//SCRUTE(nb);
nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?)
}
//SCRUTE(nbPoints);
for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if(_quadraticMesh)
nb = nb/2;
nbPoints += nb + 1; // internal points plus 1 vertex of 2 (last point ?)
}
return nbPoints;
}

View File

@ -30,7 +30,8 @@
#define _SMESH_2D_ALGO_HXX_
#include "SMESH_Algo.hxx"
#include <TopoDS_Wire.hxx>
#include "SMESH_subMesh.hxx"
#include "TopoDS_Wire.hxx"
class SMESH_2D_Algo:
public SMESH_Algo
@ -41,6 +42,7 @@ public:
int NumberOfWires(const TopoDS_Shape& S);
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W);
};
#endif

View File

@ -29,7 +29,6 @@
using namespace std;
#include "SMESH_3D_Algo.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_subMesh.hxx"
#include "utilities.h"
@ -56,3 +55,5 @@ SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
SMESH_3D_Algo::~SMESH_3D_Algo()
{
}

View File

@ -37,6 +37,7 @@ class SMESH_3D_Algo:
public:
SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_3D_Algo();
};
#endif

View File

@ -69,6 +69,7 @@ SMESH_Algo::SMESH_Algo(int hypId, int studyId,
gen->_mapAlgo[hypId] = this;
_onlyUnaryInput = _requireDescretBoundary = true;
_quadraticMesh = false;
}
//=============================================================================
@ -102,18 +103,17 @@ const vector < string > &SMESH_Algo::GetCompatibleHypothesis()
*/
//=============================================================================
const list <const SMESHDS_Hypothesis *> & SMESH_Algo::GetUsedHypothesis(
SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
const list <const SMESHDS_Hypothesis *> &
SMESH_Algo::GetUsedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary)
{
_usedHypList.clear();
if ( !_compatibleHypothesis.empty() )
SMESH_HypoFilter filter;
if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
{
SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( _compatibleHypothesis[0] ));
for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
filter.Or( filter.HasName( _compatibleHypothesis[ i ] ));
aMesh.GetHypotheses( aShape, filter, _usedHypList, true );
if ( _usedHypList.size() > 1 )
if ( ignoreAuxiliary && _usedHypList.size() > 1 )
_usedHypList.clear(); //only one compatible hypothesis allowed
}
return _usedHypList;
@ -127,18 +127,16 @@ const list <const SMESHDS_Hypothesis *> & SMESH_Algo::GetUsedHypothesis(
*/
//=============================================================================
const list<const SMESHDS_Hypothesis *> & SMESH_Algo::GetAppliedHypothesis(
SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
const list<const SMESHDS_Hypothesis *> &
SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary)
{
_appliedHypList.clear();
if ( !_compatibleHypothesis.empty() )
{
SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( _compatibleHypothesis[0] ));
for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
filter.Or( filter.HasName( _compatibleHypothesis[ i ] ));
SMESH_HypoFilter filter;
if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
aMesh.GetHypotheses( aShape, filter, _appliedHypList, false );
}
return _appliedHypList;
}
@ -344,3 +342,28 @@ bool SMESH_Algo::GetNodeParamOnEdge(const SMESHDS_Mesh* theMesh,
return theParams.size() > 1;
}
//================================================================================
/*!
* \brief Make filter recognize only compatible hypotheses
* \param theFilter - the filter to initialize
* \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
*/
//================================================================================
bool SMESH_Algo::InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
const bool ignoreAuxiliary) const
{
if ( !_compatibleHypothesis.empty() )
{
theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));
if ( ignoreAuxiliary )
theFilter.AndNot( theFilter.IsAuxiliary() );
return true;
}
return false;
}

View File

@ -33,16 +33,20 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <gp_XY.hxx>
#include <string>
#include <vector>
#include <list>
#include <map>
class SMESH_Gen;
class SMESH_Mesh;
class SMESH_HypoFilter;
class TopoDS_Face;
class TopoDS_Shape;
class SMESHDS_Mesh;
class SMDS_MeshNode;
class SMESH_Algo:public SMESH_Hypothesis
{
@ -58,13 +62,27 @@ class SMESH_Algo:public SMESH_Hypothesis
virtual bool Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) = 0;
virtual const std::list <const SMESHDS_Hypothesis *> &
GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
GetUsedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary=true);
const list <const SMESHDS_Hypothesis *> &
GetAppliedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
GetAppliedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary=true);
static double EdgeLength(const TopoDS_Edge & E);
/*!
* \brief Make filter recognize only compatible hypotheses
* \param theFilter - the filter to initialize
* \param ignoreAuxiliary - make filter ignore compatible auxiliary hypotheses
* \retval bool - true if the algo has compatible hypotheses
*/
bool InitCompatibleHypoFilter( SMESH_HypoFilter & theFilter,
const bool ignoreAuxiliary) const;
/*!
* \brief Fill vector of node parameters on geometrical edge, including vertex nodes
* \param theMesh - The mesh containing nodes
@ -121,6 +139,9 @@ class SMESH_Algo:public SMESH_Hypothesis
std::vector<std::string> _compatibleHypothesis;
std::list<const SMESHDS_Hypothesis *> _appliedHypList;
std::list<const SMESHDS_Hypothesis *> _usedHypList;
// quadratic mesh creation required
bool _quadraticMesh;
};
#endif

View File

@ -633,13 +633,14 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
if ( algoList.empty() )
return NULL;
if (algoList.size() > 1 ) { // check if there is one algo several times
list <const SMESHDS_Hypothesis * >::iterator algo = algoList.begin();
for ( ; algo != algoList.end(); ++algo )
if ( (*algo) != algoList.front() &&
(*algo)->GetName() != algoList.front()->GetName() )
return NULL;
}
// Now it is checked in SMESH_Mesh::GetHypotheses()
// if (algoList.size() > 1 ) { // check if there is one algo several times
// list <const SMESHDS_Hypothesis * >::iterator algo = algoList.begin();
// for ( ; algo != algoList.end(); ++algo )
// if ( (*algo) != algoList.front() &&
// (*algo)->GetName() != algoList.front()->GetName() )
// return NULL;
// }
return const_cast<SMESH_Algo*> ( static_cast<const SMESH_Algo* >( algoList.front() ));
}

View File

@ -75,6 +75,17 @@ bool SMESH_HypoFilter::ApplicablePredicate::IsOk(const SMESH_Hypothesis* aHyp,
return SMESH_subMesh::IsApplicableHypotesis( aHyp, (TopAbs_ShapeEnum)_shapeType );
};
//=======================================================================
//function : IsAuxiliaryPredicate::IsOk
//purpose :
//=======================================================================
bool SMESH_HypoFilter::IsAuxiliaryPredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& /*aShape*/) const
{
return aHyp->IsAuxiliary();
};
//=======================================================================
//function : ApplicablePredicate::ApplicablePredicate
//purpose :
@ -190,6 +201,17 @@ SMESH_HypoPredicate* SMESH_HypoFilter::IsAlgo()
return new TypePredicate( MORE, SMESHDS_Hypothesis::PARAM_ALGO );
}
//=======================================================================
//function : IsAuxiliary
//purpose :
//=======================================================================
SMESH_HypoPredicate* SMESH_HypoFilter::IsAuxiliary()
{
return new IsAuxiliaryPredicate();
}
//=======================================================================
//function : IsGlobal
//purpose :

View File

@ -67,6 +67,7 @@ class SMESH_HypoFilter: public SMESH_HypoPredicate
// Create predicates
static SMESH_HypoPredicate* IsAlgo();
static SMESH_HypoPredicate* IsAuxiliary();
static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* IsAssignedTo(const TopoDS_Shape& theShape);
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
@ -158,6 +159,11 @@ class SMESH_HypoFilter: public SMESH_HypoPredicate
const TopoDS_Shape& aShape) const;
};
struct IsAuxiliaryPredicate : public SMESH_HypoPredicate {
bool IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const;
};
};

View File

@ -72,13 +72,14 @@ SMESH_Hypothesis::~SMESH_Hypothesis()
int SMESH_Hypothesis::GetDim() const
{
int dim = -1;
int dim = 0;
switch (_type)
{
case ALGO_1D: dim = 1; break;
case ALGO_2D: dim = 2; break;
case ALGO_3D: dim = 3; break;
case PARAM_ALGO: dim = _param_algo_dim; break;
case PARAM_ALGO:
dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break;
}
return dim;
}
@ -124,14 +125,15 @@ void SMESH_Hypothesis::NotifySubMeshesHypothesisModification()
itm++)
{
SMESH_Mesh* mesh = (*itm).second;
const list<SMESH_subMesh*>& subMeshes =
mesh->GetSubMeshUsingHypothesis(this);
mesh->NotifySubMeshesHypothesisModification( this );
// const list<SMESH_subMesh*>& subMeshes =
// mesh->GetSubMeshUsingHypothesis(this);
//for all subMeshes using hypothesis
// //for all subMeshes using hypothesis
list<SMESH_subMesh*>::const_iterator its;
for (its = subMeshes.begin(); its != subMeshes.end(); its++)
(*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
// list<SMESH_subMesh*>::const_iterator its;
// for (its = subMeshes.begin(); its != subMeshes.end(); its++)
// (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
}
}

View File

@ -57,11 +57,11 @@ public:
SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_Hypothesis();
int GetDim() const;
virtual int GetDim() const;
int GetStudyId() const;
void NotifySubMeshesHypothesisModification();
int GetShapeType() const;
const char* GetLibName() const;
virtual void NotifySubMeshesHypothesisModification();
virtual int GetShapeType() const;
virtual const char* GetLibName() const;
void SetLibName(const char* theLibName);
/*!
@ -72,6 +72,17 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape)=0;
/*!
* \brief Return true if me is an auxiliary hypothesis
* \retval bool - auxiliary or not
*
* An auxiliary hypothesis is optional, i.e. an algorithm
* can work without it and another hypothesis of the same
* dimention can be assigned to the shape
*/
virtual bool IsAuxiliary() const
{ return GetType() == PARAM_ALGO && _param_algo_dim <= 0; }
protected:
SMESH_Gen* _gen;
int _studyId;

View File

@ -526,45 +526,62 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS
//purpose :
//=======================================================================
bool SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
const SMESH_HypoFilter& aFilter,
list <const SMESHDS_Hypothesis * >& aHypList,
const bool andAncestors) const
//================================================================================
/*!
* \brief Return hypothesis assigned to the shape
* \param aSubShape - the shape to check
* \param aFilter - the hypothesis filter
* \param aHypList - the list of the found hypotheses
* \param andAncestors - flag to check hypos assigned to ancestors of the shape
* \retval int - number of unique hypos in aHypList
*/
//================================================================================
int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape,
const SMESH_HypoFilter& aFilter,
list <const SMESHDS_Hypothesis * >& aHypList,
const bool andAncestors) const
{
int nbHyp = 0;
set<string> hypTypes; // to exclude same type hypos from the result list
int nbHyps = 0;
// fill in hypTypes
list<const SMESHDS_Hypothesis*>::const_iterator hyp;
for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ )
if ( hypTypes.insert( (*hyp)->GetName() ).second )
nbHyps++;
// get hypos from aSubShape
{
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(aSubShape);
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
for ( ; hyp != hypList.end(); hyp++ )
if ( aFilter.IsOk (static_cast<const SMESH_Hypothesis*>( *hyp ), aSubShape)) {
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
if ( aFilter.IsOk (static_cast<const SMESH_Hypothesis*>( *hyp ), aSubShape) &&
hypTypes.insert( (*hyp)->GetName() ).second )
{
aHypList.push_back( *hyp );
nbHyp++;
nbHyps++;
}
}
// get hypos from shape of one type only: if any hypo is found on edge, do
// not look up on faces
if ( !nbHyp && andAncestors )
// get hypos from ancestors of aSubShape
if ( andAncestors )
{
TopTools_MapOfShape map;
TopTools_ListIteratorOfListOfShape it( GetAncestors( aSubShape ));
int shapeType = it.More() ? it.Value().ShapeType() : TopAbs_SHAPE;
for (; it.More(); it.Next() )
{
if ( nbHyp && shapeType != it.Value().ShapeType() )
break;
shapeType = it.Value().ShapeType();
if ( !map.Add( it.Value() ))
if ( !map.Add( it.Value() ))
continue;
const list<const SMESHDS_Hypothesis*>& hypList = _myMeshDS->GetHypothesis(it.Value());
list<const SMESHDS_Hypothesis*>::const_iterator hyp = hypList.begin();
for ( ; hyp != hypList.end(); hyp++ )
if (aFilter.IsOk( static_cast<const SMESH_Hypothesis*>( *hyp ), it.Value() )) {
aHypList.push_back( *hyp );
nbHyp++;
}
for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ )
if (aFilter.IsOk( static_cast<const SMESH_Hypothesis*>( *hyp ), it.Value() ) &&
hypTypes.insert( (*hyp)->GetName() ).second ) {
aHypList.push_back( *hyp );
nbHyps++;
}
}
}
return nbHyp;
return !aHypList.empty();
}
//=============================================================================
@ -696,15 +713,17 @@ throw(SALOME_Exception)
//=======================================================================
bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const TopoDS_Shape & aSubShape)
const SMESH_subMesh* aSubMesh)
{
SMESH_Hypothesis* hyp = static_cast<SMESH_Hypothesis*>(anHyp);
// check if anHyp is applicable to aSubShape
SMESH_subMesh * subMesh = GetSubMeshContaining( aSubShape );
if ( !subMesh || !subMesh->IsApplicableHypotesis( hyp ))
// check if anHyp can be used to mesh aSubMesh
if ( !aSubMesh || !aSubMesh->IsApplicableHypotesis( hyp ))
return false;
SMESH_Algo *algo = _gen->GetAlgo(*this, aSubShape);
const TopoDS_Shape & aSubShape = const_cast<SMESH_subMesh*>( aSubMesh )->GetSubShape();
SMESH_Algo *algo = _gen->GetAlgo(*this, aSubShape );
// algorithm
if (anHyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO)
@ -714,17 +733,19 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
if (algo)
{
// look trough hypotheses used by algo
const list <const SMESHDS_Hypothesis * >&usedHyps =
algo->GetUsedHypothesis(*this, aSubShape);
return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
SMESH_HypoFilter hypoKind;
if ( algo->InitCompatibleHypoFilter( hypoKind, !hyp->IsAuxiliary() )) {
list <const SMESHDS_Hypothesis * > usedHyps;
if ( GetHypotheses( aSubShape, hypoKind, usedHyps, true ))
return ( find( usedHyps.begin(), usedHyps.end(), anHyp ) != usedHyps.end() );
}
}
// look through all assigned hypotheses
SMESH_HypoFilter filter( SMESH_HypoFilter::Is( hyp ));
return GetHypothesis( aSubShape, filter, true );
//SMESH_HypoFilter filter( SMESH_HypoFilter::Is( hyp ));
return false; //GetHypothesis( aSubShape, filter, true );
}
//=============================================================================
/*!
*
@ -732,20 +753,78 @@ bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
//=============================================================================
const list < SMESH_subMesh * >&
SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
throw(SALOME_Exception)
SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
map < int, SMESH_subMesh * >::iterator itsm;
_subMeshesUsingHypothesisList.clear();
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
{
SMESH_subMesh *aSubMesh = (*itsm).second;
if ( IsUsedHypothesis ( anHyp, aSubMesh->GetSubShape() ))
_subMeshesUsingHypothesisList.push_back(aSubMesh);
}
return _subMeshesUsingHypothesisList;
if(MYDEBUG) MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
map < int, SMESH_subMesh * >::iterator itsm;
_subMeshesUsingHypothesisList.clear();
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
{
SMESH_subMesh *aSubMesh = (*itsm).second;
if ( IsUsedHypothesis ( anHyp, aSubMesh ))
_subMeshesUsingHypothesisList.push_back(aSubMesh);
}
return _subMeshesUsingHypothesisList;
}
//=======================================================================
//function : NotifySubMeshesHypothesisModification
//purpose : Say all submeshes using theChangedHyp that it has been modified
//=======================================================================
void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp)
{
Unexpect aCatch(SalomeException);
const SMESH_Hypothesis* hyp = static_cast<const SMESH_Hypothesis*>(theChangedHyp);
const SMESH_Algo *foundAlgo = 0;
SMESH_HypoFilter algoKind( SMESH_HypoFilter::IsAlgo() );
SMESH_HypoFilter compatibleHypoKind;
list <const SMESHDS_Hypothesis * > usedHyps;
map < int, SMESH_subMesh * >::iterator itsm;
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
{
SMESH_subMesh *aSubMesh = (*itsm).second;
if ( aSubMesh->IsApplicableHypotesis( hyp ))
{
const TopoDS_Shape & aSubShape = aSubMesh->GetSubShape();
if ( !foundAlgo ) // init filter for algo search
algoKind.And( algoKind.IsApplicableTo( aSubShape ));
const SMESH_Algo *algo = static_cast<const SMESH_Algo*>
( GetHypothesis( aSubShape, algoKind, true ));
if ( algo )
{
bool sameAlgo = ( algo == foundAlgo );
if ( !sameAlgo && foundAlgo )
sameAlgo = ( strcmp( algo->GetName(), foundAlgo->GetName() ) == 0);
if ( !sameAlgo ) { // init filter for used hypos search
if ( !algo->InitCompatibleHypoFilter( compatibleHypoKind, !hyp->IsAuxiliary() ))
continue; // algo does not use any hypothesis
foundAlgo = algo;
}
// check if hyp is used by algo
usedHyps.clear();
if ( GetHypotheses( aSubShape, compatibleHypoKind, usedHyps, true ) &&
find( usedHyps.begin(), usedHyps.end(), hyp ) != usedHyps.end() )
{
aSubMesh->ComputeStateEngine(SMESH_subMesh::MODIF_HYP);
if ( algo->GetDim() == 1 && IsPropagationHypothesis( aSubShape ))
CleanMeshOnPropagationChain( aSubShape );
}
}
}
}
}
//=============================================================================
@ -895,7 +974,8 @@ int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
const SMDS_MeshFace * curFace;
while (itFaces->more()) {
curFace = itFaces->next();
if (!curFace->IsPoly() && curFace->NbNodes() == 3) Nb++;
if ( !curFace->IsPoly() &&
( curFace->NbNodes()==3 || curFace->NbNodes()==6 ) ) Nb++;
}
return Nb;
}
@ -913,7 +993,8 @@ int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
const SMDS_MeshFace * curFace;
while (itFaces->more()) {
curFace = itFaces->next();
if (!curFace->IsPoly() && curFace->NbNodes() == 4) Nb++;
if ( !curFace->IsPoly() &&
( curFace->NbNodes() == 4 || curFace->NbNodes()==8 ) ) Nb++;
}
return Nb;
}
@ -951,7 +1032,8 @@ int SMESH_Mesh::NbTetras() throw(SALOME_Exception)
const SMDS_MeshVolume * curVolume;
while (itVolumes->more()) {
curVolume = itVolumes->next();
if (!curVolume->IsPoly() && curVolume->NbNodes() == 4) Nb++;
if ( !curVolume->IsPoly() &&
( curVolume->NbNodes() == 4 || curVolume->NbNodes()==10 ) ) Nb++;
}
return Nb;
}
@ -965,7 +1047,8 @@ int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
const SMDS_MeshVolume * curVolume;
while (itVolumes->more()) {
curVolume = itVolumes->next();
if (!curVolume->IsPoly() && curVolume->NbNodes() == 8) Nb++;
if ( !curVolume->IsPoly() &&
( curVolume->NbNodes() == 8 || curVolume->NbNodes()==20 ) ) Nb++;
}
return Nb;
}
@ -979,7 +1062,8 @@ int SMESH_Mesh::NbPyramids() throw(SALOME_Exception)
const SMDS_MeshVolume * curVolume;
while (itVolumes->more()) {
curVolume = itVolumes->next();
if (!curVolume->IsPoly() && curVolume->NbNodes() == 5) Nb++;
if ( !curVolume->IsPoly() &&
( curVolume->NbNodes() == 5 || curVolume->NbNodes()==13 ) ) Nb++;
}
return Nb;
}
@ -993,7 +1077,8 @@ int SMESH_Mesh::NbPrisms() throw(SALOME_Exception)
const SMDS_MeshVolume * curVolume;
while (itVolumes->more()) {
curVolume = itVolumes->next();
if (!curVolume->IsPoly() && curVolume->NbNodes() == 6) Nb++;
if ( !curVolume->IsPoly() &&
( curVolume->NbNodes() == 6 || curVolume->NbNodes()==15 ) ) Nb++;
}
return Nb;
}

View File

@ -110,10 +110,10 @@ public:
const SMESH_HypoFilter& aFilter,
const bool andAncestors) const;
bool GetHypotheses(const TopoDS_Shape & aSubShape,
const SMESH_HypoFilter& aFilter,
list <const SMESHDS_Hypothesis * >& aHypList,
const bool andAncestors) const;
int GetHypotheses(const TopoDS_Shape & aSubShape,
const SMESH_HypoFilter& aFilter,
list <const SMESHDS_Hypothesis * >& aHypList,
const bool andAncestors) const;
const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
@ -134,12 +134,15 @@ public:
SMESH_subMesh *GetSubMeshContaining(const int aShapeID)
throw(SALOME_Exception);
void NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* theChangedHyp);
// Say all submeshes that theChangedHyp has been modified
const list < SMESH_subMesh * >&
GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
throw(SALOME_Exception);
bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const TopoDS_Shape & aSubShape);
bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const SMESH_subMesh * aSubMesh);
// Return True if anHyp is used to mesh aSubShape
bool IsNotConformAllowed() const;

File diff suppressed because it is too large Load Diff

View File

@ -433,7 +433,7 @@ void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape)
*/
//=============================================================================
const TopoDS_Shape & SMESH_subMesh::GetSubShape()
const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
{
//MESSAGE("SMESH_subMesh::GetSubShape");
return _subShape;
@ -540,7 +540,7 @@ SMESH_Hypothesis::Hypothesis_Status
if ( ! CanAddHypothesis( anHyp ))
return SMESH_Hypothesis::HYP_BAD_DIM;
if ( GetSimilarAttached( _subShape, anHyp ) )
if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) )
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
if ( !_meshDS->AddHypothesis(_subShape, anHyp))
@ -549,9 +549,9 @@ SMESH_Hypothesis::Hypothesis_Status
// Serve Propagation of 1D hypothesis
if (event == ADD_HYP) {
bool isPropagationOk = true;
string hypName = anHyp->GetName();
bool isPropagationHyp = ( strcmp( "Propagation", anHyp->GetName() ) == 0 );
if (hypName == "Propagation") {
if ( isPropagationHyp ) {
TopExp_Explorer exp (_subShape, TopAbs_EDGE);
TopTools_MapOfShape aMap;
for (; exp.More(); exp.Next()) {
@ -579,7 +579,11 @@ SMESH_Hypothesis::Hypothesis_Status
} else {
}
if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) {
if ( isPropagationOk ) {
if ( isPropagationHyp )
return ret; // nothing more to do for "Propagation" hypothesis
}
else if ( ret < SMESH_Hypothesis::HYP_CONCURENT) {
ret = SMESH_Hypothesis::HYP_CONCURENT;
}
} // Serve Propagation of 1D hypothesis
@ -598,7 +602,9 @@ SMESH_Hypothesis::Hypothesis_Status
{
bool isPropagationOk = true;
SMESH_HypoFilter propagFilter( SMESH_HypoFilter::HasName( "Propagation" ));
if ( propagFilter.IsOk( anHyp, _subShape ))
bool isPropagationHyp = propagFilter.IsOk( anHyp, _subShape );
if ( isPropagationHyp )
{
TopExp_Explorer exp (_subShape, TopAbs_EDGE);
TopTools_MapOfShape aMap;
@ -620,7 +626,11 @@ SMESH_Hypothesis::Hypothesis_Status
isPropagationOk = _father->RebuildPropagationChains();
}
if (!isPropagationOk && ret < SMESH_Hypothesis::HYP_CONCURENT) {
if ( isPropagationOk ) {
if ( isPropagationHyp )
return ret; // nothing more to do for "Propagation" hypothesis
}
else if ( ret < SMESH_Hypothesis::HYP_CONCURENT) {
ret = SMESH_Hypothesis::HYP_CONCURENT;
}
} // Serve Propagation of 1D hypothesis
@ -698,7 +708,7 @@ SMESH_Hypothesis::Hypothesis_Status
SetAlgoState(HYP_OK);
if (SMESH_Hypothesis::IsStatusFatal( ret ))
_meshDS->RemoveHypothesis(_subShape, anHyp);
else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
else if (!_father->IsUsedHypothesis( anHyp, this ))
{
_meshDS->RemoveHypothesis(_subShape, anHyp);
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
@ -788,7 +798,7 @@ SMESH_Hypothesis::Hypothesis_Status
// ret should be fatal: anHyp was not added
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
else if (!_father->IsUsedHypothesis( anHyp, this ))
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
if (SMESH_Hypothesis::IsStatusFatal( ret ))
@ -852,7 +862,7 @@ SMESH_Hypothesis::Hypothesis_Status
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
{
if (_father->IsUsedHypothesis( anHyp, _subShape )) // new Hyp
if (_father->IsUsedHypothesis( anHyp, this )) // new Hyp
modifiedHyp = true;
}
else
@ -1607,8 +1617,9 @@ TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlg
if ( mainShape.IsSame( _subShape ))
return _subShape;
const bool ignoreAuxiliaryHyps = false;
list<const SMESHDS_Hypothesis*> aUsedHyp =
theAlgo->GetUsedHypothesis( *_father, _subShape ); // copy
theAlgo->GetUsedHypothesis( *_father, _subShape, ignoreAuxiliaryHyps ); // copy
// put in a compound all shapes with the same hypothesis assigned
// and a good ComputState
@ -1626,7 +1637,7 @@ TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlg
if (subMesh->GetComputeState() == READY_TO_COMPUTE &&
anAlgo == theAlgo &&
anAlgo->GetUsedHypothesis( *_father, S ) == aUsedHyp)
anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp)
{
aBuilder.Add( aCompound, S );
}
@ -1637,26 +1648,31 @@ TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlg
//=======================================================================
//function : GetSimilarAttached
//purpose : return nb of hypotheses attached to theShape.
//purpose : return a hypothesis attached to theShape.
// If theHyp is provided, similar but not same hypotheses
// are countered; else only applicable ones having theHypType
// are countered
// is returned; else only applicable ones having theHypType
// is returned
//=======================================================================
const SMESH_Hypothesis* SMESH_subMesh::GetSimilarAttached(const TopoDS_Shape& theShape,
const SMESH_Hypothesis * theHyp,
const int theHypType)
{
SMESH_HypoFilter filter;
filter.Init( SMESH_HypoFilter::HasType( theHyp ? theHyp->GetType() : theHypType ));
SMESH_HypoFilter hypoKind;
hypoKind.Init( hypoKind.HasType( theHyp ? theHyp->GetType() : theHypType ));
if ( theHyp ) {
filter.And( SMESH_HypoFilter::HasDim( theHyp->GetDim() ));
filter.AndNot( SMESH_HypoFilter::Is( theHyp ));
hypoKind.And ( hypoKind.HasDim( theHyp->GetDim() ));
hypoKind.AndNot( hypoKind.Is( theHyp ));
if ( theHyp->IsAuxiliary() )
hypoKind.And( hypoKind.HasName( theHyp->GetName() ));
else
hypoKind.AndNot( hypoKind.IsAuxiliary());
}
else {
hypoKind.And( hypoKind.IsApplicableTo( theShape ));
}
else
filter.And( SMESH_HypoFilter::IsApplicableTo( theShape ));
return _father->GetHypothesis( theShape, filter, false );
return _father->GetHypothesis( theShape, hypoKind, false );
}
//=======================================================================

View File

@ -70,7 +70,7 @@ class SMESH_subMesh
const map < int, SMESH_subMesh * >&DependsOn();
//const map < int, SMESH_subMesh * >&Dependants();
const TopoDS_Shape & GetSubShape();
const TopoDS_Shape & GetSubShape() const;
// bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
@ -103,17 +103,13 @@ class SMESH_subMesh
SMESH_Hypothesis::Hypothesis_Status
SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
int GetAlgoState() { return _algoState; }
int GetAlgoState() const { return _algoState; }
int GetComputeState() const { return _computeState; };
void DumpAlgoState(bool isMain);
bool ComputeStateEngine(int event);
int GetComputeState()
{
return _computeState;
};
bool IsConform(const SMESH_Algo* theAlgo);
// check if a conform mesh will be produced by the Algo

View File

@ -416,3 +416,199 @@ const list < double >&SMESHDS_Command::GetCoords()
{
return myReals;
}
//********************************************************************
//***** Methods for quadratic elements ******
//********************************************************************
//=======================================================================
//function : AddEdge
//purpose :
//=======================================================================
void SMESHDS_Command::AddEdge(int NewEdgeID, int n1, int n2, int n12)
{
if (!myType == SMESHDS_AddQuadEdge) {
MESSAGE("SMESHDS_Command::AddEdge : Bad Type");
return;
}
myIntegers.push_back(NewEdgeID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n12);
myNumber++;
}
//=======================================================================
//function : AddFace
//purpose :
//=======================================================================
void SMESHDS_Command::AddFace(int NewFaceID,
int n1, int n2, int n3,
int n12, int n23, int n31)
{
if (!myType == SMESHDS_AddQuadTriangle) {
MESSAGE("SMESHDS_Command::AddFace : Bad Type");
return;
}
myIntegers.push_back(NewFaceID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n3);
myIntegers.push_back(n12);
myIntegers.push_back(n23);
myIntegers.push_back(n31);
myNumber++;
}
//=======================================================================
//function : AddFace
//purpose :
//=======================================================================
void SMESHDS_Command::AddFace(int NewFaceID,
int n1, int n2, int n3, int n4,
int n12, int n23, int n34, int n41)
{
if (!myType == SMESHDS_AddQuadQuadrangle) {
MESSAGE("SMESHDS_Command::AddFace : Bad Type");
return;
}
myIntegers.push_back(NewFaceID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n3);
myIntegers.push_back(n4);
myIntegers.push_back(n12);
myIntegers.push_back(n23);
myIntegers.push_back(n34);
myIntegers.push_back(n41);
myNumber++;
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n12, int n23, int n31,
int n14, int n24, int n34)
{
if (!myType == SMESHDS_AddQuadTetrahedron) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.push_back(NewVolID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n3);
myIntegers.push_back(n4);
myIntegers.push_back(n12);
myIntegers.push_back(n23);
myIntegers.push_back(n31);
myIntegers.push_back(n14);
myIntegers.push_back(n24);
myIntegers.push_back(n34);
myNumber++;
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
int n3, int n4, int n5,
int n12, int n23, int n34, int n41,
int n15, int n25, int n35, int n45)
{
if (!myType == SMESHDS_AddQuadPyramid) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.push_back(NewVolID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n3);
myIntegers.push_back(n4);
myIntegers.push_back(n5);
myIntegers.push_back(n12);
myIntegers.push_back(n23);
myIntegers.push_back(n34);
myIntegers.push_back(n41);
myIntegers.push_back(n15);
myIntegers.push_back(n25);
myIntegers.push_back(n35);
myIntegers.push_back(n45);
myNumber++;
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2,
int n3, int n4, int n5,int n6,
int n12, int n23, int n31,
int n45, int n56, int n64,
int n14, int n25, int n36)
{
if (!myType == SMESHDS_AddQuadPentahedron) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.push_back(NewVolID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n3);
myIntegers.push_back(n4);
myIntegers.push_back(n5);
myIntegers.push_back(n6);
myIntegers.push_back(n12);
myIntegers.push_back(n23);
myIntegers.push_back(n31);
myIntegers.push_back(n45);
myIntegers.push_back(n56);
myIntegers.push_back(n64);
myIntegers.push_back(n14);
myIntegers.push_back(n25);
myIntegers.push_back(n36);
myNumber++;
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Command::AddVolume(int NewVolID, int n1, int n2, int n3,
int n4, int n5, int n6, int n7, int n8,
int n12, int n23, int n34, int n41,
int n56, int n67, int n78, int n85,
int n15, int n26, int n37, int n48)
{
if (!myType == SMESHDS_AddQuadHexahedron) {
MESSAGE("SMESHDS_Command::AddVolume : Bad Type");
return;
}
myIntegers.push_back(NewVolID);
myIntegers.push_back(n1);
myIntegers.push_back(n2);
myIntegers.push_back(n3);
myIntegers.push_back(n4);
myIntegers.push_back(n5);
myIntegers.push_back(n6);
myIntegers.push_back(n7);
myIntegers.push_back(n8);
myIntegers.push_back(n12);
myIntegers.push_back(n23);
myIntegers.push_back(n34);
myIntegers.push_back(n41);
myIntegers.push_back(n56);
myIntegers.push_back(n67);
myIntegers.push_back(n78);
myIntegers.push_back(n85);
myIntegers.push_back(n15);
myIntegers.push_back(n26);
myIntegers.push_back(n37);
myIntegers.push_back(n48);
myNumber++;
}

View File

@ -54,6 +54,28 @@ class SMESHDS_Command
void AddPolyhedralVolume (const int ElementID,
std::vector<int> nodes_ids,
std::vector<int> quantities);
// special methods for quadratic elements
void AddEdge(int NewEdgeID, int n1, int n2, int n12);
void AddFace(int NewFaceID, int n1, int n2, int n3,
int n12, int n23, int n31);
void AddFace(int NewFaceID, int n1, int n2, int n3, int n4,
int n12, int n23, int n34, int n41);
void AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n12, int n23, int n31, int n14, int n24, int n34);
void AddVolume(int NewVolID, int n1, int n2, int n3, int n4, int n5,
int n12, int n23, int n34, int n41,
int n15, int n25, int n35, int n45);
void AddVolume(int NewVolID, int n1, int n2, int n3,
int n4, int n5, int n6,
int n12, int n23, int n31,
int n45, int n56, int n64,
int n14, int n25, int n36);
void AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8,
int n12, int n23, int n34, int n41,
int n56, int n67, int n78, int n85,
int n15, int n26, int n37, int n48);
void MoveNode(int NewNodeID, double x, double y, double z);
void RemoveNode(int NodeID);
void RemoveElement(int ElementID);

View File

@ -30,22 +30,30 @@
//#include <Standard_PrimitiveTypes.hxx>
enum SMESHDS_CommandType {
SMESHDS_AddNode,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,
SMESHDS_AddPolygon,
SMESHDS_AddTetrahedron,
SMESHDS_AddPyramid,
SMESHDS_AddPrism,
SMESHDS_AddHexahedron,
SMESHDS_AddPolyhedron,
SMESHDS_RemoveNode,
SMESHDS_RemoveElement,
SMESHDS_MoveNode,
SMESHDS_ChangeElementNodes,
SMESHDS_ChangePolyhedronNodes,
SMESHDS_Renumber
SMESHDS_AddNode,
SMESHDS_AddEdge,
SMESHDS_AddTriangle,
SMESHDS_AddQuadrangle,
SMESHDS_AddPolygon,
SMESHDS_AddTetrahedron,
SMESHDS_AddPyramid,
SMESHDS_AddPrism,
SMESHDS_AddHexahedron,
SMESHDS_AddPolyhedron,
SMESHDS_RemoveNode,
SMESHDS_RemoveElement,
SMESHDS_MoveNode,
SMESHDS_ChangeElementNodes,
SMESHDS_ChangePolyhedronNodes,
SMESHDS_Renumber,
// special types for quadratic elements
SMESHDS_AddQuadEdge,
SMESHDS_AddQuadTriangle,
SMESHDS_AddQuadQuadrangle,
SMESHDS_AddQuadTetrahedron,
SMESHDS_AddQuadPyramid,
SMESHDS_AddQuadPentahedron,
SMESHDS_AddQuadHexahedron
};

View File

@ -1184,3 +1184,460 @@ SMESHDS_Mesh::~SMESHDS_Mesh()
{
delete myScript;
}
//********************************************************************
//********************************************************************
//******** *********
//***** Methods for addition of quadratic elements ******
//******** *********
//********************************************************************
//********************************************************************
//=======================================================================
//function : AddEdgeWithID
//purpose :
//=======================================================================
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID)
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdgeWithID(n1,n2,n12,ID);
if(anElem) myScript->AddEdge(ID,n1,n2,n12);
return anElem;
}
//=======================================================================
//function : AddEdge
//purpose :
//=======================================================================
SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n2,
const SMDS_MeshNode* n12)
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2,n12);
if(anElem) myScript->AddEdge(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n12->GetID());
return anElem;
}
//=======================================================================
//function : AddEdgeWithID
//purpose :
//=======================================================================
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
int ID)
{
return AddEdgeWithID(n1->GetID(),
n2->GetID(),
n12->GetID(),
ID);
}
//=======================================================================
//function : AddFace
//purpose :
//=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n12,n23,n31);
if(anElem) myScript->AddFace(anElem->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(),
n12->GetID(), n23->GetID(), n31->GetID());
return anElem;
}
//=======================================================================
//function : AddFaceWithID
//purpose :
//=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3,
int n12,int n23,int n31, int ID)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1,n2,n3,n12,n23,n31,ID);
if(anElem) myScript->AddFace(ID,n1,n2,n3,n12,n23,n31);
return anElem;
}
//=======================================================================
//function : AddFaceWithID
//purpose :
//=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int ID)
{
return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
ID);
}
//=======================================================================
//function : AddFace
//purpose :
//=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1,n2,n3,n4,n12,n23,n34,n41);
if(anElem) myScript->AddFace(anElem->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID());
return anElem;
}
//=======================================================================
//function : AddFaceWithID
//purpose :
//=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n34,int n41, int ID)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1,n2,n3,n4,n12,n23,n34,n41,ID);
if(anElem) myScript->AddFace(ID,n1,n2,n3,n4,n12,n23,n34,n41);
return anElem;
}
//=======================================================================
//function : AddFaceWithID
//purpose :
//=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
int ID)
{
return AddFaceWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
ID);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
n14->GetID(), n24->GetID(), n34->GetID());
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n31,
int n14,int n24,int n34, int ID)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n12,n23,
n31,n14,n24,n34,ID);
if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n12,n23,n31,n14,n24,n34);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order tetrahedron of 10 nodes
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34,
int ID)
{
return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
n14->GetID(), n24->GetID(), n34->GetID(), ID);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n12,n23,n34,n41,
n15,n25,n35,n45);
if(anElem)
myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
n3->GetID(), n4->GetID(), n5->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
n15->GetID(), n25->GetID(), n35->GetID(), n45->GetID());
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
int n12,int n23,int n34,int n41,
int n15,int n25,int n35,int n45, int ID)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,
n12,n23,n34,n41,
n15,n25,n35,n45,ID);
if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n12,n23,n34,n41,
n15,n25,n35,n45);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order pyramid of 13 nodes
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45,
int ID)
{
return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(),
n4->GetID(), n5->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
n15->GetID(), n25->GetID(), n35->GetID(), n45->GetID(),
ID);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n6,n12,n23,n31,
n45,n56,n64,n14,n25,n36);
if(anElem)
myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
n3->GetID(), n4->GetID(), n5->GetID(), n6->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
n45->GetID(), n56->GetID(), n64->GetID(),
n14->GetID(), n25->GetID(), n36->GetID());
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3,
int n4, int n5, int n6,
int n12,int n23,int n31,
int n45,int n56,int n64,
int n14,int n25,int n36, int ID)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,n6,
n12,n23,n31,
n45,n56,n64,
n14,n25,n36,ID);
if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n6,n12,n23,n31,
n45,n56,n64,n14,n25,n36);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order Pentahedron with 15 nodes
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36,
int ID)
{
return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(),
n4->GetID(), n5->GetID(), n6->GetID(),
n12->GetID(), n23->GetID(), n31->GetID(),
n45->GetID(), n56->GetID(), n64->GetID(),
n14->GetID(), n25->GetID(), n36->GetID(),
ID);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1,n2,n3,n4,n5,n6,n7,n8,
n12,n23,n34,n41,
n56,n67,n78,n85,
n15,n26,n37,n48);
if(anElem)
myScript->AddVolume(anElem->GetID(), n1->GetID(), n2->GetID(),
n3->GetID(), n4->GetID(), n5->GetID(),
n6->GetID(), n7->GetID(), n8->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
n56->GetID(), n67->GetID(), n78->GetID(), n85->GetID(),
n15->GetID(), n26->GetID(), n37->GetID(), n48->GetID());
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose :
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8,
int n12,int n23,int n34,int n41,
int n56,int n67,int n78,int n85,
int n15,int n26,int n37,int n48, int ID)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1,n2,n3,n4,n5,n6,n7,n8,
n12,n23,n34,n41,
n56,n67,n78,n85,
n15,n26,n37,n48,ID);
if(anElem) myScript->AddVolume(ID,n1,n2,n3,n4,n5,n6,n7,n8,n12,n23,n34,n41,
n56,n67,n78,n85,n15,n26,n37,n48);
return anElem;
}
//=======================================================================
//function : AddVolumeWithID
//purpose : 2d order Hexahedrons with 20 nodes
//=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48,
int ID)
{
return AddVolumeWithID(n1->GetID(), n2->GetID(), n3->GetID(), n4->GetID(),
n5->GetID(), n6->GetID(), n7->GetID(), n8->GetID(),
n12->GetID(), n23->GetID(), n34->GetID(), n41->GetID(),
n56->GetID(), n67->GetID(), n78->GetID(), n85->GetID(),
n15->GetID(), n26->GetID(), n37->GetID(), n48->GetID(),
ID);
}

View File

@ -93,6 +93,16 @@ public:
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
// 2d order edge with 3 nodes: n12 - node between n1 and n2
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int n12, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n12);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -113,6 +123,44 @@ public:
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
// 2d order triangle of 6 nodes
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3,
int n12,int n23,int n31, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31);
// 2d order quadrangle
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n34,int n41, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
@ -171,6 +219,153 @@ public:
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
// 2d order tetrahedron of 10 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n12,int n23,int n31,
int n14,int n24,int n34, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n24,
const SMDS_MeshNode * n34);
// 2d order pyramid of 13 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5,
int n12,int n23,int n34,int n41,
int n15,int n25,int n35,int n45,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n35,
const SMDS_MeshNode * n45);
// 2d order Pentahedron with 15 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3,
int n4, int n5, int n6,
int n12,int n23,int n31,
int n45,int n56,int n64,
int n14,int n25,int n36,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n31,
const SMDS_MeshNode * n45,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n64,
const SMDS_MeshNode * n14,
const SMDS_MeshNode * n25,
const SMDS_MeshNode * n36);
// 2d order Hexahedrons with 20 nodes
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8,
int n12,int n23,int n34,int n41,
int n56,int n67,int n78,int n85,
int n15,int n26,int n37,int n48,
int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
const SMDS_MeshNode * n12,
const SMDS_MeshNode * n23,
const SMDS_MeshNode * n34,
const SMDS_MeshNode * n41,
const SMDS_MeshNode * n56,
const SMDS_MeshNode * n67,
const SMDS_MeshNode * n78,
const SMDS_MeshNode * n85,
const SMDS_MeshNode * n15,
const SMDS_MeshNode * n26,
const SMDS_MeshNode * n37,
const SMDS_MeshNode * n48);
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
const int ID);

View File

@ -257,3 +257,98 @@ const list<SMESHDS_Command*>& SMESHDS_Script::GetCommands()
{
return myCommands;
}
//********************************************************************
//***** Methods for quadratic elements ******
//********************************************************************
//=======================================================================
//function : AddEdge
//purpose :
//=======================================================================
void SMESHDS_Script::AddEdge(int NewEdgeID, int n1, int n2, int n12)
{
getCommand(SMESHDS_AddQuadEdge)->AddEdge(NewEdgeID, n1, n2, n12);
}
//=======================================================================
//function : AddFace
//purpose :
//=======================================================================
void SMESHDS_Script::AddFace(int NewFaceID, int n1, int n2, int n3,
int n12, int n23, int n31)
{
getCommand(SMESHDS_AddQuadTriangle)->AddFace(NewFaceID, n1, n2, n3,
n12, n23, n31);
}
//=======================================================================
//function : AddFace
//purpose :
//=======================================================================
void SMESHDS_Script::AddFace(int NewFaceID, int n1, int n2, int n3, int n4,
int n12, int n23, int n34, int n41)
{
getCommand(SMESHDS_AddQuadQuadrangle)->AddFace(NewFaceID, n1, n2, n3, n4,
n12, n23, n34, n41);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n12, int n23, int n31,
int n14, int n24, int n34)
{
getCommand(SMESHDS_AddQuadTetrahedron)->AddVolume(NewVolID, n1, n2, n3, n4,
n12, n23, n31,
n14, n24, n34);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n5, int n12, int n23, int n34, int n41,
int n15, int n25, int n35, int n45)
{
getCommand(SMESHDS_AddQuadPyramid)->AddVolume(NewVolID, n1, n2, n3, n4, n5,
n12, n23, n34, n41,
n15, n25, n35, n45);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n5,int n6, int n12, int n23, int n31,
int n45, int n56, int n64,
int n14, int n25, int n36)
{
getCommand(SMESHDS_AddQuadPentahedron)->AddVolume(NewVolID, n1,n2,n3,n4,n5,n6,
n12, n23, n31,
n45, n56, n64,
n14, n25, n36);
}
//=======================================================================
//function : AddVolume
//purpose :
//=======================================================================
void SMESHDS_Script::AddVolume(int NewVolID, int n1, int n2, int n3,
int n4, int n5, int n6, int n7, int n8,
int n12, int n23, int n34, int n41,
int n56, int n67, int n78, int n85,
int n15, int n26, int n37, int n48)
{
getCommand(SMESHDS_AddQuadHexahedron)->AddVolume(NewVolID, n1, n2, n3, n4,
n5, n6, n7, n8,
n12, n23, n34, n41,
n56, n67, n78, n85,
n15, n26, n37, n48);
}

View File

@ -59,6 +59,27 @@ class SMESHDS_Script
std::vector<int> nodes_ids,
std::vector<int> quantities);
// special methods for quadratic elements
void AddEdge(int NewEdgeID, int n1, int n2, int n12);
void AddFace(int NewFaceID, int n1, int n2, int n3,
int n12, int n23, int n31);
void AddFace(int NewFaceID, int n1, int n2, int n3, int n4,
int n12, int n23, int n34, int n41);
void AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n12, int n23, int n31, int n14, int n24, int n34);
void AddVolume(int NewVolID, int n1, int n2, int n3, int n4, int n5,
int n12, int n23, int n34, int n41,
int n15, int n25, int n35, int n45);
void AddVolume(int NewVolID, int n1, int n2, int n3,
int n4, int n5, int n6,
int n12, int n23, int n31,
int n45, int n56, int n64,
int n14, int n25, int n36);
void AddVolume(int NewVolID, int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8,
int n12, int n23, int n34, int n41,
int n56, int n67, int n78, int n85,
int n15, int n26, int n37, int n48);
void MoveNode(int NewNodeID, double x, double y, double z);
void RemoveNode(int NodeID);
void RemoveElement(int ElementID);

View File

@ -109,7 +109,8 @@ LIB_SRC = SMESHGUI.cxx \
SMESHGUI_MeshOp.cxx \
SMESHGUI_Displayer.cxx \
SMESHGUI_Hypotheses.cxx \
SMESHGUI_ShapeByMeshDlg.cxx
SMESHGUI_ShapeByMeshDlg.cxx \
SMESHGUI_AddQuadraticElementDlg.cxx
LIB_MOC = \
SMESHGUI.h \
@ -156,8 +157,8 @@ LIB_MOC = \
SMESHGUI_Dialog.h \
SMESHGUI_MeshDlg.h \
SMESHGUI_MeshOp.h \
SMESHGUI_Hypotheses.h \
SMESHGUI_ShapeByMeshDlg.h
SMESHGUI_ShapeByMeshDlg.h \
SMESHGUI_AddQuadraticElementDlg.h
LIB_CLIENT_IDL = SALOME_Exception.idl \

View File

@ -40,6 +40,7 @@
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_MoveNodesDlg.h"
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_AddQuadraticElementDlg.h"
#include "SMESHGUI_EditHypothesesDlg.h"
#include "SMESHGUI_CreateHypothesesDlg.h"
#include "SMESHGUI_FilterDlg.h"
@ -1866,6 +1867,46 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
break;
}
case 4034: // QUADRATIC EDGE
case 4035: // QUADRATIC TRIANGLE
case 4036: // QUADRATIC QUADRANGLE
case 4037: // QUADRATIC TETRAHEDRON
case 4038: // QUADRATIC PYRAMID
case 4039: // QUADRATIC PENTAHEDRON
case 4040: // QUADRATIC HEXAHEDRON
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
int type;
switch (theCommandID) {
case 4034:
type = QUAD_EDGE; break;
case 4035:
type = QUAD_TRIANGLE; break;
case 4036:
type = QUAD_QUADRANGLE; break;
case 4037:
type = QUAD_TETRAHEDRON; break;
case 4038:
type = QUAD_PYRAMID; break;
case 4039:
type = QUAD_PENTAHEDRON; break;
case 4040:
type = QUAD_HEXAHEDRON;
break;
default:;
}
new SMESHGUI_AddQuadraticElementDlg( this, type );
}
else {
SUIT_MessageBox::warn1(SMESHGUI::desktop(),
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
tr("SMESH_BUT_OK"));
}
break;
}
case 4041: // REMOVES NODES
{
if(checkLock(aStudy)) break;
@ -2320,6 +2361,13 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 301, "DISPLAY" );
createSMESHAction( 302, "DISPLAY_ONLY" );
createSMESHAction( 4033, "POLYHEDRON", "ICON_DLG_POLYHEDRON" );
createSMESHAction( 4034, "QUADRATIC_EDGE", "ICON_DLG_QUADRATIC_EDGE" );
createSMESHAction( 4035, "QUADRATIC_TRIANGLE", "ICON_DLG_QUADRATIC_TRIANGLE" );
createSMESHAction( 4036, "QUADRATIC_QUADRANGLE", "ICON_DLG_QUADRATIC_QUADRANGLE" );
createSMESHAction( 4037, "QUADRATIC_TETRAHEDRON", "ICON_DLG_QUADRATIC_TETRAHEDRON" );
createSMESHAction( 4038, "QUADRATIC_PYRAMID", "ICON_DLG_QUADRATIC_PYRAMID" );
createSMESHAction( 4039, "QUADRATIC_PENTAHEDRON", "ICON_DLG_QUADRATIC_PENTAHEDRON" );
createSMESHAction( 4040, "QUADRATIC_HEXAHEDRON", "ICON_DLG_QUADRATIC_HEXAHEDRON" );
// ----- create menu --------------
int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
@ -2399,6 +2447,14 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 4031, addId, -1 );
createMenu( 4032, addId, -1 );
createMenu( 4033, addId, -1 );
createMenu( separator(), addId, -1 );
createMenu( 4034, addId, -1 );
createMenu( 4035, addId, -1 );
createMenu( 4036, addId, -1 );
createMenu( 4037, addId, -1 );
createMenu( 4038, addId, -1 );
createMenu( 4039, addId, -1 );
createMenu( 4040, addId, -1 );
createMenu( 4041, removeId, -1 );
createMenu( 4042, removeId, -1 );
@ -2475,6 +2531,14 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 4032, addRemTb );
createTool( 4033, addRemTb );
createTool( separator(), addRemTb );
createTool( 4034, addRemTb );
createTool( 4035, addRemTb );
createTool( 4036, addRemTb );
createTool( 4037, addRemTb );
createTool( 4038, addRemTb );
createTool( 4039, addRemTb );
createTool( 4040, addRemTb );
createTool( separator(), addRemTb );
createTool( 4041, addRemTb );
createTool( 4042, addRemTb );
createTool( separator(), addRemTb );

View File

@ -37,6 +37,7 @@
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
#include <vtkProperty.h>
#include <vtkQuadraticEdge.h>
#include <vtkQuadraticTriangle.h>

View File

@ -388,6 +388,35 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
anActor = myActor;
if (anActor != 0)
{
// skl 07.02.2006
SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh();
if( myFilterType == SMESHGUI_TriaFilter ||
myFilterType == SMESHGUI_QuadFilter ||
myFilterType == SMESHGUI_FaceFilter ) {
SMDS_FaceIteratorPtr it = aMesh->facesIterator();
while(it->more()) {
const SMDS_MeshFace* f = it->next();
if(myFilterType == SMESHGUI_FaceFilter) {
myIds.Add(f->GetID());
}
else if( myFilterType==SMESHGUI_TriaFilter &&
( f->NbNodes()==3 || f->NbNodes()==6 ) ) {
myIds.Add(f->GetID());
}
else if( myFilterType==SMESHGUI_QuadFilter &&
( f->NbNodes()==4 || f->NbNodes()==8 ) ) {
myIds.Add(f->GetID());
}
}
}
else if(myFilterType == SMESHGUI_VolumeFilter) {
SMDS_VolumeIteratorPtr it = aMesh->volumesIterator();
while(it->more()) {
const SMDS_MeshVolume* f = it->next();
myIds.Add(f->GetID());
}
}
/* commented by skl 07.02.2006
TVisualObjPtr aVisualObj = anActor->GetObject();
vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
if (aGrid != 0) {
@ -411,6 +440,7 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
}
}
}
*/
}
}

View File

@ -155,7 +155,33 @@ msgstr "mesh_tetra.png"
msgid "ICON_DLG_HEXAS"
msgstr "mesh_hexa.png"
#Quadratic Edge
msgid "ICON_DLG_QUADRATIC_EDGE"
msgstr "mesh_quad_edge.png"
#Quadratic Triangle
msgid "ICON_DLG_QUADRATIC_TRIANGLE"
msgstr "mesh_quad_triangle.png"
#Quadratic Quadrangle
msgid "ICON_DLG_QUADRATIC_QUADRANGLE"
msgstr "mesh_quad_quadrangle.png"
#Quadratic Tetrahedron
msgid "ICON_DLG_QUADRATIC_TETRAHEDRON"
msgstr "mesh_quad_tetrahedron.png"
#Quadratic Pyramid
msgid "ICON_DLG_QUADRATIC_PYRAMID"
msgstr "mesh_quad_pyramid.png"
#Quadratic Pentahedron
msgid "ICON_DLG_QUADRATIC_PENTAHEDRON"
msgstr "mesh_quad_pentahedron.png"
#Quadratic Hexahedron
msgid "ICON_DLG_QUADRATIC_HEXAHEDRON"
msgstr "mesh_quad_hexahedron.png"
#-----------------------------------------------------------
# ObjectBrowser
#-----------------------------------------------------------

View File

@ -170,6 +170,35 @@ msgstr "mesh_hexa.png"
#Polyhedre
msgid "ICON_DLG_POLYHEDRON"
msgstr "mesh_polyhedron.png"
#Quadratic Edge
msgid "ICON_DLG_QUADRATIC_EDGE"
msgstr "mesh_quad_edge.png"
#Quadratic Triangle
msgid "ICON_DLG_QUADRATIC_TRIANGLE"
msgstr "mesh_quad_triangle.png"
#Quadratic Quadrangle
msgid "ICON_DLG_QUADRATIC_QUADRANGLE"
msgstr "mesh_quad_quadrangle.png"
#Quadratic Tetrahedron
msgid "ICON_DLG_QUADRATIC_TETRAHEDRON"
msgstr "mesh_quad_tetrahedron.png"
#Quadratic Pyramid
msgid "ICON_DLG_QUADRATIC_PYRAMID"
msgstr "mesh_quad_pyramid.png"
#Quadratic Pentahedron
msgid "ICON_DLG_QUADRATIC_PENTAHEDRON"
msgstr "mesh_quad_pentahedron.png"
#Quadratic Hexahedron
msgid "ICON_DLG_QUADRATIC_HEXAHEDRON"
msgstr "mesh_quad_hexahedron.png"
#-----------------------------------------------------------
# ObjectBrowser
#-----------------------------------------------------------

View File

@ -1814,6 +1814,80 @@ msgstr "Polygon"
msgid "SMESH_ADD_POLYGON"
msgstr "Add polygon"
msgid "SMESH_ADD_QUADRATIC_EDGE_TITLE"
msgstr "Add Quadratic Edge"
msgid "SMESH_ADD_QUADRATIC_TRIANGLE_TITLE"
msgstr "Add Quadratic Triangle"
msgid "SMESH_ADD_QUADRATIC_QUADRANGLE_TITLE"
msgstr "Add Quadratic Quadrangle"
msgid "SMESH_ADD_QUADRATIC_TETRAHEDRON_TITLE"
msgstr "Add Quadratic Tetrahedron"
msgid "SMESH_ADD_QUADRATIC_PYRAMID_TITLE"
msgstr "Add Quadratic Pyramid"
msgid "SMESH_ADD_QUADRATIC_PENTAHEDRON_TITLE"
msgstr "Add Quadratic Pentahedron"
msgid "SMESH_ADD_QUADRATIC_HEXAHEDRON_TITLE"
msgstr "Add Quadratic Hexahedron"
msgid "SMESH_QUADRATIC_EDGE"
msgstr "Quadratic Edge"
msgid "SMESH_QUADRATIC_TRIANGLE"
msgstr "Quadratic Triangle"
msgid "SMESH_QUADRATIC_QUADRANGLE"
msgstr "Quadratic Quadrangle"
msgid "SMESH_QUADRATIC_TETRAHEDRON"
msgstr "Quadratic Tetrahedron"
msgid "SMESH_QUADRATIC_PYRAMID"
msgstr "Quadratic Pyramid"
msgid "SMESH_QUADRATIC_PENTAHEDRON"
msgstr "Quadratic Pentahedron"
msgid "SMESH_QUADRATIC_HEXAHEDRON"
msgstr "Quadratic Hexahedron"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_CORNER_NODES"
msgstr "Corner Nodes:"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_EDGE"
msgstr "Add Quadratic Edge"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_TRIANGLE"
msgstr "Add Quadratic Triangle"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_QUADRANGLE"
msgstr "Add Quadratic Quadrangle"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_TETRAHEDRON"
msgstr "Add Quadratic Tetrahedron"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_PYRAMID"
msgstr "Add Quadratic PYRAMID"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_PENTAHEDRON"
msgstr "Add Quadratic Pentahedron"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_ADD_QUADRATIC_HEXAHEDRON"
msgstr "Add Quadratic Hexahedron"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_FIRST"
msgstr "First"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_MIDDLE"
msgstr "Middle"
msgid "SMESHGUI_AddQuadraticElementDlg::SMESH_LAST"
msgstr "Last"
#----------------------------------------------------
msgid "SMESHGUI_CreatePatternDlg::CAPTION"
@ -2028,6 +2102,27 @@ msgstr "Polygon"
msgid "MEN_POLYHEDRON"
msgstr "Polyhedron"
msgid "MEN_QUADRATIC_EDGE"
msgstr "Quadratic Edge"
msgid "MEN_QUADRATIC_TRIANGLE"
msgstr "Quadratic Triangle"
msgid "MEN_QUADRATIC_QUADRANGLE"
msgstr "Quadratic Quadrangle"
msgid "MEN_QUADRATIC_TETRAHEDRON"
msgstr "Quadratic Tetrahedron"
msgid "MEN_QUADRATIC_PYRAMID"
msgstr "Quadratic Pyramid"
msgid "MEN_QUADRATIC_PENTAHEDRON"
msgstr "Quadratic Pentahedron"
msgid "MEN_QUADRATIC_HEXAHEDRON"
msgstr "Quadratic Hexahedron"
msgid "MEN_NODES"
msgstr "Nodes"
@ -2357,6 +2452,27 @@ msgstr "Polygon"
msgid "TOP_POLYHEDRON"
msgstr "Polyhedron"
msgid "TOP_QUADRATIC_EDGE"
msgstr "Quadratic Edge"
msgid "TOP_QUADRATIC_TRIANGLE"
msgstr "Quadratic Triangle"
msgid "TOP_QUADRATIC_QUADRANGLE"
msgstr "Quadratic Quadrangle"
msgid "TOP_QUADRATIC_TETRAHEDRON"
msgstr "Quadratic Tetrahedron"
msgid "TOP_QUADRATIC_PYRAMID"
msgstr "Quadratic Pyramid"
msgid "TOP_QUADRATIC_PENTAHEDRON"
msgstr "Quadratic Pentahedron"
msgid "TOP_QUADRATIC_HEXAHEDRON"
msgstr "Quadratic Hexahedron"
msgid "TOP_NODES"
msgstr "Nodes"
@ -2637,6 +2753,27 @@ msgstr "Polygon"
msgid "STB_POLYHEDRON"
msgstr "Polyhedron"
msgid "STB_QUADRATIC_EDGE"
msgstr "Quadratic Edge"
msgid "STB_QUADRATIC_TRIANGLE"
msgstr "Quadratic Triangle"
msgid "STB_QUADRATIC_QUADRANGLE"
msgstr "Quadratic Quadrangle"
msgid "STB_QUADRATIC_TETRAHEDRON"
msgstr "Quadratic Tetrahedron"
msgid "STB_QUADRATIC_PYRAMID"
msgstr "Quadratic Pyramid"
msgid "STB_QUADRATIC_PENTAHEDRON"
msgstr "Quadratic Pentahedron"
msgid "STB_QUADRATIC_HEXAHEDRON"
msgstr "Quadratic Hexahedron"
msgid "STB_NODES"
msgstr "Nodes"

View File

@ -1,3 +1,31 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMESH_2D_Algo_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
// File : SMESH_2smeshpy.cxx
// Created : Fri Nov 18 13:20:10 2005
// Author : Edward AGAPOV (eap)
@ -407,6 +435,13 @@ _pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd): _pyObject(theCreation
*/
//================================================================================
//================================================================================
/*!
* \brief Convert a IDL API command of SMESH::Mesh to a method call of python Mesh
* \param theCommand - Engine method called for this mesh
*/
//================================================================================
void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
{
// smesh.py wraps the following methods:
@ -663,6 +698,11 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
hyp->myCreationMethod = "Propagation";
hyp->myType = "Regular_1D";
}
else if ( hypType == "QuadraticMesh" ) {
hyp->myDim = 1;
hyp->myCreationMethod = "QuadraticMesh";
hyp->myType = "Regular_1D";
}
else if ( hypType == "AutomaticLength" ) {
hyp->myDim = 1;
hyp->myCreationMethod = "AutomaticLength";

View File

@ -89,7 +89,7 @@ SMESH_Hypothesis_i::~SMESH_Hypothesis_i()
char* SMESH_Hypothesis_i::GetName()
{
MESSAGE( "SMESH_Hypothesis_i::GetName" );
//MESSAGE( "SMESH_Hypothesis_i::GetName" );
return CORBA::string_dup( myBaseImpl->GetName() );
};

View File

@ -1121,7 +1121,7 @@ void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
if (_creeFamily == false)
{
_creeFamily = true;
SMESH_subMesh_i *subMeshServant;
//SMESH_subMesh_i *subMeshServant;
map < int, SMESH_subMesh_i * >::iterator it;
for (it = _mesh_i->_mapSubMesh_i.begin();

View File

@ -128,6 +128,17 @@ CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
TPythonDump() << "isDone = " << this << ".AddEdge([ "
<< index1 << ", " << index2 <<" ])";
}
if (NbNodes == 3) {
CORBA::Long n1 = IDsOfNodes[0];
CORBA::Long n2 = IDsOfNodes[1];
CORBA::Long n12 = IDsOfNodes[2];
GetMeshDS()->AddEdge(GetMeshDS()->FindNode(n1),
GetMeshDS()->FindNode(n2),
GetMeshDS()->FindNode(n12));
// Update Python script
TPythonDump() << "isDone = " << this << ".AddEdge([ "
<<n1<<", "<<n2<<", "<<n12<<" ])";
}
return true;
}
@ -175,9 +186,15 @@ CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
{
GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
}
else
else if (NbNodes == 6)
{
GetMeshDS()->AddPolygonalFace(nodes);
GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3],
nodes[4], nodes[5]);
}
else if (NbNodes == 8)
{
GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3],
nodes[4], nodes[5], nodes[6], nodes[7]);
}
// Update Python script
@ -189,6 +206,30 @@ CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
return true;
};
//=============================================================================
/*!
* AddPolygonalFace
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddPolygonalFace
(const SMESH::long_array & IDsOfNodes)
{
int NbNodes = IDsOfNodes.length();
std::vector<const SMDS_MeshNode*> nodes (NbNodes);
for (int i = 0; i < NbNodes; i++)
nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
GetMeshDS()->AddPolygonalFace(nodes);
// Update Python script
TPythonDump() <<"isDone = "<<this<<".AddPolygonalFace( "<<IDsOfNodes<<" )";
#ifdef _DEBUG_
TPythonDump() << "print 'AddPolygonalFace: ', isDone";
#endif
return true;
};
//=============================================================================
/*!
*
@ -202,12 +243,26 @@ CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNode
for(int i=0;i<NbNodes;i++)
n[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
SMDS_MeshElement* elem = 0;
switch(NbNodes)
{
case 4:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3]); break;
case 5:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
case 6:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
case 8:GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
case 4 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3]); break;
case 5 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
case 6 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
case 8 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
case 10:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],
n[6],n[7],n[8],n[9]);
break;
case 13:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],
n[7],n[8],n[9],n[10],n[11],n[12]);
break;
case 15:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],
n[9],n[10],n[11],n[12],n[13],n[14]);
break;
case 20:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],
n[8],n[9],n[10],n[11],n[12],n[13],n[14],
n[15],n[16],n[17],n[18],n[19]);
break;
}
// Update Python script
TPythonDump() << "isDone = " << this << ".AddVolume( " << IDsOfNodes << " )";
@ -215,7 +270,7 @@ CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNode
TPythonDump() << "print 'AddVolume: ', isDone";
#endif
return true;
return elem;
};
//=============================================================================

View File

@ -50,6 +50,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
CORBA::Boolean AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,

View File

@ -250,6 +250,18 @@ class Mesh_Segment(Mesh_Algorithm):
hyp.SetFineness( fineness )
return hyp
def QuadraticMesh(self):
"""
Define "QuadraticMesh" hypothesis, forcing 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.
"""
hyp = self.Hypothesis("QuadraticMesh")
return hyp
# Public class: Mesh_Segment_Python
# ---------------------------------

View File

@ -50,7 +50,9 @@ EXPORT_HEADERS = \
StdMeshers_Hexa_3D.hxx \
StdMeshers_AutomaticLength.hxx \
StdMeshers_Distribution.hxx \
StdMeshers_QuadranglePreference.hxx
StdMeshers_QuadranglePreference.hxx \
StdMeshers_Helper.hxx \
StdMeshers_QuadraticMesh.hxx
EXPORT_PYSCRIPTS =
@ -76,7 +78,9 @@ LIB_SRC = \
StdMeshers_Hexa_3D.cxx \
StdMeshers_AutomaticLength.cxx \
StdMeshers_Distribution.cxx \
StdMeshers_QuadranglePreference.cxx
StdMeshers_QuadranglePreference.cxx \
StdMeshers_Helper.cxx \
StdMeshers_QuadraticMesh.cxx
LIB_SERVER_IDL =

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,8 @@
#include "StdMeshers_Quadrangle_2D.hxx"
#include "Utils_SALOME_Exception.hxx"
#include "StdMeshers_Helper.hxx"
typedef struct point3Dstruct
{
const SMDS_MeshNode * node;
@ -127,6 +129,8 @@ protected:
Point3DStruct *np,
const SMESHDS_Mesh* meshDS);
bool ClearAndReturn(const bool res);
CubeStruct _cube;
FaceQuadStruct* _quads[6];
int _indX0;
@ -135,6 +139,9 @@ protected:
int _indY1;
int _indZ0;
int _indZ1;
bool myCreateQuadratic;
StdMeshers_Helper* myTool; // toll for working with quadratic elements
};
#endif

View File

@ -62,9 +62,6 @@ using namespace std;
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <string>
//#include <algorithm>
//=============================================================================
/*!
*
@ -72,19 +69,19 @@ using namespace std;
//=============================================================================
StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, int studyId,
SMESH_Gen * gen):SMESH_2D_Algo(hypId, studyId, gen)
SMESH_Gen * gen):SMESH_2D_Algo(hypId, studyId, gen)
{
MESSAGE("StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D");
_name = "MEFISTO_2D";
// _shapeType = TopAbs_FACE;
_shapeType = (1 << TopAbs_FACE);
_compatibleHypothesis.push_back("MaxElementArea");
_compatibleHypothesis.push_back("LengthFromEdges");
MESSAGE("StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D");
_name = "MEFISTO_2D";
_shapeType = (1 << TopAbs_FACE);
_compatibleHypothesis.push_back("MaxElementArea");
_compatibleHypothesis.push_back("LengthFromEdges");
_edgeLength = 0;
_maxElementArea = 0;
_hypMaxElementArea = NULL;
_hypLengthFromEdges = NULL;
_edgeLength = 0;
_maxElementArea = 0;
_hypMaxElementArea = NULL;
_hypLengthFromEdges = NULL;
myTool = 0;
}
//=============================================================================
@ -95,7 +92,7 @@ StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, int studyId,
StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D()
{
MESSAGE("StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D");
MESSAGE("StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D");
}
//=============================================================================
@ -184,112 +181,121 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis
bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
{
MESSAGE("StdMeshers_MEFISTO_2D::Compute");
MESSAGE("StdMeshers_MEFISTO_2D::Compute");
if (_hypLengthFromEdges)
_edgeLength = ComputeEdgeElementLength(aMesh, aShape);
if (_hypLengthFromEdges)
_edgeLength = ComputeEdgeElementLength(aMesh, aShape);
bool isOk = false;
//const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
//SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
bool isOk = false;
//const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
//SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
const TopoDS_Face & FF = TopoDS::Face(aShape);
bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
const TopoDS_Face & FF = TopoDS::Face(aShape);
bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
Z nblf; //nombre de lignes fermees (enveloppe en tete)
Z *nudslf = NULL; //numero du dernier sommet de chaque ligne fermee
R2 *uvslf = NULL;
Z nbpti = 0; //nombre points internes futurs sommets de la triangulation
R2 *uvpti = NULL;
Z nbst;
R2 *uvst = NULL;
Z nbt;
Z *nust = NULL;
Z ierr = 0;
Z nblf; //nombre de lignes fermees (enveloppe en tete)
Z *nudslf = NULL; //numero du dernier sommet de chaque ligne fermee
R2 *uvslf = NULL;
Z nbpti = 0; //nombre points internes futurs sommets de la triangulation
R2 *uvpti = NULL;
Z nutysu = 1; // 1: il existe un fonction areteideale_()
// Z nutysu=0; // 0: on utilise aretmx
R aretmx = _edgeLength; // longueur max aretes future triangulation
nblf = NumberOfWires(F);
nudslf = new Z[1 + nblf];
nudslf[0] = 0;
int iw = 1;
int nbpnt = 0;
Z nbst;
R2 *uvst = NULL;
Z nbt;
Z *nust = NULL;
Z ierr = 0;
myTool = new StdMeshers_Helper(aMesh);
_quadraticMesh = myTool->IsQuadraticSubMesh(aShape);
Z nutysu = 1; // 1: il existe un fonction areteideale_()
// Z nutysu=0; // 0: on utilise aretmx
R aretmx = _edgeLength; // longueur max aretes future triangulation
myOuterWire = BRepTools::OuterWire(F);
nbpnt += NumberOfPoints(aMesh, myOuterWire);
if ( nbpnt < 3 ) { // ex: a circle with 2 segments
delete myTool; myTool = 0;
return false;
}
nudslf[iw++] = nbpnt;
nblf = NumberOfWires(F);
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next()) {
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
if (!myOuterWire.IsSame(W)) {
nbpnt += NumberOfPoints(aMesh, W);
nudslf[iw++] = nbpnt;
}
}
nudslf = new Z[1 + nblf];
nudslf[0] = 0;
int iw = 1;
int nbpnt = 0;
// avoid passing same uv points for a vertex common to 2 wires
TopTools_IndexedDataMapOfShapeListOfShape VWMap;
if ( iw - 1 > 1 ) // nbofWires > 1
TopExp::MapShapesAndAncestors( F , TopAbs_VERTEX, TopAbs_WIRE, VWMap );
myOuterWire = BRepTools::OuterWire(F);
nbpnt += NumberOfPoints(aMesh, myOuterWire);
if ( nbpnt < 3 ) // ex: a circle with 2 segments
return false;
nudslf[iw++] = nbpnt;
uvslf = new R2[nudslf[nblf]];
int m = 0;
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
{
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
if (!myOuterWire.IsSame(W))
{
nbpnt += NumberOfPoints(aMesh, W);
nudslf[iw++] = nbpnt;
}
}
double scalex, scaley;
ComputeScaleOnFace(aMesh, F, scalex, scaley);
// avoid passing same uv points for a vertex common to 2 wires
TopTools_IndexedDataMapOfShapeListOfShape VWMap;
if ( iw - 1 > 1 ) // nbofWires > 1
TopExp::MapShapesAndAncestors( F , TopAbs_VERTEX, TopAbs_WIRE, VWMap );
map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
mefistoToDS, scalex, scaley, VWMap) ) {
delete myTool; myTool = 0;
return false;
}
uvslf = new R2[nudslf[nblf]];
int m = 0;
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
{
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
if (!myOuterWire.IsSame(W))
{
if (! LoadPoints(aMesh, F, W, uvslf, m,
mefistoToDS, scalex, scaley, VWMap )) {
delete myTool; myTool = 0;
return false;
}
}
}
double scalex, scaley;
ComputeScaleOnFace(aMesh, F, scalex, scaley);
uvst = NULL;
nust = NULL;
aptrte(nutysu, aretmx,
nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
mefistoToDS, scalex, scaley, VWMap))
return false;
if (ierr == 0)
{
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
MESSAGE(" Node Number " << nbst);
StoreResult(aMesh, nbst, uvst, nbt, nust, F,
faceIsForward, mefistoToDS, scalex, scaley);
isOk = true;
}
else
{
MESSAGE("Error in Triangulation");
isOk = false;
}
if (nudslf != NULL)
delete[]nudslf;
if (uvslf != NULL)
delete[]uvslf;
if (uvst != NULL)
delete[]uvst;
if (nust != NULL)
delete[]nust;
delete myTool; myTool = 0;
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
{
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
if (!myOuterWire.IsSame(W))
{
if (! LoadPoints(aMesh, F, W, uvslf, m,
mefistoToDS, scalex, scaley, VWMap ))
return false;
}
}
uvst = NULL;
nust = NULL;
aptrte(nutysu, aretmx,
nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
if (ierr == 0)
{
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
MESSAGE(" Node Number " << nbst);
StoreResult(aMesh, nbst, uvst, nbt, nust, F,
faceIsForward, mefistoToDS, scalex, scaley);
isOk = true;
}
else
{
MESSAGE("Error in Triangulation");
isOk = false;
}
if (nudslf != NULL)
delete[]nudslf;
if (uvslf != NULL)
delete[]uvslf;
if (uvst != NULL)
delete[]uvst;
if (nust != NULL)
delete[]nust;
return isOk;
return isOk;
}
//=======================================================================
@ -354,7 +360,8 @@ static bool fixCommonVertexUV (gp_Pnt2d & theUV,
const TopoDS_Wire& theOW,
const TopoDS_Face& theF,
const TopTools_IndexedDataMapOfShapeListOfShape & theVWMap,
SMESH_Mesh & theMesh)
SMESH_Mesh & theMesh,
bool CreateQuadratic)
{
if( theW.IsSame( theOW ) ||
!theVWMap.Contains( theV )) return false;
@ -417,10 +424,12 @@ static bool fixCommonVertexUV (gp_Pnt2d & theUV,
umin = l;
umax = f;
}
else
{
else {
while ( nIt->more() ) {
const SMDS_MeshNode* node = nIt->next();
// check if node is medium
if ( CreateQuadratic && StdMeshers_Helper::IsMedium( node, SMDSAbs_Edge ))
continue;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double u = epos->GetUParameter();
@ -515,9 +524,13 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
while ( nodeIt->more() )
{
node = nodeIt->next();
if ( _quadraticMesh && StdMeshers_Helper::IsMedium( node, SMDSAbs_Edge ))
continue;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
params[ epos->GetUParameter() ] = node;
double param = epos->GetUParameter();
if ( !isForward ) param = -param;
params.insert( make_pair( param, node ));
}
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if ( nbPoints != params.size())
@ -535,7 +548,7 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
// vertex node
gp_Pnt2d p = C2d->Value( uFirst ).XY().Multiplied( scale );
if ( fixCommonVertexUV( p, V, W, myOuterWire, F, VWMap, aMesh ))
if ( fixCommonVertexUV( p, V, W, myOuterWire, F, VWMap, aMesh, _quadraticMesh ))
myNodesOnCommonV.push_back( idFirst );
mOnVertex.push_back( m );
uvslf[m].x = p.X();
@ -547,22 +560,13 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
// internal nodes
map<double, const SMDS_MeshNode*>::iterator u_n = params.begin();
map<double, const SMDS_MeshNode*>::reverse_iterator u_n_rev = params.rbegin();
for ( int i = 0; i < nbPoints; ++i )
for ( int i = 0; u_n != params.end(); ++u_n, ++i )
{
if ( isForward ) {
u = u_n->first;
node = u_n->second;
++u_n;
} else {
u = u_n_rev->first;
node = u_n_rev->second;
++u_n_rev;
}
u = isForward ? u_n->first : - u_n->first;
gp_Pnt2d p = C2d->Value( u ).XY().Multiplied( scale );
uvslf[m].x = p.X();
uvslf[m].y = p.Y();
mefistoToDS[m + 1] = node;
mefistoToDS[m + 1] = u_n->second;
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
//MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
m++;
@ -713,37 +717,31 @@ void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
}
m = 0;
//int mt = 0;
//SCRUTE(faceIsForward);
// triangle points must be in trigonometric order if face is Forward
// else they must be put clockwise
bool triangleIsWellOriented = faceIsForward;
for (n = 1; n <= nbt; n++)
{
int inode1 = nust[m++];
int inode2 = nust[m++];
int inode3 = nust[m++];
const SMDS_MeshNode *n1, *n2, *n3;
n1 = mefistoToDS[inode1];
n2 = mefistoToDS[inode2];
n3 = mefistoToDS[inode3];
//MESSAGE("-- "<<inode1<<" "<<inode2<<" "<<inode3);
// triangle points must be in trigonometric order if face is Forward
// else they must be put clockwise
bool triangleIsWellOriented = faceIsForward;
const SMDS_MeshNode * n1 = mefistoToDS[ nust[m++] ];
const SMDS_MeshNode * n2 = mefistoToDS[ nust[m++] ];
const SMDS_MeshNode * n3 = mefistoToDS[ nust[m++] ];
SMDS_MeshElement * elt;
if (triangleIsWellOriented)
elt = meshDS->AddFace(n1, n2, n3);
//elt = meshDS->AddFace(n1, n2, n3);
elt = myTool->AddFace(n1, n2, n3);
else
elt = meshDS->AddFace(n1, n3, n2);
//elt = meshDS->AddFace(n1, n3, n2);
elt = myTool->AddFace(n1, n3, n2);
meshDS->SetMeshElementOnShape(elt, faceID);
m++;
}
// remove bad elements build on vertices shared by wires
// remove bad elements built on vertices shared by wires
list<const SMDS_MeshNode*>::iterator itN = myNodesOnCommonV.begin();
for ( ; itN != myNodesOnCommonV.end(); itN++ )
@ -779,17 +777,14 @@ double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
//MESSAGE("StdMeshers_MEFISTO_2D::ComputeEdgeElementLength");
// **** a mettre dans SMESH_2D_Algo ?
const TopoDS_Face & FF = TopoDS::Face(aShape);
//const TopoDS_Face & FF = TopoDS::Face(aShape);
//bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
//TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
double meanElementLength = 100;
double wireLength = 0;
int wireElementsNumber = 0;
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
{
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
for (TopExp_Explorer expe(W, TopAbs_EDGE); expe.More(); expe.Next())
for (TopExp_Explorer expe(aShape, TopAbs_EDGE); expe.More(); expe.Next())
{
const TopoDS_Edge & E = TopoDS::Edge(expe.Current());
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
@ -797,7 +792,6 @@ double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
wireLength += length;
wireElementsNumber += nb;
}
}
if (wireElementsNumber)
meanElementLength = wireLength / wireElementsNumber;
//SCRUTE(meanElementLength);

View File

@ -33,6 +33,8 @@
#include "SMESH_2D_Algo.hxx"
#include <TopoDS_Wire.hxx>
#include "StdMeshers_Helper.hxx"
class SMDS_MeshNode;
class TopTools_IndexedDataMapOfShapeListOfShape;
class TopoDS_Face;
@ -95,6 +97,8 @@ protected:
TopoDS_Wire myOuterWire;
std::list<const SMDS_MeshNode*> myNodesOnCommonV;
StdMeshers_Helper* myTool; // toll for working with quadratic elements
};
#endif

View File

@ -51,6 +51,9 @@
#include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp_Pnt.hxx>
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <stdio.h>
#include <algorithm>
@ -70,7 +73,20 @@ StdMeshers_Penta_3D::StdMeshers_Penta_3D()
myTol3D=0.1;
myWallNodesMaps.resize( SMESH_Block::NbFaces() );
myShapeXYZ.resize( SMESH_Block::NbSubShapes() );
myTool = 0;
}
//=======================================================================
//function : ~StdMeshers_Penta_3D
//purpose :
//=======================================================================
StdMeshers_Penta_3D::~StdMeshers_Penta_3D()
{
if ( myTool )
delete myTool;
}
//=======================================================================
//function : Compute
//purpose :
@ -91,33 +107,43 @@ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
if (myErrorStatus){
return bOK;
}
myTool = new StdMeshers_Helper(aMesh);
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape);
//
MakeBlock();
if (myErrorStatus){
if (myErrorStatus){
delete myTool; myTool = 0;
return bOK;
}
//
ClearMeshOnFxy1();
if (myErrorStatus) {
delete myTool; myTool = 0;
return bOK;
}
//
MakeNodes();
if (myErrorStatus){
delete myTool; myTool = 0;
return bOK;
}
//
MakeConnectingMap();
//
ClearMeshOnFxy1();
if (myErrorStatus) {
return bOK;
}
//
MakeMeshOnFxy1();
if (myErrorStatus) {
delete myTool; myTool = 0;
return bOK;
}
//
MakeVolumeMesh();
//
delete myTool; myTool = 0;
return !bOK;
}
//=======================================================================
//function : MakeNodes
//purpose :
@ -144,12 +170,24 @@ void StdMeshers_Penta_3D::MakeNodes()
// 1.1 Horizontal size
myJSize=0;
for (i=0; i<aNbSIDs; ++i) {
const TopoDS_Shape& aS=myBlock.Shape(aSIDs[i]);
const TopoDS_Shape& aS = myBlock.Shape(aSIDs[i]);
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aS);
ASSERT(aSubMesh);
SMESHDS_SubMesh *aSM=aSubMesh->GetSubMeshDS();
iNbN=aSM->NbNodes();
myJSize+=iNbN;
SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
if(!myCreateQuadratic) {
iNbN = aSM->NbNodes();
}
else {
iNbN = 0;
SMDS_NodeIteratorPtr itn = aSM->GetNodes();
while(itn->more()) {
const SMDS_MeshNode* aNode = itn->next();
if(myTool->IsMedium(aNode))
continue;
iNbN++;
}
}
myJSize += iNbN;
}
//printf("*** Horizontal: number of nodes summary=%d\n", myJSize);
//
@ -159,9 +197,21 @@ void StdMeshers_Penta_3D::MakeNodes()
const TopoDS_Shape& aS=myBlock.Shape(SMESH_Block::ID_E00z);
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aS);
ASSERT(aSubMesh);
SMESHDS_SubMesh *aSM=aSubMesh->GetSubMeshDS();
iNbN=aSM->NbNodes();
myISize+=iNbN;
SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
if(!myCreateQuadratic) {
iNbN = aSM->NbNodes();
}
else {
iNbN = 0;
SMDS_NodeIteratorPtr itn = aSM->GetNodes();
while(itn->more()) {
const SMDS_MeshNode* aNode = itn->next();
if(myTool->IsMedium(aNode))
continue;
iNbN++;
}
}
myISize += iNbN;
}
//printf("*** Vertical: number of nodes on edges and vertices=%d\n", myISize);
//
@ -177,18 +227,19 @@ void StdMeshers_Penta_3D::MakeNodes()
// vertices
for (k=0; k<aNbSIDs; ++k) {
aSID=aSIDs[k];
const TopoDS_Shape& aS=myBlock.Shape(aSID);
SMDS_NodeIteratorPtr ite =pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
const TopoDS_Shape& aS = myBlock.Shape(aSID);
SMDS_NodeIteratorPtr ite = pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
while(ite->more()) {
const SMDS_MeshNode* aNode = ite->next();
if(myTool->IsMedium(aNode))
continue;
aNodeID=aNode->GetID();
//
aTNode.SetNode(aNode);
aTNode.SetShapeSupportID(aSID);
aTNode.SetBaseNodeID(aNodeID);
//
if ( SMESH_Block::IsEdgeID (aSID))
{
if ( SMESH_Block::IsEdgeID (aSID)) {
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(aNode->GetPosition().get());
myBlock.ComputeParameters( epos->GetUParameter(), aS, aCoords );
@ -200,7 +251,7 @@ void StdMeshers_Penta_3D::MakeNodes()
aP3D.SetCoord(aX, aY, aZ);
myBlock.ComputeParameters(aP3D, aS, aCoords);
}
iErr=myBlock.ErrorStatus();
iErr = myBlock.ErrorStatus();
if (iErr) {
MESSAGE("StdMeshers_Penta_3D::MakeNodes()," <<
"SMESHBlock: ComputeParameters operation failed");
@ -325,8 +376,7 @@ void StdMeshers_Penta_3D::MakeNodes()
// 3.3 set XYZ of vertices, and initialize of the rest
SMESHDS_Mesh* aMesh = GetMesh()->GetMeshDS();
for ( int id = SMESH_Block::ID_V000; id < SMESH_Block::ID_Shell; ++id )
{
for ( int id = SMESH_Block::ID_V000; id < SMESH_Block::ID_Shell; ++id ) {
if ( SMESH_Block::IsVertexID( id )) {
TopoDS_Shape V = myBlock.Shape( id );
SMESHDS_SubMesh* sm = aMesh->MeshElements( V );
@ -344,23 +394,46 @@ void StdMeshers_Penta_3D::MakeNodes()
SMESH_Block::TShapeID aSSID, aBNSSID;
StdMeshers_TNode aTN;
//
for (j=0; j<myJSize; ++j)
{
// create top face and find UV for it's corners
const TopoDS_Face& TopFace = TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy1));
SMESHDS_Mesh* meshDS = pMesh->GetMeshDS();
int topfaceID = meshDS->ShapeToIndex(TopFace);
const TopoDS_Vertex& v001 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V001));
SMDS_NodeIteratorPtr itn = pMesh->GetSubMeshContaining(v001)->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* N = itn->next();
gp_XY UV001 = myTool->GetNodeUV(TopFace,N);
const TopoDS_Vertex& v101 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V101));
itn = pMesh->GetSubMeshContaining(v101)->GetSubMeshDS()->GetNodes();
N = itn->next();
gp_XY UV101 = myTool->GetNodeUV(TopFace,N);
const TopoDS_Vertex& v011 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V011));
itn = pMesh->GetSubMeshContaining(v011)->GetSubMeshDS()->GetNodes();
N = itn->next();
gp_XY UV011 = myTool->GetNodeUV(TopFace,N);
const TopoDS_Vertex& v111 = TopoDS::Vertex(myBlock.Shape(SMESH_Block::ID_V111));
itn = pMesh->GetSubMeshContaining(v111)->GetSubMeshDS()->GetNodes();
N = itn->next();
gp_XY UV111 = myTool->GetNodeUV(TopFace,N);
for (j=0; j<myJSize; ++j) {
// base node info
const StdMeshers_TNode& aBN=myTNodes[j];
aBNSSID=(SMESH_Block::TShapeID)aBN.ShapeSupportID();
iBNID=aBN.BaseNodeID();
const gp_XYZ& aBNXYZ=aBN.NormCoord();
const StdMeshers_TNode& aBN = myTNodes[j];
aBNSSID = (SMESH_Block::TShapeID)aBN.ShapeSupportID();
iBNID = aBN.BaseNodeID();
const gp_XYZ& aBNXYZ = aBN.NormCoord();
bool createNode = ( aBNSSID == SMESH_Block::ID_Fxy0 );
//
// set XYZ on horizontal edges and get node columns of faces:
// 2 columns for each face, between which a base node is located
vector<const SMDS_MeshNode*>* nColumns[8];
double ratio[4]; // base node position between columns [0.-1.]
if ( createNode )
for ( k = 0; k < 4; ++k )
if ( createNode ) {
for ( k = 0; k < 4; ++k ) {
ratio[ k ] = SetHorizEdgeXYZ (aBNXYZ, wallFaceID[ k ],
nColumns[k*2], nColumns[k*2+1]);
}
}
//
// XYZ on the bottom and top faces
const SMDS_MeshNode* n = aBN.Node();
@ -368,8 +441,9 @@ void StdMeshers_Penta_3D::MakeNodes()
myShapeXYZ[ SMESH_Block::ID_Fxy1 ].SetCoord( 0., 0., 0. );
//
// first create or find a top node, then the rest ones in a column
for (i=myISize-1; i>0; --i)
{
for (i=myISize-1; i>0; --i) {
bIsUpperLayer = (i==(myISize-1));
gp_XY UV_Ex01, UV_Ex11, UV_E0y1, UV_E1y1;
if ( createNode ) {
// set XYZ on vertical edges and faces
for ( k = 0; k < 4; ++k ) {
@ -377,11 +451,28 @@ void StdMeshers_Penta_3D::MakeNodes()
myShapeXYZ[ verticEdgeID[ k ] ].SetCoord( n->X(), n->Y(), n->Z() );
//
n = (*nColumns[k*2]) [ i ];
gp_XY tmp1;
if( i==myISize-1 ) {
tmp1 = myTool->GetNodeUV(TopFace,n);
tmp1 = ( 1. - ratio[ k ]) * tmp1;
}
gp_XYZ xyz( n->X(), n->Y(), n->Z() );
myShapeXYZ[ wallFaceID[ k ]] = ( 1. - ratio[ k ]) * xyz;
n = (*nColumns[k*2+1]) [ i ];
xyz.SetCoord( n->X(), n->Y(), n->Z() );
myShapeXYZ[ wallFaceID[ k ]] += ratio[ k ] * xyz;
if( i==myISize-1 ) {
gp_XY tmp2 = myTool->GetNodeUV(TopFace,n);
tmp1 += ratio[ k ] * tmp2;
if( k==0 )
UV_Ex01 = tmp1;
else if( k==1 )
UV_Ex11 = tmp1;
else if( k==2 )
UV_E0y1 = tmp1;
else
UV_E1y1 = tmp1;
}
}
}
// fill current node info
@ -395,7 +486,6 @@ void StdMeshers_Penta_3D::MakeNodes()
aCoords.SetCoord(aX, aY, aZ);
//
// suporting shape ID
bIsUpperLayer=(i==(myISize-1));
ShapeSupportID(bIsUpperLayer, aBNSSID, aSSID);
if (myErrorStatus) {
MESSAGE("StdMeshers_Penta_3D::MakeNodes() ");
@ -418,6 +508,30 @@ void StdMeshers_Penta_3D::MakeNodes()
if ( bIsUpperLayer ) {
const SMDS_MeshNode* n = aTN.Node();
myShapeXYZ[ SMESH_Block::ID_Fxy1 ].SetCoord( n->X(), n->Y(), n->Z() );
// set node on top face:
// find UV parameter for this node
// UV_Ex11
// UV011+-----+----------+UV111
// | |
// | |
// UV_E0y1+ +node +UV_E1y1
// | |
// | |
// | |
// UV001+-----+----------+UV101
// UV_Ex01
gp_Pnt2d aP;
double u = aCoords.X(), v = aCoords.Y();
double u1 = ( 1. - u ), v1 = ( 1. - v );
aP.ChangeCoord() = UV_Ex01 * v1;
aP.ChangeCoord() += UV_Ex11 * v;
aP.ChangeCoord() += UV_E0y1 * u1;
aP.ChangeCoord() += UV_E1y1 * u;
aP.ChangeCoord() -= UV001 * u1 * v1;
aP.ChangeCoord() -= UV101 * u * v1;
aP.ChangeCoord() -= UV011 * u1 * v;
aP.ChangeCoord() -= UV111 * u * v;
meshDS->SetNodeOnFace((SMDS_MeshNode*)n, topfaceID, aP.X(), aP.Y());
}
}
if (myErrorStatus) {
@ -456,10 +570,13 @@ void StdMeshers_Penta_3D::MakeNodes()
*/
//DEB t
}
//=======================================================================
//function : FindNodeOnShape
//purpose :
//=======================================================================
void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
const gp_XYZ& aParams,
const int z,
@ -470,14 +587,13 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
double aX, aY, aZ, aD, aTol2, minD;
gp_Pnt aP1, aP2;
//
SMESH_Mesh* pMesh=GetMesh();
aTol2=myTol3D*myTol3D;
SMESH_Mesh* pMesh = GetMesh();
aTol2 = myTol3D*myTol3D;
minD = 1.e100;
SMDS_MeshNode* pNode=NULL;
SMDS_MeshNode* pNode = NULL;
//
if ( aS.ShapeType() == TopAbs_FACE ||
aS.ShapeType() == TopAbs_EDGE )
{
aS.ShapeType() == TopAbs_EDGE ) {
// find a face ID to which aTN belongs to
int faceID;
if ( aS.ShapeType() == TopAbs_FACE )
@ -492,13 +608,13 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
}
ASSERT( SMESH_Block::IsFaceID( faceID ));
int fIndex = SMESH_Block::ShapeIndex( faceID );
StdMeshers_IJNodeMap & ijNodes= myWallNodesMaps[ fIndex ];
StdMeshers_IJNodeMap & ijNodes = myWallNodesMaps[ fIndex ];
// look for a base node in ijNodes
const SMDS_MeshNode* baseNode = pMesh->GetMeshDS()->FindNode( aTN.BaseNodeID() );
StdMeshers_IJNodeMap::const_iterator par_nVec = ijNodes.begin();
for ( ; par_nVec != ijNodes.end(); par_nVec++ )
if ( par_nVec->second[ 0 ] == baseNode ) {
pNode=(SMDS_MeshNode*)par_nVec->second.at( z );
pNode = (SMDS_MeshNode*)par_nVec->second.at( z );
aTN.SetNode(pNode);
return;
}
@ -510,6 +626,8 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
pMesh->GetSubMeshContaining(aS)->GetSubMeshDS()->GetNodes();
while(ite->more()) {
const SMDS_MeshNode* aNode = ite->next();
if(myTool->IsMedium(aNode))
continue;
aX=aNode->X();
aY=aNode->Y();
aZ=aNode->Z();
@ -532,6 +650,7 @@ void StdMeshers_Penta_3D::FindNodeOnShape(const TopoDS_Shape& aS,
//myErrorStatus=11; // can not find the node;
}
//=======================================================================
//function : SetHorizEdgeXYZ
//purpose :
@ -583,6 +702,7 @@ double StdMeshers_Penta_3D::SetHorizEdgeXYZ(const gp_XYZ& aBase
return r;
}
//=======================================================================
//function : MakeVolumeMesh
//purpose :
@ -593,20 +713,20 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
//
int i, j, ij, ik, i1, i2, aSSID;
//
SMESH_Mesh* pMesh =GetMesh();
SMESHDS_Mesh* meshDS=pMesh->GetMeshDS();
SMESH_Mesh* pMesh = GetMesh();
SMESHDS_Mesh* meshDS = pMesh->GetMeshDS();
//
int shapeID = meshDS->ShapeToIndex( myShape );
//
// 1. Set Node In Volume
ik=myISize-1;
ik = myISize-1;
for (i=1; i<ik; ++i){
for (j=0; j<myJSize; ++j){
ij=i*myJSize+j;
const StdMeshers_TNode& aTN=myTNodes[ij];
const StdMeshers_TNode& aTN = myTNodes[ij];
aSSID=aTN.ShapeSupportID();
if (aSSID==SMESH_Block::ID_NONE) {
SMDS_MeshNode* aNode=(SMDS_MeshNode*)aTN.Node();
SMDS_MeshNode* aNode = (SMDS_MeshNode*)aTN.Node();
meshDS->SetNodeInVolume(aNode, shapeID);
}
}
@ -621,22 +741,28 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
const TopoDS_Face& aFxy0=
TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy0));
SMESH_subMesh *aSubMesh0 = pMesh->GetSubMeshContaining(aFxy0);
SMESHDS_SubMesh *aSM0=aSubMesh0->GetSubMeshDS();
SMESHDS_SubMesh *aSM0 = aSubMesh0->GetSubMeshDS();
//
itf=aSM0->GetElements();
itf = aSM0->GetElements();
while(itf->more()) {
const SMDS_MeshElement* pE0=itf->next();
const SMDS_MeshElement* pE0 = itf->next();
//
int nbFaceNodes = pE0->NbNodes();
if(myCreateQuadratic)
nbFaceNodes = nbFaceNodes/2;
if ( aN.size() < nbFaceNodes * 2 )
aN.resize( nbFaceNodes * 2 );
//
k=0;
aItNodes=pE0->nodesIterator();
while (aItNodes->more()) {
const SMDS_MeshElement* pNode=aItNodes->next();
aID0=pNode->GetID();
aJ[k]=GetIndexOnLayer(aID0);
//const SMDS_MeshElement* pNode = aItNodes->next();
const SMDS_MeshNode* pNode =
static_cast<const SMDS_MeshNode*> (aItNodes->next());
if(myTool->IsMedium(pNode))
continue;
aID0 = pNode->GetID();
aJ[k] = GetIndexOnLayer(aID0);
if (myErrorStatus) {
MESSAGE("StdMeshers_Penta_3D::MakeVolumeMesh");
return;
@ -646,19 +772,19 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
}
//
bool forward = true;
for (i=0; i<ik; ++i){
for (i=0; i<ik; ++i) {
i1=i;
i2=i+1;
for(j=0; j<nbFaceNodes; ++j) {
ij=i1*myJSize+aJ[j];
const StdMeshers_TNode& aTN1=myTNodes[ij];
const SMDS_MeshNode* aN1=aTN1.Node();
ij = i1*myJSize+aJ[j];
const StdMeshers_TNode& aTN1 = myTNodes[ij];
const SMDS_MeshNode* aN1 = aTN1.Node();
aN[j]=aN1;
//
ij=i2*myJSize+aJ[j];
const StdMeshers_TNode& aTN2=myTNodes[ij];
const SMDS_MeshNode* aN2=aTN2.Node();
aN[j+nbFaceNodes]=aN2;
const StdMeshers_TNode& aTN2 = myTNodes[ij];
const SMDS_MeshNode* aN2 = aTN2.Node();
aN[j+nbFaceNodes] = aN2;
}
// check if volume orientation will be ok
if ( i == 0 ) {
@ -685,20 +811,30 @@ void StdMeshers_Penta_3D::MakeVolumeMesh()
SMDS_MeshVolume* aV = 0;
switch ( nbFaceNodes ) {
case 3:
if ( forward )
aV = meshDS->AddVolume(aN[0], aN[1], aN[2],
aN[3], aN[4], aN[5]);
else
aV = meshDS->AddVolume(aN[0], aN[2], aN[1],
aN[3], aN[5], aN[4]);
if ( forward ) {
//aV = meshDS->AddVolume(aN[0], aN[1], aN[2],
// aN[3], aN[4], aN[5]);
aV = myTool->AddVolume(aN[0], aN[1], aN[2], aN[3], aN[4], aN[5]);
}
else {
//aV = meshDS->AddVolume(aN[0], aN[2], aN[1],
// aN[3], aN[5], aN[4]);
aV = myTool->AddVolume(aN[0], aN[2], aN[1], aN[3], aN[5], aN[4]);
}
break;
case 4:
if ( forward )
aV = meshDS->AddVolume(aN[0], aN[1], aN[2], aN[3],
if ( forward ) {
//aV = meshDS->AddVolume(aN[0], aN[1], aN[2], aN[3],
// aN[4], aN[5], aN[6], aN[7]);
aV = myTool->AddVolume(aN[0], aN[1], aN[2], aN[3],
aN[4], aN[5], aN[6], aN[7]);
else
aV = meshDS->AddVolume(aN[0], aN[3], aN[2], aN[1],
}
else {
//aV = meshDS->AddVolume(aN[0], aN[3], aN[2], aN[1],
// aN[4], aN[7], aN[6], aN[5]);
aV = myTool->AddVolume(aN[0], aN[3], aN[2], aN[1],
aN[4], aN[7], aN[6], aN[5]);
}
break;
default:
continue;
@ -727,74 +863,68 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
const TopoDS_Face& aFxy1=
TopoDS::Face(myBlock.Shape(SMESH_Block::ID_Fxy1));
//
SMESH_Mesh* pMesh=GetMesh();
SMESH_Mesh* pMesh = GetMesh();
SMESHDS_Mesh * meshDS = pMesh->GetMeshDS();
//
SMESH_subMesh *aSubMesh0 = pMesh->GetSubMeshContaining(aFxy0);
SMESHDS_SubMesh *aSM0=aSubMesh0->GetSubMeshDS();
SMESHDS_SubMesh *aSM0 = aSubMesh0->GetSubMeshDS();
//
// set nodes on aFxy1
aLevel=myISize-1;
itn=aSM0->GetNodes();
aNbNodes=aSM0->NbNodes();
aLevel = myISize-1;
itn = aSM0->GetNodes();
aNbNodes = aSM0->NbNodes();
//printf("** aNbNodes=%d\n", aNbNodes);
while(itn->more()) {
const SMDS_MeshNode* aN0=itn->next();
aID0=aN0->GetID();
aJ=GetIndexOnLayer(aID0);
if (myErrorStatus) {
MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
return;
}
//
ij=aLevel*myJSize+aJ;
const StdMeshers_TNode& aTN1=myTNodes[ij];
SMDS_MeshNode* aN1=(SMDS_MeshNode*)aTN1.Node();
//
meshDS->SetNodeOnFace(aN1, aFxy1);
}
//
// set elements on aFxy1
vector<const SMDS_MeshNode*> aNodes1;
//
itf=aSM0->GetElements();
itf = aSM0->GetElements();
while(itf->more()) {
const SMDS_MeshElement * pE0=itf->next();
aElementType=pE0->GetType();
const SMDS_MeshElement* pE0 = itf->next();
aElementType = pE0->GetType();
if (!aElementType==SMDSAbs_Face) {
continue;
}
aNbNodes=pE0->NbNodes();
aNbNodes = pE0->NbNodes();
if(myCreateQuadratic)
aNbNodes = aNbNodes/2;
// if (aNbNodes!=3) {
// continue;
// }
if ( aNodes1.size() < aNbNodes )
aNodes1.resize( aNbNodes );
//
k=aNbNodes-1; // reverse a face
aItNodes=pE0->nodesIterator();
k = aNbNodes-1; // reverse a face
aItNodes = pE0->nodesIterator();
while (aItNodes->more()) {
const SMDS_MeshElement* pNode=aItNodes->next();
aID0=pNode->GetID();
aJ=GetIndexOnLayer(aID0);
//const SMDS_MeshElement* pNode = aItNodes->next();
const SMDS_MeshNode* pNode =
static_cast<const SMDS_MeshNode*> (aItNodes->next());
if(myTool->IsMedium(pNode))
continue;
aID0 = pNode->GetID();
aJ = GetIndexOnLayer(aID0);
if (myErrorStatus) {
MESSAGE("StdMeshers_Penta_3D::MakeMeshOnFxy1() ");
return;
}
//
ij=aLevel*myJSize+aJ;
const StdMeshers_TNode& aTN1=myTNodes[ij];
const SMDS_MeshNode* aN1=aTN1.Node();
aNodes1[k]=aN1;
ij = aLevel*myJSize + aJ;
const StdMeshers_TNode& aTN1 = myTNodes[ij];
const SMDS_MeshNode* aN1 = aTN1.Node();
aNodes1[k] = aN1;
--k;
}
SMDS_MeshFace * face = 0;
switch ( aNbNodes ) {
case 3:
face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2]);
//face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2]);
face = myTool->AddFace(aNodes1[0], aNodes1[1], aNodes1[2]);
break;
case 4:
face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2], aNodes1[3]);
//face = meshDS->AddFace(aNodes1[0], aNodes1[1], aNodes1[2], aNodes1[3]);
face = myTool->AddFace(aNodes1[0], aNodes1[1], aNodes1[2], aNodes1[3]);
break;
default:
continue;
@ -802,6 +932,7 @@ void StdMeshers_Penta_3D::MakeMeshOnFxy1()
meshDS->SetMeshElementOnShape(face, aFxy1);
}
}
//=======================================================================
//function : ClearMeshOnFxy1
//purpose :
@ -838,6 +969,7 @@ int StdMeshers_Penta_3D::GetIndexOnLayer(const int aID)
j=(*aMapIt).second;
return j;
}
//=======================================================================
//function : MakeConnectingMap
//purpose :
@ -852,6 +984,7 @@ void StdMeshers_Penta_3D::MakeConnectingMap()
myConnectingMap[aBNID]=j;
}
}
//=======================================================================
//function : CreateNode
//purpose :
@ -879,8 +1012,7 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
// // point inside solid
// myBlock.Point(aParams, aP);
// }
if (bIsUpperLayer)
{
if (bIsUpperLayer) {
double u = aParams.X(), v = aParams.Y();
double u1 = ( 1. - u ), v1 = ( 1. - v );
aP.ChangeCoord() = myShapeXYZ[ SMESH_Block::ID_Ex01 ] * v1;
@ -893,8 +1025,7 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
aP.ChangeCoord() -= myShapeXYZ[ SMESH_Block::ID_V011 ] * u1 * v;
aP.ChangeCoord() -= myShapeXYZ[ SMESH_Block::ID_V111 ] * u * v;
}
else
{
else {
SMESH_Block::ShellPoint( aParams, myShapeXYZ, aP.ChangeCoord() );
}
//
@ -906,12 +1037,14 @@ void StdMeshers_Penta_3D::CreateNode(const bool bIsUpperLayer,
//
aX=aP.X(); aY=aP.Y(); aZ=aP.Z();
//
SMESH_Mesh* pMesh=GetMesh();
SMESHDS_Mesh* pMeshDS=pMesh->GetMeshDS();
SMESH_Mesh* pMesh = GetMesh();
SMESHDS_Mesh* pMeshDS = pMesh->GetMeshDS();
//
pNode = pMeshDS->AddNode(aX, aY, aZ);
aTN.SetNode(pNode);
}
//=======================================================================
//function : ShapeSupportID
//purpose :
@ -980,21 +1113,21 @@ void StdMeshers_Penta_3D::MakeBlock()
SMDSAbs_ElementType aElementType;
SMESH_Mesh* pMesh=GetMesh();
//
iCnt=0;
iNbF=aM.Extent();
iCnt = 0;
iNbF = aM.Extent();
for (i=1; i<=iNbF; ++i) {
const TopoDS_Shape& aF=aM(i);
const TopoDS_Shape& aF = aM(i);
SMESH_subMesh *aSubMesh = pMesh->GetSubMeshContaining(aF);
ASSERT(aSubMesh);
SMESHDS_SubMesh *aSM=aSubMesh->GetSubMeshDS();
SMDS_ElemIteratorPtr itf=aSM->GetElements();
SMESHDS_SubMesh *aSM = aSubMesh->GetSubMeshDS();
SMDS_ElemIteratorPtr itf = aSM->GetElements();
while(itf->more()) {
const SMDS_MeshElement * pElement=itf->next();
aElementType=pElement->GetType();
const SMDS_MeshElement * pElement = itf->next();
aElementType = pElement->GetType();
if (aElementType==SMDSAbs_Face) {
iNbNodes=pElement->NbNodes();
if (iNbNodes==3) {
aFTr=aF;
iNbNodes = pElement->NbNodes();
if ( iNbNodes==3 || (myCreateQuadratic && iNbNodes==6) ) {
aFTr = aF;
++iCnt;
if (iCnt>1) {
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
@ -1013,7 +1146,7 @@ void StdMeshers_Penta_3D::MakeBlock()
TopExp::MapShapesAndAncestors(myShape, TopAbs_VERTEX, TopAbs_EDGE, aMVES);
//
// 1.1 Base vertex V000
iNbE=aME.Extent();
iNbE = aME.Extent();
if (iNbE!=4){
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
myErrorStatus=7; // too few edges are in base face aFTr
@ -1080,7 +1213,7 @@ void StdMeshers_Penta_3D::MakeBlock()
// 2. Load Block
const TopoDS_Shell& aShell=TopoDS::Shell(aME(1));
myBlock.Load(aShell, aV000, aV001);
iErr=myBlock.ErrorStatus();
iErr = myBlock.ErrorStatus();
if (iErr) {
MESSAGE("StdMeshers_Penta_3D::MakeBlock() ");
myErrorStatus=100; // SMESHBlock: Load operation failed
@ -1154,10 +1287,10 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
bool rev1, CumOri = false;
TopExp_Explorer exp( theFace, TopAbs_EDGE );
int nbEdges = 0;
for ( ; exp.More(); exp.Next() )
{
if ( ++nbEdges > 4 )
for ( ; exp.More(); exp.Next() ) {
if ( ++nbEdges > 4 ) {
return false; // more than 4 edges in theFace
}
TopoDS_Edge e = TopoDS::Edge( exp.Current() );
if ( theBaseEdge.IsSame( e ))
continue;
@ -1174,8 +1307,9 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
else
e2 = e;
}
if ( nbEdges < 4 )
return false; // lass than 4 edges in theFace
if ( nbEdges < 4 ) {
return false; // less than 4 edges in theFace
}
// submeshes corresponding to shapes
SMESHDS_SubMesh* smFace = theMesh->MeshElements( theFace );
@ -1200,13 +1334,32 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
return false;
}
if ( sm1->NbNodes() * smb->NbNodes() != smFace->NbNodes() ) {
MESSAGE( "Wrong nb face nodes: " <<
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
return false;
// check quadratic case
if ( myCreateQuadratic ) {
int n1 = sm1->NbNodes()/2;
int n2 = smb->NbNodes()/2;
int n3 = sm1->NbNodes() - n1;
int n4 = smb->NbNodes() - n2;
int nf = sm1->NbNodes()*smb->NbNodes() - n3*n4;
if( nf != smFace->NbNodes() ) {
MESSAGE( "Wrong nb face nodes: " <<
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
return false;
}
}
else {
MESSAGE( "Wrong nb face nodes: " <<
sm1->NbNodes()<<" "<<smb->NbNodes()<<" "<<smFace->NbNodes());
return false;
}
}
// IJ size
int vsize = sm1->NbNodes() + 2;
int hsize = smb->NbNodes() + 2;
if(myCreateQuadratic) {
vsize = vsize - sm1->NbNodes()/2 -1;
hsize = hsize - smb->NbNodes()/2 -1;
}
// load nodes from theBaseEdge
@ -1226,12 +1379,15 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
double range = l - f;
SMDS_NodeIteratorPtr nIt = smb->GetNodes();
const SMDS_MeshNode* node;
while ( nIt->more() )
{
while ( nIt->more() ) {
node = nIt->next();
if(myTool->IsMedium(node))
continue;
const SMDS_EdgePosition* pos =
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
if ( !pos ) return false;
if ( !pos ) {
return false;
}
double u = ( pos->GetUParameter() - f ) / range;
vector<const SMDS_MeshNode*> & nVec = theIJNodes[ u ];
nVec.resize( vsize, nullNode );
@ -1246,19 +1402,21 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
map< double, const SMDS_MeshNode*> sortedNodes; // sort by param on edge
nIt = sm1->GetNodes();
while ( nIt->more() )
{
while ( nIt->more() ) {
node = nIt->next();
if(myTool->IsMedium(node))
continue;
const SMDS_EdgePosition* pos =
dynamic_cast<const SMDS_EdgePosition*>( node->GetPosition().get() );
if ( !pos ) return false;
if ( !pos ) {
return false;
}
sortedNodes.insert( make_pair( pos->GetUParameter(), node ));
}
loadedNodes.insert( nVecf[ vsize - 1 ] = smVft->GetNodes()->next() );
map< double, const SMDS_MeshNode*>::iterator u_n = sortedNodes.begin();
int row = rev1 ? vsize - 1 : 0;
for ( ; u_n != sortedNodes.end(); u_n++ )
{
for ( ; u_n != sortedNodes.end(); u_n++ ) {
if ( rev1 ) row--;
else row++;
loadedNodes.insert( nVecf[ row ] = u_n->second );
@ -1285,8 +1443,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
StdMeshers_IJNodeMap::iterator par_nVec_2 = par_nVec_1;
// loop on columns
int col = 0;
for ( par_nVec_2++; par_nVec_2 != theIJNodes.end(); par_nVec_1++, par_nVec_2++ )
{
for ( par_nVec_2++; par_nVec_2 != theIJNodes.end(); par_nVec_1++, par_nVec_2++ ) {
col++;
row = 0;
const SMDS_MeshNode* n1 = par_nVec_1->second[ row ];
@ -1295,10 +1452,10 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
do {
// look for a face by 2 nodes
face = SMESH_MeshEditor::FindFaceInSet( n1, n2, allFaces, foundFaces );
if ( face )
{
if ( face ) {
int nbFaceNodes = face->NbNodes();
if ( nbFaceNodes > 4 ) {
if ( (!myCreateQuadratic && nbFaceNodes>4) ||
(myCreateQuadratic && nbFaceNodes>8) ) {
MESSAGE(" Too many nodes in a face: " << nbFaceNodes );
return false;
}
@ -1308,6 +1465,8 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
eIt = face->nodesIterator() ;
while ( !found && eIt->more() ) {
node = static_cast<const SMDS_MeshNode*>( eIt->next() );
if(myTool->IsMedium(node))
continue;
found = loadedNodes.insert( node ).second;
if ( !found && node != n1 && node != n2 )
n3 = node;
@ -1320,18 +1479,21 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
par_nVec_2->second[ row ] = node;
foundFaces.insert( face );
n2 = node;
if ( nbFaceNodes == 4 )
if ( nbFaceNodes==4 || (myCreateQuadratic && nbFaceNodes==8) ) {
n1 = par_nVec_1->second[ row ];
}
}
else if (nbFaceNodes == 3 &&
n3 == par_nVec_1->second[ row ] )
else if ( (nbFaceNodes==3 || (myCreateQuadratic && nbFaceNodes==6) ) &&
n3 == par_nVec_1->second[ row ] ) {
n1 = n3;
}
else {
MESSAGE( "Not quad mesh, column "<< col );
return false;
}
}
} while ( face && n1 && n2 );
}
while ( face && n1 && n2 );
if ( row < vsize - 1 ) {
MESSAGE( "Too few nodes in column "<< col <<": "<< row+1);
@ -1390,17 +1552,18 @@ int StdMeshers_SMESHBlock::ErrorStatus() const
{
return myErrorStatus;
}
//=======================================================================
//function : Load
//purpose :
//=======================================================================
void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell)
{
TopoDS_Vertex aV000, aV001;
//
Load(theShell, aV000, aV001);
}
//=======================================================================
//function : Load
//purpose :
@ -1416,12 +1579,13 @@ void StdMeshers_SMESHBlock::Load(const TopoDS_Shell& theShell,
bool bOk;
//
myShapeIDMap.Clear();
bOk=myTBlock.LoadBlockShapes(myShell, theV000, theV001, myShapeIDMap);
bOk = myTBlock.LoadBlockShapes(myShell, theV000, theV001, myShapeIDMap);
if (!bOk) {
myErrorStatus=2;
return;
}
}
//=======================================================================
//function : ComputeParameters
//purpose :
@ -1431,24 +1595,25 @@ void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
{
ComputeParameters(thePnt, myShell, theXYZ);
}
//=======================================================================
//function : ComputeParameters
//purpose :
//=======================================================================
void StdMeshers_SMESHBlock::ComputeParameters(const gp_Pnt& thePnt,
const TopoDS_Shape& theShape,
gp_XYZ& theXYZ)
gp_XYZ& theXYZ)
{
myErrorStatus=0;
//
int aID;
bool bOk;
//
aID=ShapeID(theShape);
aID = ShapeID(theShape);
if (myErrorStatus) {
return;
}
bOk=myTBlock.ComputeParameters(thePnt, theXYZ, aID);
bOk = myTBlock.ComputeParameters(thePnt, theXYZ, aID);
if (!bOk) {
myErrorStatus=4; // problems with computation Parameters
return;
@ -1469,12 +1634,12 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
int aID;
bool bOk=false;
//
aID=ShapeID(theShape);
aID = ShapeID(theShape);
if (myErrorStatus) {
return;
}
if ( SMESH_Block::IsEdgeID( aID ))
bOk=myTBlock.EdgeParameters( aID, theU, theXYZ );
bOk = myTBlock.EdgeParameters( aID, theU, theXYZ );
if (!bOk) {
myErrorStatus=4; // problems with computation Parameters
return;
@ -1492,6 +1657,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
//
Point(theParams, aS, aP3D);
}
//=======================================================================
//function : Point
//purpose :
@ -1500,15 +1666,15 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
const TopoDS_Shape& theShape,
gp_Pnt& aP3D)
{
myErrorStatus=0;
myErrorStatus = 0;
//
int aID;
bool bOk=false;
bool bOk = false;
gp_XYZ aXYZ(99.,99.,99.);
aP3D.SetXYZ(aXYZ);
//
if (theShape.IsNull()) {
bOk=myTBlock.ShellPoint(theParams, aXYZ);
bOk = myTBlock.ShellPoint(theParams, aXYZ);
}
//
else {
@ -1518,14 +1684,14 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
}
//
if (SMESH_Block::IsVertexID(aID)) {
bOk=myTBlock.VertexPoint(aID, aXYZ);
bOk = myTBlock.VertexPoint(aID, aXYZ);
}
else if (SMESH_Block::IsEdgeID(aID)) {
bOk=myTBlock.EdgePoint(aID, theParams, aXYZ);
bOk = myTBlock.EdgePoint(aID, theParams, aXYZ);
}
//
else if (SMESH_Block::IsFaceID(aID)) {
bOk=myTBlock.FacePoint(aID, theParams, aXYZ);
bOk = myTBlock.FacePoint(aID, theParams, aXYZ);
}
}
if (!bOk) {
@ -1534,6 +1700,7 @@ void StdMeshers_SMESHBlock::ComputeParameters(const double& theU,
}
aP3D.SetXYZ(aXYZ);
}
//=======================================================================
//function : ShapeID
//purpose :
@ -1561,6 +1728,7 @@ int StdMeshers_SMESHBlock::ShapeID(const TopoDS_Shape& theShape)
myErrorStatus=2; // unknown shape;
return aID;
}
//=======================================================================
//function : Shape
//purpose :
@ -1580,3 +1748,5 @@ const TopoDS_Shape& StdMeshers_SMESHBlock::Shape(const int theID)
const TopoDS_Shape& aS=myShapeIDMap.FindKey(theID);
return aS;
}

View File

@ -39,9 +39,12 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Shell.hxx>
#include <TopTools_IndexedMapOfOrientedShape.hxx>
#include <TColStd_MapOfInteger.hxx>
#include "SMESH_Block.hxx"
#include "StdMeshers_Helper.hxx"
typedef std::map< double, std::vector<const SMDS_MeshNode*> > StdMeshers_IJNodeMap;
class StdMeshers_SMESHBlock {
@ -165,7 +168,7 @@ class StdMeshers_Penta_3D {
public: // methods
StdMeshers_Penta_3D();
//~StdMeshers_Penta_3D();
~StdMeshers_Penta_3D();
bool Compute(SMESH_Mesh& , const TopoDS_Shape& );
@ -181,10 +184,10 @@ class StdMeshers_Penta_3D {
return myTol3D;
}
static bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
const TopoDS_Face& theFace,
const TopoDS_Edge& theBaseEdge,
SMESHDS_Mesh* theMesh);
bool LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
const TopoDS_Face& theFace,
const TopoDS_Edge& theBaseEdge,
SMESHDS_Mesh* theMesh);
// Load nodes bound to theFace into column (vectors) and rows
// of theIJNodes.
// The value of theIJNodes map is a vector of ordered nodes so
@ -251,6 +254,9 @@ class StdMeshers_Penta_3D {
//
vector<StdMeshers_IJNodeMap> myWallNodesMaps; // nodes on a face
vector<gp_XYZ> myShapeXYZ; // point on each sub-shape
bool myCreateQuadratic;
StdMeshers_Helper* myTool; // toll for working with quadratic elements
};
#endif

View File

@ -40,7 +40,7 @@ StdMeshers_Propagation::StdMeshers_Propagation (int hypId, int studyId,
: SMESH_Hypothesis(hypId, studyId, gen)
{
_name = GetName();
_param_algo_dim = -2;
_param_algo_dim = -1; // 1D auxiliary
}
//=============================================================================

View File

@ -47,6 +47,7 @@ using namespace std;
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GCPnts_UniformAbscissa.hxx>
#include <TopExp.hxx>
#include <Precision.hxx>
#include <gp_Pnt2d.hxx>
@ -80,6 +81,7 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, SMES
_name = "Quadrangle_2D";
_shapeType = (1 << TopAbs_FACE);
_compatibleHypothesis.push_back("QuadranglePreference");
myTool = 0;
}
//=============================================================================
@ -91,6 +93,8 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId, SMES
StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D()
{
MESSAGE("StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D");
if ( myTool )
delete myTool;
}
//=============================================================================
@ -128,11 +132,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
aMesh.GetSubMesh(aShape);
if ( !myTool )
myTool = new StdMeshers_Helper(aMesh);
_quadraticMesh = myTool->IsQuadraticSubMesh(aShape);
//FaceQuadStruct *quad = CheckAnd2Dcompute(aMesh, aShape);
FaceQuadStruct* quad = CheckNbEdges(aMesh, aShape);
if (!quad)
if (!quad) {
delete myTool; myTool = 0;
return false;
}
if(myQuadranglePreference) {
int n1 = quad->nbPts[0];
@ -144,14 +154,18 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
ntmp = ntmp*2;
if( nfull==ntmp && ( (n1!=n3) || (n2!=n4) ) ) {
// special path for using only quandrangle faces
return ComputeQuadPref(aMesh, aShape, quad);
bool ok = ComputeQuadPref(aMesh, aShape, quad);
delete myTool; myTool = 0;
return ok;
}
}
// set normalized grid on unit square in parametric domain
SetNormalizedGrid(aMesh, aShape, quad);
if (!quad)
if (!quad) {
delete myTool; myTool = 0;
return false;
}
// --- compute 3D values on points, store points & quadrangles
@ -180,7 +194,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
quad->uv_grid[ij].node = node;
}
}
// mesh faces
// [2]
@ -194,16 +208,16 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
// 0 > > > > > > > > nbhoriz
// i
// [0]
i = 0;
int ilow = 0;
int iup = nbhoriz - 1;
if (quad->isEdgeOut[3]) { ilow++; } else { if (quad->isEdgeOut[1]) iup--; }
int jlow = 0;
int jup = nbvertic - 1;
if (quad->isEdgeOut[0]) { jlow++; } else { if (quad->isEdgeOut[2]) jup--; }
// regular quadrangles
for (i = ilow; i < iup; i++) {
for (j = jlow; j < jup; j++) {
@ -212,11 +226,12 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
b = quad->uv_grid[j * nbhoriz + i + 1].node;
c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
d = quad->uv_grid[(j + 1) * nbhoriz + i].node;
SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
//SMDS_MeshFace * face = meshDS->AddFace(a, b, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
}
}
UVPtStruct *uv_e0 = quad->uv_edges[0];
UVPtStruct *uv_e1 = quad->uv_edges[1];
UVPtStruct *uv_e2 = quad->uv_edges[2];
@ -225,7 +240,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
double eps = Precision::Confusion();
// Boundary quadrangles
if (quad->isEdgeOut[0]) {
// Down edge is out
//
@ -237,14 +252,14 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
// . . . . . . . . . __ down edge nodes
//
// >->->->->->->->->->->->-> -- direction of processing
int g = 0; // number of last processed node in the regular grid
// number of last node of the down edge to be processed
int stop = nbdown - 1;
// if right edge is out, we will stop at a node, previous to the last one
if (quad->isEdgeOut[1]) stop--;
// for each node of the down edge find nearest node
// in the first row of the regular grid and link them
for (i = 0; i < stop; i++) {
@ -252,18 +267,19 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
a = uv_e0[i].node;
b = uv_e0[i + 1].node;
gp_Pnt pb (b->X(), b->Y(), b->Z());
// find node c in the regular grid, which will be linked with node b
int near = g;
if (i == stop - 1) {
// right bound reached, link with the rightmost node
near = iup;
c = quad->uv_grid[nbhoriz + iup].node;
} else {
}
else {
// find in the grid node c, nearest to the b
double mind = RealLast();
for (int k = g; k <= iup; k++) {
const SMDS_MeshNode *nk;
if (k < ilow) // this can be, if left edge is out
nk = uv_e3[1].node; // get node from the left edge
@ -283,14 +299,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
}
if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, geomFaceID);
} else { // make quadrangle
}
else { // make quadrangle
if (near - 1 < ilow)
d = uv_e3[1].node;
else
d = quad->uv_grid[nbhoriz + near - 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
// if node d is not at position g - make additional triangles
@ -301,7 +320,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
d = uv_e3[1].node;
else
d = quad->uv_grid[nbhoriz + k - 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
}
}
@ -363,14 +383,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
}
if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, geomFaceID);
} else { // make quadrangle
}
else { // make quadrangle
if (near + 1 > iup)
d = uv_e1[nbright - 2].node;
else
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
if (near + 1 < g) { // if d not is at g - make additional triangles
@ -380,7 +403,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
d = uv_e1[nbright - 2].node;
else
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
}
}
@ -428,14 +452,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
}
if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, geomFaceID);
} else { // make quadrangle
}
else { // make quadrangle
if (near - 1 < jlow)
d = uv_e0[nbdown - 2].node;
else
d = quad->uv_grid[nbhoriz*near - 2].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
if (near - 1 > g) { // if d not is at g - make additional triangles
@ -445,7 +472,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
d = uv_e0[nbdown - 2].node;
else
d = quad->uv_grid[nbhoriz*k - 2].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
}
}
@ -490,14 +518,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
}
if (near == g) { // make triangle
SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c);
SMDS_MeshFace* face = myTool->AddFace(a, b, c);
meshDS->SetMeshElementOnShape(face, geomFaceID);
} else { // make quadrangle
}
else { // make quadrangle
if (near + 1 > jup)
d = uv_e2[1].node;
else
d = quad->uv_grid[nbhoriz*(near + 1) + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, b, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
if (near + 1 < g) { // if d not is at g - make additional triangles
@ -507,7 +538,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
d = uv_e2[1].node;
else
d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
//SMDS_MeshFace* face = meshDS->AddFace(a, c, d);
SMDS_MeshFace* face = myTool->AddFace(a, c, d);
meshDS->SetMeshElementOnShape(face, geomFaceID);
}
}
@ -518,6 +550,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
}
QuadDelete(quad);
delete myTool; myTool = 0;
bool isOk = true;
return isOk;
}
@ -557,7 +591,13 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if (nbEdges < 4) {
quad->edge[nbEdges] = E;
quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
if(!_quadraticMesh) {
quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
}
else {
int tmp = nb/2;
quad->nbPts[nbEdges] = tmp + 2; // internal not medium points + 2 extrema
}
}
nbEdges++;
}
@ -571,18 +611,21 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
return quad;
}
//=============================================================================
/*!
*
* CheckAnd2Dcompute
*/
//=============================================================================
FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) throw(SALOME_Exception)
(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool CreateQuadratic) throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
_quadraticMesh = CreateQuadratic;
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
if(!quad) return 0;
@ -1185,13 +1228,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref
for(j=1; j<nl; j++) {
if(WisF) {
SMDS_MeshFace* F =
meshDS->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
NodesL.Value(i+1,j+1), NodesL.Value(i,j+1));
meshDS->SetMeshElementOnShape(F, geomFaceID);
}
else {
SMDS_MeshFace* F =
meshDS->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1),
myTool->AddFace(NodesL.Value(i,j), NodesL.Value(i,j+1),
NodesL.Value(i+1,j+1), NodesL.Value(i+1,j));
meshDS->SetMeshElementOnShape(F, geomFaceID);
}
@ -1252,13 +1295,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref
for(j=1; j<nr; j++) {
if(WisF) {
SMDS_MeshFace* F =
meshDS->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
NodesR.Value(i+1,j+1), NodesR.Value(i,j+1));
meshDS->SetMeshElementOnShape(F, geomFaceID);
}
else {
SMDS_MeshFace* F =
meshDS->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1),
myTool->AddFace(NodesR.Value(i,j), NodesR.Value(i,j+1),
NodesR.Value(i+1,j+1), NodesR.Value(i+1,j));
meshDS->SetMeshElementOnShape(F, geomFaceID);
}
@ -1335,13 +1378,13 @@ bool StdMeshers_Quadrangle_2D::ComputeQuadPref
for(j=1; j<nbv; j++) {
if(WisF) {
SMDS_MeshFace* F =
meshDS->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
meshDS->SetMeshElementOnShape(F, geomFaceID);
}
else {
SMDS_MeshFace* F =
meshDS->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1),
myTool->AddFace(NodesC.Value(i,j), NodesC.Value(i,j+1),
NodesC.Value(i+1,j+1), NodesC.Value(i+1,j));
meshDS->SetMeshElementOnShape(F, geomFaceID);
}
@ -1389,16 +1432,47 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints2 (SMESH_Mesh & aMesh,
map<double, const SMDS_MeshNode *> params;
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
while(ite->more()) {
const SMDS_MeshNode* node = ite->next();
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double param = epos->GetUParameter();
params[param] = node;
if(!_quadraticMesh) {
while(ite->more()) {
const SMDS_MeshNode* node = ite->next();
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double param = epos->GetUParameter();
params[param] = node;
}
}
else {
vector<const SMDS_MeshNode*> nodes(nbPoints+2);
nodes[0] = idFirst;
nodes[nbPoints+1] = idLast;
nbPoints = nbPoints/2;
int nn = 1;
while(ite->more()) {
const SMDS_MeshNode* node = ite->next();
nodes[nn++] = node;
// check if node is medium
bool IsMedium = false;
SMDS_ElemIteratorPtr itn = node->GetInverseElementIterator();
while (itn->more()) {
const SMDS_MeshElement* elem = itn->next();
if ( elem->GetType() != SMDSAbs_Edge )
continue;
if(elem->IsMediumNode(node)) {
IsMedium = true;
break;
}
}
if(IsMedium)
continue;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double param = epos->GetUParameter();
params[param] = node;
}
}
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if (nbPoints != params.size()) {
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
return 0;
@ -1523,21 +1597,60 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
// --- edge internal IDNodes (relies on good order storage, not checked)
// if(_quadraticMesh) {
// fill myNLinkNodeMap
// SMDS_ElemIteratorPtr iter = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetElements();
// while(iter->more()) {
// const SMDS_MeshElement* elem = iter->next();
// SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
// const SMDS_MeshNode* n1 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
// const SMDS_MeshNode* n2 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
// const SMDS_MeshNode* n3 = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
// NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
// myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n3));
// myNLinkNodeMap[link] = n3;
// }
// }
map<double, const SMDS_MeshNode *> params;
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
while(ite->more())
{
const SMDS_MeshNode* node = ite->next();
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double param = epos->GetUParameter();
params[param] = node;
if(!_quadraticMesh) {
while(ite->more()) {
const SMDS_MeshNode* node = ite->next();
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double param = epos->GetUParameter();
params[param] = node;
}
}
else {
nbPoints = nbPoints/2;
while(ite->more()) {
const SMDS_MeshNode* node = ite->next();
// check if node is medium
bool IsMedium = false;
SMDS_ElemIteratorPtr itn = node->GetInverseElementIterator();
while (itn->more()) {
const SMDS_MeshElement* elem = itn->next();
if ( elem->GetType() != SMDSAbs_Edge )
continue;
if(elem->IsMediumNode(node)) {
IsMedium = true;
break;
}
}
if(IsMedium)
continue;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double param = epos->GetUParameter();
params[param] = node;
}
}
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
if (nbPoints != params.size())
{
if (nbPoints != params.size()) {
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
return 0;
}

View File

@ -34,7 +34,11 @@
#include "SMESH_Mesh.hxx"
#include "Utils_SALOME_Exception.hxx"
class SMDS_MeshNode;
#include "gp_XY.hxx"
#include "StdMeshers_Helper.hxx"
//class SMDS_MeshNode;
typedef struct uvPtStruct
{
@ -75,11 +79,17 @@ public:
throw (SALOME_Exception);
FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
const TopoDS_Shape& aShape,
const bool CreateQuadratic)
throw (SALOME_Exception);
static void QuadDelete(FaceQuadStruct* quad);
/**
* Returns NLinkNodeMap from myTool
*/
const NLinkNodeMap& GetNLinkNodeMap() { return myTool->GetNLinkNodeMap(); }
ostream & SaveTo(ostream & save);
istream & LoadFrom(istream & load);
friend ostream & operator << (ostream & save, StdMeshers_Quadrangle_2D & hyp);
@ -120,6 +130,8 @@ protected:
// construction of quadrangles if the number of nodes on opposite edges
// is not the same in the case where the global number of nodes on edges is even
bool myQuadranglePreference;
StdMeshers_Helper* myTool; // toll for working with quadratic elements
};
#endif

View File

@ -98,3 +98,14 @@ istream & operator >>(istream & load, StdMeshers_QuadraticMesh & hyp)
{
return hyp.LoadFrom( load );
}
//================================================================================
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \retval bool - false as this hypothesis does not have parameters values
*/
//================================================================================
bool StdMeshers_QuadraticMesh::SetParametersByMesh(const SMESH_Mesh*, const TopoDS_Shape&)
{
return false;
}

View File

@ -49,6 +49,17 @@ class StdMeshers_QuadraticMesh:public SMESH_Hypothesis
virtual std::istream & LoadFrom(std::istream & load);
friend std::ostream & operator <<(std::ostream & save, StdMeshers_QuadraticMesh & hyp);
friend std::istream & operator >>(std::istream & load, StdMeshers_QuadraticMesh & hyp);
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*
* Just return false as this hypothesis does not have parameters values
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
};
#endif

View File

@ -33,6 +33,8 @@ using namespace std;
#include "StdMeshers_Distribution.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_subMesh.hxx"
#include "StdMeshers_LocalLength.hxx"
#include "StdMeshers_NumberOfSegments.hxx"
@ -44,7 +46,6 @@ using namespace std;
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMESH_subMesh.hxx"
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
@ -90,6 +91,8 @@ StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
_compatibleHypothesis.push_back("Deflection1D");
_compatibleHypothesis.push_back("Arithmetic1D");
_compatibleHypothesis.push_back("AutomaticLength");
_compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!!
}
//=============================================================================
@ -109,22 +112,37 @@ StdMeshers_Regular_1D::~StdMeshers_Regular_1D()
//=============================================================================
bool StdMeshers_Regular_1D::CheckHypothesis
(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
_hypType = NONE;
_quadraticMesh = false;
const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
if (hyps.size() == 0)
const bool ignoreAuxiliaryHyps = false;
const list <const SMESHDS_Hypothesis * > & hyps =
GetUsedHypothesis(aMesh, aShape, ignoreAuxiliaryHyps);
// find non-auxiliary hypothesis
const SMESHDS_Hypothesis *theHyp = 0;
list <const SMESHDS_Hypothesis * >::const_iterator h = hyps.begin();
for ( ; h != hyps.end(); ++h ) {
if ( static_cast<const SMESH_Hypothesis*>(*h)->IsAuxiliary() ) {
if ( strcmp( "QuadraticMesh", (*h)->GetName() ) == 0 )
_quadraticMesh = true;
}
else {
if ( !theHyp )
theHyp = *h; // use only the first non-auxiliary hypothesis
}
}
if ( !theHyp )
{
aStatus = SMESH_Hypothesis::HYP_MISSING;
return false; // can't work without a hypothesis
}
// use only the first hypothesis
const SMESHDS_Hypothesis *theHyp = hyps.front();
string hypName = theHyp->GetName();
if (hypName == "LocalLength")
@ -538,15 +556,13 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
ASSERT(!VLast.IsNull());
lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
if (!lid->more())
{
if (!lid->more()) {
MESSAGE (" NO NODE BUILT ON VERTEX ");
return false;
}
const SMDS_MeshNode * idLast = lid->next();
if (!Curve.IsNull())
{
if (!Curve.IsNull()) {
list< double > params;
bool reversed = false;
if ( !_mainEdge.IsNull() )
@ -566,9 +582,14 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
// only internal nodes receive an edge position with param on curve
const SMDS_MeshNode * idPrev = idFirst;
double parPrev = f;
double parLast = l;
// if(reversed) {
// parPrev = l;
// parLast = f;
// }
for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++)
{
for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++) {
double param = *itU;
gp_Pnt P = Curve->Value(param);
@ -576,17 +597,39 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
meshDS->SetNodeOnEdge(node, shapeID, param);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
meshDS->SetMeshElementOnShape(edge, shapeID);
if(_quadraticMesh) {
// create medium node
double prm = ( parPrev + param )/2;
gp_Pnt PM = Curve->Value(prm);
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
meshDS->SetNodeOnEdge(NM, shapeID, prm);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
else {
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
idPrev = node;
parPrev = param;
}
if(_quadraticMesh) {
double prm = ( parPrev + parLast )/2;
gp_Pnt PM = Curve->Value(prm);
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
meshDS->SetNodeOnEdge(NM, shapeID, prm);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
else {
SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
SMDS_MeshEdge* edge = meshDS->AddEdge(idPrev, idLast);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
else
{
else {
// Edge is a degenerated Edge : We put n = 5 points on the edge.
int NbPoints = 5;
const int NbPoints = 5;
BRep_Tool::Range(E, f, l);
double du = (l - f) / (NbPoints - 1);
//MESSAGE("************* Degenerated edge! *****************");
@ -596,18 +639,38 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
gp_Pnt P = BRep_Tool::Pnt(V1);
const SMDS_MeshNode * idPrev = idFirst;
for (int i = 2; i < NbPoints; i++)
{
for (int i = 2; i < NbPoints; i++) {
double param = f + (i - 1) * du;
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
if(_quadraticMesh) {
// create medium node
double prm = param - du/2.;
gp_Pnt PM = Curve->Value(prm);
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
meshDS->SetNodeOnEdge(NM, shapeID, prm);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node, NM);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
else {
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
meshDS->SetNodeOnEdge(node, shapeID, param);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, node);
meshDS->SetMeshElementOnShape(edge, shapeID);
idPrev = node;
}
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
meshDS->SetMeshElementOnShape(edge, shapeID);
if(_quadraticMesh) {
// create medium node
double prm = l - du/2.;
gp_Pnt PM = Curve->Value(prm);
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
meshDS->SetNodeOnEdge(NM, shapeID, prm);
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast, NM);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
else {
SMDS_MeshEdge * edge = meshDS->AddEdge(idPrev, idLast);
meshDS->SetMeshElementOnShape(edge, shapeID);
}
}
return true;
}
@ -618,40 +681,47 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
*/
//=============================================================================
const list <const SMESHDS_Hypothesis *> & StdMeshers_Regular_1D::GetUsedHypothesis(
SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
const list <const SMESHDS_Hypothesis *> &
StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary)
{
_usedHypList.clear();
_usedHypList = GetAppliedHypothesis(aMesh, aShape); // copy
int nbHyp = _usedHypList.size();
_mainEdge.Nullify();
SMESH_HypoFilter auxiliaryFilter, compatibleFilter;
auxiliaryFilter.Init( SMESH_HypoFilter::IsAuxiliary() );
const bool ignoreAux = true;
InitCompatibleHypoFilter( compatibleFilter, ignoreAux );
// get non-auxiliary assigned to aShape
int nbHyp = aMesh.GetHypotheses( aShape, compatibleFilter, _usedHypList, false );
if (nbHyp == 0)
{
// Check, if propagated from some other edge
if (aShape.ShapeType() == TopAbs_EDGE &&
aMesh.IsPropagatedHypothesis(aShape, _mainEdge))
{
// Propagation of 1D hypothesis from <aMainEdge> on this edge
//_usedHypList = GetAppliedHypothesis(aMesh, _mainEdge); // copy
// use a general method in order not to nullify _mainEdge
_usedHypList = SMESH_Algo::GetUsedHypothesis(aMesh, _mainEdge); // copy
nbHyp = _usedHypList.size();
// Propagation of 1D hypothesis from <aMainEdge> on this edge;
// get non-auxiliary assigned to _mainEdge
nbHyp = aMesh.GetHypotheses( _mainEdge, compatibleFilter, _usedHypList, false );
}
}
if (nbHyp == 0)
if (nbHyp == 0) // nothing propagated nor assigned to aShape
{
TopTools_ListIteratorOfListOfShape ancIt( aMesh.GetAncestors( aShape ));
for (; ancIt.More(); ancIt.Next())
{
const TopoDS_Shape& ancestor = ancIt.Value();
_usedHypList = GetAppliedHypothesis(aMesh, ancestor); // copy
nbHyp = _usedHypList.size();
if (nbHyp == 1)
break;
}
SMESH_Algo::GetUsedHypothesis( aMesh, aShape, ignoreAuxiliary );
nbHyp = _usedHypList.size();
}
if (nbHyp > 1)
_usedHypList.clear(); //only one compatible hypothesis allowed
else
{
// get auxiliary hyps from aShape
aMesh.GetHypotheses( aShape, auxiliaryFilter, _usedHypList, true );
}
if ( nbHyp > 1 && ignoreAuxiliary )
_usedHypList.clear(); //only one compatible non-auxiliary hypothesis allowed
return _usedHypList;
}

View File

@ -49,7 +49,7 @@ public:
const TopoDS_Shape& aShape);
virtual const std::list <const SMESHDS_Hypothesis *> &
GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, const bool=true);
ostream & SaveTo(ostream & save);
istream & LoadFrom(istream & load);

View File

@ -80,10 +80,14 @@ msgstr "mesh_tree_algo_quad.png"
msgid "ICON_SMESH_TREE_HYPO_MaxElementArea"
msgstr "mesh_tree_hypo_area.png"
#mesh_tree_hypo_area
#mesh_tree_hypo_quadranglepreference
msgid "ICON_SMESH_TREE_HYPO_QuadranglePreference"
msgstr "mesh_tree_algo_quad.png"
#mesh_tree_hypo_quadraticmesh
msgid "ICON_SMESH_TREE_HYPO_QuadraticMesh"
msgstr "mesh_tree_hypo_length.png"
#mesh_tree_hypo_length
msgid "ICON_SMESH_TREE_HYPO_LocalLength"
msgstr "mesh_tree_hypo_length.png"

View File

@ -52,7 +52,8 @@ EXPORT_HEADERS = \
StdMeshers_MEFISTO_2D_i.hxx \
StdMeshers_Hexa_3D_i.hxx \
StdMeshers_AutomaticLength_i.hxx \
StdMeshers_QuadranglePreference_i.hxx
StdMeshers_QuadranglePreference_i.hxx \
StdMeshers_QuadraticMesh_i.hxx
# Libraries targets
@ -75,7 +76,8 @@ LIB_SRC = \
StdMeshers_MEFISTO_2D_i.cxx \
StdMeshers_Hexa_3D_i.cxx \
StdMeshers_AutomaticLength_i.cxx \
StdMeshers_QuadranglePreference_i.cxx
StdMeshers_QuadranglePreference_i.cxx \
StdMeshers_QuadraticMesh_i.cxx
LIB_SERVER_IDL = SMESH_BasicHypothesis.idl

View File

@ -39,6 +39,7 @@ using namespace std;
#include "StdMeshers_Propagation_i.hxx"
#include "StdMeshers_LengthFromEdges_i.hxx"
#include "StdMeshers_QuadranglePreference_i.hxx"
#include "StdMeshers_QuadraticMesh_i.hxx"
#include "StdMeshers_MaxElementArea_i.hxx"
#include "StdMeshers_MaxElementVolume_i.hxx"
#include "StdMeshers_NotConformAllowed_i.hxx"
@ -87,6 +88,8 @@ extern "C"
aCreator = new HypothesisCreator_i<StdMeshers_AutomaticLength_i>;
else if (strcmp(aHypName, "QuadranglePreference") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_QuadranglePreference_i>;
else if (strcmp(aHypName, "QuadraticMesh") == 0)
aCreator = new HypothesisCreator_i<StdMeshers_QuadraticMesh_i>;
// Algorithms
else if (strcmp(aHypName, "Regular_1D") == 0)