-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gismo/develop
Expand C-interface to more classes
- Loading branch information
Showing
31 changed files
with
948 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include <gismo.h> | ||
#include <gsCInterface/gsCTypes.h> | ||
#include <gsCInterface/gsCMemory.h> | ||
#include <gsCInterface/gsMacros.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
GISMO_EXPORT gsCBoundaryConditions * gsBoundaryConditions_create() | ||
{ | ||
return RICAST_CBC(new gismo::gsBoundaryConditions<double>()); | ||
} | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_addCondition(gsCBoundaryConditions * bc, | ||
int patch, | ||
int side, | ||
int ctype, | ||
gsCFunctionSet * fun, | ||
int unknown, | ||
int component, | ||
bool parametric) | ||
{ | ||
gismo::boxSide bside(side); | ||
gsFunctionSet<double> * f_ptr = RICAST_F(fun); | ||
RICAST_BC(bc)->addCondition(patch, | ||
bside, | ||
(gismo::condition_type::type)ctype, | ||
f_ptr, | ||
unknown, | ||
component, | ||
parametric); | ||
} | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_addCornerValue(gsCBoundaryConditions * bc, | ||
int corner, | ||
double value, | ||
int patch, | ||
int unknown, | ||
int component) | ||
{ | ||
gismo::boxCorner bcorner(corner); | ||
RICAST_BC(bc)->addCornerValue(bcorner, value, patch, unknown, component); | ||
} | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_setGeoMap(gsCBoundaryConditions * bc, gsCFunctionSet * gm) | ||
{ | ||
RICAST_BC(bc)->setGeoMap(*RICAST_F(gm)); | ||
} | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_print(gsCBoundaryConditions * bc) | ||
{ | ||
RICAST_BC(bc)->print(gsInfo); | ||
} | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_delete(gsCBoundaryConditions * bc) | ||
{ | ||
delete RICAST_BC(bc); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
#include<stdbool.h> | ||
|
||
GISMO_EXPORT gsCBoundaryConditions * gsBoundaryConditions_create(); | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_addCondition(gsCBoundaryConditions * bc, | ||
int patch, | ||
int side, | ||
int type, | ||
gsCFunctionSet * fun, | ||
int unknown, | ||
int component, | ||
bool parametric); | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_addCornerValue(gsCBoundaryConditions * bc, | ||
int corner, | ||
double value, | ||
int patch, | ||
int unknown, | ||
int component); | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_setGeoMap(gsCBoundaryConditions * bc, gsCFunctionSet * gm); | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_print(gsCBoundaryConditions * bc); | ||
|
||
GISMO_EXPORT void gsBoundaryConditions_delete(gsCBoundaryConditions * bc); | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
#include <gismo.h> | ||
#include <gsCInterface/gsCTypes.h> | ||
#include <gsCInterface/gsMacros.h> | ||
#include <gsCInterface/gsCFitting.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
GISMO_EXPORT gsCFitting * gsFitting_create(gsCMatrix * param_values, gsCMatrix * points, gsCBasis * basis) | ||
{ | ||
auto * param_values_ptr = RICAST_M(param_values); | ||
auto * points_ptr = RICAST_M(points); | ||
auto * basis_ptr = RICAST_B(basis); | ||
return reinterpret_cast<gsCFitting*>(new gismo::gsFitting<double>(*param_values_ptr, *points_ptr, *basis_ptr)); | ||
} | ||
|
||
GISMO_EXPORT void gsFitting_delete(gsCFitting * fitter) | ||
{ | ||
delete reinterpret_cast<gismo::gsFitting<double>*>(fitter); | ||
} | ||
|
||
GISMO_EXPORT void gsFitting_compute(gsCFitting * fitter, double lambda) | ||
{ | ||
reinterpret_cast<gismo::gsFitting<double>*>(fitter)->compute(lambda); | ||
} | ||
|
||
GISMO_EXPORT void gsFitting_parameterCorrection(gsCFitting * fitter, double accuracy, int maxIter, double tolOrth) | ||
{ | ||
reinterpret_cast<gismo::gsFitting<double>*>(fitter)->parameterCorrection(accuracy, maxIter, tolOrth); | ||
} | ||
|
||
GISMO_EXPORT void gsFitting_computeErrors(gsCFitting * fitter) | ||
{ | ||
reinterpret_cast<gismo::gsFitting<double>*>(fitter)->computeErrors(); | ||
} | ||
|
||
GISMO_EXPORT double gsFitting_minPointError(gsCFitting * fitter) | ||
{ | ||
return reinterpret_cast<gismo::gsFitting<double>*>(fitter)->minPointError(); | ||
} | ||
|
||
GISMO_EXPORT double gsFitting_maxPointError(gsCFitting * fitter) | ||
{ | ||
return reinterpret_cast<gismo::gsFitting<double>*>(fitter)->maxPointError(); | ||
} | ||
|
||
GISMO_EXPORT double* gsFitting_pointWiseErrors(gsCFitting * fitter) | ||
{ | ||
const double * errors = reinterpret_cast< const double* >(reinterpret_cast<gismo::gsFitting<double>*>(fitter)->pointWiseErrors().data()); | ||
return const_cast<double *>(errors); | ||
} | ||
|
||
GISMO_EXPORT int gsFitting_numPointsBelow(gsCFitting * fitter, double threshold) | ||
{ | ||
return reinterpret_cast<gismo::gsFitting<double>*>(fitter)->numPointsBelow(threshold); | ||
} | ||
|
||
GISMO_EXPORT gsCGeometry* gsFitting_result(gsCFitting * fitter) | ||
{ | ||
auto * result = reinterpret_cast<gismo::gsFitting<double>*>(fitter)->result(); | ||
return RICAST_CG(result->clone().release()); | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
GISMO_EXPORT gsCFitting* gsFitting_create(gsCMatrix * param_values, gsCMatrix * points, gsCBasis * basis); | ||
GISMO_EXPORT void gsFitting_delete(gsCFitting * fitter); | ||
|
||
GISMO_EXPORT void gsFitting_compute(gsCFitting* fitter, double lambda); | ||
GISMO_EXPORT void gsFitting_parameterCorrection(gsCFitting* fitter, double accuracy, int maxIter, double tolOrth); | ||
|
||
GISMO_EXPORT void gsFitting_computeErrors(gsCFitting* fitter); | ||
|
||
GISMO_EXPORT double gsFitting_minPointError(gsCFitting* fitter); | ||
GISMO_EXPORT double gsFitting_maxPointError(gsCFitting* fitter); | ||
GISMO_EXPORT double* gsFitting_pointWiseErrors(gsCFitting* fitter); | ||
GISMO_EXPORT int gsFitting_numPointsBelow(gsCFitting* fitter, double threshold); | ||
|
||
GISMO_EXPORT gsCGeometry* gsFitting_result(gsCFitting* fitter); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include <gismo.h> | ||
#include <gsCInterface/gsCTypes.h> | ||
#include <gsCInterface/gsCMemory.h> | ||
#include <gsCInterface/gsMacros.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
GISMO_EXPORT gsCFunctionExpr * gsFunctionExpr1_create(const char * expression_string, | ||
short_t ddim) | ||
{ | ||
return RICAST_CF(new gismo::gsFunctionExpr<double>(expression_string, | ||
ddim)); | ||
} | ||
|
||
GISMO_EXPORT gsCFunctionExpr * gsFunctionExpr2_create(const char * expression_string1, | ||
const char * expression_string2, | ||
short_t ddim) | ||
{ | ||
return RICAST_CF(new gismo::gsFunctionExpr<double>(expression_string1, | ||
expression_string2, ddim)); | ||
} | ||
|
||
GISMO_EXPORT gsCFunctionExpr * gsFunctionExpr3_create(const char * expression_string1, | ||
const char * expression_string2, | ||
const char * expression_string3, | ||
short_t ddim) | ||
{ | ||
return RICAST_CF(new gismo::gsFunctionExpr<double>(expression_string1, | ||
expression_string2, | ||
expression_string3, | ||
ddim)); | ||
} | ||
|
||
GISMO_EXPORT gsCFunctionExpr * gsFunctionExpr4_create(const char * expression_string1, | ||
const char * expression_string2, | ||
const char * expression_string3, | ||
const char * expression_string4, | ||
short_t ddim) | ||
{ | ||
return RICAST_CF(new gismo::gsFunctionExpr<double>(expression_string1, | ||
expression_string2, | ||
expression_string3, | ||
expression_string4, | ||
ddim)); | ||
} | ||
|
||
GISMO_EXPORT gsCFunctionExpr * gsFunctionExpr9_create(const char * expression_string1, | ||
const char * expression_string2, | ||
const char * expression_string3, | ||
const char * expression_string4, | ||
const char * expression_string5, | ||
const char * expression_string6, | ||
const char * expression_string7, | ||
const char * expression_string8, | ||
const char * expression_string9, | ||
short_t ddim) | ||
{ | ||
return RICAST_CF(new gismo::gsFunctionExpr<double>(expression_string1, | ||
expression_string2, | ||
expression_string3, | ||
expression_string4, | ||
expression_string5, | ||
expression_string6, | ||
expression_string7, | ||
expression_string8, | ||
expression_string9, | ||
ddim)); | ||
} | ||
|
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.