nasa / trick

Trick Simulation Environment. Trick provides a common set of simulation capabilities and utilities to build simulations automatically.
Other
44 stars 22 forks source link

Error when setting member of type er7_utils::Integration::Technique from Python context #692

Open dbankieris opened 6 years ago

dbankieris commented 6 years ago

S_define

#include "sim_objects/default_trick_sys.sm"
##include "trick/Integrator.hh"

class Sandbox : public Trick::SimObject {
    public:
    er7_utils::Integration::Technique technique;
};

Sandbox sandbox;

input.py

sandbox.technique = trick.Integration.SymplecticEuler

Result

Traceback (most recent call last):
  File "RUN_test/input.py", line 1, in <module>
    sandbox.technique = trick.Integration.SymplecticEuler
TypeError: in method 'Sandbox_technique_set', argument 2 of type 'er7_utils::Integration::Technique'
dbankieris commented 6 years ago

@alexlin0 Repeating the test with a member of type Trick::MonteRun::ExitStatus does not result in an error. The generated wrapper code is different as well.

    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_er7_utils__Integration__Technique,  0  | 0); 
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Sandbox_technique_set" "', argument " "2"" of type '" "er7_utils::Integration::Technique""'"); 
    }     
    if (!argp2) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Sandbox_technique_set" "', argument " "2"" of type '" "er7_utils::Integration::Technique""'");
    } else {
      er7_utils::Integration::Technique * temp = reinterpret_cast< er7_utils::Integration::Technique * >(argp2);
      arg2 = *temp;
      if (SWIG_IsNewObj(res2)) delete temp; 
    }
    int ret ;
    ret = typemap_in_scalar<Trick::MonteRun::ExitStatus >( arg2 , obj1 , "Sandbox_status_set") ;
    if ( ret != 0 ) {
      SWIG_exception_fail(SWIG_TypeError,"Right hand side could not be converted proper scalar type");
    }
ccsullivan2 commented 5 days ago

Commenting to note that this is still an issue. Using a workaround for now, but would prefer that this be resolved eventually.