Add mesh parameters and Some fixes
This commit is contained in:
parent
8a28382848
commit
527a6f5562
BIN
data/examples/Fem2.FCStd
Normal file
BIN
data/examples/Fem2.FCStd
Normal file
Binary file not shown.
|
@ -38,6 +38,7 @@
|
||||||
#include <SMDS_VolumeTool.hxx>
|
#include <SMDS_VolumeTool.hxx>
|
||||||
|
|
||||||
#include <NETGENPlugin_SimpleHypothesis_3D.hxx>
|
#include <NETGENPlugin_SimpleHypothesis_3D.hxx>
|
||||||
|
#include <NETGENPlugin_Hypothesis.hxx>
|
||||||
#include <NETGENPlugin_Mesher.hxx>
|
#include <NETGENPlugin_Mesher.hxx>
|
||||||
|
|
||||||
#include <BRepBuilderAPI_Copy.hxx>
|
#include <BRepBuilderAPI_Copy.hxx>
|
||||||
|
@ -48,10 +49,19 @@ using namespace App;
|
||||||
|
|
||||||
PROPERTY_SOURCE(Fem::FemMeshShapeNetgenObject, Fem::FemMeshShapeObject)
|
PROPERTY_SOURCE(Fem::FemMeshShapeNetgenObject, Fem::FemMeshShapeObject)
|
||||||
|
|
||||||
|
const char* FininessEnums[]= {"VeryCoarse","Coarse","Moderate","Fine","VeryFine","UserDefined",NULL};
|
||||||
|
|
||||||
FemMeshShapeNetgenObject::FemMeshShapeNetgenObject()
|
FemMeshShapeNetgenObject::FemMeshShapeNetgenObject()
|
||||||
{
|
{
|
||||||
//ADD_PROPERTY_TYPE(Shape,(0), "Shape",Prop_None,"Shape for the analysis");
|
ADD_PROPERTY_TYPE(MaxSize,(1000), "MeshParams",Prop_None,"Maximum element size");
|
||||||
|
ADD_PROPERTY_TYPE(SecondOrder,(false), "MeshParams",Prop_None,"Create quadric elements");
|
||||||
|
ADD_PROPERTY_TYPE(Fininess,(2), "MeshParams",Prop_None,"Fininess level of the mesh");
|
||||||
|
Fininess.setEnums(FininessEnums);
|
||||||
|
ADD_PROPERTY_TYPE(GrothRate,(0.3), "MeshParams",Prop_None," allows to define how much the linear dimensions of two adjacent cells can differ");
|
||||||
|
ADD_PROPERTY_TYPE(NbSegsPerEdge,(1), "MeshParams",Prop_None,"allows to define the minimum number of mesh segments in which edges will be split");
|
||||||
|
ADD_PROPERTY_TYPE(NbSegsPerRadius,(2), "MeshParams",Prop_None,"allows to define the minimum number of mesh segments in which radiuses will be split");
|
||||||
|
ADD_PROPERTY_TYPE(Optimize,(true), "MeshParams",Prop_None,"Shape for the analysis");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FemMeshShapeNetgenObject::~FemMeshShapeNetgenObject()
|
FemMeshShapeNetgenObject::~FemMeshShapeNetgenObject()
|
||||||
|
@ -60,12 +70,19 @@ FemMeshShapeNetgenObject::~FemMeshShapeNetgenObject()
|
||||||
|
|
||||||
App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
|
App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
Fem::FemMesh newMesh;
|
Fem::FemMesh newMesh;
|
||||||
|
|
||||||
Part::Feature *feat = Shape.getValue<Part::Feature*>();
|
Part::Feature *feat = Shape.getValue<Part::Feature*>();
|
||||||
|
|
||||||
|
|
||||||
TopoDS_Shape shape = feat->Shape.getValue();
|
TopoDS_Shape shape = feat->Shape.getValue();
|
||||||
if(shape.IsNull())
|
|
||||||
return App::DocumentObject::StdReturn;
|
|
||||||
|
newMesh.getSMesh()->ShapeToMesh(shape);
|
||||||
|
SMESH_Gen *myGen = newMesh.getGenerator();
|
||||||
|
|
||||||
|
int hyp=0;
|
||||||
|
|
||||||
NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true);
|
NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true);
|
||||||
|
|
||||||
|
@ -80,9 +97,17 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute(void)
|
||||||
//static_cast<NETGENPlugin_SimpleHypothesis_3D*>(tet.get())->SetMaxElementVolume(0.1);
|
//static_cast<NETGENPlugin_SimpleHypothesis_3D*>(tet.get())->SetMaxElementVolume(0.1);
|
||||||
//myNetGenMesher.SetParameters( tet);
|
//myNetGenMesher.SetParameters( tet);
|
||||||
|
|
||||||
|
NETGENPlugin_Hypothesis* tet= new NETGENPlugin_Hypothesis(hyp++,1,myGen);
|
||||||
|
tet->SetMaxSize(MaxSize.getValue());
|
||||||
|
tet->SetSecondOrder(SecondOrder.getValue());
|
||||||
|
tet->SetOptimize(Optimize.getValue());
|
||||||
|
tet->SetFineness((NETGENPlugin_Hypothesis::Fineness)Fininess.getValue());
|
||||||
|
tet->SetGrowthRate(GrothRate.getValue());
|
||||||
|
tet->SetNbSegPerEdge(NbSegsPerEdge.getValue());
|
||||||
|
tet->SetNbSegPerRadius(NbSegsPerRadius.getValue());
|
||||||
|
myNetGenMesher.SetParameters( tet);
|
||||||
|
|
||||||
myNetGenMesher.Compute();
|
myNetGenMesher.Compute();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(newMesh.getSMesh())->GetMeshDS();
|
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(newMesh.getSMesh())->GetMeshDS();
|
||||||
const SMDS_MeshInfo& info = data->GetMeshInfo();
|
const SMDS_MeshInfo& info = data->GetMeshInfo();
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "FemMesh.h"
|
#include "FemMesh.h"
|
||||||
#include "FemMeshShapeObject.h"
|
#include "FemMeshShapeObject.h"
|
||||||
|
#include <App/PropertyStandard.h>
|
||||||
|
|
||||||
namespace Fem
|
namespace Fem
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,14 @@ public:
|
||||||
FemMeshShapeNetgenObject(void);
|
FemMeshShapeNetgenObject(void);
|
||||||
virtual ~FemMeshShapeNetgenObject();
|
virtual ~FemMeshShapeNetgenObject();
|
||||||
|
|
||||||
|
App::PropertyFloat MaxSize;
|
||||||
|
App::PropertyBool SecondOrder;
|
||||||
|
App::PropertyEnumeration Fininess;
|
||||||
|
App::PropertyFloat GrothRate;
|
||||||
|
App::PropertyInteger NbSegsPerEdge;
|
||||||
|
App::PropertyInteger NbSegsPerRadius;
|
||||||
|
App::PropertyBool Optimize;
|
||||||
|
|
||||||
/// returns the type name of the ViewProvider
|
/// returns the type name of the ViewProvider
|
||||||
virtual const char* getViewProviderName(void) const {
|
virtual const char* getViewProviderName(void) const {
|
||||||
return "FemGui::ViewProviderFemMeshShapeNetgen";
|
return "FemGui::ViewProviderFemMeshShapeNetgen";
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <Gui/Application.h>
|
#include <Gui/Application.h>
|
||||||
#include <Gui/Document.h>
|
#include <Gui/Document.h>
|
||||||
#include <Gui/Command.h>
|
#include <Gui/Command.h>
|
||||||
#include "ViewProviderFemMesh.h"
|
#include "ViewProviderFemMeshShapeNetgen.h"
|
||||||
|
|
||||||
#include <Mod/Fem/App/FemMeshShapeNetgenObject.h>
|
#include <Mod/Fem/App/FemMeshShapeNetgenObject.h>
|
||||||
#include "TaskTetParameter.h"
|
#include "TaskTetParameter.h"
|
||||||
|
@ -47,10 +47,11 @@ using namespace FemGui;
|
||||||
// TaskDialog
|
// TaskDialog
|
||||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
TaskDlgMeshShapeNetgen::TaskDlgMeshShapeNetgen(Fem::FemMeshShapeNetgenObject *obj)
|
TaskDlgMeshShapeNetgen::TaskDlgMeshShapeNetgen(FemGui::ViewProviderFemMeshShapeNetgen *obj)
|
||||||
: TaskDialog(),FemMeshShapeNetgenObject(obj)
|
: TaskDialog(),ViewProviderFemMeshShapeNetgen(obj)
|
||||||
{
|
{
|
||||||
param = new TaskTetParameter(obj);
|
FemMeshShapeNetgenObject = dynamic_cast<Fem::FemMeshShapeNetgenObject *>(obj->getObject());
|
||||||
|
param = new TaskTetParameter(FemMeshShapeNetgenObject);
|
||||||
|
|
||||||
Content.push_back(param);
|
Content.push_back(param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace Fem {
|
||||||
namespace FemGui {
|
namespace FemGui {
|
||||||
|
|
||||||
class TaskTetParameter;
|
class TaskTetParameter;
|
||||||
|
class ViewProviderFemMeshShapeNetgen;
|
||||||
|
|
||||||
/// simulation dialog for the TaskView
|
/// simulation dialog for the TaskView
|
||||||
class TaskDlgMeshShapeNetgen : public Gui::TaskView::TaskDialog
|
class TaskDlgMeshShapeNetgen : public Gui::TaskView::TaskDialog
|
||||||
|
@ -41,7 +42,7 @@ class TaskDlgMeshShapeNetgen : public Gui::TaskView::TaskDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskDlgMeshShapeNetgen(Fem::FemMeshShapeNetgenObject *);
|
TaskDlgMeshShapeNetgen(FemGui::ViewProviderFemMeshShapeNetgen *);
|
||||||
~TaskDlgMeshShapeNetgen();
|
~TaskDlgMeshShapeNetgen();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -61,7 +62,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
TaskTetParameter *param;
|
TaskTetParameter *param;
|
||||||
|
|
||||||
Fem::FemMeshShapeNetgenObject *FemMeshShapeNetgenObject;
|
Fem::FemMeshShapeNetgenObject *FemMeshShapeNetgenObject;
|
||||||
|
FemGui::ViewProviderFemMeshShapeNetgen *ViewProviderFemMeshShapeNetgen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ ViewProviderFemConstraintBearing::~ViewProviderFemConstraintBearing()
|
||||||
|
|
||||||
bool ViewProviderFemConstraintBearing::setEdit(int ModNum)
|
bool ViewProviderFemConstraintBearing::setEdit(int ModNum)
|
||||||
{
|
{
|
||||||
Base::Console().Error("ViewProviderFemConstraintBearing::setEdit()\n");
|
|
||||||
|
|
||||||
if (ModNum == ViewProvider::Default ) {
|
if (ModNum == ViewProvider::Default ) {
|
||||||
// When double-clicking on the item for this constraint the
|
// When double-clicking on the item for this constraint the
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ViewProviderFemMeshShapeNetgen.h"
|
#include "ViewProviderFemMeshShapeNetgen.h"
|
||||||
|
#include "TaskDlgMeshShapeNetgen.h"
|
||||||
|
|
||||||
|
#include "Gui/Control.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace FemGui;
|
using namespace FemGui;
|
||||||
|
@ -52,3 +54,24 @@ ViewProviderFemMeshShapeNetgen::~ViewProviderFemMeshShapeNetgen()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ViewProviderFemMeshShapeNetgen::setEdit(int ModNum)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (ModNum == ViewProvider::Default ) {
|
||||||
|
|
||||||
|
// clear the selection (convenience)
|
||||||
|
Gui::Selection().clearSelection();
|
||||||
|
|
||||||
|
Gui::Control().showDialog(new TaskDlgMeshShapeNetgen(this));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ViewProviderDocumentObject::setEdit(ModNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewProviderFemMeshShapeNetgen::updateData(const App::Property* prop)
|
||||||
|
{
|
||||||
|
ViewProviderFemMeshShape::updateData(prop);
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,10 @@ public:
|
||||||
/// destructor.
|
/// destructor.
|
||||||
~ViewProviderFemMeshShapeNetgen();
|
~ViewProviderFemMeshShapeNetgen();
|
||||||
|
|
||||||
|
virtual void updateData(const App::Property*);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool setEdit(int ModNum);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user