Add Inspection and Import WebAssembly probes
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Stale Issues / stale (push) Has been cancelled

This commit is contained in:
2026-08-21 10:57:23 +08:00
parent c87b2871be
commit a6f251f657
15 changed files with 1264 additions and 59 deletions

View File

@@ -34,10 +34,12 @@
#include <TopoDS.hxx>
#include <gp_Pnt.hxx>
#include <QEventLoop>
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentMap>
#include <QEventLoop>
#ifndef FREECAD_WEB_CORE
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentMap>
#endif
#include <Base/Console.h>
#include <Base/FutureWatcherProgress.h>
@@ -930,7 +932,8 @@ App::DocumentObjectExecReturn* Feature::execute()
DistanceInspectionRMS res;
if (useMultithreading) {
#ifndef FREECAD_WEB_CORE
if (useMultithreading) {
// Build vector of increasing indices
std::vector<unsigned long> index(count);
std::iota(index.begin(), index.end(), 0);
@@ -958,8 +961,11 @@ App::DocumentObjectExecReturn* Feature::execute()
watcher.setFuture(future);
loop.exec();
res = future.result();
}
else {
}
else {
#else
{
#endif
// Single-threaded operation
std::stringstream str;
str << "Inspecting " << this->Label.getValue() << "…";

View File

@@ -42,7 +42,9 @@
#include <boost/core/ignore_unused.hpp>
// Qt
#include <QEventLoop>
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentMap>
#include <QEventLoop>
#ifndef FREECAD_WEB_CORE
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentMap>
#endif

View File

@@ -26,9 +26,11 @@
#include <functional>
#include <limits>
#ifndef FREECAD_WEB_CORE
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentMap>
#endif
#include <Base/Sequencer.h>
#include <Base/Tools.h>
@@ -72,7 +74,11 @@ void MeshCurvature::ComputePerFace(bool parallel)
MeshRefPointToFacets search(myKernel);
FacetCurvature face(myKernel, search, myRadius, myMinPoints);
#ifdef FREECAD_WEB_CORE
if (true) {
#else
if (!parallel) {
#endif
Base::SequencerLauncher seq("Curvature estimation", mySegment.size());
for (FacetIndex it : mySegment) {
CurvatureInfo info = face.Compute(it);
@@ -80,6 +86,7 @@ void MeshCurvature::ComputePerFace(bool parallel)
seq.next();
}
}
#ifndef FREECAD_WEB_CORE
else {
// NOLINTBEGIN
QFuture<CurvatureInfo> future
@@ -92,6 +99,7 @@ void MeshCurvature::ComputePerFace(bool parallel)
myCurvature.push_back(it);
}
}
#endif
}
#ifdef OPTIMIZE_CURVATURE

View File

@@ -22,7 +22,9 @@
* *
***************************************************************************/
#include <QtConcurrentMap>
#ifndef FREECAD_WEB_CORE
#include <QtConcurrentMap>
#endif
#include <boost/math/special_functions/fpclassify.hpp>
#include <cmath>
#include <iostream>
@@ -36,9 +38,9 @@
#include "PointsAlgos.h"
#ifdef _MSC_VER
# include <ppl.h>
#endif
#ifdef _MSC_VER
# include <ppl.h>
#endif
using namespace Points;
using namespace std;
@@ -84,7 +86,11 @@ Data::Segment* PointKernel::getSubElement(const char* /*Type*/, unsigned long /*
void PointKernel::transformGeometry(const Base::Matrix4D& rclMat)
{
std::vector<value_type>& kernel = getBasicPoints();
#ifdef _MSC_VER
#if defined(FREECAD_WEB_CORE)
std::for_each(kernel.begin(), kernel.end(), [rclMat](value_type& value) {
rclMat.multVec(value, value);
});
#elif defined(_MSC_VER)
// Win32-only at the moment since ppl.h is a Microsoft library. Points is not using Qt so we
// cannot use QtConcurrent We could also rewrite Points to leverage SIMD instructions Other
// option: openMP. But with VC2013 results in high CPU usage even after computation (busy-waits
@@ -92,7 +98,7 @@ void PointKernel::transformGeometry(const Base::Matrix4D& rclMat)
Concurrency::parallel_for_each(kernel.begin(), kernel.end(), [rclMat](value_type& value) {
value = rclMat * value;
});
#else
#else
QtConcurrent::blockingMap(kernel, [rclMat](value_type& value) { rclMat.multVec(value, value); });
#endif
}
@@ -101,7 +107,11 @@ void PointKernel::moveGeometry(const Base::Vector3d& vec)
{
Base::Vector3f offset = Base::toVector<float>(vec);
std::vector<value_type>& kernel = getBasicPoints();
#ifdef _MSC_VER
#if defined(FREECAD_WEB_CORE)
std::for_each(kernel.begin(), kernel.end(), [offset](value_type& value) {
value += offset;
});
#elif defined(_MSC_VER)
Concurrency::parallel_for_each(kernel.begin(), kernel.end(), [offset](value_type& value) {
value += offset;
});

View File

@@ -22,7 +22,9 @@
* *
***************************************************************************/
#include <QtConcurrentMap>
#ifndef FREECAD_WEB_CORE
#include <QtConcurrentMap>
#endif
#include <algorithm>
#include <cmath>
#include <iostream>
@@ -38,9 +40,9 @@
#include "Points.h"
#include "Properties.h"
#ifdef _MSC_VER
# include <ppl.h>
#endif
#ifdef _MSC_VER
# include <ppl.h>
#endif
using namespace Points;
@@ -383,11 +385,15 @@ void PropertyNormalList::transformGeometry(const Base::Matrix4D& mat)
aboutToSetValue();
// Rotate the normal vectors
#ifdef _MSC_VER
#if defined(FREECAD_WEB_CORE)
std::for_each(_lValueList.begin(), _lValueList.end(), [rot](Base::Vector3f& value) {
rot.multVec(value, value);
});
#elif defined(_MSC_VER)
Concurrency::parallel_for_each(_lValueList.begin(), _lValueList.end(), [rot](Base::Vector3f& value) {
value = rot * value;
});
#else
#else
QtConcurrent::blockingMap(_lValueList, [rot](Base::Vector3f& value) {
rot.multVec(value, value);
});