Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: CI

# Fast per-PR/per-push gate. Deliberately does NOT rebuild OCCT from source (that's
# kernel-rebuild.yml's job, ~30-60 min) — a clean checkout has no local Libraries/, so
# Fast per-PR/per-push gate. Deliberately does NOT rebuild OCCT from source (that is a manual
# local `Scripts/build-occt.sh` run, ~30-60 min, done only when a carried patch in
# Scripts/patches/ needs to reach the shipped binary). A clean checkout has no local Libraries/, so
# Package.swift's binaryTarget resolves OCCT.xcframework from its pinned release URL and
# verifies the checksum, which only costs a download. OCCTBridge compiles from source by
# default (no OCCTSWIFT_BRIDGE_PREBUILT set) — that's the repo's own intended default, see
# default (no OCCTSWIFT_BRIDGE_PREBUILT set), which is the repo's own intended default, see
# the comment above `useBridgePrebuilt` in Package.swift, and it's a couple of minutes, not
# tens of minutes.

Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
diff --git a/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx b/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx
index e29e6751..19fdfabf 100644
--- a/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx
+++ b/src/FoundationClasses/TKernel/Resource/Resource_Manager.cxx
@@ -31,6 +31,7 @@
#include <NCollection_Array1.hxx>

#include <algorithm>
+#include <atomic>
#include <cerrno>

IMPLEMENT_STANDARD_RTTIEXT(Resource_Manager, Standard_Transient)
@@ -51,7 +52,7 @@

static int GetLine(OSD_File& aFile, TCollection_AsciiString& aLine);

-static bool Debug;
+static std::atomic<bool> Debug(false);

//=================================================================================================

diff --git a/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx b/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx
index 64d3f3d0..c19a99fb 100644
--- a/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx
+++ b/src/FoundationClasses/TKernel/Storage/Storage_Schema.cxx
@@ -318,7 +318,7 @@ void Storage_Schema::Write(const occ::handle<Storage_BaseDriver>& theDriver,
occ::handle<Standard_Persistent> p;
occ::handle<NCollection_HSequence<occ::handle<Storage_Root>>> plist;
TCollection_AsciiString errorContext("AddPersistent");
- Storage_Schema::ISetCurrentData(aData);
+ myCurrentData = aData;

occ::handle<Storage_InternalData> iData = aData->InternalData();

@@ -614,8 +614,8 @@ void Storage_Schema::BindType(const TCollection_AsciiString& aTypeName,
{
if (!HasTypeBinding(aTypeName))
{
- occ::handle<Storage_InternalData> iData = Storage_Schema::ICurrentData()->InternalData();
- occ::handle<Storage_TypeData> tData = Storage_Schema::ICurrentData()->TypeData();
+ occ::handle<Storage_InternalData> iData = myCurrentData->InternalData();
+ occ::handle<Storage_TypeData> tData = myCurrentData->TypeData();
occ::handle<Storage_TypedCallBack> c = new Storage_TypedCallBack(aTypeName, aCallBack);

tData->AddType(aTypeName, iData->myTypeId);
@@ -633,7 +633,7 @@ occ::handle<Storage_CallBack> Storage_Schema::TypeBinding(

if (HasTypeBinding(aTypeName))
{
- occ::handle<Storage_InternalData> iData = Storage_Schema::ICurrentData()->InternalData();
+ occ::handle<Storage_InternalData> iData = myCurrentData->InternalData();

result = iData->myTypeBinding.Find(aTypeName)->CallBack();
}
@@ -650,14 +650,13 @@ bool Storage_Schema::AddPersistent(const occ::handle<Standard_Persistent>& sp,

if (!sp.IsNull())
{
- occ::handle<Storage_InternalData> iData = Storage_Schema::ICurrentData()->InternalData();
+ occ::handle<Storage_InternalData> iData = myCurrentData->InternalData();

if (sp->_typenum == 0)
{
- int aTypenum;
- static TCollection_AsciiString aTypeName;
- aTypeName = tName;
- occ::handle<Storage_TypeData> tData = Storage_Schema::ICurrentData()->TypeData();
+ int aTypenum;
+ TCollection_AsciiString aTypeName(tName);
+ occ::handle<Storage_TypeData> tData = myCurrentData->TypeData();

aTypenum = iData->myTypeBinding.Find(aTypeName)->Index();

@@ -679,7 +678,7 @@ bool Storage_Schema::PersistentToAdd(const occ::handle<Standard_Persistent>& sp)

if (!sp.IsNull())
{
- occ::handle<Storage_InternalData> di = Storage_Schema::ICurrentData()->InternalData();
+ occ::handle<Storage_InternalData> di = myCurrentData->InternalData();

if (sp->_typenum == 0 && sp->_refnum != -1)
{
@@ -696,7 +695,7 @@ bool Storage_Schema::PersistentToAdd(const occ::handle<Standard_Persistent>& sp)

void Storage_Schema::Clear() const
{
- Storage_Schema::ICurrentData().Nullify();
+ myCurrentData.Nullify();
}

#ifdef DATATYPE_MIGRATION
@@ -790,21 +789,6 @@ bool Storage_Schema::CheckTypeMigration(const TCollection_AsciiString& oldName,
}
#endif

-//=================================================================================================
-
-void Storage_Schema::ISetCurrentData(const occ::handle<Storage_Data>& dData)
-{
- Storage_Schema::ICurrentData() = dData;
-}
-
-//=================================================================================================
-
-occ::handle<Storage_Data>& Storage_Schema::ICurrentData()
-{
- static occ::handle<Storage_Data> _Storage_CData;
- return _Storage_CData;
-}
-
#define SLENGTH 80

//=================================================================================================
diff --git a/src/FoundationClasses/TKernel/Storage/Storage_Schema.hxx b/src/FoundationClasses/TKernel/Storage/Storage_Schema.hxx
index fa0d8959..09b52cad 100644
--- a/src/FoundationClasses/TKernel/Storage/Storage_Schema.hxx
+++ b/src/FoundationClasses/TKernel/Storage/Storage_Schema.hxx
@@ -167,7 +167,7 @@ public:
protected:
bool HasTypeBinding(const TCollection_AsciiString& aTypeName) const
{
- return Storage_Schema::ICurrentData()->InternalData()->myTypeBinding.IsBound(aTypeName);
+ return myCurrentData->InternalData()->myTypeBinding.IsBound(aTypeName);
}

Standard_EXPORT void BindType(const TCollection_AsciiString& aTypeName,
@@ -179,9 +179,8 @@ protected:
private:
Standard_EXPORT void Clear() const;

- Standard_EXPORT static void ISetCurrentData(const occ::handle<Storage_Data>& dData);
-
- Standard_EXPORT static occ::handle<Storage_Data>& ICurrentData();
+ //! Scratch state for the duration of one Write() call.
+ mutable occ::handle<Storage_Data> myCurrentData;

NCollection_DataMap<TCollection_AsciiString, occ::handle<Storage_TypedCallBack>> myCallBack;
bool myCallBackState;
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
diff --git a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformAbscissa.cxx b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformAbscissa.cxx
index 4cccafa0..b0250f3f 100644
--- a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformAbscissa.cxx
+++ b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_QuasiUniformAbscissa.cxx
@@ -130,6 +130,14 @@ void GCPnts_QuasiUniformAbscissa::initialize(const TheCurve& theC,
Standard_ConstructionError_Raise_if(
theNbPoints <= 1,
"GCPnts_QuasiUniformAbscissa::Initialize(), number of points should be >= 2");
+ if (theNbPoints <= 1)
+ {
+ // The check above is compiled out in a build defining No_Exception. Without this the code
+ // below stores into myParams, which is allocated empty for such a count.
+ myDone = false;
+ myNbPoints = 0;
+ return;
+ }

// evaluate the approximative length of the 3dCurve
myNbPoints = theNbPoints;
diff --git a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx
index 64b5a983..1f6e1094 100644
--- a/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx
+++ b/src/ModelingData/TKGeomBase/GCPnts/GCPnts_UniformAbscissa.cxx
@@ -94,7 +94,8 @@ static bool Perform(NCollection_Array1<double>& theParameters,
const double theU2,
const double theTotalLength,
int& theNbPoints,
- const double theEPSILON)
+ const double theEPSILON,
+ const double theTol3d)
{
bool isLocalDone = true;
double aUU1 = std::min(theU1, theU2), aUU2 = std::max(theU1, theU2);
@@ -104,6 +105,7 @@ static bool Perform(NCollection_Array1<double>& theParameters,
double aDelta = (theAbscissa / theTotalLength) * (aUU2 - aUU1);
int anIndex = 1;
theParameters.SetValue(anIndex, aUU1);
+ const typename GCPnts_TCurveTypes<TheCurve>::Point aPEnd = theC.Value(aUU2);
for (bool isNotDone = true; isNotDone;)
{
double aUi = theParameters.Value(anIndex) + aDelta;
@@ -125,7 +127,12 @@ static bool Perform(NCollection_Array1<double>& theParameters,
{
anIndex += 1;
aUi = anAbscissaFinder.Parameter();
- if (std::abs(aUi - aUU2) <= theEPSILON)
+ // theEPSILON is a parametric tolerance obtained from theTol3d through Resolution(),
+ // which converts using the curve's largest derivative; where the local derivative is
+ // much smaller it is far too tight. Also accept a point that coincides with the end
+ // within theTol3d, otherwise the walk takes one more step and appends a duplicate.
+ if (std::abs(aUi - aUU2) <= theEPSILON
+ || (aUU2 - aUi < aDelta && theC.Value(aUi).Distance(aPEnd) <= theTol3d))
{
theParameters.SetValue(anIndex, aUU2);
isNotDone = false;
@@ -437,7 +444,8 @@ void GCPnts_UniformAbscissa::initialize(const TheCurve& theC,
theU2,
aL,
myNbPoints,
- anEPSILON);
+ anEPSILON,
+ std::max(theTol, Precision::Confusion()));
break;
}
}
@@ -497,6 +505,12 @@ void GCPnts_UniformAbscissa::initialize(const TheCurve& theC,
"GCPnts_UniformAbscissa::Initialize() - number of points should be >= 2");
myNbPoints = 0;
myDone = false;
+ if (theNbPoints <= 1)
+ {
+ // The check above is compiled out in a build defining No_Exception, and the abscissa below
+ // would be computed from a zero or negative divisor.
+ return;
+ }

const double anEPSILON = theC.Resolution(std::max(theTol, Precision::Confusion()));
// although very similar to Initialize with Abscissa this avoid
@@ -550,7 +564,8 @@ void GCPnts_UniformAbscissa::initialize(const TheCurve& theC,
theU2,
aL,
myNbPoints,
- anEPSILON);
+ anEPSILON,
+ std::max(theTol, Precision::Confusion()));
break;
}
}
Loading
Loading