Skip to content

Commit

Permalink
Merge branch 'main' of github.com:gismo/gsCInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
eve70a committed Jul 26, 2024
2 parents cbf2714 + d6f6907 commit b23284c
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
18 changes: 18 additions & 0 deletions examples/geometry_cexample.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ int main(int argc, char* argv[])
if (irow==2) { printf("\n"); }
}


gsCMatrix * tMat = gsMatrix_create();
gsCVector * tVec = gsVector_create();
gsCGeometryTransform * tr = gsGeometryTransform_create(G, tMat, tVec);
destroy(tr);
destroy(tMat);
destroy(tVec);

gsCGeometry * isoparam = gsTensorBSpline2_slice(G, 0, 0.5);
print(isoparam);
destroy(isoparam);


// tb.slice(dir, param, result);
//equidistant sampling. arc length curve (+surface..)
//


destroy(uvm);
destroy(out_d);
destroy(G);
Expand Down
1 change: 1 addition & 0 deletions src/Cgismo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <gsCInterface/gsCMultiPatch.h>
#include <gsCInterface/gsCBasis.h>
#include <gsCInterface/gsCGeometry.h>
#include <gsCInterface/gsCGeometryTransform.h>
#include <gsCInterface/gsCReadFile.h>

//
Expand Down
12 changes: 11 additions & 1 deletion src/gsCGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GISMO_EXPORT gsCGeometry* gsTensorBSpline2_create(gsCBasis* b, gsCMatrix * coefs
auto * m = RICAST_M(coefs);
return RICAST_CG(new gismo::gsTensorBSpline<2,double>(*basis_ptr,*m));
}

GISMO_EXPORT gsCGeometry* gsTensorBSpline3_create(gsCBasis* b, gsCMatrix * coefs)
{
gismo::gsTensorBSplineBasis<3,double>* basis_ptr = reinterpret_cast< gismo::gsTensorBSplineBasis<3,double>* >(b);
Expand Down Expand Up @@ -96,6 +96,16 @@ GISMO_EXPORT gsCGeometry* gsHBSpline4_create(gsCBasis* b, gsCMatrix * coefs)
return RICAST_CG(new gismo::gsHBSpline<4,double>(*basis_ptr,*m));
}

GISMO_EXPORT gsCGeometry* gsTensorBSpline2_slice(gsCGeometry * g, int direction, double parameter)
{
auto * g_ptr = reinterpret_cast< gismo::gsTensorBSpline<2,double>* >(g);
typedef typename gsTensorBSpline<2,double>::BoundaryGeometryType GeometryBdr;
GeometryBdr * bdr = new GeometryBdr();
g_ptr->slice(direction, parameter, *bdr);
return RICAST_CG(bdr);
}


GISMO_EXPORT gsCBasis* gsGeometry_basis(gsCGeometry * g)
{ return RICAST_CB(&RICAST_G(g)->basis()); }

Expand Down
2 changes: 2 additions & 0 deletions src/gsCGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extern "C"
GISMO_EXPORT gsCGeometry* gsHBSpline3_create(gsCBasis* b, gsCMatrix * coef);
GISMO_EXPORT gsCGeometry* gsHBSpline4_create(gsCBasis* b, gsCMatrix * coef);

GISMO_EXPORT gsCGeometry* gsTensorBSpline2_slice(gsCGeometry * g, int direction, double parameter);

GISMO_EXPORT gsCBasis* gsGeometry_basis(gsCGeometry * g);

GISMO_EXPORT void gsGeometry_coefs_into(gsCGeometry * g, gsCMatrix * coef);
Expand Down
27 changes: 27 additions & 0 deletions src/gsCGeometryTransform.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@

#include <gismo.h>
#include <gsCInterface/gsCTypes.h>
#include <gsCInterface/gsCMatrix.h>
#include <gsCInterface/gsCGeometry.h>
#include <gsCInterface/gsCGeometryTransform.h>
#include <gsCInterface/gsCKnotVector.h>
#include <gsCInterface/gsCBasis.h>
#include <gsCInterface/gsMacros.h>

#ifdef __cplusplus
extern "C"
{
#endif

GISMO_EXPORT gsCGeometryTransform * gsGeometryTransform_create(gsCGeometry* g, gsCMatrix * m,
gsCVector * v)
{
auto * g_ptr = RICAST_G(g);
auto * mm = RICAST_M(m);
auto * vv = RICAST_V(v);
return RICAST_CG(new gismo::gsGeometryTransform<double>(g_ptr,*mm, *vv));
}


#ifdef __cplusplus
}
#endif
4 changes: 2 additions & 2 deletions src/gsCGeometryTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ extern "C"
# define gsGeometryTransform_print gsFunctionSet_print
# define gsGeometryTransform_delete gsFunctionSet_delete

GISMO_EXPORT gsCGeometryTransform* gsGeometryTransform_create(gsCBasis* b, gsCMatrix * m,
gsCVector * v);
GISMO_EXPORT gsCGeometryTransform * gsGeometryTransform_create(gsCBasis* b, gsCMatrix * m,
gsCVector * v);

#ifdef __cplusplus
}
Expand Down

0 comments on commit b23284c

Please sign in to comment.