FEM: Use std::numeric_limits and std::numbers instead of defines
This commit is contained in:
@@ -75,7 +75,10 @@ using Adaptor3d_HSurface = Adaptor3d_Surface;
|
||||
using BRepAdaptor_HSurface = BRepAdaptor_Surface;
|
||||
#endif
|
||||
|
||||
static const App::PropertyFloatConstraint::Constraints scaleConstraint = {0.0, DBL_MAX, 0.1};
|
||||
static const App::PropertyFloatConstraint::Constraints scaleConstraint = {
|
||||
0.0,
|
||||
std::numeric_limits<double>::max(),
|
||||
0.1};
|
||||
|
||||
PROPERTY_SOURCE(Fem::Constraint, App::DocumentObject)
|
||||
|
||||
|
||||
@@ -116,12 +116,14 @@ namespace
|
||||
|
||||
Base::Rotation anglesToRotation(double xAngle, double yAngle, double zAngle)
|
||||
{
|
||||
using std::numbers::pi;
|
||||
|
||||
static Base::Vector3d a(1, 0, 0);
|
||||
static Base::Vector3d b(0, 1, 0);
|
||||
static int count = 0;
|
||||
double xRad = xAngle * D_PI / 180.0;
|
||||
double yRad = yAngle * D_PI / 180.0;
|
||||
double zRad = zAngle * D_PI / 180.0;
|
||||
double xRad = xAngle * pi / 180.0;
|
||||
double yRad = yAngle * pi / 180.0;
|
||||
double zRad = zAngle * pi / 180.0;
|
||||
if (xAngle != 0) {
|
||||
a[1] = 0;
|
||||
a[2] = 0;
|
||||
|
||||
@@ -43,8 +43,8 @@ DlgSettingsFemCcxImp::DlgSettingsFemCcxImp(QWidget* parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// set ranges
|
||||
ui->dsb_ccx_analysis_time->setMaximum(FLOAT_MAX);
|
||||
ui->dsb_ccx_initial_time_step->setMaximum(FLOAT_MAX);
|
||||
ui->dsb_ccx_analysis_time->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->dsb_ccx_initial_time_step->setMaximum(std::numeric_limits<float>::max());
|
||||
|
||||
connect(ui->fc_ccx_binary_path,
|
||||
&Gui::PrefFileChooser::fileNameChanged,
|
||||
|
||||
@@ -66,18 +66,19 @@ TaskFemConstraintBearing::TaskFemConstraintBearing(ViewProviderFemConstraint* Co
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
// setup ranges
|
||||
ui->spinDiameter->setMinimum(-FLOAT_MAX);
|
||||
ui->spinDiameter->setMaximum(FLOAT_MAX);
|
||||
ui->spinOtherDiameter->setMinimum(-FLOAT_MAX);
|
||||
ui->spinOtherDiameter->setMaximum(FLOAT_MAX);
|
||||
ui->spinCenterDistance->setMinimum(-FLOAT_MAX);
|
||||
ui->spinCenterDistance->setMaximum(FLOAT_MAX);
|
||||
ui->spinForce->setMinimum(-FLOAT_MAX);
|
||||
ui->spinForce->setMaximum(FLOAT_MAX);
|
||||
ui->spinTensionForce->setMinimum(-FLOAT_MAX);
|
||||
ui->spinTensionForce->setMaximum(FLOAT_MAX);
|
||||
ui->spinDistance->setMinimum(-FLOAT_MAX);
|
||||
ui->spinDistance->setMaximum(FLOAT_MAX);
|
||||
constexpr float max = std::numeric_limits<float>::max();
|
||||
ui->spinDiameter->setMinimum(-max);
|
||||
ui->spinDiameter->setMaximum(max);
|
||||
ui->spinOtherDiameter->setMinimum(-max);
|
||||
ui->spinOtherDiameter->setMaximum(max);
|
||||
ui->spinCenterDistance->setMinimum(-max);
|
||||
ui->spinCenterDistance->setMaximum(max);
|
||||
ui->spinForce->setMinimum(-max);
|
||||
ui->spinForce->setMaximum(max);
|
||||
ui->spinTensionForce->setMinimum(-max);
|
||||
ui->spinTensionForce->setMaximum(max);
|
||||
ui->spinDistance->setMinimum(-max);
|
||||
ui->spinDistance->setMaximum(max);
|
||||
|
||||
// Get the feature data
|
||||
Fem::ConstraintBearing* pcConstraint = ConstraintView->getObject<Fem::ConstraintBearing>();
|
||||
|
||||
@@ -96,27 +96,27 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont
|
||||
// Fill data into dialog elements
|
||||
ui->spbSlope->setUnit(pcConstraint->Slope.getUnit());
|
||||
ui->spbSlope->setMinimum(0);
|
||||
ui->spbSlope->setMaximum(FLOAT_MAX);
|
||||
ui->spbSlope->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spbSlope->setValue(pcConstraint->Slope.getQuantityValue());
|
||||
ui->spbSlope->bind(pcConstraint->Slope);
|
||||
|
||||
ui->spbAdjust->setUnit(pcConstraint->Adjust.getUnit());
|
||||
ui->spbAdjust->setMinimum(0);
|
||||
ui->spbAdjust->setMaximum(FLOAT_MAX);
|
||||
ui->spbAdjust->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spbAdjust->setValue(pcConstraint->Adjust.getQuantityValue());
|
||||
ui->spbAdjust->bind(pcConstraint->Adjust);
|
||||
|
||||
ui->ckbFriction->setChecked(friction);
|
||||
|
||||
ui->spbFrictionCoeff->setMinimum(0);
|
||||
ui->spbFrictionCoeff->setMaximum(FLOAT_MAX);
|
||||
ui->spbFrictionCoeff->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spbFrictionCoeff->setValue(pcConstraint->FrictionCoefficient.getValue());
|
||||
ui->spbFrictionCoeff->setEnabled(friction);
|
||||
ui->spbFrictionCoeff->bind(pcConstraint->FrictionCoefficient);
|
||||
|
||||
ui->spbStickSlope->setUnit(pcConstraint->StickSlope.getUnit());
|
||||
ui->spbStickSlope->setMinimum(0);
|
||||
ui->spbStickSlope->setMaximum(FLOAT_MAX);
|
||||
ui->spbStickSlope->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spbStickSlope->setValue(pcConstraint->StickSlope.getQuantityValue());
|
||||
ui->spbStickSlope->setEnabled(friction);
|
||||
ui->spbStickSlope->bind(pcConstraint->StickSlope);
|
||||
|
||||
@@ -74,18 +74,19 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement(
|
||||
this->groupLayout()->addWidget(proxy);
|
||||
|
||||
// setup ranges
|
||||
ui->spinxDisplacement->setMinimum(-FLOAT_MAX);
|
||||
ui->spinxDisplacement->setMaximum(FLOAT_MAX);
|
||||
ui->spinyDisplacement->setMinimum(-FLOAT_MAX);
|
||||
ui->spinyDisplacement->setMaximum(FLOAT_MAX);
|
||||
ui->spinzDisplacement->setMinimum(-FLOAT_MAX);
|
||||
ui->spinzDisplacement->setMaximum(FLOAT_MAX);
|
||||
ui->spinxRotation->setMinimum(-FLOAT_MAX);
|
||||
ui->spinxRotation->setMaximum(FLOAT_MAX);
|
||||
ui->spinyRotation->setMinimum(-FLOAT_MAX);
|
||||
ui->spinyRotation->setMaximum(FLOAT_MAX);
|
||||
ui->spinzRotation->setMinimum(-FLOAT_MAX);
|
||||
ui->spinzRotation->setMaximum(FLOAT_MAX);
|
||||
constexpr float max = std::numeric_limits<float>::max();
|
||||
ui->spinxDisplacement->setMinimum(-max);
|
||||
ui->spinxDisplacement->setMaximum(max);
|
||||
ui->spinyDisplacement->setMinimum(-max);
|
||||
ui->spinyDisplacement->setMaximum(max);
|
||||
ui->spinzDisplacement->setMinimum(-max);
|
||||
ui->spinzDisplacement->setMaximum(max);
|
||||
ui->spinxRotation->setMinimum(-max);
|
||||
ui->spinxRotation->setMaximum(max);
|
||||
ui->spinyRotation->setMinimum(-max);
|
||||
ui->spinyRotation->setMaximum(max);
|
||||
ui->spinzRotation->setMinimum(-max);
|
||||
ui->spinzRotation->setMaximum(max);
|
||||
|
||||
// Get the feature data
|
||||
Fem::ConstraintDisplacement* pcConstraint =
|
||||
|
||||
@@ -145,18 +145,19 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(
|
||||
&TaskFemConstraintFluidBoundary::onReferenceDeleted);
|
||||
|
||||
// setup ranges
|
||||
ui->spinBoundaryValue->setMinimum(-FLOAT_MAX);
|
||||
ui->spinBoundaryValue->setMaximum(FLOAT_MAX);
|
||||
constexpr float max = std::numeric_limits<float>::max();
|
||||
ui->spinBoundaryValue->setMinimum(-max);
|
||||
ui->spinBoundaryValue->setMaximum(max);
|
||||
ui->spinTurbulentIntensityValue->setMinimum(0.0);
|
||||
ui->spinTurbulentIntensityValue->setMaximum(FLOAT_MAX);
|
||||
ui->spinTurbulentIntensityValue->setMaximum(max);
|
||||
ui->spinTurbulentLengthValue->setMinimum(0.0);
|
||||
ui->spinTurbulentLengthValue->setMaximum(FLOAT_MAX);
|
||||
ui->spinTurbulentLengthValue->setMaximum(max);
|
||||
ui->spinTemperatureValue->setMinimum(-273.15);
|
||||
ui->spinTemperatureValue->setMaximum(FLOAT_MAX);
|
||||
ui->spinTemperatureValue->setMaximum(max);
|
||||
ui->spinHeatFluxValue->setMinimum(0.0);
|
||||
ui->spinHeatFluxValue->setMaximum(FLOAT_MAX);
|
||||
ui->spinHeatFluxValue->setMaximum(max);
|
||||
ui->spinHTCoeffValue->setMinimum(0.0);
|
||||
ui->spinHTCoeffValue->setMaximum(FLOAT_MAX);
|
||||
ui->spinHTCoeffValue->setMaximum(max);
|
||||
|
||||
connect(ui->comboBoundaryType,
|
||||
qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
@@ -352,8 +353,8 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(
|
||||
|
||||
// Fill data into dialog elements
|
||||
double f = pcConstraint->BoundaryValue.getValue();
|
||||
ui->spinBoundaryValue->setMinimum(FLOAT_MIN); // previous set the min to ZERO is not flexible
|
||||
ui->spinBoundaryValue->setMaximum(FLOAT_MAX);
|
||||
ui->spinBoundaryValue->setMinimum(std::numeric_limits<float>::min()); // ZERO is not flexible
|
||||
ui->spinBoundaryValue->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinBoundaryValue->setValue(f);
|
||||
ui->listReferences->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
|
||||
@@ -75,7 +75,7 @@ TaskFemConstraintForce::TaskFemConstraintForce(ViewProviderFemConstraintForce* C
|
||||
// Fill data into dialog elements
|
||||
ui->spinForce->setUnit(pcConstraint->Force.getUnit());
|
||||
ui->spinForce->setMinimum(0);
|
||||
ui->spinForce->setMaximum(FLOAT_MAX);
|
||||
ui->spinForce->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinForce->setValue(force);
|
||||
ui->listReferences->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
|
||||
@@ -87,10 +87,10 @@ TaskFemConstraintGear::TaskFemConstraintGear(ViewProviderFemConstraint* Constrai
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->spinDiameter->setMinimum(0);
|
||||
ui->spinDiameter->setMaximum(FLOAT_MAX);
|
||||
ui->spinDiameter->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinDiameter->setValue(dia);
|
||||
ui->spinForce->setMinimum(0);
|
||||
ui->spinForce->setMaximum(FLOAT_MAX);
|
||||
ui->spinForce->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinForce->setValue(force);
|
||||
ui->spinForceAngle->setMinimum(-360);
|
||||
ui->spinForceAngle->setMaximum(360);
|
||||
|
||||
@@ -119,16 +119,16 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux(
|
||||
ui->sw_heatflux->setCurrentIndex(constrType->getValue());
|
||||
|
||||
ui->qsb_ambienttemp_conv->setMinimum(0);
|
||||
ui->qsb_ambienttemp_conv->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_ambienttemp_conv->setMaximum(std::numeric_limits<float>::max());
|
||||
|
||||
ui->qsb_film_coef->setMinimum(0);
|
||||
ui->qsb_film_coef->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_film_coef->setMaximum(std::numeric_limits<float>::max());
|
||||
|
||||
ui->dsb_emissivity->setMinimum(0);
|
||||
ui->dsb_emissivity->setMaximum(FLOAT_MAX);
|
||||
ui->dsb_emissivity->setMaximum(std::numeric_limits<float>::max());
|
||||
|
||||
ui->qsb_ambienttemp_rad->setMinimum(0);
|
||||
ui->qsb_ambienttemp_rad->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_ambienttemp_rad->setMaximum(std::numeric_limits<float>::max());
|
||||
|
||||
ui->qsb_ambienttemp_conv->setValue(pcConstraint->AmbientTemp.getQuantityValue());
|
||||
ui->qsb_film_coef->setValue(pcConstraint->FilmCoef.getQuantityValue());
|
||||
|
||||
@@ -64,7 +64,7 @@ TaskFemConstraintPressure::TaskFemConstraintPressure(
|
||||
// Fill data into dialog elements
|
||||
ui->if_pressure->setUnit(pcConstraint->Pressure.getUnit());
|
||||
ui->if_pressure->setMinimum(0);
|
||||
ui->if_pressure->setMaximum(FLOAT_MAX);
|
||||
ui->if_pressure->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->if_pressure->setValue(pcConstraint->Pressure.getQuantityValue());
|
||||
ui->if_pressure->bind(pcConstraint->Pressure);
|
||||
|
||||
|
||||
@@ -76,15 +76,15 @@ TaskFemConstraintPulley::TaskFemConstraintPulley(ViewProviderFemConstraintPulley
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->spinOtherDiameter->setMinimum(0);
|
||||
ui->spinOtherDiameter->setMaximum(FLOAT_MAX);
|
||||
ui->spinOtherDiameter->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinOtherDiameter->setValue(otherdia);
|
||||
ui->spinCenterDistance->setMinimum(0);
|
||||
ui->spinCenterDistance->setMaximum(FLOAT_MAX);
|
||||
ui->spinCenterDistance->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinCenterDistance->setValue(centerdist);
|
||||
ui->checkIsDriven->setChecked(isdriven);
|
||||
ui->spinForce->setMinimum(-FLOAT_MAX);
|
||||
ui->spinForce->setMinimum(-std::numeric_limits<float>::max());
|
||||
ui->spinTensionForce->setMinimum(0);
|
||||
ui->spinTensionForce->setMaximum(FLOAT_MAX);
|
||||
ui->spinTensionForce->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->spinTensionForce->setValue(tensionforce);
|
||||
|
||||
// Adjust ui
|
||||
|
||||
@@ -48,6 +48,7 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
|
||||
QWidget* parent)
|
||||
: TaskFemConstraintOnBoundary(ConstraintView, parent, "FEM_ConstraintRigidBody")
|
||||
{ // Note change "RigidBody" in line above to new constraint name
|
||||
constexpr float floatMax = std::numeric_limits<float>::max();
|
||||
proxy = new QWidget(this);
|
||||
ui = new Ui_TaskFemConstraintRigidBody();
|
||||
ui->setupUi(proxy);
|
||||
@@ -137,12 +138,12 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
|
||||
App::ObjectIdentifier::parse(pcConstraint, std::string("ReferenceNode.y")));
|
||||
ui->qsb_ref_node_z->bind(
|
||||
App::ObjectIdentifier::parse(pcConstraint, std::string("ReferenceNode.z")));
|
||||
ui->qsb_ref_node_x->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_ref_node_x->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_ref_node_y->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_ref_node_y->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_ref_node_z->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_ref_node_z->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_ref_node_x->setMinimum(-floatMax);
|
||||
ui->qsb_ref_node_x->setMaximum(floatMax);
|
||||
ui->qsb_ref_node_y->setMinimum(-floatMax);
|
||||
ui->qsb_ref_node_y->setMaximum(floatMax);
|
||||
ui->qsb_ref_node_z->setMinimum(-floatMax);
|
||||
ui->qsb_ref_node_z->setMaximum(floatMax);
|
||||
|
||||
ui->qsb_disp_x->setValue(disp.x);
|
||||
ui->qsb_disp_y->setValue(disp.y);
|
||||
@@ -150,12 +151,12 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
|
||||
ui->qsb_disp_x->bind(App::ObjectIdentifier::parse(pcConstraint, std::string("Displacement.x")));
|
||||
ui->qsb_disp_y->bind(App::ObjectIdentifier::parse(pcConstraint, std::string("Displacement.y")));
|
||||
ui->qsb_disp_z->bind(App::ObjectIdentifier::parse(pcConstraint, std::string("Displacement.z")));
|
||||
ui->qsb_disp_x->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_disp_x->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_disp_y->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_disp_y->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_disp_z->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_disp_z->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_disp_x->setMinimum(-floatMax);
|
||||
ui->qsb_disp_x->setMaximum(floatMax);
|
||||
ui->qsb_disp_y->setMinimum(-floatMax);
|
||||
ui->qsb_disp_y->setMaximum(floatMax);
|
||||
ui->qsb_disp_z->setMinimum(-floatMax);
|
||||
ui->qsb_disp_z->setMaximum(floatMax);
|
||||
|
||||
ui->spb_rot_axis_x->setValue(rotDir.x);
|
||||
ui->spb_rot_axis_y->setValue(rotDir.y);
|
||||
@@ -169,14 +170,14 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
|
||||
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Axis.z")));
|
||||
ui->qsb_rot_angle->bind(
|
||||
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Angle")));
|
||||
ui->spb_rot_axis_x->setMinimum(-FLOAT_MAX);
|
||||
ui->spb_rot_axis_x->setMaximum(FLOAT_MAX);
|
||||
ui->spb_rot_axis_y->setMinimum(-FLOAT_MAX);
|
||||
ui->spb_rot_axis_y->setMaximum(FLOAT_MAX);
|
||||
ui->spb_rot_axis_z->setMinimum(-FLOAT_MAX);
|
||||
ui->spb_rot_axis_z->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_rot_angle->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_rot_angle->setMaximum(FLOAT_MAX);
|
||||
ui->spb_rot_axis_x->setMinimum(-floatMax);
|
||||
ui->spb_rot_axis_x->setMaximum(floatMax);
|
||||
ui->spb_rot_axis_y->setMinimum(-floatMax);
|
||||
ui->spb_rot_axis_y->setMaximum(floatMax);
|
||||
ui->spb_rot_axis_z->setMinimum(-floatMax);
|
||||
ui->spb_rot_axis_z->setMaximum(floatMax);
|
||||
ui->qsb_rot_angle->setMinimum(-floatMax);
|
||||
ui->qsb_rot_angle->setMaximum(floatMax);
|
||||
|
||||
ui->qsb_force_x->setValue(forceX);
|
||||
ui->qsb_force_y->setValue(forceY);
|
||||
@@ -184,12 +185,12 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
|
||||
ui->qsb_force_x->bind(pcConstraint->ForceX);
|
||||
ui->qsb_force_y->bind(pcConstraint->ForceY);
|
||||
ui->qsb_force_z->bind(pcConstraint->ForceZ);
|
||||
ui->qsb_force_x->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_force_x->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_force_y->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_force_y->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_force_z->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_force_z->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_force_x->setMinimum(-floatMax);
|
||||
ui->qsb_force_x->setMaximum(floatMax);
|
||||
ui->qsb_force_y->setMinimum(-floatMax);
|
||||
ui->qsb_force_y->setMaximum(floatMax);
|
||||
ui->qsb_force_z->setMinimum(-floatMax);
|
||||
ui->qsb_force_z->setMaximum(floatMax);
|
||||
|
||||
ui->qsb_moment_x->setValue(momentX);
|
||||
ui->qsb_moment_y->setValue(momentY);
|
||||
@@ -197,12 +198,12 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody(
|
||||
ui->qsb_moment_x->bind(pcConstraint->MomentX);
|
||||
ui->qsb_moment_y->bind(pcConstraint->MomentY);
|
||||
ui->qsb_moment_z->bind(pcConstraint->MomentZ);
|
||||
ui->qsb_moment_x->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_moment_x->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_moment_y->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_moment_y->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_moment_z->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_moment_z->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_moment_x->setMinimum(-floatMax);
|
||||
ui->qsb_moment_x->setMaximum(floatMax);
|
||||
ui->qsb_moment_y->setMinimum(-floatMax);
|
||||
ui->qsb_moment_y->setMaximum(floatMax);
|
||||
ui->qsb_moment_z->setMinimum(-floatMax);
|
||||
ui->qsb_moment_z->setMaximum(floatMax);
|
||||
|
||||
QStringList modeList;
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->qsb_norm->setUnit(pcConstraint->NormalStiffness.getUnit());
|
||||
ui->qsb_norm->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_norm->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->qsb_norm->setValue(pcConstraint->NormalStiffness.getQuantityValue());
|
||||
|
||||
ui->qsb_tan->setUnit(pcConstraint->TangentialStiffness.getUnit());
|
||||
ui->qsb_tan->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_tan->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->qsb_tan->setValue(pcConstraint->TangentialStiffness.getQuantityValue());
|
||||
|
||||
ui->cb_elmer_stiffness->clear();
|
||||
|
||||
@@ -68,9 +68,9 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->qsb_temperature->setMinimum(0);
|
||||
ui->qsb_temperature->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_cflux->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_cflux->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_temperature->setMaximum(std::numeric_limits<float>::max());
|
||||
ui->qsb_cflux->setMinimum(-std::numeric_limits<float>::max());
|
||||
ui->qsb_cflux->setMaximum(std::numeric_limits<float>::max());
|
||||
|
||||
App::PropertyEnumeration* constrType = &pcConstraint->ConstraintType;
|
||||
QStringList qTypeList;
|
||||
|
||||
@@ -130,14 +130,15 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(
|
||||
ui->qsb_rot_angle->bind(
|
||||
App::ObjectIdentifier::parse(pcConstraint, std::string("Rotation.Angle")));
|
||||
|
||||
ui->spb_rot_axis_x->setMinimum(-FLOAT_MAX);
|
||||
ui->spb_rot_axis_x->setMaximum(FLOAT_MAX);
|
||||
ui->spb_rot_axis_y->setMinimum(-FLOAT_MAX);
|
||||
ui->spb_rot_axis_y->setMaximum(FLOAT_MAX);
|
||||
ui->spb_rot_axis_z->setMinimum(-FLOAT_MAX);
|
||||
ui->spb_rot_axis_z->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_rot_angle->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_rot_angle->setMaximum(FLOAT_MAX);
|
||||
float max = std::numeric_limits<float>::max();
|
||||
ui->spb_rot_axis_x->setMinimum(-max);
|
||||
ui->spb_rot_axis_x->setMaximum(max);
|
||||
ui->spb_rot_axis_y->setMinimum(-max);
|
||||
ui->spb_rot_axis_y->setMaximum(max);
|
||||
ui->spb_rot_axis_z->setMinimum(-max);
|
||||
ui->spb_rot_axis_z->setMaximum(max);
|
||||
ui->qsb_rot_angle->setMinimum(-max);
|
||||
ui->qsb_rot_angle->setMaximum(max);
|
||||
|
||||
std::string transform_type = pcConstraint->TransformType.getValueAsString();
|
||||
if (transform_type == "Rectangular") {
|
||||
|
||||
@@ -145,8 +145,8 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
|
||||
|
||||
for (const auto& point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
if (forceDirection.GetAngle(normal)
|
||||
< M_PI_2) { // Move arrow so it doesn't disappear inside the solid
|
||||
if (forceDirection.GetAngle(normal) < std::numbers::pi
|
||||
/ 2) { // Move arrow so it doesn't disappear inside the solid
|
||||
base = base + dir * scaledlength; // OvG: Scaling
|
||||
}
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
@@ -191,7 +191,7 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
|
||||
|
||||
for (const auto& point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
if (forceDirection.GetAngle(normal) < M_PI_2) {
|
||||
if (forceDirection.GetAngle(normal) < std::numbers::pi / 2) {
|
||||
base = base + dir * scaledlength; // OvG: Scaling
|
||||
}
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
|
||||
@@ -88,7 +88,7 @@ void ViewProviderFemConstraintForce::transformSymbol(const Base::Vector3d& point
|
||||
// Place each symbol outside the boundary
|
||||
Base::Vector3d dir = (rev ? -1.0 : 1.0) * obj->DirectionVector.getValue();
|
||||
float symTraY = dir.Dot(normal) < 0 ? -1 * symLen : 0.0f;
|
||||
float rotAngle = rev ? F_PI : 0.0f;
|
||||
float rotAngle = rev ? std::numbers::pi_v<float> : 0.0f;
|
||||
SbMatrix mat0, mat1;
|
||||
mat0.setTransform(SbVec3f(0, symTraY, 0),
|
||||
SbRotation(SbVec3f(0, 0, 1), rotAngle),
|
||||
|
||||
@@ -88,7 +88,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double angle = pcConstraint->ForceAngle.getValue() / 180 * std::numbers::pi;
|
||||
|
||||
SbVec3f b(base.x, base.y, base.z);
|
||||
SbVec3f ax(axis.x, axis.y, axis.z);
|
||||
@@ -118,7 +118,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double angle = pcConstraint->ForceAngle.getValue() / 180 * std::numbers::pi;
|
||||
|
||||
SbVec3f ax(axis.x, axis.y, axis.z);
|
||||
SbVec3f dir(direction.x, direction.y, direction.z);
|
||||
@@ -143,7 +143,7 @@ void ViewProviderFemConstraintGear::updateData(const App::Property* prop)
|
||||
direction = Base::Vector3d(0, 1, 0);
|
||||
}
|
||||
double dia = pcConstraint->Diameter.getValue();
|
||||
double angle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double angle = pcConstraint->ForceAngle.getValue() / 180 * std::numbers::pi;
|
||||
|
||||
SbVec3f ax(axis.x, axis.y, axis.z);
|
||||
SbVec3f dir(direction.x, direction.y, direction.z);
|
||||
|
||||
@@ -82,7 +82,7 @@ void ViewProviderFemConstraintPressure::transformSymbol(const Base::Vector3d& po
|
||||
SbMatrix& mat) const
|
||||
{
|
||||
auto obj = this->getObject<const Fem::ConstraintPressure>();
|
||||
float rotAngle = obj->Reversed.getValue() ? F_PI : 0.0f;
|
||||
float rotAngle = obj->Reversed.getValue() ? std::numbers::pi_v<float> : 0.0f;
|
||||
float s = obj->getScaleFactor();
|
||||
// Symbol length from .iv file
|
||||
float symLen = 4.0f;
|
||||
|
||||
@@ -66,6 +66,8 @@ bool ViewProviderFemConstraintPulley::setEdit(int ModNum)
|
||||
|
||||
void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
{
|
||||
using std::numbers::pi;
|
||||
|
||||
// Gets called whenever a property of the attached object changes
|
||||
Fem::ConstraintPulley* pcConstraint = this->getObject<Fem::ConstraintPulley>();
|
||||
|
||||
@@ -82,7 +84,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
@@ -106,9 +108,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2),
|
||||
SbVec3f(sin(forceAngle + beltAngle + pi / 2),
|
||||
0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
cos(forceAngle + beltAngle + pi / 2))));
|
||||
GuiTools::createPlacement(sep, SbVec3f(0, dia / 8 + dia / 2 * rat1, 0), SbRotation());
|
||||
sep->addChild(GuiTools::createArrow(dia / 8 + dia / 2 * rat1, dia / 8));
|
||||
pShapeSep->addChild(sep); // child 3
|
||||
@@ -118,9 +120,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - pi / 2),
|
||||
0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
-cos(forceAngle - beltAngle - pi / 2))));
|
||||
GuiTools::createPlacement(sep, SbVec3f(0, dia / 8 + dia / 2 * rat2, 0), SbRotation());
|
||||
sep->addChild(GuiTools::createArrow(dia / 8 + dia / 2 * rat2, dia / 8));
|
||||
pShapeSep->addChild(sep); // child 4
|
||||
@@ -134,7 +136,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
double rat1 = 0.8, rat2 = 0.2;
|
||||
double f1 = pcConstraint->BeltForce1.getValue();
|
||||
@@ -153,9 +155,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2),
|
||||
SbVec3f(sin(forceAngle + beltAngle + pi / 2),
|
||||
0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
cos(forceAngle + beltAngle + pi / 2))));
|
||||
GuiTools::updatePlacement(sep,
|
||||
2,
|
||||
SbVec3f(0, dia / 8 + dia / 2 * rat1, 0),
|
||||
@@ -169,9 +171,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - pi / 2),
|
||||
0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
-cos(forceAngle - beltAngle - pi / 2))));
|
||||
GuiTools::updatePlacement(sep,
|
||||
2,
|
||||
SbVec3f(0, dia / 8 + dia / 2 * rat2, 0),
|
||||
@@ -187,7 +189,7 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
if (dia < 2 * radius) {
|
||||
dia = 2 * radius;
|
||||
}
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * M_PI;
|
||||
double forceAngle = pcConstraint->ForceAngle.getValue() / 180 * pi;
|
||||
double beltAngle = pcConstraint->BeltAngle.getValue();
|
||||
|
||||
const SoSeparator* sep = static_cast<SoSeparator*>(pShapeSep->getChild(3));
|
||||
@@ -197,9 +199,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
dia / 2 * cos(forceAngle + beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(sin(forceAngle + beltAngle + M_PI_2),
|
||||
SbVec3f(sin(forceAngle + beltAngle + pi / 2),
|
||||
0,
|
||||
cos(forceAngle + beltAngle + M_PI_2))));
|
||||
cos(forceAngle + beltAngle + pi / 2))));
|
||||
sep = static_cast<SoSeparator*>(pShapeSep->getChild(4));
|
||||
GuiTools::updatePlacement(sep,
|
||||
0,
|
||||
@@ -207,9 +209,9 @@ void ViewProviderFemConstraintPulley::updateData(const App::Property* prop)
|
||||
0,
|
||||
-dia / 2 * cos(forceAngle - beltAngle)),
|
||||
SbRotation(SbVec3f(0, 1, 0),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - M_PI_2),
|
||||
SbVec3f(-sin(forceAngle - beltAngle - pi / 2),
|
||||
0,
|
||||
-cos(forceAngle - beltAngle - M_PI_2))));
|
||||
-cos(forceAngle - beltAngle - pi / 2))));
|
||||
}
|
||||
}
|
||||
else if ((prop == &pcConstraint->BeltForce1) || (prop == &pcConstraint->BeltForce2)) {
|
||||
|
||||
@@ -756,7 +756,10 @@ void CylinderWidget::radiusChanged(double)
|
||||
|
||||
PROPERTY_SOURCE(FemGui::ViewProviderFemPostPlaneFunction, FemGui::ViewProviderFemPostFunction)
|
||||
// NOTE: The technical lower limit is at 1e-4 that the Coin3D manipulator can handle
|
||||
static const App::PropertyFloatConstraint::Constraints scaleConstraint = {1e-4, DBL_MAX, 1.0};
|
||||
static const App::PropertyFloatConstraint::Constraints scaleConstraint = {
|
||||
1e-4,
|
||||
std::numeric_limits<double>::max(),
|
||||
1.0};
|
||||
|
||||
ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction()
|
||||
: m_detectscale(false)
|
||||
@@ -1178,6 +1181,8 @@ SoGroup* postBox()
|
||||
|
||||
SoGroup* postCylinder()
|
||||
{
|
||||
using std::numbers::pi;
|
||||
|
||||
SoCoordinate3* points = new SoCoordinate3();
|
||||
int nCirc = 20;
|
||||
const int nSide = 8;
|
||||
@@ -1189,8 +1194,8 @@ SoGroup* postCylinder()
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < nCirc + 1; ++j) {
|
||||
points->point.set1Value(idx,
|
||||
SbVec3f(std::cos(2 * M_PI / nCirc * j),
|
||||
std::sin(2 * M_PI / nCirc * j),
|
||||
SbVec3f(std::cos(2 * pi / nCirc * j),
|
||||
std::sin(2 * pi / nCirc * j),
|
||||
-h / 2. + h * i));
|
||||
++idx;
|
||||
}
|
||||
@@ -1199,8 +1204,8 @@ SoGroup* postCylinder()
|
||||
for (int i = 0; i < nSide; ++i) {
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
points->point.set1Value(idx,
|
||||
SbVec3f(std::cos(2 * M_PI / nSide * i),
|
||||
std::sin(2 * M_PI / nSide * i),
|
||||
SbVec3f(std::cos(2 * pi / nSide * i),
|
||||
std::sin(2 * pi / nSide * i),
|
||||
-h / 2. + h * j));
|
||||
++idx;
|
||||
}
|
||||
@@ -1243,24 +1248,26 @@ SoGroup* postPlane()
|
||||
|
||||
SoGroup* postSphere()
|
||||
{
|
||||
using std::numbers::pi;
|
||||
|
||||
SoCoordinate3* points = new SoCoordinate3();
|
||||
points->point.setNum(2 * 84);
|
||||
int idx = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 21; j++) {
|
||||
points->point.set1Value(idx,
|
||||
SbVec3f(std::sin(2 * M_PI / 20 * j) * std::cos(M_PI / 4 * i),
|
||||
std::sin(2 * M_PI / 20 * j) * std::sin(M_PI / 4 * i),
|
||||
std::cos(2 * M_PI / 20 * j)));
|
||||
SbVec3f(std::sin(2 * pi / 20 * j) * std::cos(pi / 4 * i),
|
||||
std::sin(2 * pi / 20 * j) * std::sin(pi / 4 * i),
|
||||
std::cos(2 * pi / 20 * j)));
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 21; j++) {
|
||||
points->point.set1Value(idx,
|
||||
SbVec3f(std::sin(M_PI / 4 * i) * std::cos(2 * M_PI / 20 * j),
|
||||
std::sin(M_PI / 4 * i) * std::sin(2 * M_PI / 20 * j),
|
||||
std::cos(M_PI / 4 * i)));
|
||||
SbVec3f(std::sin(pi / 4 * i) * std::cos(2 * pi / 20 * j),
|
||||
std::sin(pi / 4 * i) * std::sin(2 * pi / 20 * j),
|
||||
std::cos(pi / 4 * i)));
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user