25 #include "marginalTrek++.h"
26 #include "isoSpec++.h"
27 #include "tabulator.h"
33 void * setupIso(
int dimNumber,
34 const int* isotopeNumbers,
35 const int* atomCounts,
36 const double* isotopeMasses,
37 const double* isotopeProbabilities)
39 const double** IM =
new const double*[dimNumber];
40 const double** IP =
new const double*[dimNumber];
42 for(
int i=0; i<dimNumber; i++)
44 IM[i] = &isotopeMasses[idx];
45 IP[i] = &isotopeProbabilities[idx];
46 idx += isotopeNumbers[i];
50 Iso* iso =
new Iso(dimNumber, isotopeNumbers, atomCounts, IM, IP);
55 return reinterpret_cast<void*>(iso);
58 void deleteIso(
void* iso)
60 delete reinterpret_cast<Iso*>(iso);
64 #define ISOSPEC_C_FN_CODE(generatorType, dataType, method)\
65 dataType method##generatorType(void* generator){ return reinterpret_cast<generatorType*>(generator)->method(); }
67 #define ISOSPEC_C_FN_CODE_GET_CONF_SIGNATURE(generatorType)\
68 void get_conf_signature##generatorType(void* generator, int* space)\
69 { reinterpret_cast<generatorType*>(generator)->get_conf_signature(space); }
72 #define ISOSPEC_C_FN_DELETE(generatorType) void delete##generatorType(void* generator){ delete reinterpret_cast<generatorType*>(generator); }
74 #define ISOSPEC_C_FN_CODES(generatorType)\
75 ISOSPEC_C_FN_CODE(generatorType, double, mass) \
76 ISOSPEC_C_FN_CODE(generatorType, double, lprob) \
77 ISOSPEC_C_FN_CODE(generatorType, double, prob) \
78 ISOSPEC_C_FN_CODE_GET_CONF_SIGNATURE(generatorType) \
79 ISOSPEC_C_FN_CODE(generatorType, bool, advanceToNextConfiguration) \
80 ISOSPEC_C_FN_DELETE(generatorType)
85 void* setupIsoThresholdGenerator(
void* iso,
92 std::move(*reinterpret_cast<Iso*>(iso)),
98 return reinterpret_cast<void*>(iso_tmp);
104 void* setupIsoLayeredGenerator(
void* iso,
105 double _target_coverage,
106 double _percentage_to_expand,
112 std::move(*reinterpret_cast<Iso*>(iso)),
114 _percentage_to_expand,
119 return reinterpret_cast<void*>(iso_tmp);
125 void* setupIsoOrderedGenerator(
void* iso,
130 std::move(*reinterpret_cast<Iso*>(iso)),
134 return reinterpret_cast<void*>(iso_tmp);
140 void* setupThresholdTabulator(
void* generator,
152 return reinterpret_cast<void*>(tabulator);
155 void deleteThresholdTabulator(
void* t)
160 const double* massesThresholdTabulator(
void* tabulator)
165 const double* lprobsThresholdTabulator(
void* tabulator)
170 const double* probsThresholdTabulator(
void* tabulator)
175 const int* confsThresholdTabulator(
void* tabulator)
180 int confs_noThresholdTabulator(
void* tabulator)
188 void* setupLayeredTabulator(
void* generator,
200 return reinterpret_cast<void*>(tabulator);
203 void deleteLayeredTabulator(
void* t)
208 const double* massesLayeredTabulator(
void* tabulator)
213 const double* lprobsLayeredTabulator(
void* tabulator)
218 const double* probsLayeredTabulator(
void* tabulator)
223 const int* confsLayeredTabulator(
void* tabulator)
228 int confs_noLayeredTabulator(
void* tabulator)
233 void freeReleasedArray(
void* array)