diff --git a/Source/Wrappers/CMakeLists.txt b/Source/Wrappers/CMakeLists.txt index d54fed7e9f94c02515019eb04e5273f3d8e3f950..8b227a7c533b54a47a2b1126da3c15ed1ef7ba46 100644 --- a/Source/Wrappers/CMakeLists.txt +++ b/Source/Wrappers/CMakeLists.txt @@ -42,7 +42,7 @@ if (MSVC) endif() set_target_properties(iMSTKCWrapper PROPERTIES - SWIG_COMPILE_OPTIONS "-namespace;imstk" + SWIG_COMPILE_OPTIONS "-namespace;Imstk" FOLDER Wrappers) if(iMSTK_SWIG_PINNED_ARRAY) set_target_properties(iMSTKCWrapper PROPERTIES diff --git a/Source/Wrappers/SwigInterface/common.i b/Source/Wrappers/SwigInterface/common.i index a40383b3c7b3d26c4a8fa4ad93de04a657cd4699..0680ffba9c50e7fac248eac2f0ed4b1c0be34ba4 100644 --- a/Source/Wrappers/SwigInterface/common.i +++ b/Source/Wrappers/SwigInterface/common.i @@ -4,6 +4,8 @@ #ifdef SWIG_PINNED_ARRAY %csmethodmodifiers imstk::VecDataArray::setValues "public unsafe"; %csmethodmodifiers imstk::VecDataArray::getValues "public unsafe"; + %csmethodmodifiers imstk::DataArray::setValues "public unsafe"; + %csmethodmodifiers imstk::DataArray::getValues "public unsafe"; #endif #ifdef SWIG_PINNED_ARRAY @@ -37,6 +39,8 @@ %rename(getValue) imstk::VecDataArray::operator[] (const size_t pos) const; %rename(setValue) imstk::VecDataArray::operator[] (const size_t pos); +%rename(getValue) imstk::DataArray::operator[] (const size_t pos) const; +%rename(setValue) imstk::DataArray::operator[] (const size_t pos); %rename(getValue) imstk::Vec::operator[] (const int pos) const; %rename(setValue) imstk::Vec::operator[] (const int pos); @@ -69,6 +73,30 @@ } }; %enddef +%define %extend_DataArray(T) + %extend imstk::DataArray<T> + { + void setValues(const T* val) + { + /* std::copy(val, val+$self->m_vecSize, $self->Base::m_data); */ + T* data = $self->DataArray<T>::getPointer(); + std::copy(val, val + $self->size(), data); + } + + void setValues(const T* val, const int n) + { + T* data = $self->DataArray<T>::getPointer(); + CHECK($self->size() >= n) << "number of values are larger than the array size"; + std::copy(val, val + n, data); + } + + void getValues(T* val) + { + T* data = $self->DataArray<T>::getPointer(); + std::copy(data, data+$self->size(), val); + } + }; +%enddef %extend_VecDataArray(float, 2) %extend_VecDataArray(double, 2) @@ -77,6 +105,11 @@ %extend_VecDataArray(unsigned char, 3) %extend_VecDataArray(int, 4) +%extend_DataArray(float) +%extend_DataArray(double) +%extend_DataArray(int) +%extend_DataArray(unsigned char) + %typemap(cscode) imstk::imstkQuatf %{ public static implicit operator SWIGTYPE_p_Eigen__QuaternionT_float_t (Quatf cs_data) diff --git a/Source/Wrappers/SwigInterface/imstkCWrapper.i b/Source/Wrappers/SwigInterface/imstkCWrapper.i index 4129f035354abdf54b2a66633afe4afe259e317b..304d9f0196472949e5dcdb6054549c0fdc1a994d 100644 --- a/Source/Wrappers/SwigInterface/imstkCWrapper.i +++ b/Source/Wrappers/SwigInterface/imstkCWrapper.i @@ -56,6 +56,7 @@ #include "imstkSurfaceMeshSubdivide.h" #include "imstkImplicitGeometryToImageData.h" #include "imstkSurfaceMeshFlyingEdges.h" +#include "imstkSelectEnclosedPoints.h" /* * MeshIO @@ -195,11 +196,14 @@ %include <stdint.i> %include <std_string.i> %include <std_vector.i> +%include <std_pair.i> namespace std { %template(VectorInt) vector<int>; %template(VectorSizet) vector<std::size_t>; %template(VectorCollisionElement) vector<imstk::CollisionElement>; + %template(PbdTypeStiffnessPair) pair<imstk::PbdConstraint::Type, double>; + %template(VectorPbdTypeStiffnessPair) vector<std::pair<imstk::PbdConstraint::Type, double>>; } %include "shared_ptr_instantiation.i" @@ -265,6 +269,7 @@ namespace std %include "../../Filtering/imstkSurfaceMeshSubdivide.h" %include "../../Filtering/imstkImplicitGeometryToImageData.h" %include "../../Filtering/imstkSurfaceMeshFlyingEdges.h" +%include "../../Filtering/imstkSelectEnclosedPoints.h" /* * MeshIO diff --git a/Source/Wrappers/SwigInterface/shared_ptr_instantiation.i b/Source/Wrappers/SwigInterface/shared_ptr_instantiation.i index 7738287fcc3310bb29cb1a4cca143d89d1aeff70..c6c3b71d13803c31be5d2e45ad55f6d087292a0d 100644 --- a/Source/Wrappers/SwigInterface/shared_ptr_instantiation.i +++ b/Source/Wrappers/SwigInterface/shared_ptr_instantiation.i @@ -58,6 +58,7 @@ %shared_ptr(imstk::SurfaceMeshSubdivide) %shared_ptr(imstk::ImplicitGeometryToImageData) %shared_ptr(imstk::SurfaceMeshFlyingEdges) +%shared_ptr(imstk::SelectEnclosedPoints) /* * DynamicalModel diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/femDeformable.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/femDeformable.cs index 82d85590b61b111e7dfff8bbebf38b2b2e735b53..bfc7ca094fcd888bab0453a4e678327b69ebdd17 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/femDeformable.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/femDeformable.cs @@ -1,4 +1,4 @@ -using imstk; +using Imstk; public enum Geom { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCloth.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCloth.cs index cb99c8288f1d952cc4fc8699b4e26bdf4b22591e..22c533d213405bee974146537b7779e0662db768 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCloth.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCloth.cs @@ -1,5 +1,5 @@ using System; -using imstk; +using Imstk; public class PbdCloth { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdClothCollision.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdClothCollision.cs index 980554ce711a850fe794935f738e707bbbf1a740..fc0d8e060441cbb4a103dfb5925ed662758d4b31 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdClothCollision.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdClothCollision.cs @@ -1,5 +1,5 @@ using System; -using imstk; +using Imstk; public class PbdCloth { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCollisionOneObject.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCollisionOneObject.cs index 1227f5e446cd71d9714ded497134c3fa4cab402f..7d9017653166725d443af8ea4ae3950be2a11e9c 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCollisionOneObject.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCollisionOneObject.cs @@ -1,4 +1,4 @@ -using imstk; +using Imstk; public class PbdCollisionOneObject { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCutting.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCutting.cs index d2155fab40538d671a8ffaf09d629fa04f8a0a76..4ed2e4fe71a883376c0c459bafe9c21f22f0dd63 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCutting.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdCutting.cs @@ -1,5 +1,5 @@ using System; -using imstk; +using Imstk; public class PbdCutting { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdVolume.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdVolume.cs index 1d9ef44439c9f31d252583f7e68f28aa4bf9f79a..5f0238595ca1603770808638db3f6b4be80c1d29 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdVolume.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/pbdVolume.cs @@ -1,4 +1,4 @@ -using imstk; +using Imstk; public class PbdVolume { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/rigidBody2.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/rigidBody2.cs index 0e1fcf60eecff560617c8388de8c6df83caea3ee..cc989649c53b0fd793ad1a2bb197ad0c63b17c56 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/rigidBody2.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/rigidBody2.cs @@ -1,5 +1,5 @@ using System; -using imstk; +using Imstk; public class RigidBody2 { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/sdfHaptics.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/sdfHaptics.cs index 467a7e13f0fa62ab3a4cd6f2d5445475f34e8235..e7275d9547980b0c93281eaf8bcb0d3dc6cc76bf 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/sdfHaptics.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/sdfHaptics.cs @@ -1,5 +1,5 @@ using System; -using imstk; +using Imstk; public class SdfHaptics { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/sphFluid.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/sphFluid.cs index fd49dc3b7ea4912514065b33bd97f4221b82bfb9..1ea800dcdc9930a59e5ca8a46e9827f077c0a6af 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/sphFluid.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/sphFluid.cs @@ -1,4 +1,4 @@ -using imstk; +using Imstk; public class PbdCloth { diff --git a/Source/Wrappers/iMSTKCSharpWrapper/Examples/testGeometry.cs b/Source/Wrappers/iMSTKCSharpWrapper/Examples/testGeometry.cs index 29ae8bb414f763e82086bb5297cf043607658528..50f4e24bff44503d138bfe0c81992f3275b2c59c 100644 --- a/Source/Wrappers/iMSTKCSharpWrapper/Examples/testGeometry.cs +++ b/Source/Wrappers/iMSTKCSharpWrapper/Examples/testGeometry.cs @@ -1,5 +1,5 @@ using System; -using imstk; +using Imstk; public class PbdCloth {