* Can be zero in case of LengthFromEdges()
*/
double GetMaxElementArea();
+
+ /*!
+ * Enables/disables generation of quadrangular faces
+ */
+ void SetAllowQuadrangles(in boolean toAllow);
+ /*!
+ * Returns true if generation of quadrangular faces is enabled
+ */
+ boolean GetAllowQuadrangles();
};
/*!
myLengthRadioBut(0),
myLenFromEdgesCheckBox(0),
myArea(0),
+ myAllowQuadCheckBox(0),
myLenFromFacesCheckBox(0),
myVolume(0)
{
dimLay->addWidget( myArea, dimRow, 1 );
dimRow++;
+ // * allow quadrangles
+ myAllowQuadCheckBox = new QCheckBox( tr( "NETGEN_ALLOW_QUADRANGLES" ), dimGroup );
+ dimLay->addWidget( myAllowQuadCheckBox, dimRow, 0, 1, 2 );
+ dimRow++;
+
// 3D params group
if ( hypType()=="NETGEN_SimpleParameters_3D" )
{
myLenFromEdgesCheckBox->setChecked( true );
myArea->setEnabled( false );
}
+ myAllowQuadCheckBox->setChecked( h->GetAllowQuadrangles() );
// 3D
if ( myVolume ) {
valStr += "; lenFromEdges";
aVariablesList.append(QString());
}
+ h->SetAllowQuadrangles( myAllowQuadCheckBox->isChecked() );
h->SetParameters(aVariablesList.join(":").toLatin1().constData());
QCheckBox* myLenFromEdgesCheckBox;
SMESHGUI_SpinBox* myArea;
+ QCheckBox* myAllowQuadCheckBox;
QCheckBox* myLenFromFacesCheckBox;
SMESHGUI_SpinBox* myVolume;
if( visitedEdges.Add(exp.Current()) )
edgeLength += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() ));
// we have to multiply length by 2 since for each TopoDS_Edge there
- // are double set of NETGEN edges or, in other words, we have to
+ // are double set of NETGEN edges, in other words, we have to
// divide ngMesh->GetNSeg() by 2.
mparams.maxh = 2*edgeLength / ngMesh->GetNSeg();
}
}
mparams.grading = 0.2; // slow size growth
}
+ mparams.quad = _simpleHyp->GetAllowQuadrangles();
mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
ngMesh->SetGlobalH (mparams.maxh);
netgen::Box<3> bb = occgeo.GetBoundingBox();
// Author : Michael Sazonov (OCN)
// Date : 20/03/2006
// Project : SALOME
-// $Header$
//=============================================================================
//
#include "NETGENPlugin_NETGEN_2D.hxx"
#ifdef WITH_SMESH_CANCEL_COMPUTE
netgen::multithread.terminate = 0;
#endif
- //SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
NETGENPlugin_Mesher mesher(&aMesh, aShape, false);
-// NETGENPlugin_Mesher mesher(meshDS, aShape, false);
mesher.SetParameters(dynamic_cast<const NETGENPlugin_Hypothesis*>(_hypothesis));
mesher.SetParameters(dynamic_cast<const NETGENPlugin_SimpleHypothesis_2D*>(_hypothesis));
return mesher.Compute();
_compatibleHypothesis.push_back("MaxElementArea");
_compatibleHypothesis.push_back("LengthFromEdges");
- _compatibleHypothesis.push_back("QuadranglePreference");
+ //_compatibleHypothesis.push_back("QuadranglePreference");
+ _compatibleHypothesis.push_back("QuadrangleParams"); /* QuadranglePreference was removed and
+ it is converted into QuadrangleParams
+ at reading an old study; so we use
+ QuadrangleParams insead of
+ QuadranglePreference for backward
+ compatibility
+ */
_compatibleHypothesis.push_back("NETGEN_Parameters_2D");
_hypMaxElementArea = 0;
_hypLengthFromEdges = static_cast<const StdMeshers_LengthFromEdges*> (hyp);
else if ( hypName == "NETGEN_Parameters_2D" )
_hypParameters = static_cast<const NETGENPlugin_Hypothesis_2D*>(hyp);
+ else if ( hypName == "QuadrangleParams" )
+ _hypQuadranglePreference = hyp;
else {
aStatus = HYP_INCOMPATIBLE;
return false;
class StdMeshers_MaxElementArea;
class StdMeshers_LengthFromEdges;
-class StdMeshers_QuadranglePreference;
class NETGENPlugin_Hypothesis_2D;
/*!
protected:
const StdMeshers_MaxElementArea* _hypMaxElementArea;
const StdMeshers_LengthFromEdges* _hypLengthFromEdges;
- const StdMeshers_QuadranglePreference* _hypQuadranglePreference;
+ const SMESHDS_Hypothesis* _hypQuadranglePreference;
const NETGENPlugin_Hypothesis_2D* _hypParameters;
};
: SMESH_Hypothesis(hypId, studyId, gen),
_nbSegments ((int)NETGENPlugin_Hypothesis::GetDefaultNbSegPerEdge()),
_segmentLength(0),
- _area (0.)
+ _area (0.),
+ _allowQuad (false)
{
_name = "NETGEN_SimpleParameters_2D";
_param_algo_dim = 2;
}
}
+//=======================================================================
+//function : SetAllowQuadrangles
+//purpose : Enables/disables generation of quadrangular faces
+//=======================================================================
+
+void NETGENPlugin_SimpleHypothesis_2D::SetAllowQuadrangles(bool toAllow)
+{
+ if ( _allowQuad != toAllow )
+ {
+ _allowQuad = toAllow;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=======================================================================
+//function : GetAllowQuadrangles
+//purpose : Returns true if generation of quadrangular faces is enabled
+//=======================================================================
+
+bool NETGENPlugin_SimpleHypothesis_2D::GetAllowQuadrangles() const
+{
+ return _allowQuad;
+}
+
//=============================================================================
/*!
*
//=============================================================================
ostream & NETGENPlugin_SimpleHypothesis_2D::SaveTo(ostream & save)
{
- save << _nbSegments << " " << _segmentLength << " " << _area;
+ save << _nbSegments << " " << _segmentLength << " " << _area << " " << _allowQuad;
return save;
}
else
load.clear(ios::badbit | load.rdstate());
+ load >> _allowQuad;
+
return load;
}
*/
double GetMaxElementArea() const { return _area; }
+ /*!
+ * Enables/disables generation of quadrangular faces
+ */
+ void SetAllowQuadrangles(bool toAllow);
+ /*!
+ * Returns true if generation of quadrangular faces is enabled
+ */
+ bool GetAllowQuadrangles() const;
+
// Persistence
virtual ostream & SaveTo(ostream & save);
virtual istream & LoadFrom(istream & load);
private:
int _nbSegments;
double _segmentLength, _area;
+ bool _allowQuad;
};
#endif
* NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea()
*/
//=============================================================================
+
CORBA::Double NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea()
{
MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea");
ASSERT(myBaseImpl);
return this->GetImpl()->GetMaxElementArea();
}
+
+//=============================================================================
+/*!
+ * Enables/disables generation of quadrangular faces
+ */
+//=============================================================================
+
+void NETGENPlugin_SimpleHypothesis_2D_i::SetAllowQuadrangles(CORBA::Boolean toAllow)
+{
+ ASSERT(myBaseImpl);
+ SMESH::TPythonDump() << _this() << ".SetAllowQuadrangles( " << toAllow << " )";
+ this->GetImpl()->SetAllowQuadrangles(toAllow);
+}
+
+//=============================================================================
+/*!
+ * Returns true if generation of quadrangular faces is enabled
+ */
+//=============================================================================
+
+CORBA::Boolean NETGENPlugin_SimpleHypothesis_2D_i::GetAllowQuadrangles()
+{
+ return this->GetImpl()->GetAllowQuadrangles();
+}
//=============================================================================
/*!
* NETGENPlugin_SimpleHypothesis_2D_i::GetImpl
//================================================================================
/*!
* \brief Verify whether hypothesis supports given entity type
- * \param type - dimension (see SMESH::Dimension enumeration)
- * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
- *
+ * \param type - dimension (see SMESH::Dimension enumeration)
+ * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
+ *
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
*/
//================================================================================
void SetMaxElementArea(CORBA::Double area);
CORBA::Double GetMaxElementArea();
+ void SetAllowQuadrangles(CORBA::Boolean toAllow);
+ CORBA::Boolean GetAllowQuadrangles();
// Get implementation
::NETGENPlugin_SimpleHypothesis_2D* GetImpl();