From df608730ad0fd8e7960c824921a6175db78ad728 Mon Sep 17 00:00:00 2001 From: Edwin Vollebregt Date: Tue, 23 Apr 2024 17:25:28 +0200 Subject: [PATCH] add ifc-files, add recoverPoints in F-example --- examples/geometry_fexample.F90 | 90 +++++++++++++-- src/gismo.ifc | 199 ++------------------------------- src/gsCBasis.ifc | 26 +++++ src/gsCFunctionSet.ifc | 71 ++++++++++++ src/gsCGeometry.ifc | 82 ++++++++++++++ src/gsCKnotVector.ifc | 6 + src/gsCMatrix.h | 8 +- src/gsCMatrix.ifc | 128 +++++++++++++++++++++ src/gsCMatrixInt.ifc | 15 +++ src/gsCMultiPatch.ifc | 20 ++++ src/gsCReadFile.ifc | 15 +++ src/gsCVector.ifc | 14 +++ src/gsCVectorInt.ifc | 15 +++ 13 files changed, 487 insertions(+), 202 deletions(-) create mode 100644 src/gsCBasis.ifc create mode 100644 src/gsCFunctionSet.ifc create mode 100644 src/gsCGeometry.ifc create mode 100644 src/gsCKnotVector.ifc create mode 100644 src/gsCMatrix.ifc create mode 100644 src/gsCMatrixInt.ifc create mode 100644 src/gsCMultiPatch.ifc create mode 100644 src/gsCReadFile.ifc create mode 100644 src/gsCVector.ifc create mode 100644 src/gsCVectorInt.ifc diff --git a/examples/geometry_fexample.F90 b/examples/geometry_fexample.F90 index d86643b..bf47f95 100644 --- a/examples/geometry_fexample.F90 +++ b/examples/geometry_fexample.F90 @@ -33,6 +33,10 @@ program geometry_fexample call show_basic_usage( g ) endif + if (.true.) then + call show_recover_points( g ) + endif + call gsFunctionSet_delete(g) write(*,*) 'done.' @@ -49,7 +53,7 @@ subroutine show_basic_usage( g ) type(c_ptr) :: g !--local variables integer(C_INT) :: nRows, nCols, out_rows, out_cols, irow, icol, icoor, ipar - type(C_PTR) :: uvm, xyzm, xyz1 + type(C_PTR) :: uvm, xyzm, xyz_p real(C_DOUBLE), dimension(:,:), allocatable :: uv real(C_DOUBLE), dimension(:,:), pointer :: xyz character(len=1), parameter :: c_param(2) = (/ 'u', 'v' /) @@ -69,16 +73,18 @@ subroutine show_basic_usage( g ) ! evaluate positions (x,y,z) at given parameter values - uvm = gsMatrix_create_rcd(nRows, nCols, uv) + uvm = gsMatrix_create_rcd(nRows, nCols, uv) xyzm = gsMatrix_create() call gsFunctionSet_eval_into(G, uvm, xyzm) - call gsMatrix_print(xyzm) + ! call gsMatrix_print(xyzm) - xyz1 = gsMatrix_data(xyzm) - call C_F_POINTER(xyz1, xyz, (/ 3,nCols /)) + ! get pointer to matrix data + + out_rows = gsMatrix_rows(xyzm) + out_cols = gsMatrix_cols(xyzm) + xyz_p = gsMatrix_data(xyzm) + call C_F_POINTER(xyz_p, xyz, (/ out_rows, out_cols /)) - out_rows = size(xyz, 1) - out_cols = size(xyz, 2) write(*,'(3(a,i3))') 'Got #rows =', out_rows, ', #cols =', out_cols do irow = 1, out_rows write(*,'(3a,10f10.3)') ' ',c_coor(irow),': ', (xyz(irow,icol), icol=1,out_cols) @@ -86,10 +92,76 @@ subroutine show_basic_usage( g ) call gsMatrix_delete(uvm) call gsMatrix_delete(xyzm) - deallocate(uv) - ! TODO: deallocate memory allocated by gsMatrix_data? Or is xyz1 pointing inside xyzm? + ! write(*,*) 'deallocate uv' + ! deallocate(uv) end subroutine show_basic_usage !----------------------------------------------------------------------------------------------------------- +subroutine show_recover_points( g ) +!--purpose: for some positions (x,y), determine z on the surface and corresponding (u,v) + use, intrinsic :: iso_c_binding + implicit none +# include "gsCInterface/gismo.ifc" +!--subroutine arguments + type(c_ptr) :: g +!--local variables + integer(C_INT), parameter :: XDIR = 0, YDIR = 1, ZDIR = 2 + integer(C_INT) :: nCols, irow, icol, out_rows, out_cols + real(C_DOUBLE) :: eps + real(C_DOUBLE), dimension(:,:), allocatable :: xyz + real(C_DOUBLE), dimension(:,:), pointer :: uv + type(C_PTR) :: uvm, xyzm, uv_p + character(len=1), parameter :: c_param(2) = (/ 'u', 'v' /) + character(len=1), parameter :: c_coor(3) = (/ 'x', 'y', 'z' /) + + write(*,*) '----------------------------- show_recover_points -----------------------------' + nCols = 4 + allocate(xyz(3,ncols)) + + xyz(1, 1:ncols) = (/ 2451.0, 210.001, 708.0, 210.0 /) + xyz(2, 1:ncols) = (/ 122.3, -38.957, 18.568, -13.9 /) + xyz(3, 1:ncols) = (/ 0.0, 0.0, 0.0, 0.0 /) + + write(*,'(a,i3,a)') 'Input #cols =', nCols,', (x,y,z) =' + do irow = 1, 3 + write(*,'(3a,10f10.3)') ' ',c_coor(irow),': ', (xyz(irow,icol), icol=1,nCols) + enddo + + ! evaluate z-positions and (u,v)-values for given (x,y)-positions + + ! evaluate positions (x,y,z) at given parameter values + + xyzm = gsMatrix_create_rcd(3, ncols, xyz) + uvm = gsMatrix_create() + + eps = 1d-6 + call gsGeometry_recoverPoints(G, uvm, xyzm, ZDIR, eps) + + ! get pointer to matrix data + + out_rows = gsMatrix_rows(uvm) + out_cols = gsMatrix_cols(uvm) + uv_p = gsMatrix_data(uvm) + call C_F_POINTER(uv_p, uv, (/ out_rows, out_cols /)) + + write(*,'(a)') 'Output (u,v) =' + do irow = 1, 2 + write(*,'(3a,10f10.3)') ' ',c_param(irow),': ', (uv(irow,icol), icol=1, nCols) + enddo + write(*,'(a)') 'Output (x,y,z) =' + do irow = 1, 3 + write(*,'(3a,10f10.3)') ' ',c_coor(irow),': ', (xyz(irow,icol), icol=1, nCols) + enddo + + ! clean up input data, matrices used + + call gsMatrix_delete(xyzm) + call gsMatrix_delete(uvm) + deallocate(xyz) + +end subroutine show_recover_points + +!----------------------------------------------------------------------------------------------------------- + diff --git a/src/gismo.ifc b/src/gismo.ifc index 7bcfcc5..7316d13 100644 --- a/src/gismo.ifc +++ b/src/gismo.ifc @@ -64,194 +64,15 @@ interface -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT gsCMatrix * gsMatrix_create(void); - - function gsMatrix_create( ) bind(c,name='gsMatrix_create') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsMatrix_create -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR) :: gsMatrix_create - end function gsMatrix_create - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT gsCMatrix * gsMatrix_create_rc (int rows, int cols); - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT gsCMatrix * gsMatrix_create_rcd(int rows, int cols, double * data); - - function gsMatrix_create_rcd(rows, cols, data ) bind(c,name='gsMatrix_create_rcd') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsMatrix_create_rcd -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR) :: gsMatrix_create_rcd - integer(C_INT), value :: rows, cols - real(C_DOUBLE) :: data(*) - end function gsMatrix_create_rcd - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT void gsMatrix_delete(gsCMatrix * m); - - subroutine gsMatrix_delete(m) bind(c,name='gsMatrix_delete') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsMatrix_delete -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR), value :: m - end subroutine gsMatrix_delete - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT void gsMatrix_print(gsCMatrix * m); - - subroutine gsMatrix_print(m) bind(c,name='gsMatrix_print') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsMatrix_print -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR), value :: m - end subroutine gsMatrix_print - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT double* gsMatrix_data(gsCMatrix * m); - - function gsMatrix_data(m) bind(c,name='gsMatrix_data') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsMatrix_data -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR) :: gsMatrix_data - type(C_PTR), value :: m - end function gsMatrix_data - -! GISMO_EXPORT void gsMatrix_transposeInPlace(gsCMatrix * m); -! GISMO_EXPORT int gsMatrix_rows(gsCMatrix * m); -! GISMO_EXPORT int gsMatrix_cols(gsCMatrix * m); -! GISMO_EXPORT void gsMatrix_setZero(gsCMatrix * m); - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT void gsFunctionSet_delete(gsCFunctionSet * ptr); - - subroutine gsFunctionSet_delete( fs ) bind(c,name='gsFunctionSet_delete') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsFunctionSet_delete -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR), value :: fs - end subroutine gsFunctionSet_delete - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT void gsFunctionSet_print(gsCFunctionSet * fs); - - subroutine gsFunctionSet_print(fs) bind(c,name='gsFunctionSet_print') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsFunctionSet_print -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR), value :: fs - end subroutine gsFunctionSet_print - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT int gsFunctionSet_domainDim(gsCFunctionSet * fs); - - function gsFunctionSet_domainDim(fs) bind(c,name='gsFunctionSet_domainDim') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsFunctionSet_domainDim -#endif - use, intrinsic :: iso_c_binding - implicit none - integer :: gsFunctionSet_domainDim - type(C_PTR), value :: fs - end function gsFunctionSet_domainDim - -! GISMO_EXPORT int gsFunctionSet_targetDim(gsCFunctionSet * fs); - -! GISMO_EXPORT gsCBasis * gsFunctionSet_basis(gsCFunctionSet * fs, int i); - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT void gsFunctionSet_eval_into(gsCFunctionSet * fs, -! gsCMatrix * u, -! gsCMatrix * result); - - subroutine gsFunctionSet_eval_into(fs, u, result) bind(c,name='gsFunctionSet_eval_into') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsFunctionSet_eval_into -#endif - use, intrinsic :: iso_c_binding - implicit none - type(C_PTR), value :: fs - type(C_PTR), value :: u - type(C_PTR), value :: result - end subroutine gsFunctionSet_eval_into - -!------------------------------------------------------------------------------------------------------------ -! GISMO_EXPORT void gsFunctionSet_deriv_into(gsCFunctionSet * fs, -! gsCMatrix * u, -! gsCMatrix * result); - -! GISMO_EXPORT void gsFunctionSet_normal_into(gsCFunctionSet * fs, -! gsCMatrix * u, -! gsCMatrix * result); - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - -!------------------------------------------------------------------------------------------------------------ -! #include -!------------------------------------------------------------------------------------------------------------ - - function gsCReadFile(filename) bind(c,name='gsCReadFile') -#ifdef _WIN32 - !dir$ attributes stdcall :: gsCReadFile -#endif - use, intrinsic :: iso_c_binding - implicit none - type(c_ptr) :: gsCReadFile - character(len=1,kind=C_CHAR) :: filename(*) - end function gsCReadFile - -! end -!------------------------------------------------------------------------------------------------------------ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include end interface diff --git a/src/gsCBasis.ifc b/src/gsCBasis.ifc new file mode 100644 index 0000000..4c92fe9 --- /dev/null +++ b/src/gsCBasis.ifc @@ -0,0 +1,26 @@ + +!------------------------------------------------------------------------------------------------------------ +! #define gsBasis_print gsFunctionSet_print +! #define gsBasis_delete gsFunctionSet_delete + +! GISMO_EXPORT gsCBasis* gsBSplineBasis_create(gsCKnotVector* knots); + +! GISMO_EXPORT gsCBasis* gsTensorBSplineBasis2_create(gsCKnotVector* KV1, gsCKnotVector* KV2); +! GISMO_EXPORT gsCBasis* gsTensorBSplineBasis3_create(gsCKnotVector* KV1, gsCKnotVector* KV2, gsCKnotVector* KV3); +! GISMO_EXPORT gsCBasis* gsTensorBSplineBasis4_create(gsCKnotVector* KV1, gsCKnotVector* KV2, gsCKnotVector* KV3, gsCKnotVector* KV4); + +! GISMO_EXPORT gsCBasis* THBSplineBasis1_create(gsCBasis* basis); +! GISMO_EXPORT gsCBasis* THBSplineBasis2_create(gsCBasis* basis); +! GISMO_EXPORT gsCBasis* THBSplineBasis3_create(gsCBasis* basis); +! GISMO_EXPORT gsCBasis* THBSplineBasis4_create(gsCBasis* basis); + +! GISMO_EXPORT void gsBasis_active_into(gsCBasis * b, gsCMatrix * u, gsCMatrixInt * result); + +! GISMO_EXPORT gsCBasis * gsBasis_component(gsCBasis * b, int dir); +! GISMO_EXPORT int gsBasis_degree(gsCBasis * b, int dir); +! GISMO_EXPORT int gsBasis_numElements(gsCBasis * b); +! GISMO_EXPORT int gsBasis_size(gsCBasis * b); +! +! GISMO_EXPORT void gsBasis_uniformRefine(gsCBasis * b, int numKnots, int mul, int dir); +! GISMO_EXPORT void gsBasis_refineElements(gsCBasis * b, int * boxData, int boxSize); +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCFunctionSet.ifc b/src/gsCFunctionSet.ifc new file mode 100644 index 0000000..aaf64b4 --- /dev/null +++ b/src/gsCFunctionSet.ifc @@ -0,0 +1,71 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsFunctionSet_delete(gsCFunctionSet * ptr); + + subroutine gsFunctionSet_delete( fs ) bind(c,name='gsFunctionSet_delete') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsFunctionSet_delete +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: fs + end subroutine gsFunctionSet_delete + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsFunctionSet_print(gsCFunctionSet * fs); + + subroutine gsFunctionSet_print(fs) bind(c,name='gsFunctionSet_print') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsFunctionSet_print +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: fs + end subroutine gsFunctionSet_print + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT int gsFunctionSet_domainDim(gsCFunctionSet * fs); + + function gsFunctionSet_domainDim(fs) bind(c,name='gsFunctionSet_domainDim') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsFunctionSet_domainDim +#endif + use, intrinsic :: iso_c_binding + implicit none + integer :: gsFunctionSet_domainDim + type(C_PTR), value :: fs + end function gsFunctionSet_domainDim + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT int gsFunctionSet_targetDim(gsCFunctionSet * fs); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCBasis * gsFunctionSet_basis(gsCFunctionSet * fs, int i); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsFunctionSet_eval_into(gsCFunctionSet * fs, +! gsCMatrix * u, +! gsCMatrix * result); + + subroutine gsFunctionSet_eval_into(fs, u, result) bind(c,name='gsFunctionSet_eval_into') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsFunctionSet_eval_into +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: fs + type(C_PTR), value :: u + type(C_PTR), value :: result + end subroutine gsFunctionSet_eval_into + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsFunctionSet_deriv_into(gsCFunctionSet * fs, +! gsCMatrix * u, +! gsCMatrix * result); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsFunctionSet_normal_into(gsCFunctionSet * fs, +! gsCMatrix * u, +! gsCMatrix * result); + +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCGeometry.ifc b/src/gsCGeometry.ifc new file mode 100644 index 0000000..39d18a4 --- /dev/null +++ b/src/gsCGeometry.ifc @@ -0,0 +1,82 @@ + +!------------------------------------------------------------------------------------------------------------ +! #define gsGeometry_print gsFunctionSet_print +! #define gsGeometry_delete gsFunctionSet_delete +! #define gsBSpline_delete gsFunctionSet_delete + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsBSpline_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTensorBSpline2_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTensorBSpline3_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTensorBSpline4_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTHBSpline1_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTHBSpline2_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTHBSpline3_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCGeometry* gsTHBSpline4_create(gsCBasis* b, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCBasis* gsGeometry_basis(gsCGeometry * g); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_coefs_into(gsCGeometry * g, gsCMatrix * coef); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_uniformRefine(gsCGeometry * b, int numKnots, int mul, int dir); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_refineElements(gsCGeometry * b, int * boxData, int boxSize); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_recoverPoints(gsCGeometry * g, gsCMatrix * uv, gsCMatrix * xyz, +! int k, double accuracy); + + subroutine gsGeometry_recoverPoints(g, uv, xyz, k, accuracy) bind(c,name='gsGeometry_recoverPoints') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsGeometry_recoverPoints +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: g, uv, xyz + integer(C_INT), value :: k + real(C_DOUBLE), value :: accuracy + end subroutine gsGeometry_recoverPoints + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_recoverPointGrid(gsCGeometry * g, gsCVector * a, gsCVector * b, +! gsCVectorInt * sz, gsCMatrix * xyz, +! gsCMatrix * uv, int c, double accuracy); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_invertPointGrid(gsCGeometry * g, gsCVector * a, gsCVector * b, +! gsCVectorInt * sz, gsCMatrix * result, double accuracy); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_invertPoints(gsCGeometry * g, gsCMatrix * points, gsCMatrix * result, +! double accuracy); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsGeometry_normal_into(gsCGeometry * fs, +! gsCMatrix * u, +! gsCMatrix * result); + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT double gsGeometry_closestPointTo(gsCGeometry * fs, +! gsCMatrix * pt, +! gsCMatrix * result, +! double accuracy); + +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCKnotVector.ifc b/src/gsCKnotVector.ifc new file mode 100644 index 0000000..c1c5c6e --- /dev/null +++ b/src/gsCKnotVector.ifc @@ -0,0 +1,6 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCKnotVector * gsKnotVector_create(double* knots, int size); +! GISMO_EXPORT void gsKnotVector_delete(gsCKnotVector * kv); +! GISMO_EXPORT void gsKnotVector_print(gsCKnotVector * kv); +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCMatrix.h b/src/gsCMatrix.h index 1201643..804838b 100644 --- a/src/gsCMatrix.h +++ b/src/gsCMatrix.h @@ -4,9 +4,9 @@ extern "C" { #endif - GISMO_EXPORT gsCMatrix * gsMatrix_create(void); - GISMO_EXPORT gsCMatrix * gsMatrix_create_rc (int rows, int cols); - GISMO_EXPORT gsCMatrix * gsMatrix_create_rcd(int rows, int cols, double * data); + GISMO_EXPORT gsCMatrix * gsMatrix_create(void); // create matrix object + GISMO_EXPORT gsCMatrix * gsMatrix_create_rc (int rows, int cols); // create matrix object with rows+cols + GISMO_EXPORT gsCMatrix * gsMatrix_create_rcd(int rows, int cols, double * data); // copy data into matrix // typedef struct NoArg NoArg; //#define gsMatrix_create(...) gsMatrix_create_(__VA_ARGS__ __VA_OPT__(,) (NoArg*)0, ~ )(__VA_ARGS__) @@ -17,7 +17,7 @@ extern "C" //#define FIRST(A, ...) A GISMO_EXPORT void gsMatrix_delete(gsCMatrix * m); GISMO_EXPORT void gsMatrix_print(gsCMatrix * m); - GISMO_EXPORT double* gsMatrix_data(gsCMatrix * m); + GISMO_EXPORT double* gsMatrix_data(gsCMatrix * m); // get pointer to matrix data GISMO_EXPORT void gsMatrix_transposeInPlace(gsCMatrix * m); GISMO_EXPORT int gsMatrix_rows(gsCMatrix * m); diff --git a/src/gsCMatrix.ifc b/src/gsCMatrix.ifc new file mode 100644 index 0000000..c16b7c4 --- /dev/null +++ b/src/gsCMatrix.ifc @@ -0,0 +1,128 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCMatrix * gsMatrix_create(void); + + function gsMatrix_create( ) bind(c,name='gsMatrix_create') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_create +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR) :: gsMatrix_create + end function gsMatrix_create + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCMatrix * gsMatrix_create_rc (int rows, int cols); + + function gsMatrix_create_rc(rows, cols) bind(c,name='gsMatrix_create_rc') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_create_rc +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR) :: gsMatrix_create_rc + integer(C_INT), value :: rows, cols + end function gsMatrix_create_rc + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCMatrix * gsMatrix_create_rcd(int rows, int cols, double * data); + + function gsMatrix_create_rcd(rows, cols, data ) bind(c,name='gsMatrix_create_rcd') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_create_rcd +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR) :: gsMatrix_create_rcd + integer(C_INT), value :: rows, cols + real(C_DOUBLE) :: data(*) + end function gsMatrix_create_rcd + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsMatrix_delete(gsCMatrix * m); + + subroutine gsMatrix_delete(m) bind(c,name='gsMatrix_delete') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_delete +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: m + end subroutine gsMatrix_delete + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsMatrix_print(gsCMatrix * m); + + subroutine gsMatrix_print(m) bind(c,name='gsMatrix_print') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_print +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: m + end subroutine gsMatrix_print + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT double* gsMatrix_data(gsCMatrix * m); + + function gsMatrix_data(m) bind(c,name='gsMatrix_data') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_data +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR) :: gsMatrix_data + type(C_PTR), value :: m + end function gsMatrix_data + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsMatrix_transposeInPlace(gsCMatrix * m); + + subroutine gsMatrix_transposeInPlace(m) bind(c,name='gsMatrix_transposeInPlace') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_transposeInPlace +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: m + end subroutine gsMatrix_transposeInPlace + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT int gsMatrix_rows(gsCMatrix * m); + + function gsMatrix_rows(m) bind(c,name='gsMatrix_rows') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_rows +#endif + use, intrinsic :: iso_c_binding + implicit none + integer :: gsMatrix_rows + type(C_PTR), value :: m + end function gsMatrix_rows + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT int gsMatrix_cols(gsCMatrix * m); + + function gsMatrix_cols(m) bind(c,name='gsMatrix_cols') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_cols +#endif + use, intrinsic :: iso_c_binding + implicit none + integer :: gsMatrix_cols + type(C_PTR), value :: m + end function gsMatrix_cols + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsMatrix_setZero(gsCMatrix * m); + + subroutine gsMatrix_setZero(m) bind(c,name='gsMatrix_setZero') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsMatrix_setZero +#endif + use, intrinsic :: iso_c_binding + implicit none + type(C_PTR), value :: m + end subroutine gsMatrix_setZero + +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCMatrixInt.ifc b/src/gsCMatrixInt.ifc new file mode 100644 index 0000000..a8cbfc6 --- /dev/null +++ b/src/gsCMatrixInt.ifc @@ -0,0 +1,15 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCMatrixInt * gsMatrixInt_create(void); +! GISMO_EXPORT gsCMatrixInt * gsMatrixInt_create_rc (int rows, int cols); +! GISMO_EXPORT gsCMatrixInt * gsMatrixInt_create_rcd(int rows, int cols, int * data); + +! GISMO_EXPORT void gsMatrixInt_delete(gsCMatrixInt * m); +! GISMO_EXPORT void gsMatrixInt_print(gsCMatrixInt * m); +! GISMO_EXPORT int* gsMatrixInt_data(gsCMatrixInt * m); + +! GISMO_EXPORT void gsMatrixInt_transposeInPlace(gsCMatrixInt * m); +! GISMO_EXPORT int gsMatrixInt_rows(gsCMatrixInt * m); +! GISMO_EXPORT int gsMatrixInt_cols(gsCMatrixInt * m); +! GISMO_EXPORT void gsMatrixInt_setZero(gsCMatrixInt * m); +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCMultiPatch.ifc b/src/gsCMultiPatch.ifc new file mode 100644 index 0000000..1d6e1f8 --- /dev/null +++ b/src/gsCMultiPatch.ifc @@ -0,0 +1,20 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void gsFunctionSet_delete(gsCFunctionSet * ptr); + +! GISMO_EXPORT void gsFunctionSet_print(gsCFunctionSet * fs); +! GISMO_EXPORT int gsFunctionSet_domainDim(gsCFunctionSet * fs); +! GISMO_EXPORT int gsFunctionSet_targetDim(gsCFunctionSet * fs); + +! GISMO_EXPORT void gsFunctionSet_eval_into(gsCFunctionSet * fs, +! gsCMatrix * u, +! gsCMatrix * result); + +! GISMO_EXPORT void gsFunctionSet_deriv_into(gsCFunctionSet * fs, +! gsCMatrix * u, +! gsCMatrix * result); + +! GISMO_EXPORT void gsFunctionSet_normal_into(gsCFunctionSet * fs, +! gsCMatrix * u, +! gsCMatrix * result); +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCReadFile.ifc b/src/gsCReadFile.ifc new file mode 100644 index 0000000..3c3fe29 --- /dev/null +++ b/src/gsCReadFile.ifc @@ -0,0 +1,15 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT void* gsCReadFile(char* filename); + + function gsCReadFile(filename) bind(c,name='gsCReadFile') +#ifdef _WIN32 + !dir$ attributes stdcall :: gsCReadFile +#endif + use, intrinsic :: iso_c_binding + implicit none + type(c_ptr) :: gsCReadFile + character(len=1,kind=C_CHAR) :: filename(*) + end function gsCReadFile + +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCVector.ifc b/src/gsCVector.ifc new file mode 100644 index 0000000..f639782 --- /dev/null +++ b/src/gsCVector.ifc @@ -0,0 +1,14 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCVector * gsVector_create(void); +! GISMO_EXPORT gsCVector * gsVector_create_r (int rows, int cols); +! GISMO_EXPORT gsCVector * gsVector_create_rd(int rows, int cols, double * data); +! GISMO_EXPORT void gsVector_delete(gsCVector * m); +! GISMO_EXPORT void gsVector_print(gsCVector * m); +! GISMO_EXPORT double * gsVector_data(gsCVector * m); + +! GISMO_EXPORT void gsVector_transposeInPlace(gsCVector * m); +! GISMO_EXPORT int gsVector_rows(gsCVector * m); +! GISMO_EXPORT int gsVector_cols(gsCVector * m); +! GISMO_EXPORT void gsVector_setZero(gsCVector * m); +!------------------------------------------------------------------------------------------------------------ diff --git a/src/gsCVectorInt.ifc b/src/gsCVectorInt.ifc new file mode 100644 index 0000000..40da3a2 --- /dev/null +++ b/src/gsCVectorInt.ifc @@ -0,0 +1,15 @@ + +!------------------------------------------------------------------------------------------------------------ +! GISMO_EXPORT gsCVectorInt * gsVectorInt_create(void); +! GISMO_EXPORT gsCVectorInt * gsVectorInt_create_r (int rows); +! GISMO_EXPORT gsCVectorInt * gsVectorInt_create_rd(int rows, int * data); + +! GISMO_EXPORT void gsVectorInt_delete(gsCVectorInt * m); +! GISMO_EXPORT void gsVectorInt_print(gsCVectorInt * m); +! GISMO_EXPORT int * gsVectorInt_data(gsCVectorInt * m); + +! GISMO_EXPORT void gsVectorInt_transposeInPlace(gsCVectorInt * m); +! GISMO_EXPORT int gsVectorInt_rows(gsCVectorInt * m); +! GISMO_EXPORT int gsVectorInt_cols(gsCVectorInt * m); +! GISMO_EXPORT void gsVectorInt_setZero(gsCVectorInt * m); +!------------------------------------------------------------------------------------------------------------