@@ -545,27 +545,7 @@ void stringFromRatBoundedArray(const char_T array_data[], const int32_T array_si
545545 memcpy (&result[0 ], array_data, array_size[1 ]);
546546}
547547
548- coder::array<real_T, 1U > pyArrayToRatRowArray1d (py::array_t <real_T> value)
549- {
550- coder::array<real_T, 1U > result;
551-
552- py::buffer_info buffer_info = value.request ();
553-
554- if (buffer_info.size == 0 )
555- return result;
556-
557- if (buffer_info.ndim != 1 )
558- throw std::runtime_error (" Expects a 1D numeric array" );
559-
560- result.set_size (buffer_info.shape [0 ]);
561- for (int32_T idx0{0 }; idx0 < buffer_info.shape [0 ]; idx0++) {
562- result[idx0] = value.at (idx0);
563- }
564-
565- return result;
566- }
567-
568- coder::array<real_T, 2U > pyArrayToRatColArray1d (py::array_t <real_T> value)
548+ coder::array<real_T, 2U > pyArrayToRatRowArray1d (py::array_t <real_T> value)
569549{
570550 coder::array<real_T, 2U > result;
571551
@@ -750,7 +730,7 @@ coder::array<RAT::cell_wrap_4, 2U> pyListToRatCellWrap4(py::list values)
750730 for (py::handle array: values)
751731 {
752732 py::array_t <real_T> casted_array = py::cast<py::array>(array);
753- result[idx].f1 = customCaller (" $id[" + std::to_string (idx) +" ]" , pyArrayToRatColArray1d , casted_array);
733+ result[idx].f1 = customCaller (" $id[" + std::to_string (idx) +" ]" , pyArrayToRatRowArray1d , casted_array);
754734 idx++;
755735 }
756736
@@ -827,14 +807,14 @@ RAT::struct1_T createStruct1(const NameStore& names)
827807RAT::struct2_T createStruct2 (const Checks& checks)
828808{
829809 RAT::struct2_T checks_struct;
830- checks_struct.params = customCaller (" Checks.params" , pyArrayToRatColArray1d , checks.params );
831- checks_struct.backgroundParams = customCaller (" Checks.backgroundParams" , pyArrayToRatColArray1d , checks.backgroundParams );
832- checks_struct.scalefactors = customCaller (" Checks.scalefactors" , pyArrayToRatColArray1d , checks.scalefactors );
833- checks_struct.qzshifts = customCaller (" Checks.qzshifts" , pyArrayToRatColArray1d , checks.qzshifts );
834- checks_struct.bulkIns = customCaller (" Checks.bulkIns" , pyArrayToRatColArray1d , checks.bulkIns );
835- checks_struct.bulkOuts = customCaller (" Checks.bulkOuts" , pyArrayToRatColArray1d , checks.bulkOuts );
836- checks_struct.resolutionParams = customCaller (" Checks.resolutionParams" , pyArrayToRatColArray1d , checks.resolutionParams );
837- checks_struct.domainRatios = customCaller (" Checks.domainRatios" , pyArrayToRatColArray1d , checks.domainRatios );
810+ checks_struct.params = customCaller (" Checks.params" , pyArrayToRatRowArray1d , checks.params );
811+ checks_struct.backgroundParams = customCaller (" Checks.backgroundParams" , pyArrayToRatRowArray1d , checks.backgroundParams );
812+ checks_struct.scalefactors = customCaller (" Checks.scalefactors" , pyArrayToRatRowArray1d , checks.scalefactors );
813+ checks_struct.qzshifts = customCaller (" Checks.qzshifts" , pyArrayToRatRowArray1d , checks.qzshifts );
814+ checks_struct.bulkIns = customCaller (" Checks.bulkIns" , pyArrayToRatRowArray1d , checks.bulkIns );
815+ checks_struct.bulkOuts = customCaller (" Checks.bulkOuts" , pyArrayToRatRowArray1d , checks.bulkOuts );
816+ checks_struct.resolutionParams = customCaller (" Checks.resolutionParams" , pyArrayToRatRowArray1d , checks.resolutionParams );
817+ checks_struct.domainRatios = customCaller (" Checks.domainRatios" , pyArrayToRatRowArray1d , checks.domainRatios );
838818
839819 return checks_struct;
840820}
@@ -844,39 +824,39 @@ RAT::struct0_T createStruct0(const ProblemDefinition& problem)
844824 RAT::struct0_T problem_struct;
845825
846826 stringToRatBoundedArray (problem.TF , problem_struct.TF .data , problem_struct.TF .size );
847- problem_struct.resample = customCaller (" Problem.resample" , pyArrayToRatColArray1d , problem.resample );
827+ problem_struct.resample = customCaller (" Problem.resample" , pyArrayToRatRowArray1d , problem.resample );
848828 problem_struct.data = customCaller (" Problem.data" , pyListToRatCellWrap1, problem.data );
849- problem_struct.dataPresent = customCaller (" Problem.dataPresent" , pyArrayToRatColArray1d , problem.dataPresent );
829+ problem_struct.dataPresent = customCaller (" Problem.dataPresent" , pyArrayToRatRowArray1d , problem.dataPresent );
850830 problem_struct.dataLimits = customCaller (" Problem.dataLimits" , pyListToRatCellWrap2, problem.dataLimits );
851831 problem_struct.simulationLimits = customCaller (" Problem.simulationLimits" , pyListToRatCellWrap2, problem.simulationLimits );
852- problem_struct.oilChiDataPresent = customCaller (" Problem.oilChiDataPresent" , pyArrayToRatColArray1d , problem.oilChiDataPresent );
832+ problem_struct.oilChiDataPresent = customCaller (" Problem.oilChiDataPresent" , pyArrayToRatRowArray1d , problem.oilChiDataPresent );
853833 problem_struct.numberOfContrasts = problem.numberOfContrasts ;
854834 stringToRatBoundedArray (problem.geometry , problem_struct.geometry .data , problem_struct.geometry .size );
855835 problem_struct.useImaginary = problem.useImaginary ;
856836 problem_struct.repeatLayers = customCaller (" Problem.repeatLayers" , pyListToRatCellWrap2, problem.repeatLayers );
857837 problem_struct.contrastBackgroundParams = customCaller (" Problem.contrastBackgroundParams" , pyListToRatCellWrap3, problem.contrastBackgroundParams );
858838 problem_struct.contrastBackgroundTypes = customCaller (" Problem.contrastBackgroundTypes" , pyListToRatCellWrap0, problem.contrastBackgroundTypes );
859839 problem_struct.contrastBackgroundActions = customCaller (" Problem.contrastBackgroundActions" , pyListToRatCellWrap0, problem.contrastBackgroundActions );
860- problem_struct.contrastQzshifts = customCaller (" Problem.contrastQzshifts" , pyArrayToRatColArray1d , problem.contrastQzshifts );
861- problem_struct.contrastScalefactors = customCaller (" Problem.contrastScalefactors" , pyArrayToRatColArray1d , problem.contrastScalefactors );
862- problem_struct.contrastBulkIns = customCaller (" Problem.contrastBulkIns" , pyArrayToRatColArray1d , problem.contrastBulkIns );
863- problem_struct.contrastBulkOuts = customCaller (" Problem.contrastBulkOuts" , pyArrayToRatColArray1d , problem.contrastBulkOuts );
864- problem_struct.contrastResolutionParams = customCaller (" Problem.contrastResolutionParams" , pyArrayToRatColArray1d , problem.contrastResolutionParams );
865- problem_struct.backgroundParams = customCaller (" Problem.backgroundParams" , pyArrayToRatColArray1d , problem.backgroundParams );
866- problem_struct.qzshifts = customCaller (" Problem.qzshifts" , pyArrayToRatColArray1d , problem.qzshifts );
867- problem_struct.scalefactors = customCaller (" Problem.scalefactors" , pyArrayToRatColArray1d , problem.scalefactors );
868- problem_struct.bulkIns = customCaller (" Problem.bulkIns" , pyArrayToRatColArray1d , problem.bulkIns );
869- problem_struct.bulkOuts = customCaller (" Problem.bulkOuts" , pyArrayToRatColArray1d , problem.bulkOuts );
870- problem_struct.resolutionParams = customCaller (" Problem.resolutionParams" , pyArrayToRatColArray1d , problem.resolutionParams );
871- problem_struct.params = customCaller (" Problem.params" , pyArrayToRatColArray1d , problem.params );
840+ problem_struct.contrastQzshifts = customCaller (" Problem.contrastQzshifts" , pyArrayToRatRowArray1d , problem.contrastQzshifts );
841+ problem_struct.contrastScalefactors = customCaller (" Problem.contrastScalefactors" , pyArrayToRatRowArray1d , problem.contrastScalefactors );
842+ problem_struct.contrastBulkIns = customCaller (" Problem.contrastBulkIns" , pyArrayToRatRowArray1d , problem.contrastBulkIns );
843+ problem_struct.contrastBulkOuts = customCaller (" Problem.contrastBulkOuts" , pyArrayToRatRowArray1d , problem.contrastBulkOuts );
844+ problem_struct.contrastResolutionParams = customCaller (" Problem.contrastResolutionParams" , pyArrayToRatRowArray1d , problem.contrastResolutionParams );
845+ problem_struct.backgroundParams = customCaller (" Problem.backgroundParams" , pyArrayToRatRowArray1d , problem.backgroundParams );
846+ problem_struct.qzshifts = customCaller (" Problem.qzshifts" , pyArrayToRatRowArray1d , problem.qzshifts );
847+ problem_struct.scalefactors = customCaller (" Problem.scalefactors" , pyArrayToRatRowArray1d , problem.scalefactors );
848+ problem_struct.bulkIns = customCaller (" Problem.bulkIns" , pyArrayToRatRowArray1d , problem.bulkIns );
849+ problem_struct.bulkOuts = customCaller (" Problem.bulkOuts" , pyArrayToRatRowArray1d , problem.bulkOuts );
850+ problem_struct.resolutionParams = customCaller (" Problem.resolutionParams" , pyArrayToRatRowArray1d , problem.resolutionParams );
851+ problem_struct.params = customCaller (" Problem.params" , pyArrayToRatRowArray1d , problem.params );
872852 problem_struct.numberOfLayers = problem.numberOfLayers ;
873853 problem_struct.contrastLayers = customCaller (" Problem.contrastLayers" , pyListToRatCellWrap4, problem.contrastLayers );
874854 problem_struct.layersDetails = customCaller (" Problem.layersDetails" , pyListToRatCellWrap5, problem.layersDetails );
875855 problem_struct.customFiles = customCaller (" Problem.customFiles" , py_function_array_to_rat_cell_wrap_0, problem.customFiles );
876856 stringToRatBoundedArray (problem.modelType , problem_struct.modelType .data , problem_struct.modelType .size );
877- problem_struct.contrastCustomFiles = customCaller (" Problem.contrastCustomFiles" , pyArrayToRatColArray1d , problem.contrastCustomFiles );
878- problem_struct.contrastDomainRatios = customCaller (" Problem.contrastDomainRatios" , pyArrayToRatColArray1d , problem.contrastDomainRatios );
879- problem_struct.domainRatios = customCaller (" Problem.domainRatios" , pyArrayToRatColArray1d , problem.domainRatios );
857+ problem_struct.contrastCustomFiles = customCaller (" Problem.contrastCustomFiles" , pyArrayToRatRowArray1d , problem.contrastCustomFiles );
858+ problem_struct.contrastDomainRatios = customCaller (" Problem.contrastDomainRatios" , pyArrayToRatRowArray1d , problem.contrastDomainRatios );
859+ problem_struct.domainRatios = customCaller (" Problem.domainRatios" , pyArrayToRatRowArray1d , problem.domainRatios );
880860 problem_struct.numberOfDomainContrasts = problem.numberOfDomainContrasts ;
881861 problem_struct.domainContrastLayers = customCaller (" Problem.domainContrastLayers" , pyListToRatCellWrap4, problem.domainContrastLayers );
882862 problem_struct.fitParams = customCaller (" Problem.fitParams" , pyArrayToRatRowArray1d, problem.fitParams );
@@ -1221,8 +1201,8 @@ ProblemDefinition problemDefinitionFromStruct0T(const RAT::struct0_T problem)
12211201 problem_def.domainRatios = pyArrayFromRatArray1d<coder::array<real_T, 2U >>(problem.domainRatios );
12221202 problem_def.numberOfDomainContrasts = problem.numberOfDomainContrasts ;
12231203 problem_def.domainContrastLayers = pyList1DFromRatCellWrap2D<coder::array<RAT::cell_wrap_4, 2U >>(problem.domainContrastLayers );
1224- problem_def.fitParams = pyArrayFromRatArray1d<coder::array<real_T, 1U >>(problem.fitParams , false );
1225- problem_def.otherParams = pyArrayFromRatArray1d<coder::array<real_T, 1U >>(problem.otherParams , false );
1204+ problem_def.fitParams = pyArrayFromRatArray1d<coder::array<real_T, 2U >>(problem.fitParams );
1205+ problem_def.otherParams = pyArrayFromRatArray1d<coder::array<real_T, 2U >>(problem.otherParams );
12261206 problem_def.fitLimits = pyArrayFromRatArray2d (problem.fitLimits );
12271207 problem_def.otherLimits = pyArrayFromRatArray2d (problem.otherLimits );
12281208
0 commit comments