diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index ed9c32c12..bbc2a044e 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -3247,10 +3247,10 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_composevectornode_getoutputresult(Lib3MF_Com * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_decomposevectornode_getinputvector(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_decomposevectornode_getinputa(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index abcfd27c7..faff3f8bc 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -342,7 +342,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ComposeVectorNode_GetInputY = NULL; pWrapperTable->m_ComposeVectorNode_GetInputZ = NULL; pWrapperTable->m_ComposeVectorNode_GetOutputResult = NULL; - pWrapperTable->m_DecomposeVectorNode_GetInputVector = NULL; + pWrapperTable->m_DecomposeVectorNode_GetInputA = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputX = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputY = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputZ = NULL; @@ -3324,12 +3324,12 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputa"); #else // _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputa"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_DecomposeVectorNode_GetInputVector == NULL) + if (pWrapperTable->m_DecomposeVectorNode_GetInputA == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 536e869f0..d48fed69c 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -3234,10 +3234,10 @@ typedef Lib3MFResult (*PLib3MFComposeVectorNode_GetOutputResultPtr) (Lib3MF_Comp * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputVectorPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputAPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component @@ -6467,7 +6467,7 @@ typedef struct { PLib3MFComposeVectorNode_GetInputYPtr m_ComposeVectorNode_GetInputY; PLib3MFComposeVectorNode_GetInputZPtr m_ComposeVectorNode_GetInputZ; PLib3MFComposeVectorNode_GetOutputResultPtr m_ComposeVectorNode_GetOutputResult; - PLib3MFDecomposeVectorNode_GetInputVectorPtr m_DecomposeVectorNode_GetInputVector; + PLib3MFDecomposeVectorNode_GetInputAPtr m_DecomposeVectorNode_GetInputA; PLib3MFDecomposeVectorNode_GetOutputXPtr m_DecomposeVectorNode_GetOutputX; PLib3MFDecomposeVectorNode_GetOutputYPtr m_DecomposeVectorNode_GetOutputY; PLib3MFDecomposeVectorNode_GetOutputZPtr m_DecomposeVectorNode_GetOutputZ; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index c0db5ade0..5460d4a45 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -1314,8 +1314,8 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_composevectornode_getoutputresult", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ComposeVectorNode_GetOutputResult (IntPtr Handle, out IntPtr AResult); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_decomposevectornode_getinputvector", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 DecomposeVectorNode_GetInputVector (IntPtr Handle, out IntPtr AVector); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_decomposevectornode_getinputa", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 DecomposeVectorNode_GetInputA (IntPtr Handle, out IntPtr AA); [DllImport("lib3mf.dll", EntryPoint = "lib3mf_decomposevectornode_getoutputx", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 DecomposeVectorNode_GetOutputX (IntPtr Handle, out IntPtr AX); @@ -5941,12 +5941,12 @@ public CDecomposeVectorNode (IntPtr NewHandle) : base (NewHandle) { } - public CImplicitPort GetInputVector () + public CImplicitPort GetInputA () { - IntPtr newVector = IntPtr.Zero; + IntPtr newA = IntPtr.Zero; - CheckError(Internal.Lib3MFWrapper.DecomposeVectorNode_GetInputVector (Handle, out newVector)); - return Internal.Lib3MFWrapper.PolymorphicFactory(newVector); + CheckError(Internal.Lib3MFWrapper.DecomposeVectorNode_GetInputA (Handle, out newA)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newA); } public CImplicitPort GetOutputX () diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index f33231f20..1671c3d43 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -3247,10 +3247,10 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_composevectornode_getoutputresult(Lib3MF_Com * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_decomposevectornode_getinputvector(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_decomposevectornode_getinputa(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index 10b6224aa..680dd143f 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -2660,7 +2660,7 @@ class CDecomposeVectorNode : public CImplicitNode { { } - inline PImplicitPort GetInputVector(); + inline PImplicitPort GetInputA(); inline PImplicitPort GetOutputX(); inline PImplicitPort GetOutputY(); inline PImplicitPort GetOutputZ(); @@ -7683,18 +7683,18 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) */ /** - * CDecomposeVectorNode::GetInputVector - Retrieves the input - * @return the input + * CDecomposeVectorNode::GetInputA - Retrieves the input + * @return the input port for the vector to decompose */ - PImplicitPort CDecomposeVectorNode::GetInputVector() + PImplicitPort CDecomposeVectorNode::GetInputA() { - Lib3MFHandle hVector = nullptr; - CheckError(lib3mf_decomposevectornode_getinputvector(m_pHandle, &hVector)); + Lib3MFHandle hA = nullptr; + CheckError(lib3mf_decomposevectornode_getinputa(m_pHandle, &hA)); - if (!hVector) { + if (!hA) { CheckError(LIB3MF_ERROR_INVALIDPARAM); } - return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hVector))); + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hA))); } /** diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index dbbc18e2d..18ed1c638 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -3234,10 +3234,10 @@ typedef Lib3MFResult (*PLib3MFComposeVectorNode_GetOutputResultPtr) (Lib3MF_Comp * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputVectorPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputAPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component @@ -6467,7 +6467,7 @@ typedef struct { PLib3MFComposeVectorNode_GetInputYPtr m_ComposeVectorNode_GetInputY; PLib3MFComposeVectorNode_GetInputZPtr m_ComposeVectorNode_GetInputZ; PLib3MFComposeVectorNode_GetOutputResultPtr m_ComposeVectorNode_GetOutputResult; - PLib3MFDecomposeVectorNode_GetInputVectorPtr m_DecomposeVectorNode_GetInputVector; + PLib3MFDecomposeVectorNode_GetInputAPtr m_DecomposeVectorNode_GetInputA; PLib3MFDecomposeVectorNode_GetOutputXPtr m_DecomposeVectorNode_GetOutputX; PLib3MFDecomposeVectorNode_GetOutputYPtr m_DecomposeVectorNode_GetOutputY; PLib3MFDecomposeVectorNode_GetOutputZPtr m_DecomposeVectorNode_GetOutputZ; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index c0cf38234..132664582 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -2684,7 +2684,7 @@ class CDecomposeVectorNode : public CImplicitNode { { } - inline PImplicitPort GetInputVector(); + inline PImplicitPort GetInputA(); inline PImplicitPort GetOutputX(); inline PImplicitPort GetOutputY(); inline PImplicitPort GetOutputZ(); @@ -4023,7 +4023,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_ComposeVectorNode_GetInputY = nullptr; pWrapperTable->m_ComposeVectorNode_GetInputZ = nullptr; pWrapperTable->m_ComposeVectorNode_GetOutputResult = nullptr; - pWrapperTable->m_DecomposeVectorNode_GetInputVector = nullptr; + pWrapperTable->m_DecomposeVectorNode_GetInputA = nullptr; pWrapperTable->m_DecomposeVectorNode_GetOutputX = nullptr; pWrapperTable->m_DecomposeVectorNode_GetOutputY = nullptr; pWrapperTable->m_DecomposeVectorNode_GetOutputZ = nullptr; @@ -7001,12 +7001,12 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputa"); #else // _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputa"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_DecomposeVectorNode_GetInputVector == nullptr) + if (pWrapperTable->m_DecomposeVectorNode_GetInputA == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -10721,8 +10721,8 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ComposeVectorNode_GetOutputResult == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_decomposevectornode_getinputvector", (void**)&(pWrapperTable->m_DecomposeVectorNode_GetInputVector)); - if ( (eLookupError != 0) || (pWrapperTable->m_DecomposeVectorNode_GetInputVector == nullptr) ) + eLookupError = (*pLookup)("lib3mf_decomposevectornode_getinputa", (void**)&(pWrapperTable->m_DecomposeVectorNode_GetInputA)); + if ( (eLookupError != 0) || (pWrapperTable->m_DecomposeVectorNode_GetInputA == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; eLookupError = (*pLookup)("lib3mf_decomposevectornode_getoutputx", (void**)&(pWrapperTable->m_DecomposeVectorNode_GetOutputX)); @@ -15833,18 +15833,18 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) */ /** - * CDecomposeVectorNode::GetInputVector - Retrieves the input - * @return the input + * CDecomposeVectorNode::GetInputA - Retrieves the input + * @return the input port for the vector to decompose */ - PImplicitPort CDecomposeVectorNode::GetInputVector() + PImplicitPort CDecomposeVectorNode::GetInputA() { - Lib3MFHandle hVector = nullptr; - CheckError(m_pWrapper->m_WrapperTable.m_DecomposeVectorNode_GetInputVector(m_pHandle, &hVector)); + Lib3MFHandle hA = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_DecomposeVectorNode_GetInputA(m_pHandle, &hA)); - if (!hVector) { + if (!hA) { CheckError(LIB3MF_ERROR_INVALIDPARAM); } - return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hVector))); + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hA))); } /** diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index d4b182415..ad1d884ae 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -2718,12 +2718,12 @@ Lib3MFResult CCall_lib3mf_composevectornode_getoutputresult(Lib3MFHandle library } -Lib3MFResult CCall_lib3mf_decomposevectornode_getinputvector(Lib3MFHandle libraryHandle, Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector) +Lib3MFResult CCall_lib3mf_decomposevectornode_getinputa(Lib3MFHandle libraryHandle, Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_DecomposeVectorNode_GetInputVector (pDecomposeVectorNode, pVector); + return wrapperTable->m_DecomposeVectorNode_GetInputA (pDecomposeVectorNode, pA); } @@ -9966,14 +9966,14 @@ func (wrapper Wrapper) NewDecomposeVectorNode(r ref) DecomposeVectorNode { return DecomposeVectorNode{wrapper.NewImplicitNode(r)} } -// GetInputVector retrieves the input. -func (inst DecomposeVectorNode) GetInputVector() (ImplicitPort, error) { - var vector ref - ret := C.CCall_lib3mf_decomposevectornode_getinputvector(inst.wrapperRef.LibraryHandle, inst.Ref, &vector) +// GetInputA retrieves the input. +func (inst DecomposeVectorNode) GetInputA() (ImplicitPort, error) { + var a ref + ret := C.CCall_lib3mf_decomposevectornode_getinputa(inst.wrapperRef.LibraryHandle, inst.Ref, &a) if ret != 0 { return ImplicitPort{}, makeError(uint32(ret)) } - return inst.wrapperRef.NewImplicitPort(vector), nil + return inst.wrapperRef.NewImplicitPort(a), nil } // GetOutputX retrieves the output for the x component. diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc index abcfd27c7..faff3f8bc 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc @@ -342,7 +342,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ComposeVectorNode_GetInputY = NULL; pWrapperTable->m_ComposeVectorNode_GetInputZ = NULL; pWrapperTable->m_ComposeVectorNode_GetOutputResult = NULL; - pWrapperTable->m_DecomposeVectorNode_GetInputVector = NULL; + pWrapperTable->m_DecomposeVectorNode_GetInputA = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputX = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputY = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputZ = NULL; @@ -3324,12 +3324,12 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputa"); #else // _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputa"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_DecomposeVectorNode_GetInputVector == NULL) + if (pWrapperTable->m_DecomposeVectorNode_GetInputA == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 536e869f0..d48fed69c 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -3234,10 +3234,10 @@ typedef Lib3MFResult (*PLib3MFComposeVectorNode_GetOutputResultPtr) (Lib3MF_Comp * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputVectorPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputAPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component @@ -6467,7 +6467,7 @@ typedef struct { PLib3MFComposeVectorNode_GetInputYPtr m_ComposeVectorNode_GetInputY; PLib3MFComposeVectorNode_GetInputZPtr m_ComposeVectorNode_GetInputZ; PLib3MFComposeVectorNode_GetOutputResultPtr m_ComposeVectorNode_GetOutputResult; - PLib3MFDecomposeVectorNode_GetInputVectorPtr m_DecomposeVectorNode_GetInputVector; + PLib3MFDecomposeVectorNode_GetInputAPtr m_DecomposeVectorNode_GetInputA; PLib3MFDecomposeVectorNode_GetOutputXPtr m_DecomposeVectorNode_GetOutputX; PLib3MFDecomposeVectorNode_GetOutputYPtr m_DecomposeVectorNode_GetOutputY; PLib3MFDecomposeVectorNode_GetOutputZPtr m_DecomposeVectorNode_GetOutputZ; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index abcfd27c7..faff3f8bc 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -342,7 +342,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ComposeVectorNode_GetInputY = NULL; pWrapperTable->m_ComposeVectorNode_GetInputZ = NULL; pWrapperTable->m_ComposeVectorNode_GetOutputResult = NULL; - pWrapperTable->m_DecomposeVectorNode_GetInputVector = NULL; + pWrapperTable->m_DecomposeVectorNode_GetInputA = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputX = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputY = NULL; pWrapperTable->m_DecomposeVectorNode_GetOutputZ = NULL; @@ -3324,12 +3324,12 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) GetProcAddress(hLibrary, "lib3mf_decomposevectornode_getinputa"); #else // _WIN32 - pWrapperTable->m_DecomposeVectorNode_GetInputVector = (PLib3MFDecomposeVectorNode_GetInputVectorPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputvector"); + pWrapperTable->m_DecomposeVectorNode_GetInputA = (PLib3MFDecomposeVectorNode_GetInputAPtr) dlsym(hLibrary, "lib3mf_decomposevectornode_getinputa"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_DecomposeVectorNode_GetInputVector == NULL) + if (pWrapperTable->m_DecomposeVectorNode_GetInputA == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 536e869f0..d48fed69c 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -3234,10 +3234,10 @@ typedef Lib3MFResult (*PLib3MFComposeVectorNode_GetOutputResultPtr) (Lib3MF_Comp * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputVectorPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +typedef Lib3MFResult (*PLib3MFDecomposeVectorNode_GetInputAPtr) (Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component @@ -6467,7 +6467,7 @@ typedef struct { PLib3MFComposeVectorNode_GetInputYPtr m_ComposeVectorNode_GetInputY; PLib3MFComposeVectorNode_GetInputZPtr m_ComposeVectorNode_GetInputZ; PLib3MFComposeVectorNode_GetOutputResultPtr m_ComposeVectorNode_GetOutputResult; - PLib3MFDecomposeVectorNode_GetInputVectorPtr m_DecomposeVectorNode_GetInputVector; + PLib3MFDecomposeVectorNode_GetInputAPtr m_DecomposeVectorNode_GetInputA; PLib3MFDecomposeVectorNode_GetOutputXPtr m_DecomposeVectorNode_GetOutputX; PLib3MFDecomposeVectorNode_GetOutputYPtr m_DecomposeVectorNode_GetOutputY; PLib3MFDecomposeVectorNode_GetOutputZPtr m_DecomposeVectorNode_GetOutputZ; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index b0084d8fa..e10ddbb32 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -13708,7 +13708,7 @@ void CLib3MFDecomposeVectorNode::Init() tpl->InstanceTemplate()->SetInternalFieldCount(NODEWRAPPER_FIELDCOUNT); // Prototype - NODE_SET_PROTOTYPE_METHOD(tpl, "GetInputVector", GetInputVector); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetInputA", GetInputA); NODE_SET_PROTOTYPE_METHOD(tpl, "GetOutputX", GetOutputX); NODE_SET_PROTOTYPE_METHOD(tpl, "GetOutputY", GetOutputY); NODE_SET_PROTOTYPE_METHOD(tpl, "GetOutputZ", GetOutputZ); @@ -13745,22 +13745,22 @@ Local CLib3MFDecomposeVectorNode::NewInstance(Local pParent, Lib } -void CLib3MFDecomposeVectorNode::GetInputVector(const FunctionCallbackInfo& args) +void CLib3MFDecomposeVectorNode::GetInputA(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); try { - Lib3MFHandle hReturnVector = nullptr; + Lib3MFHandle hReturnA = nullptr; sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method GetInputVector."); - if (wrapperTable->m_DecomposeVectorNode_GetInputVector == nullptr) - throw std::runtime_error("Could not call Lib3MF method DecomposeVectorNode::GetInputVector."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetInputA."); + if (wrapperTable->m_DecomposeVectorNode_GetInputA == nullptr) + throw std::runtime_error("Could not call Lib3MF method DecomposeVectorNode::GetInputA."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_DecomposeVectorNode_GetInputVector(instanceHandle, &hReturnVector); + Lib3MFResult errorCode = wrapperTable->m_DecomposeVectorNode_GetInputA(instanceHandle, &hReturnA); CheckError(isolate, wrapperTable, instanceHandle, errorCode); - Local instanceObjVector = CLib3MFImplicitPort::NewInstance(args.Holder(), hReturnVector); - args.GetReturnValue().Set(instanceObjVector); + Local instanceObjA = CLib3MFImplicitPort::NewInstance(args.Holder(), hReturnA); + args.GetReturnValue().Set(instanceObjA); } catch (std::exception & E) { RaiseError(isolate, E.what()); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index ef08a5480..802fda68b 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -1849,7 +1849,7 @@ class CLib3MFDecomposeVectorNode : public CLib3MFBaseClass { private: static void New(const v8::FunctionCallbackInfo& args); static v8::Persistent constructor; - static void GetInputVector(const v8::FunctionCallbackInfo& args); + static void GetInputA(const v8::FunctionCallbackInfo& args); static void GetOutputX(const v8::FunctionCallbackInfo& args); static void GetOutputY(const v8::FunctionCallbackInfo& args); static void GetOutputZ(const v8::FunctionCallbackInfo& args); diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index d3444c2be..5b03b10f0 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -3863,10 +3863,10 @@ TLib3MFModel = class; * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. - * @param[out] pVector - the input + * @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) *) - TLib3MFDecomposeVectorNode_GetInputVectorFunc = function(pDecomposeVectorNode: TLib3MFHandle; out pVector: TLib3MFHandle): TLib3MFResult; cdecl; + TLib3MFDecomposeVectorNode_GetInputAFunc = function(pDecomposeVectorNode: TLib3MFHandle; out pA: TLib3MFHandle): TLib3MFResult; cdecl; (** * Retrieves the output for the x component @@ -8104,7 +8104,7 @@ TLib3MFDecomposeVectorNode = class(TLib3MFImplicitNode) public constructor Create(AWrapper: TLib3MFWrapper; AHandle: TLib3MFHandle); destructor Destroy; override; - function GetInputVector(): TLib3MFImplicitPort; + function GetInputA(): TLib3MFImplicitPort; function GetOutputX(): TLib3MFImplicitPort; function GetOutputY(): TLib3MFImplicitPort; function GetOutputZ(): TLib3MFImplicitPort; @@ -8922,7 +8922,7 @@ TLib3MFWrapper = class(TObject) FLib3MFComposeVectorNode_GetInputYFunc: TLib3MFComposeVectorNode_GetInputYFunc; FLib3MFComposeVectorNode_GetInputZFunc: TLib3MFComposeVectorNode_GetInputZFunc; FLib3MFComposeVectorNode_GetOutputResultFunc: TLib3MFComposeVectorNode_GetOutputResultFunc; - FLib3MFDecomposeVectorNode_GetInputVectorFunc: TLib3MFDecomposeVectorNode_GetInputVectorFunc; + FLib3MFDecomposeVectorNode_GetInputAFunc: TLib3MFDecomposeVectorNode_GetInputAFunc; FLib3MFDecomposeVectorNode_GetOutputXFunc: TLib3MFDecomposeVectorNode_GetOutputXFunc; FLib3MFDecomposeVectorNode_GetOutputYFunc: TLib3MFDecomposeVectorNode_GetOutputYFunc; FLib3MFDecomposeVectorNode_GetOutputZFunc: TLib3MFDecomposeVectorNode_GetOutputZFunc; @@ -9507,7 +9507,7 @@ TLib3MFWrapper = class(TObject) property Lib3MFComposeVectorNode_GetInputYFunc: TLib3MFComposeVectorNode_GetInputYFunc read FLib3MFComposeVectorNode_GetInputYFunc; property Lib3MFComposeVectorNode_GetInputZFunc: TLib3MFComposeVectorNode_GetInputZFunc read FLib3MFComposeVectorNode_GetInputZFunc; property Lib3MFComposeVectorNode_GetOutputResultFunc: TLib3MFComposeVectorNode_GetOutputResultFunc read FLib3MFComposeVectorNode_GetOutputResultFunc; - property Lib3MFDecomposeVectorNode_GetInputVectorFunc: TLib3MFDecomposeVectorNode_GetInputVectorFunc read FLib3MFDecomposeVectorNode_GetInputVectorFunc; + property Lib3MFDecomposeVectorNode_GetInputAFunc: TLib3MFDecomposeVectorNode_GetInputAFunc read FLib3MFDecomposeVectorNode_GetInputAFunc; property Lib3MFDecomposeVectorNode_GetOutputXFunc: TLib3MFDecomposeVectorNode_GetOutputXFunc read FLib3MFDecomposeVectorNode_GetOutputXFunc; property Lib3MFDecomposeVectorNode_GetOutputYFunc: TLib3MFDecomposeVectorNode_GetOutputYFunc read FLib3MFDecomposeVectorNode_GetOutputYFunc; property Lib3MFDecomposeVectorNode_GetOutputZFunc: TLib3MFDecomposeVectorNode_GetOutputZFunc read FLib3MFDecomposeVectorNode_GetOutputZFunc; @@ -15130,15 +15130,15 @@ implementation inherited; end; - function TLib3MFDecomposeVectorNode.GetInputVector(): TLib3MFImplicitPort; + function TLib3MFDecomposeVectorNode.GetInputA(): TLib3MFImplicitPort; var - HVector: TLib3MFHandle; + HA: TLib3MFHandle; begin Result := nil; - HVector := nil; - FWrapper.CheckError(Self, FWrapper.Lib3MFDecomposeVectorNode_GetInputVectorFunc(FHandle, HVector)); - if Assigned(HVector) then - Result := TLib3MFPolymorphicFactory.Make(FWrapper, HVector); + HA := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFDecomposeVectorNode_GetInputAFunc(FHandle, HA)); + if Assigned(HA) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HA); end; function TLib3MFDecomposeVectorNode.GetOutputX(): TLib3MFImplicitPort; @@ -18493,7 +18493,7 @@ implementation FLib3MFComposeVectorNode_GetInputYFunc := LoadFunction('lib3mf_composevectornode_getinputy'); FLib3MFComposeVectorNode_GetInputZFunc := LoadFunction('lib3mf_composevectornode_getinputz'); FLib3MFComposeVectorNode_GetOutputResultFunc := LoadFunction('lib3mf_composevectornode_getoutputresult'); - FLib3MFDecomposeVectorNode_GetInputVectorFunc := LoadFunction('lib3mf_decomposevectornode_getinputvector'); + FLib3MFDecomposeVectorNode_GetInputAFunc := LoadFunction('lib3mf_decomposevectornode_getinputa'); FLib3MFDecomposeVectorNode_GetOutputXFunc := LoadFunction('lib3mf_decomposevectornode_getoutputx'); FLib3MFDecomposeVectorNode_GetOutputYFunc := LoadFunction('lib3mf_decomposevectornode_getoutputy'); FLib3MFDecomposeVectorNode_GetOutputZFunc := LoadFunction('lib3mf_decomposevectornode_getoutputz'); @@ -19667,7 +19667,7 @@ implementation AResult := ALookupMethod(PAnsiChar('lib3mf_composevectornode_getoutputresult'), @FLib3MFComposeVectorNode_GetOutputResultFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_decomposevectornode_getinputvector'), @FLib3MFDecomposeVectorNode_GetInputVectorFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_decomposevectornode_getinputa'), @FLib3MFDecomposeVectorNode_GetInputAFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_decomposevectornode_getoutputx'), @FLib3MFDecomposeVectorNode_GetOutputXFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index 64352c731..c015bfb97 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -428,7 +428,7 @@ class FunctionTable: lib3mf_composevectornode_getinputy = None lib3mf_composevectornode_getinputz = None lib3mf_composevectornode_getoutputresult = None - lib3mf_decomposevectornode_getinputvector = None + lib3mf_decomposevectornode_getinputa = None lib3mf_decomposevectornode_getoutputx = None lib3mf_decomposevectornode_getoutputy = None lib3mf_decomposevectornode_getoutputz = None @@ -2975,11 +2975,11 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) self.lib.lib3mf_composevectornode_getoutputresult = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_decomposevectornode_getinputvector")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_decomposevectornode_getinputa")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) - self.lib.lib3mf_decomposevectornode_getinputvector = methodType(int(methodAddress.value)) + self.lib.lib3mf_decomposevectornode_getinputa = methodType(int(methodAddress.value)) err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_decomposevectornode_getoutputx")), methodAddress) if err != 0: @@ -5491,8 +5491,8 @@ def _loadFunctionTable(self): self.lib.lib3mf_composevectornode_getoutputresult.restype = ctypes.c_int32 self.lib.lib3mf_composevectornode_getoutputresult.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] - self.lib.lib3mf_decomposevectornode_getinputvector.restype = ctypes.c_int32 - self.lib.lib3mf_decomposevectornode_getinputvector.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_decomposevectornode_getinputa.restype = ctypes.c_int32 + self.lib.lib3mf_decomposevectornode_getinputa.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] self.lib.lib3mf_decomposevectornode_getoutputx.restype = ctypes.c_int32 self.lib.lib3mf_decomposevectornode_getoutputx.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] @@ -9598,15 +9598,15 @@ def GetOutputResult(self): class DecomposeVectorNode(ImplicitNode): def __init__(self, handle, wrapper): ImplicitNode.__init__(self, handle, wrapper) - def GetInputVector(self): - VectorHandle = ctypes.c_void_p() - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_decomposevectornode_getinputvector(self._handle, VectorHandle)) - if VectorHandle: - VectorObject = self._wrapper._polymorphicFactory(VectorHandle) + def GetInputA(self): + AHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_decomposevectornode_getinputa(self._handle, AHandle)) + if AHandle: + AObject = self._wrapper._polymorphicFactory(AHandle) else: raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') - return VectorObject + return AObject def GetOutputX(self): XHandle = ctypes.c_void_p() diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index f33231f20..1671c3d43 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -3247,10 +3247,10 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_composevectornode_getoutputresult(Lib3MF_Com * Retrieves the input * * @param[in] pDecomposeVectorNode - DecomposeVectorNode instance. -* @param[out] pVector - the input +* @param[out] pA - the input port for the vector to decompose * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_decomposevectornode_getinputvector(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_decomposevectornode_getinputa(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA); /** * Retrieves the output for the x component diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index 426d407d6..2bc79fa70 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -4002,10 +4002,10 @@ class IDecomposeVectorNode : public virtual IImplicitNode { } /** - * IDecomposeVectorNode::GetInputVector - Retrieves the input - * @return the input + * IDecomposeVectorNode::GetInputA - Retrieves the input + * @return the input port for the vector to decompose */ - virtual IImplicitPort * GetInputVector() = 0; + virtual IImplicitPort * GetInputA() = 0; /** * IDecomposeVectorNode::GetOutputX - Retrieves the output for the x component diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index 895489a65..2745a7873 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -11215,27 +11215,27 @@ Lib3MFResult lib3mf_composevectornode_getoutputresult(Lib3MF_ComposeVectorNode p /************************************************************************************************************************* Class implementation for DecomposeVectorNode **************************************************************************************************************************/ -Lib3MFResult lib3mf_decomposevectornode_getinputvector(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pVector) +Lib3MFResult lib3mf_decomposevectornode_getinputa(Lib3MF_DecomposeVectorNode pDecomposeVectorNode, Lib3MF_ImplicitPort * pA) { IBase* pIBaseClass = (IBase *)pDecomposeVectorNode; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pDecomposeVectorNode, "DecomposeVectorNode", "GetInputVector"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pDecomposeVectorNode, "DecomposeVectorNode", "GetInputA"); } - if (pVector == nullptr) + if (pA == nullptr) throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); - IBase* pBaseVector(nullptr); + IBase* pBaseA(nullptr); IDecomposeVectorNode* pIDecomposeVectorNode = dynamic_cast(pIBaseClass); if (!pIDecomposeVectorNode) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pBaseVector = pIDecomposeVectorNode->GetInputVector(); + pBaseA = pIDecomposeVectorNode->GetInputA(); - *pVector = (IBase*)(pBaseVector); + *pA = (IBase*)(pBaseA); if (pJournalEntry.get() != nullptr) { - pJournalEntry->addHandleResult("Vector", *pVector); + pJournalEntry->addHandleResult("A", *pA); pJournalEntry->writeSuccess(); } return LIB3MF_SUCCESS; @@ -22227,8 +22227,8 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_composevectornode_getinputz; if (sProcName == "lib3mf_composevectornode_getoutputresult") *ppProcAddress = (void*) &lib3mf_composevectornode_getoutputresult; - if (sProcName == "lib3mf_decomposevectornode_getinputvector") - *ppProcAddress = (void*) &lib3mf_decomposevectornode_getinputvector; + if (sProcName == "lib3mf_decomposevectornode_getinputa") + *ppProcAddress = (void*) &lib3mf_decomposevectornode_getinputa; if (sProcName == "lib3mf_decomposevectornode_getoutputx") *ppProcAddress = (void*) &lib3mf_decomposevectornode_getoutputx; if (sProcName == "lib3mf_decomposevectornode_getoutputy") diff --git a/AutomaticComponentToolkit/lib3mf.xml b/AutomaticComponentToolkit/lib3mf.xml index dfcac4eb9..18386b0a7 100644 --- a/AutomaticComponentToolkit/lib3mf.xml +++ b/AutomaticComponentToolkit/lib3mf.xml @@ -2183,9 +2183,9 @@ - - + + m_graphData; + + DependencySet m_vertices; + }; +} diff --git a/Include/Common/Graph/GraphAlgorithms.h b/Include/Common/Graph/GraphAlgorithms.h new file mode 100644 index 000000000..05ec3758c --- /dev/null +++ b/Include/Common/Graph/GraphAlgorithms.h @@ -0,0 +1,40 @@ +/*++ + +Copyright (C) 2023 3MF Consortium + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification,276529 +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--*/ + +#pragma once + +#include "IDirectedGraph.h" +#include +#include +#include +#include + +namespace NMR::common::graph +{ + VertexList topologicalSort(const IDirectedGraph & graph); +} diff --git a/Include/Common/Graph/IDirectedGraph.h b/Include/Common/Graph/IDirectedGraph.h new file mode 100644 index 000000000..b696dece6 --- /dev/null +++ b/Include/Common/Graph/IDirectedGraph.h @@ -0,0 +1,56 @@ +/*++ + +Copyright (C) 2023 3MF Consortium + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification,276529 +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--*/ + +#pragma once + +#include +#include + +namespace NMR::common::graph +{ + using Identifier = int; + using DependencySet = std::set; + using VertexList = std::vector; + + class IDirectedGraph + { + public: + explicit IDirectedGraph(std::size_t const /*unused*/){}; + virtual ~IDirectedGraph() = default; + virtual void addDependency(Identifier id, Identifier idOfDependency) = 0; + virtual void removeDependency(Identifier id, Identifier idOfDependency) = 0; + [[nodiscard]] virtual bool isDirectlyDependingOn(Identifier id, + Identifier dependencyInQuestion) const = 0; + + [[nodiscard]] virtual std::size_t getSize() const = 0; + virtual void removeVertex(Identifier id) = 0; + virtual void addVertex(Identifier id) = 0; + + [[nodiscard]] virtual DependencySet const & getVertices() const = 0; + }; +} // namespace gladius::nodes::graph diff --git a/Include/Model/Classes/NMR_ModelImplicitFunction.h b/Include/Model/Classes/NMR_ModelImplicitFunction.h index 7f8bdd1bd..ae90a4719 100644 --- a/Include/Model/Classes/NMR_ModelImplicitFunction.h +++ b/Include/Model/Classes/NMR_ModelImplicitFunction.h @@ -95,8 +95,7 @@ namespace NMR void addLink(const ImplicitIdentifier& sSourceNodeIdentifier, const ImplicitIdentifier& sTargetNodeIdentifier); - void addLink(CModelImplicitPort const& pSourcePort, - CModelImplicitPort& pTargetPort); + void addLink(PModelImplicitPort pSourcePort, PModelImplicitPort pTargetPort); implicit::NodeTypes const& getNodeTypes() const; @@ -124,7 +123,7 @@ namespace NMR * children. * */ - void sortNodesTopologically() const; + void sortNodesTopologically(); PModelImplicitPort findPort(const ImplicitIdentifier& sIdentifier) const; }; diff --git a/Include/Model/Classes/NMR_ModelImplicitPort.h b/Include/Model/Classes/NMR_ModelImplicitPort.h index e73acec76..f6a1505b6 100644 --- a/Include/Model/Classes/NMR_ModelImplicitPort.h +++ b/Include/Model/Classes/NMR_ModelImplicitPort.h @@ -35,12 +35,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Model/Classes/NMR_ModelImplicitPortNames.h" + namespace NMR { using ImplicitIdentifier = std::string; class CModelImplicitNode; class CModelImplicitPort; + class CModelImplicitFunction; class CModelImplicitPort { @@ -49,21 +51,20 @@ namespace NMR ImplicitIdentifier m_identifier; std::string m_displayname; Lib3MF::eImplicitPortType m_type = Lib3MF::eImplicitPortType::Scalar; - ImplicitIdentifier m_reference; - std::shared_ptr m_referencedPort; - + + mutable std::shared_ptr m_referencedPort; + ImplicitIdentifier m_reference; // m_reference might seem redundant, but it can be set if the dependency does not exist yet + + void updateReference() const; + public: CModelImplicitPort(CModelImplicitNode * parent, ImplicitIdentifier const & identifier, std::string const & displayname); + CModelImplicitPort(ImplicitIdentifier const & identifier, std::string const & displayname, Lib3MF::eImplicitPortType type); - CModelImplicitPort(ImplicitIdentifier const & identifier, - std::string const & displayname, - Lib3MF::eImplicitPortType type, - ImplicitIdentifier const & reference); - CModelImplicitPort() = delete; ImplicitIdentifier const & getIdentifier() const; std::string const & getDisplayName() const; @@ -73,12 +74,13 @@ namespace NMR Lib3MF::eImplicitPortType getType() const; void setType(Lib3MF::eImplicitPortType type); - ImplicitIdentifier const & getReference() const; + ImplicitIdentifier getReference() const; void setReference(ImplicitIdentifier const & reference); CModelImplicitNode * getParent() const; std::shared_ptr getReferencedPort() const; + void setReferencedPort(std::shared_ptr const & referencedPort); }; using PModelImplicitPort = std::shared_ptr; diff --git a/Source/API/lib3mf_decomposevectornode.cpp b/Source/API/lib3mf_decomposevectornode.cpp index 9fee50f78..e4e2d9c2b 100644 --- a/Source/API/lib3mf_decomposevectornode.cpp +++ b/Source/API/lib3mf_decomposevectornode.cpp @@ -40,9 +40,9 @@ using namespace Lib3MF::Impl; Class definition of CDecomposeVectorNode **************************************************************************************************************************/ -IImplicitPort * CDecomposeVectorNode::GetInputVector() +IImplicitPort * CDecomposeVectorNode::GetInputA() { - return FindInput("vector"); + return FindInput("A"); } IImplicitPort * CDecomposeVectorNode::GetOutputX() diff --git a/Source/API/lib3mf_implicitfunction.cpp b/Source/API/lib3mf_implicitfunction.cpp index e455af4d0..1559e069e 100644 --- a/Source/API/lib3mf_implicitfunction.cpp +++ b/Source/API/lib3mf_implicitfunction.cpp @@ -659,7 +659,7 @@ void CImplicitFunction::AddLink(IImplicitPort* pSource, IImplicitPort* pTarget) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM); } - function()->addLink(*pSourcePort->getPort(), *pTargetPort->getPort()); + function()->addLink(pSourcePort->getPort(), pTargetPort->getPort()); } void CImplicitFunction::AddLinkByNames(const std::string& sSource, diff --git a/Source/Common/Graph/DirectedGraph.cpp b/Source/Common/Graph/DirectedGraph.cpp new file mode 100644 index 000000000..79be626df --- /dev/null +++ b/Source/Common/Graph/DirectedGraph.cpp @@ -0,0 +1,97 @@ +/*++ + +Copyright (C) 2023 3MF Consortium + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification,276529 +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--*/ + +#include "Common/Graph/DirectedGraph.h" + +#include + +namespace NMR::common::graph +{ + DirectedGraph::DirectedGraph(size_t const size) + : IDirectedGraph(size) + , m_size(size) + , m_graphData(m_size * m_size, false) + { + } + + void DirectedGraph::addDependency(Identifier id, Identifier idOfDependency) + { + addVertex(id); + addVertex(idOfDependency); + if (id == idOfDependency) + { + return; + } + auto const index = id * m_size + idOfDependency; + m_graphData[index] = true; + } + + void DirectedGraph::removeDependency(Identifier id, Identifier idOfDependency) + { + auto const index = id * m_size + idOfDependency; + m_graphData[index] = false; + } + + bool DirectedGraph::isDirectlyDependingOn(Identifier id, Identifier dependencyInQuestion) const + { + auto const index = id * m_size + dependencyInQuestion; + return m_graphData[index]; + } + + size_t DirectedGraph::getSize() const + { + return m_size; + } + + void DirectedGraph::removeVertex(Identifier id) + { + auto const iterElemToRemove = std::find(std::begin(m_vertices), std::end(m_vertices), id); + if (iterElemToRemove == std::end(m_vertices)) + { + return; + } + m_vertices.erase(iterElemToRemove); + + for (auto vertex : m_vertices) + { + removeDependency(id, vertex); + removeDependency(vertex, id); + } + } + + DependencySet const& DirectedGraph::getVertices() const + { + return m_vertices; + } + + void DirectedGraph::addVertex(Identifier id) + { + m_vertices.insert(id); + } + +} // namespace gladius::nodes::graph diff --git a/Source/Common/Graph/GraphAlgorithms.cpp b/Source/Common/Graph/GraphAlgorithms.cpp new file mode 100644 index 000000000..a6999686b --- /dev/null +++ b/Source/Common/Graph/GraphAlgorithms.cpp @@ -0,0 +1,133 @@ +/*++ + +Copyright (C) 2023 3MF Consortium + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification,276529 +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--*/ + +#include "Common/Graph/GraphAlgorithms.h" +#include "Common/Graph/IDirectedGraph.h" + +#include +#include +#include +#include + +namespace NMR::common::graph +{ + bool isCyclicUtil(const IDirectedGraph & graph, Identifier node, std::vector & visited, std::vector & recStack) + { + if (!visited[node]) + { + visited[node] = true; + recStack[node] = true; + + for (auto dep = 0; dep < static_cast(graph.getSize()); ++dep) + { + if (graph.isDirectlyDependingOn(node, dep)) + { + if (!visited[dep] && isCyclicUtil(graph, dep, visited, recStack)) + { + return true; + } + else if (recStack[dep]) + { + return true; + } + } + } + } + recStack[node] = false; + return false; + } + + bool isCyclic(const IDirectedGraph & graph) + { + std::vector visited(graph.getSize(), false); + std::vector recStack(graph.getSize(), false); + + for (auto id = 0; id < static_cast(graph.getSize()); ++id) + { + if (isCyclicUtil(graph, id, visited, recStack)) + { + return true; + } + } + return false; + } + + VertexList topologicalSort(const IDirectedGraph & graph) + { + if (isCyclic(graph)) + { + return {}; + } + + // tsort based on DFS + enum class NodeType + { + CHILD, + PARENT + }; + std::stack> nodesToVisit; + std::vector visited(graph.getSize(), false); + VertexList topologicalOrder; + + for (auto id = 0; id < static_cast(graph.getSize()); ++id) + { + if (!visited[id]) + { + nodesToVisit.push({NodeType::CHILD, id}); + + while (!nodesToVisit.empty()) + { + auto [nodeType, nodeId] = nodesToVisit.top(); + nodesToVisit.pop(); + + if (nodeType == NodeType::PARENT) + { + topologicalOrder.push_back(nodeId); + continue; + } + + visited[nodeId] = true; + nodesToVisit.push({NodeType::PARENT, nodeId}); + + for (auto dep = 0; dep < static_cast(graph.getSize()); ++dep) + { + if (!visited[dep]) + { + if (graph.isDirectlyDependingOn(nodeId, dep)) + { + nodesToVisit.push({NodeType::CHILD, dep}); + } + } + } + + } + } + } + return topologicalOrder; + } +} // namespace gladius::nodes::graph diff --git a/Source/Model/Classes/NMR_ModelImplicitFunction.cpp b/Source/Model/Classes/NMR_ModelImplicitFunction.cpp index 54aecd72e..dafa2c74e 100644 --- a/Source/Model/Classes/NMR_ModelImplicitFunction.cpp +++ b/Source/Model/Classes/NMR_ModelImplicitFunction.cpp @@ -34,11 +34,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Model/Classes/NMR_ImplicitNodeTypes.h" #include "Model/Classes/NMR_ModelImplicitFunction.h" #include "Model/Classes/NMR_ModelImplicitPort.h" +#include "Common/Graph/GraphAlgorithms.h" +#include "Common/Graph/DirectedGraph.h" #include #include - namespace NMR { const implicit::NodeTypes CModelImplicitFunction::m_nodeTypes; @@ -196,53 +197,52 @@ namespace NMR "."); } + + targetPort->setReferencedPort(sourcePort); + } - targetPort->setReference(sSourceNodeIdentifier); - if(sourcePort) + void CModelImplicitFunction::addLink(PModelImplicitPort pSourcePort, + PModelImplicitPort pTargetPort) + { + if (!pSourcePort) { - sourcePort->setReference( - sTargetNodeIdentifier); // won't be visible in the xml + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Source port is nullptr."); } - } - void CModelImplicitFunction::addLink(CModelImplicitPort const & pSourcePort, - CModelImplicitPort & pTargetPort) - { - if(pSourcePort.getType() != pTargetPort.getType()) + if (!pTargetPort) + { + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Target port is nullptr."); + } + + if(pSourcePort->getType() != pTargetPort->getType()) { std::string sourceNodeIdentifier = "function inputs"; std::string targetNodeIdentifier = "function outputs"; - if(pSourcePort.getParent()) + if(pSourcePort->getParent()) { - sourceNodeIdentifier = pSourcePort.getParent()->getIdentifier(); + sourceNodeIdentifier = pSourcePort->getParent()->getIdentifier(); } - if(pTargetPort.getParent()) + if(pTargetPort->getParent()) { - targetNodeIdentifier = pTargetPort.getParent()->getIdentifier(); + targetNodeIdentifier = pTargetPort->getParent()->getIdentifier(); } throw ELib3MFInterfaceException( LIB3MF_ERROR_INCOMPATIBLEPORTTYPES, - "Output " + pSourcePort.getIdentifier() + " of node " + + "Output " + pSourcePort->getIdentifier() + " of node " + sourceNodeIdentifier + " has type " + - std::to_string(static_cast(pSourcePort.getType())) + - " while target input " + pTargetPort.getIdentifier() + + std::to_string(static_cast(pSourcePort->getType())) + + " while target input " + pTargetPort->getIdentifier() + " of node " + targetNodeIdentifier + " has type " + - std::to_string(static_cast(pTargetPort.getType())) + + std::to_string(static_cast(pTargetPort->getType())) + "."); } - if(pSourcePort.getParent() == - nullptr) // That is the case for a function input - { - pTargetPort.setReference(pSourcePort.getIdentifier()); - - return; - } - pTargetPort.setReference( - makeReferenceIdentifier(pSourcePort.getParent()->getIdentifier(), - pSourcePort.getIdentifier())); + + pTargetPort->setReferencedPort(pSourcePort); } implicit::NodeTypes const& CModelImplicitFunction::getNodeTypes() const @@ -313,94 +313,111 @@ namespace NMR return sNodeIdentifier + "." + sPortIdentifier; } - void CModelImplicitFunction::sortNodesTopologically() const + NMR::common::graph::DirectedGraph directedGraphFromNodes(const PImplicitNodes & nodes) { - // Assign an id to each node - for (size_t i = 0; i < m_nodes->size(); ++i) + if (!nodes) { - (*m_nodes)[i]->setGraphID(static_cast(i)); + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Nodes must not be nullptr."); } - std::unordered_map> graph; - std::unordered_map indegree; + using namespace NMR::common; + graph::DirectedGraph graph(nodes->size()+1); - // Build the graph and calculate the indegree of each node - for (auto const& node : *m_nodes) + std::unordered_map identifierToIndex; + graph::Identifier InputsIndex = 0; + + graph::Identifier index = 1; + for (auto const& node : *nodes) { - auto const& id = node->getGraphID(); - indegree[id] = 0; - for (auto const& port : *node->getInputs()) + if (!node) { - auto const& referenceName = port->getReference(); - if (referenceName.empty()) - { - throw ELib3MFInterfaceException( - LIB3MF_ERROR_INPUTNOTSET, - "Input " + port->getIdentifier() + " of node " + - node->getIdentifier() + " is not set."); - } - auto const& sourceNodeName = extractNodeName(referenceName); - if (sourceNodeName == "inputs") - { - continue; - } - CModelImplicitNode* sourceNode = findNode(sourceNodeName); - if (sourceNode == nullptr) - { - throw ELib3MFInterfaceException( - LIB3MF_ERROR_INVALIDPARAM, - "Input " + port->getIdentifier() + " of node " + - node->getIdentifier() + - " references a non-existing node " + - sourceNodeName + "."); - } - auto const& sourceId = sourceNode->getGraphID(); - graph[sourceId].push_back(id); - ++indegree[id]; + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Node must not be nullptr."); } + + auto const& identifier = node->getIdentifier(); + identifierToIndex[identifier] = index; + ++index; } - // Perform the topological sort - std::queue q; - for (auto const& entry : indegree) + for (auto const& node : *nodes) { - auto const& id = entry.first; - auto const& degree = entry.second; - if (degree == 0) + auto const& inputs = node->getInputs(); + + if (!inputs) { - q.push(id); + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Inputs must not be nullptr."); } - } - std::vector sortedNodes; - while (!q.empty()) - { - auto const& id = q.front(); - q.pop(); - sortedNodes.push_back(id); - for (auto const& neighbor : graph[id]) + for (auto const& input : *inputs) { - --indegree[neighbor]; - if (indegree[neighbor] == 0) + auto const& sourcePort = input->getReferencedPort(); + if (sourcePort) { - q.push(neighbor); + auto const& sourceNode = sourcePort->getParent(); + if (sourceNode) + { + auto const& sourceNodeIdentifier = sourceNode->getIdentifier(); + auto const& sourcePortIdentifier = sourcePort->getIdentifier(); + graph::Identifier const sourceIndex = identifierToIndex[sourceNodeIdentifier]; + graph::Identifier const targetIndex = identifierToIndex[node->getIdentifier()]; + if (sourceIndex >= graph.getSize()) + { + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Source index " + std::to_string(sourceIndex) + " is out of range."); + } + + if (targetIndex >= graph.getSize()) + { + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Target index " + std::to_string(targetIndex) + " is out of range."); + } + graph.addDependency(sourceIndex, targetIndex); + } + else + { + graph.addDependency(InputsIndex, identifierToIndex[node->getIdentifier()]); + } } + } } + return graph; + } - // Check if there is a cycle in the graph - if (sortedNodes.size() != m_nodes->size()) + void CModelImplicitFunction::sortNodesTopologically() + { + using namespace NMR::common; + auto graph = directedGraphFromNodes(m_nodes); + auto const sortedIndices = NMR::common::graph::topologicalSort(graph); + if (sortedIndices.empty()) { - throw ELib3MFInterfaceException(LIB3MF_ERROR_GRAPHISCYCLIC, "The graph of the implicit function " + getIdentifier() + " is cyclic."); + throw ELib3MFInterfaceException(LIB3MF_ERROR_GRAPHISCYCLIC); } + + PImplicitNodes sortedNodes = std::make_shared(); + sortedNodes->reserve(sortedIndices.size()); - // Update the node order - std::vector newNodes(m_nodes->size()); - for (size_t i = 0; i < m_nodes->size(); ++i) + for (auto const & index : sortedIndices) { - newNodes[i] = (*m_nodes)[sortedNodes[i]]; + if (index == 0) + { + continue; + } + + auto nodeIndex = index - 1; + + if (nodeIndex >= m_nodes->size()) + { + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, + "Invalid node index " + std::to_string(nodeIndex) + ". Node index must be between 0 and " + std::to_string(m_nodes->size()) + "."); + } + + sortedNodes->push_back(m_nodes->at(nodeIndex)); } - m_nodes->swap(newNodes); + std::swap(m_nodes, sortedNodes); } PModelImplicitPort diff --git a/Source/Model/Classes/NMR_ModelImplicitPort.cpp b/Source/Model/Classes/NMR_ModelImplicitPort.cpp index 10de92f11..b97ce3054 100644 --- a/Source/Model/Classes/NMR_ModelImplicitPort.cpp +++ b/Source/Model/Classes/NMR_ModelImplicitPort.cpp @@ -30,11 +30,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Model/Classes/NMR_ModelImplicitNode.h" #include "Model/Classes/NMR_ModelImplicitFunction.h" #include "Common/NMR_Exception.h" +#include "lib3mf_interfaceexception.hpp" namespace NMR { CModelImplicitPort::CModelImplicitPort(CModelImplicitNode * parent, - ImplicitIdentifier const & identifier, std::string const & displayname) : m_parent(parent) @@ -52,17 +52,6 @@ namespace NMR { } - CModelImplicitPort::CModelImplicitPort(ImplicitIdentifier const & identifier, - std::string const & displayname, - Lib3MF::eImplicitPortType type, - ImplicitIdentifier const & reference) - : m_identifier(identifier) - , m_displayname(displayname) - , m_type(type) - , m_reference(reference) - { - } - ImplicitIdentifier const & CModelImplicitPort::getIdentifier() const { return m_identifier; @@ -93,22 +82,69 @@ namespace NMR m_type = type; } - ImplicitIdentifier const & CModelImplicitPort::getReference() const + ImplicitIdentifier CModelImplicitPort::getReference() const { - return m_reference; + if (!m_referencedPort) + { + updateReference(); + } + if (!m_referencedPort) + { + return m_reference; + } + + auto sourceParentNode = m_referencedPort->getParent(); + + if (!sourceParentNode) // Function input ports don't have a node as parent + { + return "inputs." + m_referencedPort->getIdentifier(); + } + + return makeReferenceIdentifier(sourceParentNode->getIdentifier(), m_referencedPort->getIdentifier()); } void CModelImplicitPort::setReference(ImplicitIdentifier const & reference) { - if (reference == m_reference) + m_referencedPort.reset(); + m_reference = reference; + updateReference(); + } + + CModelImplicitNode * CModelImplicitPort::getParent() const + { + return m_parent; + } + + std::shared_ptr CModelImplicitPort::getReferencedPort() const + { + if (!m_referencedPort) { - return; + updateReference(); + } + if (!m_referencedPort) + { + std::string nodeName; + if (m_parent) + { + nodeName = m_parent->getIdentifier(); + } + else + { + nodeName = "inputs"; + } + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM, "Referenced port of port " + nodeName + "." + m_identifier + " is not set."); } + return m_referencedPort; + } - m_referencedPort.reset(); + void CModelImplicitPort::setReferencedPort( + std::shared_ptr const & referencedPort) + { + m_referencedPort = referencedPort; + } - m_reference = reference; - + void CModelImplicitPort::updateReference() const + { if (!m_parent) { return; @@ -122,15 +158,4 @@ namespace NMR m_referencedPort = function->findPort(m_reference); } - - CModelImplicitNode * CModelImplicitPort::getParent() const - { - return m_parent; - } - - std::shared_ptr CModelImplicitPort::getReferencedPort() const - { - return m_referencedPort; - } - -} // namespace NMR +} //namespace NMR diff --git a/Tests/CPP_Bindings/Source/Volumetric.cpp b/Tests/CPP_Bindings/Source/Volumetric.cpp index e7a07786b..93766981b 100644 --- a/Tests/CPP_Bindings/Source/Volumetric.cpp +++ b/Tests/CPP_Bindings/Source/Volumetric.cpp @@ -49,7 +49,9 @@ namespace Lib3MF auto decomposePos = gyroidFunction->AddDecomposeVectorNode( "decomposePos", "decompose pos", "group_a"); - gyroidFunction->AddLinkByNames("inputs.pos", "decomposePos.A"); + auto inputPos = gyroidFunction->FindInput("pos"); + auto decomposePosInput = decomposePos->GetInputA(); + gyroidFunction->AddLink(inputPos, decomposePosInput); auto composeYZX = gyroidFunction->AddComposeVectorNode( "composeYZX", "compose yzx", "group_a"); @@ -369,7 +371,9 @@ namespace Lib3MF "multiplication 1", "group_a"); // Add some links - newFunction->AddLink(addNode->GetOutputResult().get(), subNode->GetInputA().get()); + auto outputResult = addNode->GetOutputResult(); + auto inputA = subNode->GetInputA(); + newFunction->AddLink(outputResult, inputA); // Alternative way to add links mulNode->FindInput("A")->SetReference("addition_1.result"); @@ -378,7 +382,8 @@ namespace Lib3MF newFunction->AddOutput("shape", "signed distance to the surface", Lib3MF::eImplicitPortType::Scalar); - newFunction->AddLink(subNode->GetOutputResult().get(), output.get()); + auto subNodeOutputResult = subNode->GetOutputResult(); + newFunction->AddLink(subNodeOutputResult, output); auto theMesh = GetMesh(); auto volumeData = theMesh->VolumeData(); @@ -1162,6 +1167,5 @@ namespace Lib3MF // Check that the nodes are sorted topologically EXPECT_TRUE(helper::isTopologiallySorted(function)); - } } // namespace Lib3MF