more info on meshing and recalculation only if needed
This commit is contained in:
parent
adfe1321a5
commit
08e2cf1e40
|
@ -890,3 +890,25 @@ Data::Segment* FemMesh::getSubElement(const char* Type, unsigned long n) const
|
||||||
//return new ShapeSegment(getSubShape(temp.c_str()));
|
//return new ShapeSegment(getSubShape(temp.c_str()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo(void) const{
|
||||||
|
|
||||||
|
struct FemMeshInfo rtrn;
|
||||||
|
|
||||||
|
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(getSMesh())->GetMeshDS();
|
||||||
|
const SMDS_MeshInfo& info = data->GetMeshInfo();
|
||||||
|
rtrn.numFaces = data->NbFaces();
|
||||||
|
rtrn.numNode = info.NbNodes();
|
||||||
|
rtrn.numTria = info.NbTriangles();
|
||||||
|
rtrn.numQuad = info.NbQuadrangles();
|
||||||
|
rtrn.numPoly = info.NbPolygons();
|
||||||
|
rtrn.numVolu = info.NbVolumes();
|
||||||
|
rtrn.numTetr = info.NbTetras();
|
||||||
|
rtrn.numHexa = info.NbHexas();
|
||||||
|
rtrn.numPyrd = info.NbPyramids();
|
||||||
|
rtrn.numPris = info.NbPrisms();
|
||||||
|
rtrn.numHedr = info.NbPolyhedrons();
|
||||||
|
|
||||||
|
return rtrn;
|
||||||
|
|
||||||
|
}
|
|
@ -104,6 +104,23 @@ public:
|
||||||
void transformGeometry(const Base::Matrix4D &rclMat);
|
void transformGeometry(const Base::Matrix4D &rclMat);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
struct FemMeshInfo {
|
||||||
|
int numFaces;
|
||||||
|
int numNode;
|
||||||
|
int numTria;
|
||||||
|
int numQuad;
|
||||||
|
int numPoly;
|
||||||
|
int numVolu;
|
||||||
|
int numTetr;
|
||||||
|
int numHexa;
|
||||||
|
int numPyrd;
|
||||||
|
int numPris;
|
||||||
|
int numHedr;
|
||||||
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
struct FemMeshInfo getInfo(void) const;
|
||||||
|
|
||||||
/// import from files
|
/// import from files
|
||||||
void read(const char *FileName);
|
void read(const char *FileName);
|
||||||
void write(const char *FileName) const;
|
void write(const char *FileName) const;
|
||||||
|
|
|
@ -77,11 +77,13 @@ void TaskDlgMeshShapeNetgen::open()
|
||||||
void TaskDlgMeshShapeNetgen::clicked(int button)
|
void TaskDlgMeshShapeNetgen::clicked(int button)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if(QDialogButtonBox::Apply == button)
|
if(QDialogButtonBox::Apply == button && param->touched)
|
||||||
{
|
{
|
||||||
Gui::WaitCursor wc;
|
Gui::WaitCursor wc;
|
||||||
// May throw an exception which we must handle here
|
// May throw an exception which we must handle here
|
||||||
FemMeshShapeNetgenObject->execute();
|
FemMeshShapeNetgenObject->execute();
|
||||||
|
param->setInfo();
|
||||||
|
param->touched = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const Base::Exception& e) {
|
catch (const Base::Exception& e) {
|
||||||
|
@ -92,8 +94,11 @@ void TaskDlgMeshShapeNetgen::clicked(int button)
|
||||||
bool TaskDlgMeshShapeNetgen::accept()
|
bool TaskDlgMeshShapeNetgen::accept()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Gui::WaitCursor wc;
|
if(param->touched)
|
||||||
FemMeshShapeNetgenObject->recompute();
|
{
|
||||||
|
Gui::WaitCursor wc;
|
||||||
|
FemMeshShapeNetgenObject->recompute();
|
||||||
|
}
|
||||||
//FemSetNodesObject->Label.setValue(name->name);
|
//FemSetNodesObject->Label.setValue(name->name);
|
||||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <Gui/View3DInventorViewer.h>
|
#include <Gui/View3DInventorViewer.h>
|
||||||
#include <Gui/Utilities.h>
|
#include <Gui/Utilities.h>
|
||||||
#include <Mod/Fem/App/FemMeshShapeNetgenObject.h>
|
#include <Mod/Fem/App/FemMeshShapeNetgenObject.h>
|
||||||
|
#include <Mod/Fem/App/FemMesh.h>
|
||||||
|
|
||||||
|
|
||||||
using namespace FemGui;
|
using namespace FemGui;
|
||||||
|
@ -77,6 +78,12 @@ TaskTetParameter::TaskTetParameter(Fem::FemMeshShapeNetgenObject *pcObject,QWidg
|
||||||
QObject::connect(ui->spinBox_SegsPerRadius,SIGNAL(valueChanged (int)),this,SLOT(setSegsPerRadius(int)));
|
QObject::connect(ui->spinBox_SegsPerRadius,SIGNAL(valueChanged (int)),this,SLOT(setSegsPerRadius(int)));
|
||||||
QObject::connect(ui->checkBox_Optimize,SIGNAL(stateChanged (int)),this,SLOT(setOptimize(int)));
|
QObject::connect(ui->checkBox_Optimize,SIGNAL(stateChanged (int)),this,SLOT(setOptimize(int)));
|
||||||
|
|
||||||
|
if(pcObject->FemMesh.getValue().getInfo().numNode == 0)
|
||||||
|
touched = true;
|
||||||
|
else
|
||||||
|
touched = false;
|
||||||
|
|
||||||
|
setInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskTetParameter::~TaskTetParameter()
|
TaskTetParameter::~TaskTetParameter()
|
||||||
|
@ -97,45 +104,64 @@ void TaskTetParameter::SwitchMethod(int Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
pcObject->Fininess.setValue(Value);
|
pcObject->Fininess.setValue(Value);
|
||||||
|
touched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskTetParameter::maxSizeValueChanged(double Value)
|
void TaskTetParameter::maxSizeValueChanged(double Value)
|
||||||
{
|
{
|
||||||
pcObject->MaxSize.setValue(Value);
|
pcObject->MaxSize.setValue(Value);
|
||||||
|
touched = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskTetParameter::setQuadric(int s)
|
void TaskTetParameter::setQuadric(int s)
|
||||||
{
|
{
|
||||||
pcObject->SecondOrder.setValue(s!=0);
|
pcObject->SecondOrder.setValue(s!=0);
|
||||||
|
touched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskTetParameter::setGrothRate(double v)
|
void TaskTetParameter::setGrothRate(double v)
|
||||||
{
|
{
|
||||||
pcObject->GrothRate.setValue(v);
|
pcObject->GrothRate.setValue(v);
|
||||||
|
touched = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskTetParameter::setSegsPerEdge(int v)
|
void TaskTetParameter::setSegsPerEdge(int v)
|
||||||
{
|
{
|
||||||
pcObject->NbSegsPerEdge.setValue(v);
|
pcObject->NbSegsPerEdge.setValue(v);
|
||||||
|
touched = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskTetParameter::setSegsPerRadius(int v)
|
void TaskTetParameter::setSegsPerRadius(int v)
|
||||||
{
|
{
|
||||||
pcObject->NbSegsPerRadius.setValue(v);
|
pcObject->NbSegsPerRadius.setValue(v);
|
||||||
|
touched = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskTetParameter::setOptimize(int v)
|
void TaskTetParameter::setOptimize(int v)
|
||||||
{
|
{
|
||||||
pcObject->Optimize.setValue(v!=0);
|
pcObject->Optimize.setValue(v!=0);
|
||||||
|
touched = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TaskTetParameter::setInfo(void)
|
||||||
|
{
|
||||||
|
Fem::FemMesh::FemMeshInfo info = pcObject->FemMesh.getValue().getInfo();
|
||||||
|
//Base::BoundBox3d bndBox = pcObject->FemMesh.getValue().getBoundBox();
|
||||||
|
|
||||||
|
|
||||||
|
ui->lineEdit_InfoNodes ->setText(QString::number(info.numNode));
|
||||||
|
ui->lineEdit_InfoTriangle ->setText(QString::number(info.numFaces));
|
||||||
|
ui->lineEdit_InfoTet ->setText(QString::number(info.numTetr));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_TaskTetParameter.cpp"
|
#include "moc_TaskTetParameter.cpp"
|
||||||
|
|
|
@ -59,6 +59,9 @@ public:
|
||||||
~TaskTetParameter();
|
~TaskTetParameter();
|
||||||
|
|
||||||
ViewProviderFemMeshShapeNetgen * MeshViewProvider;
|
ViewProviderFemMeshShapeNetgen * MeshViewProvider;
|
||||||
|
void setInfo(void);
|
||||||
|
|
||||||
|
bool touched;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void SwitchMethod(int Value);
|
void SwitchMethod(int Value);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>221</width>
|
<width>221</width>
|
||||||
<height>196</height>
|
<height>311</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -148,6 +148,62 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Node count: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_InfoNodes">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Triangle count:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_InfoTriangle">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tetraeder count:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_InfoTet">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user