mcc_bsplines.h: use of FC_GLOBAL macro to correct call FITPACK
subroutines mangled names fitpack/CMakeLists.txt: add non-empty SYMBOL_NAMESPACE to fix generated 'insert' macro (interference with STL containers 'insert' methods) macro issue various fixes
This commit is contained in:
@@ -21,8 +21,8 @@ include(FortranCInterface)
|
|||||||
FortranCInterface_HEADER(
|
FortranCInterface_HEADER(
|
||||||
FortranCInterface.h
|
FortranCInterface.h
|
||||||
MACRO_NAMESPACE "FC_"
|
MACRO_NAMESPACE "FC_"
|
||||||
# SYMBOL_NAMESPACE "fp_"
|
SYMBOL_NAMESPACE "FC_"
|
||||||
SYMBOL_NAMESPACE ""
|
#SYMBOL_NAMESPACE ""
|
||||||
# SYMBOLS ${func_str}
|
# SYMBOLS ${func_str}
|
||||||
SYMBOLS ${func_name}
|
SYMBOLS ${func_name}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
void FC_GLOBAL(insert, INSERT)(int*, double*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
|
||||||
|
|
||||||
/* fitting on XY-grid */
|
/* fitting on XY-grid */
|
||||||
void surfit(int* iopt,
|
void FC_GLOBAL(surfit, SURFIT)(int* iopt,
|
||||||
|
// void surfit(int* iopt,
|
||||||
int* m,
|
int* m,
|
||||||
double* x,
|
double* x,
|
||||||
double* y,
|
double* y,
|
||||||
@@ -41,7 +44,8 @@ void surfit(int* iopt,
|
|||||||
int* ier);
|
int* ier);
|
||||||
|
|
||||||
/* XY-grid */
|
/* XY-grid */
|
||||||
void bispev(double* tx,
|
void FC_GLOBAL(bispev, BISPEV)(double* tx,
|
||||||
|
// void bispev(double* tx,
|
||||||
int* nx,
|
int* nx,
|
||||||
double* ty,
|
double* ty,
|
||||||
int* ny,
|
int* ny,
|
||||||
@@ -60,7 +64,8 @@ void bispev(double* tx,
|
|||||||
int* ier);
|
int* ier);
|
||||||
|
|
||||||
/* XY-grid */
|
/* XY-grid */
|
||||||
void parder(double* tx,
|
void FC_GLOBAL(parder, PARDER)(double* tx,
|
||||||
|
// void parder(double* tx,
|
||||||
int* nx,
|
int* nx,
|
||||||
double* ty,
|
double* ty,
|
||||||
int* ny,
|
int* ny,
|
||||||
@@ -81,7 +86,8 @@ void parder(double* tx,
|
|||||||
int* ier);
|
int* ier);
|
||||||
|
|
||||||
/* fitting on sphere */
|
/* fitting on sphere */
|
||||||
void sphere(int* iopt,
|
void FC_GLOBAL(sphere, SPHERE)(int* iopt,
|
||||||
|
// void sphere(int* iopt,
|
||||||
int* m,
|
int* m,
|
||||||
double* teta,
|
double* teta,
|
||||||
double* phi,
|
double* phi,
|
||||||
@@ -106,7 +112,8 @@ void sphere(int* iopt,
|
|||||||
int* ier);
|
int* ier);
|
||||||
|
|
||||||
/* calculation for set of points (not grid) */
|
/* calculation for set of points (not grid) */
|
||||||
void bispeu(double* tx,
|
void FC_GLOBAL(bispeu, BISPEU)(double* tx,
|
||||||
|
// void bispeu(double* tx,
|
||||||
int* nx,
|
int* nx,
|
||||||
double* ty,
|
double* ty,
|
||||||
int* ny,
|
int* ny,
|
||||||
@@ -123,7 +130,8 @@ void bispeu(double* tx,
|
|||||||
|
|
||||||
|
|
||||||
/* calculation for set of points (not grid) */
|
/* calculation for set of points (not grid) */
|
||||||
void pardeu(double* tx,
|
void FC_GLOBAL(pardeu, PARDEU)(double* tx,
|
||||||
|
// void pardeu(double* tx,
|
||||||
int* nx,
|
int* nx,
|
||||||
double* ty,
|
double* ty,
|
||||||
int* ny,
|
int* ny,
|
||||||
@@ -257,23 +265,15 @@ int fitpack_sphere_smooth(const TethaT& tetha,
|
|||||||
if constexpr (std::ranges::contiguous_range<WeightT>) {
|
if constexpr (std::ranges::contiguous_range<WeightT>) {
|
||||||
auto weight_ptr = const_cast<double*>(std::ranges::data(weight));
|
auto weight_ptr = const_cast<double*>(std::ranges::data(weight));
|
||||||
|
|
||||||
sphere(&iopt, &m, tetha_ptr, phi_ptr, func_ptr, weight_ptr, &s_par, &nt, &np, &eps, &ntest, tetha_knots_ptr,
|
FC_GLOBAL(sphere, SPHERE)(&iopt, &m, tetha_ptr, phi_ptr, func_ptr, weight_ptr, &s_par, &nt, &np, &eps, &ntest,
|
||||||
&npest, phi_knots_ptr, std::ranges::data(coeffs), &resi2_sum, wrk1.data(), &lwrk1, wrk2.data(), &lwrk2,
|
tetha_knots_ptr, &npest, phi_knots_ptr, std::ranges::data(coeffs), &resi2_sum,
|
||||||
iwrk.data(), &kwrk, &res);
|
wrk1.data(), &lwrk1, wrk2.data(), &lwrk2, iwrk.data(), &kwrk, &res);
|
||||||
// sphere(&iopt, &m, std::ranges::data(tetha), std::ranges::data(phi), std::ranges::data(func),
|
|
||||||
// std::ranges::data(weight), &s_par, &ntest, &npest, &eps, &ntest, std::ranges::data(tetha_knots),
|
|
||||||
// &npest, std::ranges::data(phi_knots), std::ranges::data(coeffs), &resi2_sum, wrk1.data(), &lwrk1,
|
|
||||||
// wrk2.data(), &lwrk2, iwrk.data(), &kwrk, &res);
|
|
||||||
} else {
|
} else {
|
||||||
std::vector<double> weight_vec(m, weight);
|
std::vector<double> weight_vec(m, weight);
|
||||||
|
|
||||||
sphere(&iopt, &m, tetha_ptr, phi_ptr, func_ptr, weight_vec.data(), &s_par, &nt, &np, &eps, &ntest,
|
FC_GLOBAL(sphere, SPHERE)(&iopt, &m, tetha_ptr, phi_ptr, func_ptr, weight_vec.data(), &s_par, &nt, &np, &eps,
|
||||||
tetha_knots_ptr, &npest, phi_knots_ptr, std::ranges::data(coeffs), &resi2_sum, wrk1.data(), &lwrk1,
|
&ntest, tetha_knots_ptr, &npest, phi_knots_ptr, std::ranges::data(coeffs), &resi2_sum,
|
||||||
wrk2.data(), &lwrk2, iwrk.data(), &kwrk, &res);
|
wrk1.data(), &lwrk1, wrk2.data(), &lwrk2, iwrk.data(), &kwrk, &res);
|
||||||
// res = sphere(&iopt, &m, std::ranges::data(tetha), std::ranges::data(phi), std::ranges::data(func),
|
|
||||||
// weight_vec.data(), &s_par, &ntest, &npest, &eps, &ntest, std::ranges::data(tetha_knots), &npest,
|
|
||||||
// std::ranges::data(phi_knots), std::ranges::data(coeffs), &resi2_sum, wrk1.get(), &lwrk1,
|
|
||||||
// wrk2.get(), &lwrk2, iwrk.get(), &kwrk, &res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -367,8 +367,8 @@ int fitpack_eval_spl2d_grid(const TXT& tx,
|
|||||||
auto x_ptr = const_cast<double*>(std::ranges::data(x));
|
auto x_ptr = const_cast<double*>(std::ranges::data(x));
|
||||||
auto y_ptr = const_cast<double*>(std::ranges::data(y));
|
auto y_ptr = const_cast<double*>(std::ranges::data(y));
|
||||||
|
|
||||||
bispev(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, x_ptr, &mx, y_ptr, &my, std::ranges::data(func),
|
FC_GLOBAL(bispev, BISPEV)(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, x_ptr, &mx, y_ptr, &my,
|
||||||
wrk.data(), &lwrk, iwrk.data(), &kwrk, &ier);
|
std::ranges::data(func), wrk.data(), &lwrk, iwrk.data(), &kwrk, &ier);
|
||||||
|
|
||||||
return ier;
|
return ier;
|
||||||
}
|
}
|
||||||
@@ -431,8 +431,10 @@ int fitpack_eval_spl2d(const TXT& tx,
|
|||||||
int lwrk = kx + ky + 2;
|
int lwrk = kx + ky + 2;
|
||||||
std::vector<double> wrk(lwrk);
|
std::vector<double> wrk(lwrk);
|
||||||
|
|
||||||
bispeu(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, x_ptr, y_ptr, std::ranges::data(func), &m, wrk.data(),
|
FC_GLOBAL(bispeu, BISPEU)(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, x_ptr, y_ptr, std::ranges::data(func),
|
||||||
&lwrk, &ier);
|
&m, wrk.data(), &lwrk, &ier);
|
||||||
|
// bispeu(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, x_ptr, y_ptr, std::ranges::data(func), &m, wrk.data(),
|
||||||
|
// &lwrk, &ier);
|
||||||
|
|
||||||
return ier;
|
return ier;
|
||||||
}
|
}
|
||||||
@@ -536,8 +538,8 @@ int fitpack_parder_spl2d_grid(const TXT& tx,
|
|||||||
|
|
||||||
int ier = 0;
|
int ier = 0;
|
||||||
|
|
||||||
parder(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, &dx, &dy, x_ptr, &mx, y_ptr, &my, std::ranges::data(pder),
|
FC_GLOBAL(parder, PARDER)(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, &dx, &dy, x_ptr, &mx, y_ptr, &my,
|
||||||
wrk.data(), &lwrk, iwrk.data(), &kwrk, &ier);
|
std::ranges::data(pder), wrk.data(), &lwrk, iwrk.data(), &kwrk, &ier);
|
||||||
|
|
||||||
return ier;
|
return ier;
|
||||||
}
|
}
|
||||||
@@ -604,8 +606,8 @@ int fitpack_parder_spl2d(const TXT& tx,
|
|||||||
int kwrk = 2 * m;
|
int kwrk = 2 * m;
|
||||||
std::vector<int> iwrk(kwrk);
|
std::vector<int> iwrk(kwrk);
|
||||||
|
|
||||||
pardeu(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, &dx, &dy, x_ptr, y_ptr, std::ranges::data(pder), &m,
|
FC_GLOBAL(pardeu, PARDEU)(tx_ptr, &ntx, ty_ptr, &nty, coeffs_ptr, &kx, &ky, &dx, &dy, x_ptr, y_ptr,
|
||||||
wrk.data(), &lwrk, iwrk.data(), &kwrk, &ier);
|
std::ranges::data(pder), &m, wrk.data(), &lwrk, iwrk.data(), &kwrk, &ier);
|
||||||
|
|
||||||
return ier;
|
return ier;
|
||||||
}
|
}
|
||||||
@@ -645,5 +647,4 @@ int fitpack_parder_spl2d(const TXT& tx,
|
|||||||
return fitpack_parder_spl2d(tx, ty, coeffs, xv, yv, pv, dx, dy, kx, ky);
|
return fitpack_parder_spl2d(tx, ty, coeffs, xv, yv, pv, dx, dy, kx, ky);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace mcc::bsplines
|
} // namespace mcc::bsplines
|
||||||
|
|||||||
@@ -107,19 +107,14 @@ template <typename T>
|
|||||||
concept mcc_keyvalue_desc_c = requires(T t) { []<mcc_keyvalue_record_c... Ts>(std::tuple<Ts...>) {}(t); };
|
concept mcc_keyvalue_desc_c = requires(T t) { []<mcc_keyvalue_record_c... Ts>(std::tuple<Ts...>) {}(t); };
|
||||||
|
|
||||||
|
|
||||||
namespace constants
|
|
||||||
{
|
|
||||||
|
|
||||||
static constexpr char MCC_KV_COMMENT_SEQ_ARR[] = "#";
|
static constexpr char MCC_KV_COMMENT_SEQ_ARR[] = "#";
|
||||||
static constexpr char MCC_KV_KEY_VALUE_DELIM_SEQ_ARR[] = "=";
|
static constexpr char MCC_KV_KEY_VALUE_DELIM_SEQ_ARR[] = "=";
|
||||||
static constexpr char MCC_KV_COMPOSITE_VALUE_DELIM_SEQ_ARR[] = ",";
|
static constexpr char MCC_KV_COMPOSITE_VALUE_DELIM_SEQ_ARR[] = ",";
|
||||||
|
|
||||||
} // namespace constants
|
|
||||||
|
|
||||||
|
|
||||||
template <mcc_keyvalue_desc_c DESCR_T,
|
template <mcc_keyvalue_desc_c DESCR_T,
|
||||||
const char* COMM_SEQ = constants::MCC_KV_COMMENT_SEQ_ARR, // comment char sequence
|
const char* COMM_SEQ = MCC_KV_COMMENT_SEQ_ARR, // comment char sequence
|
||||||
const char* KV_DELIM = constants::MCC_KV_KEY_VALUE_DELIM_SEQ_ARR // key-value delimiter
|
const char* KV_DELIM = MCC_KV_KEY_VALUE_DELIM_SEQ_ARR // key-value delimiter
|
||||||
>
|
>
|
||||||
class MccKeyValueHolder
|
class MccKeyValueHolder
|
||||||
{
|
{
|
||||||
@@ -132,12 +127,12 @@ public:
|
|||||||
|
|
||||||
static constexpr std::string_view DEFAULT_RECORD_DELIMITER{"\n"};
|
static constexpr std::string_view DEFAULT_RECORD_DELIMITER{"\n"};
|
||||||
|
|
||||||
static constexpr std::string_view COMMENT_SEQ{COMM_SEQ == nullptr ? constants::MCC_KV_COMMENT_SEQ_ARR
|
static constexpr std::string_view COMMENT_SEQ{COMM_SEQ == nullptr ? MCC_KV_COMMENT_SEQ_ARR
|
||||||
: COMM_SEQ[0] == '\0' ? constants::MCC_KV_COMMENT_SEQ_ARR
|
: COMM_SEQ[0] == '\0' ? MCC_KV_COMMENT_SEQ_ARR
|
||||||
: COMM_SEQ};
|
: COMM_SEQ};
|
||||||
|
|
||||||
static constexpr std::string_view KEY_VALUE_DELIM{KV_DELIM == nullptr ? constants::MCC_KV_KEY_VALUE_DELIM_SEQ_ARR
|
static constexpr std::string_view KEY_VALUE_DELIM{KV_DELIM == nullptr ? MCC_KV_KEY_VALUE_DELIM_SEQ_ARR
|
||||||
: KV_DELIM[0] == '\0' ? constants::MCC_KV_KEY_VALUE_DELIM_SEQ_ARR
|
: KV_DELIM[0] == '\0' ? MCC_KV_KEY_VALUE_DELIM_SEQ_ARR
|
||||||
: KV_DELIM};
|
: KV_DELIM};
|
||||||
|
|
||||||
static constexpr size_t NUMBER_OF_RECORDS = std::tuple_size_v<DESCR_T>;
|
static constexpr size_t NUMBER_OF_RECORDS = std::tuple_size_v<DESCR_T>;
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ struct MccDeserializer<MccAltLimitPZ<KIND>> : MccDeserializerBase {
|
|||||||
MccDeserializer<MccAngle> ades;
|
MccDeserializer<MccAngle> ades;
|
||||||
|
|
||||||
auto seq = std::views::split(input, params.seq_delim);
|
auto seq = std::views::split(input, params.seq_delim);
|
||||||
if (std::ranges::distance(seq.begin(), seq.end()) < 2) {
|
if (std::ranges::distance(seq.begin(), seq.end()) > 1) {
|
||||||
for (auto const& seq_el : seq) {
|
for (auto const& seq_el : seq) {
|
||||||
s.push_back(utils::trimSpaces(seq_el, utils::TrimType::TRIM_BOTH));
|
s.push_back(utils::trimSpaces(seq_el, utils::TrimType::TRIM_BOTH));
|
||||||
}
|
}
|
||||||
@@ -661,7 +661,7 @@ struct MccDeserializer<MccAxisLimitSwitchPZ<AXIS_KIND>> : MccDeserializerBase {
|
|||||||
|
|
||||||
auto seq = std::views::split(input, params.seq_delim);
|
auto seq = std::views::split(input, params.seq_delim);
|
||||||
// if (std::ranges::size(seq) < 2) {
|
// if (std::ranges::size(seq) < 2) {
|
||||||
if (std::ranges::distance(seq.begin(), seq.end()) < 2) {
|
if (std::ranges::distance(seq.begin(), seq.end()) > 1) {
|
||||||
for (auto const& seq_el : seq) {
|
for (auto const& seq_el : seq) {
|
||||||
s.push_back(utils::trimSpaces(seq_el, utils::TrimType::TRIM_BOTH));
|
s.push_back(utils::trimSpaces(seq_el, utils::TrimType::TRIM_BOTH));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user