mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-15 18:41:26 +05:00
Delete usaged StdMeshers_Helper. Fix bug 11772
This commit is contained in:
parent
0e55a67f3c
commit
afa9c16791
@ -24,78 +24,47 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool StdMeshers_Helper::IsQuadraticSubMesh(const TopoDS_Shape& aSh,
|
||||
const bool QuadMode)
|
||||
bool StdMeshers_Helper::IsQuadraticSubMesh(const TopoDS_Shape& aSh)
|
||||
{
|
||||
SMESHDS_Mesh* meshDS = GetMesh()->GetMeshDS();
|
||||
myShapeID = meshDS->ShapeToIndex(aSh);
|
||||
myCreateQuadratic = false;
|
||||
if(QuadMode) {
|
||||
// we can create quadratic elements only if each elements
|
||||
// created on given shape is quadratic
|
||||
// also we have to fill myNLinkNodeMap
|
||||
myCreateQuadratic = true;
|
||||
if(aSh.ShapeType()!=TopAbs_FACE) {
|
||||
for (TopExp_Explorer exp(aSh, TopAbs_FACE); exp.More() && myCreateQuadratic; exp.Next()) {
|
||||
const TopoDS_Face& F = TopoDS::Face(exp.Current());
|
||||
SMDS_ElemIteratorPtr itf = GetMesh()->GetSubMesh(F)->GetSubMeshDS()->GetElements();
|
||||
while(itf->more()) {
|
||||
const SMDS_MeshElement* f = itf->next();
|
||||
if( f->GetType()==SMDSAbs_Face && !f->IsQuadratic() ) {
|
||||
myCreateQuadratic = false;
|
||||
break;
|
||||
}
|
||||
SMDS_ElemIteratorPtr itn = f->nodesIterator();
|
||||
if(f->NbNodes()==6) {
|
||||
const SMDS_MeshNode* Ns[6];
|
||||
int i = 0;
|
||||
while(itn->more()) {
|
||||
Ns[i++] = static_cast<const SMDS_MeshNode*>( itn->next() );
|
||||
}
|
||||
AddNLinkNode(Ns[0],Ns[1],Ns[3]);
|
||||
AddNLinkNode(Ns[1],Ns[2],Ns[4]);
|
||||
AddNLinkNode(Ns[2],Ns[0],Ns[5]);
|
||||
}
|
||||
else if(f->NbNodes()==8) {
|
||||
const SMDS_MeshNode* Ns[8];
|
||||
int i = 0;
|
||||
while(itn->more()) {
|
||||
Ns[i++] = static_cast<const SMDS_MeshNode*>( itn->next() );
|
||||
}
|
||||
AddNLinkNode(Ns[0],Ns[1],Ns[4]);
|
||||
AddNLinkNode(Ns[1],Ns[2],Ns[5]);
|
||||
AddNLinkNode(Ns[2],Ns[3],Ns[6]);
|
||||
AddNLinkNode(Ns[3],Ns[0],Ns[7]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
TopTools_MapOfShape aMap;
|
||||
// check edges
|
||||
const TopoDS_Face& F = TopoDS::Face(aSh);
|
||||
const TopoDS_Wire& W = BRepTools::OuterWire(F);
|
||||
BRepTools_WireExplorer wexp (W, F);
|
||||
for (wexp.Init(W, F); wexp.More() && myCreateQuadratic; wexp.Next()) {
|
||||
const TopoDS_Edge& E = wexp.Current();
|
||||
if(aMap.Contains(E))
|
||||
continue;
|
||||
aMap.Add(E);
|
||||
SMDS_ElemIteratorPtr it = GetMesh()->GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||
// we can create quadratic elements only if all elements
|
||||
// created on given shape are quadratic
|
||||
// also we have to fill myNLinkNodeMap
|
||||
myCreateQuadratic = true;
|
||||
TopAbs_ShapeEnum subType( aSh.ShapeType()==TopAbs_FACE ? TopAbs_EDGE : TopAbs_FACE );
|
||||
SMDSAbs_ElementType elemType( subType==TopAbs_FACE ? SMDSAbs_Face : SMDSAbs_Edge );
|
||||
|
||||
TopExp_Explorer exp( aSh, subType );
|
||||
for (; exp.More() && myCreateQuadratic; exp.Next()) {
|
||||
if ( SMESHDS_SubMesh * subMesh = meshDS->MeshElements( exp.Current() )) {
|
||||
if ( SMDS_ElemIteratorPtr it = subMesh->GetElements() ) {
|
||||
while(it->more()) {
|
||||
const SMDS_MeshElement* e = it->next();
|
||||
if( e->GetType()==SMDSAbs_Edge && !e->IsQuadratic() ) {
|
||||
if ( e->GetType() != elemType || !e->IsQuadratic() ) {
|
||||
myCreateQuadratic = false;
|
||||
break;
|
||||
}
|
||||
// fill NLinkNodeMap
|
||||
SMDS_ElemIteratorPtr nodeIt = e->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;
|
||||
else {
|
||||
// fill NLinkNodeMap
|
||||
switch ( e->NbNodes() ) {
|
||||
case 3:
|
||||
AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(2)); break;
|
||||
case 6:
|
||||
AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(3));
|
||||
AddNLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(4));
|
||||
AddNLinkNode(e->GetNode(2),e->GetNode(0),e->GetNode(5)); break;
|
||||
case 8:
|
||||
AddNLinkNode(e->GetNode(0),e->GetNode(1),e->GetNode(4));
|
||||
AddNLinkNode(e->GetNode(1),e->GetNode(2),e->GetNode(5));
|
||||
AddNLinkNode(e->GetNode(2),e->GetNode(3),e->GetNode(6));
|
||||
AddNLinkNode(e->GetNode(3),e->GetNode(0),e->GetNode(7));
|
||||
break;
|
||||
default:
|
||||
myCreateQuadratic = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,14 +83,18 @@ bool StdMeshers_Helper::IsQuadraticSubMesh(const TopoDS_Shape& aSh,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool StdMeshers_Helper::IsMedium(const SMDS_MeshNode* n)
|
||||
bool StdMeshers_Helper::IsMedium(const SMDS_MeshNode* node,
|
||||
const SMDSAbs_ElementType typeToCheck)
|
||||
{
|
||||
SMDS_ElemIteratorPtr it = n->GetInverseElementIterator();
|
||||
bool isMedium = false;
|
||||
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
|
||||
while (it->more()) {
|
||||
const SMDS_MeshElement* elem = it->next();
|
||||
return elem->IsMediumNode(n);
|
||||
isMedium = elem->IsMediumNode(node);
|
||||
if ( typeToCheck == SMDSAbs_All || elem->GetType() == typeToCheck )
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
return isMedium;
|
||||
}
|
||||
|
||||
|
||||
@ -136,12 +109,10 @@ void StdMeshers_Helper::AddNLinkNode(const SMDS_MeshNode* n1,
|
||||
const SMDS_MeshNode* n2,
|
||||
const SMDS_MeshNode* n12)
|
||||
{
|
||||
NLink link(( n1 < n2 ? n1 : n2 ), ( n1 < n2 ? n2 : n1 ));
|
||||
ItNLinkNode itLN = myNLinkNodeMap.find( link );
|
||||
if ( itLN == myNLinkNodeMap.end() ) {
|
||||
// add new record to map
|
||||
myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12));
|
||||
}
|
||||
NLink link( n1, n2 );
|
||||
if ( n1 > n2 ) link = NLink( n2, n1 );
|
||||
// add new record to map
|
||||
myNLinkNodeMap.insert( make_pair(link,n12));
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,8 +19,14 @@ typedef pair<const SMDS_MeshNode*, const SMDS_MeshNode*> NLink;
|
||||
typedef map<NLink, const SMDS_MeshNode*> NLinkNodeMap;
|
||||
typedef map<NLink, const SMDS_MeshNode*>::iterator ItNLinkNode;
|
||||
|
||||
/// Class StdMeshers_Helper
|
||||
//
|
||||
/*!
|
||||
* \brief It helps meshers to add elements
|
||||
*
|
||||
* It allow meshers not to care about creation of medium nodes
|
||||
* when filling a quadratic mesh. Helper does it itself.
|
||||
* It defines degree of elements to create when IsQuadraticSubMesh()
|
||||
* is called.
|
||||
*/
|
||||
|
||||
class StdMeshers_Helper
|
||||
{
|
||||
@ -42,17 +48,21 @@ class StdMeshers_Helper
|
||||
|
||||
/**
|
||||
* Check submesh for given shape
|
||||
* If QuadMode is true: check if all elements on this shape
|
||||
* Check if all elements on this shape
|
||||
* are quadratic, if yes => set true to myCreateQuadratic
|
||||
* (default value is false). Also fill myNLinkNodeMap
|
||||
* Returns myCreateQuadratic
|
||||
*/
|
||||
bool IsQuadraticSubMesh(const TopoDS_Shape& aSh, const bool QuadMode);
|
||||
bool IsQuadraticSubMesh(const TopoDS_Shape& theShape);
|
||||
|
||||
/**
|
||||
* Returns true if given node is medium
|
||||
/*!
|
||||
* \brief Returns true if given node is medium
|
||||
* \param n - node to check
|
||||
* \param typeToCheck - type of elements containing the node to ask about node status
|
||||
* \retval bool - check result
|
||||
*/
|
||||
bool IsMedium(const SMDS_MeshNode* n);
|
||||
static bool IsMedium(const SMDS_MeshNode* node,
|
||||
const SMDSAbs_ElementType typeToCheck = SMDSAbs_All);
|
||||
|
||||
/**
|
||||
* Auxilary function for filling myNLinkNodeMap
|
||||
|
@ -71,15 +71,14 @@ static bool ComputePentahedralMesh(SMESH_Mesh & aMesh, const TopoDS_Shape & aSha
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, int studyId,
|
||||
SMESH_Gen * gen):SMESH_3D_Algo(hypId, studyId, gen)
|
||||
SMESH_Gen * gen):SMESH_3D_Algo(hypId, studyId, gen)
|
||||
{
|
||||
MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D");
|
||||
_name = "Hexa_3D";
|
||||
// _shapeType = TopAbs_SOLID;
|
||||
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
|
||||
// MESSAGE("_shapeType octal " << oct << _shapeType);
|
||||
for (int i = 0; i < 6; i++)
|
||||
_quads[i] = 0;
|
||||
MESSAGE("StdMeshers_Hexa_3D::StdMeshers_Hexa_3D");
|
||||
_name = "Hexa_3D";
|
||||
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type
|
||||
for (int i = 0; i < 6; i++)
|
||||
_quads[i] = 0;
|
||||
myTool = 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -90,11 +89,29 @@ StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(int hypId, int studyId,
|
||||
|
||||
StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D()
|
||||
{
|
||||
MESSAGE("StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D");
|
||||
for (int i = 0; i < 6; i++)
|
||||
StdMeshers_Quadrangle_2D::QuadDelete(_quads[i]);
|
||||
MESSAGE("StdMeshers_Hexa_3D::~StdMeshers_Hexa_3D");
|
||||
ClearAndReturn(true);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Clear fields and return the argument
|
||||
* \param res - the value to return
|
||||
* \retval bool - the argument value
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool StdMeshers_Hexa_3D::ClearAndReturn(const bool res)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
StdMeshers_Quadrangle_2D::QuadDelete(_quads[i]);
|
||||
if ( myTool )
|
||||
delete myTool;
|
||||
myTool = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
@ -166,20 +183,12 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
MESSAGE("StdMeshers_Hexa_3D::Compute");
|
||||
//bool isOk = false;
|
||||
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||
//SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
|
||||
//const SMESHDS_SubMesh *& subMeshDS = theSubMesh->GetSubMeshDS();
|
||||
|
||||
// 0. - shape and face mesh verification
|
||||
// 0.1 - shape must be a solid (or a shell) with 6 faces
|
||||
//MESSAGE("---");
|
||||
|
||||
bool QuadMode = true;
|
||||
|
||||
myTool = new StdMeshers_Helper(aMesh);
|
||||
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||
|
||||
vector < SMESH_subMesh * >meshFaces;
|
||||
for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
SMESH_subMesh *aSubMesh = aMesh.GetSubMeshContaining(exp.Current());
|
||||
@ -188,13 +197,15 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||
}
|
||||
if (meshFaces.size() != 6) {
|
||||
SCRUTE(meshFaces.size());
|
||||
// ASSERT(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges)
|
||||
//MESSAGE("---");
|
||||
|
||||
myTool = new StdMeshers_Helper(aMesh);
|
||||
_quadraticMesh = myTool->IsQuadraticSubMesh(aShape);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
TopoDS_Shape aFace = meshFaces[i]->GetSubShape();
|
||||
SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace);
|
||||
@ -207,39 +218,23 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||
SMDS_ElemIteratorPtr eIt = sm->GetElements();
|
||||
while ( isAllQuad && eIt->more() ) {
|
||||
const SMDS_MeshElement* elem = eIt->next();
|
||||
isAllQuad = ( elem->NbNodes()==4 ||(myCreateQuadratic && elem->NbNodes()==8) );
|
||||
isAllQuad = ( elem->NbNodes()==4 ||(_quadraticMesh && elem->NbNodes()==8) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! isAllQuad ) {
|
||||
//modified by NIZNHY-PKV Wed Nov 17 15:31:37 2004 f
|
||||
bool bIsOk;
|
||||
//
|
||||
bIsOk = ComputePentahedralMesh(aMesh, aShape);
|
||||
if (bIsOk) {
|
||||
return true;
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Nov 17 15:31:42 2004 t
|
||||
SCRUTE(algoName);
|
||||
// ASSERT(0);
|
||||
return false;
|
||||
bool bIsOk = ComputePentahedralMesh(aMesh, aShape);
|
||||
return ClearAndReturn( bIsOk );
|
||||
}
|
||||
StdMeshers_Quadrangle_2D *quadAlgo =
|
||||
dynamic_cast < StdMeshers_Quadrangle_2D * >(algo);
|
||||
ASSERT(quadAlgo);
|
||||
try {
|
||||
_quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, myCreateQuadratic);
|
||||
// add links created in quadAlgo into myNLinkNodeMap
|
||||
// NLinkNodeMap aMap = quadAlgo->GetNLinkNodeMap();
|
||||
// myNLinkNodeMap.insert(aMap.begin(), aMap.end());
|
||||
myTool->AddNLinkNodeMap(quadAlgo->GetNLinkNodeMap());
|
||||
// *** to delete after usage
|
||||
_quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aFace, _quadraticMesh);
|
||||
}
|
||||
catch(SALOME_Exception & S_ex) {
|
||||
// *** delete _quads
|
||||
// *** throw exception
|
||||
// ASSERT(0);
|
||||
return false;
|
||||
return ClearAndReturn( false );
|
||||
}
|
||||
|
||||
// 0.2.1 - number of points on the opposite edges must be the same
|
||||
@ -247,7 +242,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||
_quads[i]->nbPts[1] != _quads[i]->nbPts[3]) {
|
||||
MESSAGE("different number of points on the opposite edges of face " << i);
|
||||
// ASSERT(0);
|
||||
return false;
|
||||
return ClearAndReturn( false );
|
||||
}
|
||||
}
|
||||
|
||||
@ -748,7 +743,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||
}
|
||||
if ( np ) delete [] np;
|
||||
//MESSAGE("End of StdMeshers_Hexa_3D::Compute()");
|
||||
return true;
|
||||
return ClearAndReturn( true );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -129,6 +129,8 @@ protected:
|
||||
Point3DStruct *np,
|
||||
const SMESHDS_Mesh* meshDS);
|
||||
|
||||
bool ClearAndReturn(const bool res);
|
||||
|
||||
CubeStruct _cube;
|
||||
FaceQuadStruct* _quads[6];
|
||||
int _indX0;
|
||||
|
@ -72,19 +72,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 +95,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");
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -220,15 +220,15 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
int iw = 1;
|
||||
int nbpnt = 0;
|
||||
|
||||
bool QuadMode = true;
|
||||
|
||||
myTool = new StdMeshers_Helper(aMesh);
|
||||
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||
_quadraticMesh = myTool->IsQuadraticSubMesh(aShape);
|
||||
|
||||
myOuterWire = BRepTools::OuterWire(F);
|
||||
nbpnt += NumberOfPoints(aMesh, myOuterWire);
|
||||
if ( nbpnt < 3 ) // ex: a circle with 2 segments
|
||||
if ( nbpnt < 3 ) { // ex: a circle with 2 segments
|
||||
delete myTool; myTool = 0;
|
||||
return false;
|
||||
}
|
||||
nudslf[iw++] = nbpnt;
|
||||
|
||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next()) {
|
||||
@ -252,47 +252,53 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
|
||||
map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
|
||||
if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
|
||||
mefistoToDS, scalex, scaley, VWMap) )
|
||||
mefistoToDS, scalex, scaley, VWMap) ) {
|
||||
delete myTool; myTool = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uvst = NULL;
|
||||
nust = NULL;
|
||||
aptrte(nutysu, aretmx,
|
||||
nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
|
||||
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;
|
||||
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;
|
||||
|
||||
return isOk;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -422,22 +428,9 @@ static bool fixCommonVertexUV (gp_Pnt2d & theUV,
|
||||
else {
|
||||
while ( nIt->more() ) {
|
||||
const SMDS_MeshNode* node = nIt->next();
|
||||
if(CreateQuadratic) {
|
||||
// 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;
|
||||
}
|
||||
// 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();
|
||||
@ -530,24 +523,9 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
||||
}
|
||||
const SMDS_MeshNode* idLast = lid->next();
|
||||
|
||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||
|
||||
// if(myCreateQuadratic) {
|
||||
// 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;
|
||||
// }
|
||||
// }
|
||||
|
||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||
if ( _quadraticMesh )
|
||||
nbPoints /= 2;
|
||||
|
||||
double f, l;
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
|
||||
@ -557,38 +535,14 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
||||
//bool isForward = (E.Orientation() == TopAbs_FORWARD);
|
||||
map<double, const SMDS_MeshNode*> params;
|
||||
|
||||
if(!myCreateQuadratic) {
|
||||
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;
|
||||
}
|
||||
while(ite->more()) {
|
||||
const SMDS_MeshNode * node = ite->next();
|
||||
if ( _quadraticMesh && StdMeshers_Helper::IsMedium( node, SMDSAbs_Edge ))
|
||||
continue;
|
||||
const SMDS_EdgePosition* epos =
|
||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||
double param = epos->GetUParameter();
|
||||
params[param] = node;
|
||||
}
|
||||
|
||||
if ( nbPoints != params.size()) {
|
||||
@ -602,13 +556,13 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
||||
// add IDNodes in mefistoToDS map
|
||||
if (E.Orientation() == TopAbs_FORWARD) {
|
||||
gp_Pnt2d p = C2d->Value(f).XY().Multiplied( scale ); // first point = Vertex Forward
|
||||
if ( fixCommonVertexUV( p, VFirst, W, myOuterWire, F, VWMap, aMesh, myCreateQuadratic ))
|
||||
if ( fixCommonVertexUV( p, VFirst, W, myOuterWire, F, VWMap, aMesh, _quadraticMesh ))
|
||||
myNodesOnCommonV.push_back( idFirst );
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = idFirst;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
// MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
|
||||
for (int i = 1; i <= nbPoints; i++) { // nbPoints internal
|
||||
@ -617,21 +571,21 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = (*itp).second;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
itp++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gp_Pnt2d p = C2d->Value(l).XY().Multiplied( scale ); // last point = Vertex Reversed
|
||||
if ( fixCommonVertexUV( p, VLast, W, myOuterWire, F, VWMap, aMesh, myCreateQuadratic ))
|
||||
if ( fixCommonVertexUV( p, VLast, W, myOuterWire, F, VWMap, aMesh, _quadraticMesh ))
|
||||
myNodesOnCommonV.push_back( idLast );
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = idLast;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
// MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
map<double, const SMDS_MeshNode*>::reverse_iterator itp = params.rbegin();
|
||||
for (int i = nbPoints; i >= 1; i--)
|
||||
@ -641,23 +595,27 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = (*itp).second;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
// MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
// MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
itp++;
|
||||
}
|
||||
}
|
||||
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
/// !!!!!!! HERE IS A BUG with fixOverlappedLinkUV !!!!!!!!!!!
|
||||
// !!!!!!! Correct version is in the CVS head !!!!!!!!!!
|
||||
/// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// prevent failure on overlapped adjacent links
|
||||
if ( iEdge > 0 )
|
||||
fixOverlappedLinkUV (uvslf[ mFirst - 1],
|
||||
uvslf[ mFirst ],
|
||||
uvslf[ mFirst + 1 ]);
|
||||
// if ( iEdge > 0 )
|
||||
// fixOverlappedLinkUV (uvslf[ mFirst - 1],
|
||||
// uvslf[ mFirst ],
|
||||
// uvslf[ mFirst + 1 ]);
|
||||
|
||||
} // for wexp
|
||||
|
||||
fixOverlappedLinkUV (uvslf[ m - 1],
|
||||
uvslf[ mInit ],
|
||||
uvslf[ mInit + 1 ]);
|
||||
// fixOverlappedLinkUV (uvslf[ m - 1],
|
||||
// uvslf[ mInit ],
|
||||
// uvslf[ mInit + 1 ]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -859,17 +817,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();
|
||||
@ -877,7 +832,6 @@ double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
|
||||
wireLength += length;
|
||||
wireElementsNumber += nb;
|
||||
}
|
||||
}
|
||||
if (wireElementsNumber)
|
||||
meanElementLength = wireLength / wireElementsNumber;
|
||||
//SCRUTE(meanElementLength);
|
||||
|
@ -73,8 +73,19 @@ 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
|
||||
@ -97,24 +108,25 @@ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
|
||||
return bOK;
|
||||
}
|
||||
|
||||
bool QuadMode = true;
|
||||
|
||||
myTool = new StdMeshers_Helper(aMesh);
|
||||
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape);
|
||||
|
||||
//
|
||||
MakeBlock();
|
||||
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;
|
||||
}
|
||||
//
|
||||
@ -122,11 +134,13 @@ bool StdMeshers_Penta_3D::Compute(SMESH_Mesh& aMesh,
|
||||
//
|
||||
MakeMeshOnFxy1();
|
||||
if (myErrorStatus) {
|
||||
delete myTool; myTool = 0;
|
||||
return bOK;
|
||||
}
|
||||
//
|
||||
MakeVolumeMesh();
|
||||
//
|
||||
delete myTool; myTool = 0;
|
||||
return !bOK;
|
||||
}
|
||||
|
||||
|
@ -168,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& );
|
||||
|
||||
|
@ -38,7 +38,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
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -81,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;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -92,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;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -129,16 +132,17 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
||||
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||
aMesh.GetSubMesh(aShape);
|
||||
|
||||
bool QuadMode = true;
|
||||
|
||||
myTool = new StdMeshers_Helper(aMesh);
|
||||
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||
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];
|
||||
@ -150,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
|
||||
|
||||
@ -542,6 +550,8 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
|
||||
}
|
||||
|
||||
QuadDelete(quad);
|
||||
delete myTool; myTool = 0;
|
||||
|
||||
bool isOk = true;
|
||||
return isOk;
|
||||
}
|
||||
@ -581,7 +591,7 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMesh,
|
||||
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||
if (nbEdges < 4) {
|
||||
quad->edge[nbEdges] = E;
|
||||
if(!myCreateQuadratic) {
|
||||
if(!_quadraticMesh) {
|
||||
quad->nbPts[nbEdges] = nb + 2; // internal points + 2 extrema
|
||||
}
|
||||
else {
|
||||
@ -601,23 +611,6 @@ 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)
|
||||
{
|
||||
bool QuadMode = true;
|
||||
myTool = new StdMeshers_Helper(aMesh);
|
||||
myCreateQuadratic = myTool->IsQuadraticSubMesh(aShape,QuadMode);
|
||||
return CheckAnd2Dcompute(aMesh,aShape,myCreateQuadratic);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* CheckAnd2Dcompute
|
||||
@ -631,7 +624,7 @@ FaceQuadStruct *StdMeshers_Quadrangle_2D::CheckAnd2Dcompute
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
|
||||
myCreateQuadratic = CreateQuadratic;
|
||||
_quadraticMesh = CreateQuadratic;
|
||||
|
||||
FaceQuadStruct *quad = CheckNbEdges(aMesh, aShape);
|
||||
|
||||
@ -1437,7 +1430,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints2 (SMESH_Mesh & aMesh,
|
||||
|
||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||
|
||||
// if(myCreateQuadratic) {
|
||||
// if(_quadraticMesh) {
|
||||
// fill myNLinkNodeMap
|
||||
// SMDS_ElemIteratorPtr iter = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||
// while(iter->more()) {
|
||||
@ -1456,7 +1449,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints2 (SMESH_Mesh & aMesh,
|
||||
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||
|
||||
if(!myCreateQuadratic) {
|
||||
if(!_quadraticMesh) {
|
||||
while(ite->more()) {
|
||||
const SMDS_MeshNode* node = ite->next();
|
||||
const SMDS_EdgePosition* epos =
|
||||
@ -1619,7 +1612,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
|
||||
|
||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||
|
||||
// if(myCreateQuadratic) {
|
||||
// if(_quadraticMesh) {
|
||||
// fill myNLinkNodeMap
|
||||
// SMDS_ElemIteratorPtr iter = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetElements();
|
||||
// while(iter->more()) {
|
||||
@ -1638,7 +1631,7 @@ UVPtStruct* StdMeshers_Quadrangle_2D::LoadEdgePoints (SMESH_Mesh & aMesh,
|
||||
SMDS_NodeIteratorPtr ite = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||
|
||||
if(!myCreateQuadratic) {
|
||||
if(!_quadraticMesh) {
|
||||
while(ite->more()) {
|
||||
const SMDS_MeshNode* node = ite->next();
|
||||
const SMDS_EdgePosition* epos =
|
||||
|
@ -78,10 +78,6 @@ public:
|
||||
const TopoDS_Shape& aShape)
|
||||
throw (SALOME_Exception);
|
||||
|
||||
FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape)
|
||||
throw (SALOME_Exception);
|
||||
|
||||
FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape,
|
||||
const bool CreateQuadratic)
|
||||
|
@ -42,10 +42,7 @@ StdMeshers_QuadraticMesh::StdMeshers_QuadraticMesh(int hypId,
|
||||
:SMESH_Hypothesis(hypId, studyId, gen)
|
||||
{
|
||||
_name = "QuadraticMesh";
|
||||
// only one hypo of the same dim can be assigned to the shape so
|
||||
// we use -3 in order to distingush from any usual 1D hypothsis and
|
||||
// from "NotConformAllowed" (-1) and "Propagation" (-2)
|
||||
_param_algo_dim = -3;
|
||||
_param_algo_dim = -1; // it means auxiliary, dim = 1
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -90,6 +90,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 +111,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")
|
||||
@ -508,10 +525,6 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||
aMesh.GetSubMesh(aShape);
|
||||
|
||||
// quardatic mesh required?
|
||||
SMESH_HypoFilter filter( SMESH_HypoFilter::HasName( "QuadraticMesh" ));
|
||||
bool QuadMode = aMesh.GetHypothesis( aShape, filter, true );
|
||||
|
||||
const TopoDS_Edge & EE = TopoDS::Edge(aShape);
|
||||
TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
|
||||
int shapeID = meshDS->ShapeToIndex( E );
|
||||
@ -558,10 +571,10 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
const SMDS_MeshNode * idPrev = idFirst;
|
||||
double parPrev = f;
|
||||
double parLast = l;
|
||||
if(reversed) {
|
||||
parPrev = l;
|
||||
parLast = f;
|
||||
}
|
||||
// if(reversed) {
|
||||
// parPrev = l;
|
||||
// parLast = f;
|
||||
// }
|
||||
|
||||
for (list<double>::iterator itU = params.begin(); itU != params.end(); itU++) {
|
||||
double param = *itU;
|
||||
@ -571,7 +584,7 @@ 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);
|
||||
|
||||
if(QuadMode) {
|
||||
if(_quadraticMesh) {
|
||||
// create medium node
|
||||
double prm = ( parPrev + param )/2;
|
||||
gp_Pnt PM = Curve->Value(prm);
|
||||
@ -588,7 +601,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
idPrev = node;
|
||||
parPrev = param;
|
||||
}
|
||||
if(QuadMode) {
|
||||
if(_quadraticMesh) {
|
||||
double prm = ( parPrev + parLast )/2;
|
||||
gp_Pnt PM = Curve->Value(prm);
|
||||
SMDS_MeshNode * NM = meshDS->AddNode(PM.X(), PM.Y(), PM.Z());
|
||||
@ -603,7 +616,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
}
|
||||
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! *****************");
|
||||
@ -616,7 +629,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
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(QuadMode) {
|
||||
if(_quadraticMesh) {
|
||||
// create medium node
|
||||
double prm = param - du/2.;
|
||||
gp_Pnt PM = Curve->Value(prm);
|
||||
@ -632,7 +645,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
|
||||
meshDS->SetNodeOnEdge(node, shapeID, param);
|
||||
idPrev = node;
|
||||
}
|
||||
if(QuadMode) {
|
||||
if(_quadraticMesh) {
|
||||
// create medium node
|
||||
double prm = l - du/2.;
|
||||
gp_Pnt PM = Curve->Value(prm);
|
||||
@ -655,40 +668,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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user