mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
Use udunits package for units conversions
Changed the handling of how we handle doubles and ints allowing more mathematical operations like multiplication, division, and some limited exponentiation. refs #231
This commit is contained in:
parent
684f0e6bdc
commit
4f3ef64002
@ -6,10 +6,10 @@
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
#include "trick/swig/trick_swig.i"
|
#include "trick/swig/trick_swig.i"
|
||||||
#include "trick/swig/units_attach.i"
|
|
||||||
#include "trick/swig/extra_functions.i"
|
|
||||||
#include "trick/swig/swig_class_typedef.i"
|
#include "trick/swig/swig_class_typedef.i"
|
||||||
#include "trick/swig/cast_as.i"
|
#include "trick/swig/cast_as.i"
|
||||||
|
#include "units_attach.i"
|
||||||
|
#include "extra_functions.i"
|
||||||
|
|
||||||
// Special typemap for collectee in add_collect and delete_collect.
|
// Special typemap for collectee in add_collect and delete_collect.
|
||||||
%typemap(in) void * collectee {
|
%typemap(in) void * collectee {
|
||||||
|
@ -148,10 +148,10 @@ PyObject * swig_double::__div__( PyObject * obj1 ) {
|
|||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
result->value = value / PyFloat_AsDouble(obj1) ;
|
result->value = value / PyFloat_AsDouble(obj1) ;
|
||||||
|
result->units = units ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
result->value = value / temp_m->value ;
|
result->value = value / temp_m->value ;
|
||||||
result->units = units ;
|
|
||||||
result->units = units + "/(" + temp_m->units + ")";
|
result->units = units + "/(" + temp_m->units + ")";
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
@ -159,6 +159,7 @@ PyObject * swig_double::__div__( PyObject * obj1 ) {
|
|||||||
result->units = units + "/(" + temp_m->units + ")";
|
result->units = units + "/(" + temp_m->units + ")";
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
result->value = value / PyInt_AsLong(obj1) ;
|
result->value = value / PyInt_AsLong(obj1) ;
|
||||||
|
result->units = units ;
|
||||||
}
|
}
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
return ret ;
|
return ret ;
|
||||||
@ -179,20 +180,12 @@ PyObject * swig_double::__floordiv__( PyObject * obj1 ) {
|
|||||||
result->value = (long long)(value / PyFloat_AsDouble(obj1)) ;
|
result->value = (long long)(value / PyFloat_AsDouble(obj1)) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
result->value = (long long)(value / temp_m->value) ;
|
||||||
result->value = (long long)(value / temp_m->value) ;
|
result->units = units + "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
result->value = (long long)(value / temp_m->value) ;
|
||||||
result->value = (long long)(value / temp_m->value) ;
|
result->units = units + "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
result->value = (long long)(value / PyInt_AsLong(obj1)) ;
|
result->value = (long long)(value / PyInt_AsLong(obj1)) ;
|
||||||
}
|
}
|
||||||
@ -214,18 +207,18 @@ PyObject * swig_double::__mod__( PyObject * obj1 ) {
|
|||||||
result->value = fmod(value , PyFloat_AsDouble(obj1)) ;
|
result->value = fmod(value , PyFloat_AsDouble(obj1)) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = fmod( value , temp_m->value ) ;
|
result->value = fmod( value , temp_m->value ) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Modulus must be unitless. Cannot create new unit-ed type.");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = fmod( value , temp_m->value) ;
|
result->value = fmod( value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Modulus must be unitless. Cannot create new unit-ed type.");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
@ -243,18 +236,14 @@ PyObject * swig_double::__pow__( PyObject * obj1 ) {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
void * argp2 ;
|
void * argp2 ;
|
||||||
|
|
||||||
if ( units.compare("--")) {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = new swig_double() ;
|
result = new swig_double() ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
result->value = pow(value , PyFloat_AsDouble(obj1)) ;
|
result->value = pow(value , PyFloat_AsDouble(obj1)) ;
|
||||||
|
result->units = units ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = pow(value , temp_m->value) ;
|
result->value = pow(value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -262,16 +251,20 @@ PyObject * swig_double::__pow__( PyObject * obj1 ) {
|
|||||||
}
|
}
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = pow(value , temp_m->value) ;
|
result->value = pow(value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
result->value = pow(value , PyInt_AsLong(obj1)) ;
|
int power = PyInt_AsLong(obj1) ;
|
||||||
|
result->value = pow(value , power) ;
|
||||||
|
result->units = units ;
|
||||||
|
for ( int ii = 1 ; ii < power ; ii++ ) {
|
||||||
|
result->units = result->units + "*(" + units + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result->units = units ;
|
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
@ -313,20 +306,11 @@ PyObject * swig_double::__rdiv__( PyObject * obj1 ) {
|
|||||||
result = new swig_double() ;
|
result = new swig_double() ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
result->value = PyFloat_AsDouble(obj1) / value ;
|
||||||
result->value = PyFloat_AsDouble(obj1) / value ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
result->value = PyInt_AsLong(obj1) / value ;
|
||||||
result->value = PyInt_AsLong(obj1) / value ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result->units = units ;
|
result->units = "1/(" + units + ")" ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
@ -344,20 +328,11 @@ PyObject * swig_double::__rfloordiv__( PyObject * obj1 ) {
|
|||||||
result = new swig_double() ;
|
result = new swig_double() ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
result->value = floor(PyFloat_AsDouble(obj1) / value) ;
|
||||||
result->value = floor(PyFloat_AsDouble(obj1) / value) ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
result->value = floor(PyInt_AsLong(obj1) / value) ;
|
||||||
result->value = floor(PyInt_AsLong(obj1) / value) ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result->units = units ;
|
result->units = "1/(" + units + ")" ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
@ -371,16 +346,16 @@ PyObject * swig_double::__rmod__( PyObject * obj1 ) {
|
|||||||
result = new swig_double() ;
|
result = new swig_double() ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
result->value = fmod(PyFloat_AsDouble(obj1) , value) ;
|
result->value = fmod(PyFloat_AsDouble(obj1) , value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Modulus must be unitless. Cannot create new unit-ed type.");
|
||||||
}
|
}
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
result->value = fmod(PyInt_AsLong(obj1) , value) ;
|
result->value = fmod(PyInt_AsLong(obj1) , value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Modulus must be unitless. Cannot create new unit-ed type.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result->units = units ;
|
result->units = units ;
|
||||||
@ -394,13 +369,13 @@ PyObject * swig_double::__rpow__( PyObject * obj1 ) {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
return(PyFloat_FromDouble(pow(PyFloat_AsDouble(obj1) , value))) ;
|
return(PyFloat_FromDouble(pow(PyFloat_AsDouble(obj1) , value))) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
||||||
}
|
}
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
return(PyFloat_FromDouble(pow(PyInt_AsLong(obj1) , value))) ;
|
return(PyFloat_FromDouble(pow(PyInt_AsLong(obj1) , value))) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -491,20 +466,12 @@ PyObject * swig_double::__imul__( PyObject * obj1 ) {
|
|||||||
value *= PyFloat_AsDouble(obj1) ;
|
value *= PyFloat_AsDouble(obj1) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value *= temp_m->value ;
|
||||||
value *= temp_m->value ;
|
units += "*(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value *= temp_m->value ;
|
||||||
value *= temp_m->value ;
|
units += "*(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
value *= PyInt_AsLong(obj1) ;
|
value *= PyInt_AsLong(obj1) ;
|
||||||
}
|
}
|
||||||
@ -522,20 +489,12 @@ PyObject * swig_double::__idiv__( PyObject * obj1 ) {
|
|||||||
value /= PyFloat_AsDouble(obj1) ;
|
value /= PyFloat_AsDouble(obj1) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value /= temp_m->value ;
|
||||||
value /= temp_m->value ;
|
units += "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value /= temp_m->value ;
|
||||||
value /= temp_m->value ;
|
units += "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
value /= PyInt_AsLong(obj1) ;
|
value /= PyInt_AsLong(obj1) ;
|
||||||
}
|
}
|
||||||
@ -557,20 +516,12 @@ PyObject * swig_double::__ifloordiv__( PyObject * obj1 ) {
|
|||||||
value = floor(value / PyFloat_AsDouble(obj1)) ;
|
value = floor(value / PyFloat_AsDouble(obj1)) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value = floor(value / temp_m->value) ;
|
||||||
value = floor(value / temp_m->value) ;
|
units += "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value = floor(value / temp_m->value) ;
|
||||||
value = floor(value / temp_m->value) ;
|
units += "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
value = floor( value / PyInt_AsLong(obj1)) ;
|
value = floor( value / PyInt_AsLong(obj1)) ;
|
||||||
}
|
}
|
||||||
@ -588,7 +539,7 @@ PyObject * swig_double::__imod__( PyObject * obj1 ) {
|
|||||||
value = fmod( value , PyFloat_AsDouble(obj1)) ;
|
value = fmod( value , PyFloat_AsDouble(obj1)) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = fmod(value , temp_m->value );
|
value = fmod(value , temp_m->value );
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
||||||
@ -596,7 +547,7 @@ PyObject * swig_double::__imod__( PyObject * obj1 ) {
|
|||||||
}
|
}
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = fmod( value , temp_m->value );
|
value = fmod( value , temp_m->value );
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
||||||
@ -615,7 +566,7 @@ PyObject * swig_double::__ipow__( PyObject * obj1 ) {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
void * argp2 ;
|
void * argp2 ;
|
||||||
|
|
||||||
if ( units.compare("--")) {
|
if ( units.compare("1")) {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
@ -624,7 +575,7 @@ PyObject * swig_double::__ipow__( PyObject * obj1 ) {
|
|||||||
value = pow(value , PyFloat_AsDouble(obj1)) ;
|
value = pow(value , PyFloat_AsDouble(obj1)) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = pow(value , temp_m->value) ;
|
value = pow(value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -632,7 +583,7 @@ PyObject * swig_double::__ipow__( PyObject * obj1 ) {
|
|||||||
}
|
}
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = pow(value , temp_m->value) ;
|
value = pow(value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
|
@ -122,30 +122,14 @@ PyObject * swig_int::__mul__( PyObject * obj1 ) {
|
|||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * result = new swig_int() ;
|
swig_int * result = new swig_int() ;
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
result->value = value * temp_m->value ;
|
||||||
result->value = value * temp_m->value ;
|
result->units = units + "*(" + temp_m->units + ")";
|
||||||
result->units = units ;
|
|
||||||
} else if ( !units.compare("--")) {
|
|
||||||
result->value = value * temp_m->value ;
|
|
||||||
result->units = temp_m->units ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * result = new swig_double() ;
|
swig_double * result = new swig_double() ;
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
result->value = value * temp_m->value ;
|
||||||
result->value = value * temp_m->value ;
|
result->units = units + "*(" + temp_m->units + ")";
|
||||||
result->units = units ;
|
|
||||||
} else if ( !units.compare("--")) {
|
|
||||||
result->value = value * temp_m->value ;
|
|
||||||
result->units = temp_m->units ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
swig_int * result = new swig_int() ;
|
swig_int * result = new swig_int() ;
|
||||||
@ -166,29 +150,20 @@ PyObject * swig_int::__div__( PyObject * obj1 ) {
|
|||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
result->value = value / PyFloat_AsDouble(obj1) ;
|
result->value = value / PyFloat_AsDouble(obj1) ;
|
||||||
|
result->units = units ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
result->value = value / temp_m->value ;
|
||||||
result->value = value / temp_m->value ;
|
result->units = units + "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
result->value = value / temp_m->value ;
|
||||||
result->value = value / temp_m->value ;
|
result->units = units + "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
result->value = value / PyInt_AsLong(obj1) ;
|
result->value = value / PyInt_AsLong(obj1) ;
|
||||||
|
result->units = units ;
|
||||||
}
|
}
|
||||||
result->units = units ;
|
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +179,6 @@ PyObject * swig_int::__mod__( PyObject * obj1 ) {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
void * argp2 ;
|
void * argp2 ;
|
||||||
|
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
swig_double * result = new swig_double() ;
|
swig_double * result = new swig_double() ;
|
||||||
result->value = fmod(value , PyFloat_AsDouble(obj1)) ;
|
result->value = fmod(value , PyFloat_AsDouble(obj1)) ;
|
||||||
@ -213,7 +187,7 @@ PyObject * swig_int::__mod__( PyObject * obj1 ) {
|
|||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * result = new swig_int() ;
|
swig_int * result = new swig_int() ;
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = value % temp_m->value ;
|
result->value = value % temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -224,7 +198,7 @@ PyObject * swig_int::__mod__( PyObject * obj1 ) {
|
|||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * result = new swig_double() ;
|
swig_double * result = new swig_double() ;
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = fmod( value , temp_m->value) ;
|
result->value = fmod( value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -259,7 +233,7 @@ PyObject * swig_int::__pow__( PyObject * obj1 ) {
|
|||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
swig_int * result = new swig_int() ;
|
swig_int * result = new swig_int() ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = (long long)(pow(value , temp_m->value)) ;
|
result->value = (long long)(pow(value , temp_m->value)) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -269,7 +243,7 @@ PyObject * swig_int::__pow__( PyObject * obj1 ) {
|
|||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * result = new swig_double() ;
|
swig_double * result = new swig_double() ;
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = pow(value , temp_m->value) ;
|
result->value = pow(value , temp_m->value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -279,8 +253,12 @@ PyObject * swig_int::__pow__( PyObject * obj1 ) {
|
|||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
swig_int * result = new swig_int() ;
|
swig_int * result = new swig_int() ;
|
||||||
|
int power = PyInt_AsLong(obj1) ;
|
||||||
|
result->value = (long long)(pow(value , power)) ;
|
||||||
result->units = units ;
|
result->units = units ;
|
||||||
result->value = (long long)(pow(value , PyInt_AsLong(obj1))) ;
|
for ( int ii = 1 ; ii < power ; ii++ ) {
|
||||||
|
result->units = result->units + "*(" + units + ")";
|
||||||
|
}
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +277,7 @@ PyObject * swig_int::__lshift__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = value << temp_m->value ;
|
result->value = value << temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
||||||
@ -330,7 +308,7 @@ PyObject * swig_int::__rshift__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = value >> temp_m->value ;
|
result->value = value >> temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
||||||
@ -361,7 +339,7 @@ PyObject * swig_int::__and__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = value & temp_m->value ;
|
result->value = value & temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
||||||
@ -392,7 +370,7 @@ PyObject * swig_int::__xor__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = value ^ temp_m->value ;
|
result->value = value ^ temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
||||||
@ -423,7 +401,7 @@ PyObject * swig_int::__or__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
result->value = value | temp_m->value ;
|
result->value = value | temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
||||||
@ -477,20 +455,11 @@ PyObject * swig_int::__rdiv__( PyObject * obj1 ) {
|
|||||||
result = new swig_double() ;
|
result = new swig_double() ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
result->value = PyFloat_AsDouble(obj1) / value ;
|
||||||
result->value = PyFloat_AsDouble(obj1) / value ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
result->value = PyInt_AsLong(obj1) / value ;
|
||||||
result->value = PyInt_AsLong(obj1) / value ;
|
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result->units = units ;
|
result->units = "1/(" + units + ")" ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
@ -511,7 +480,7 @@ PyObject * swig_int::__rmod__( PyObject * obj1 ) {
|
|||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
swig_double * result = new swig_double() ;
|
swig_double * result = new swig_double() ;
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
result->value = fmod(PyFloat_AsDouble(obj1) , value) ;
|
result->value = fmod(PyFloat_AsDouble(obj1) , value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -520,7 +489,7 @@ PyObject * swig_int::__rmod__( PyObject * obj1 ) {
|
|||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_double *"), SWIG_POINTER_OWN);
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
swig_int * result = new swig_int() ;
|
swig_int * result = new swig_int() ;
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
result->value = (long long)(PyInt_AsLong(obj1) % value) ;
|
result->value = (long long)(PyInt_AsLong(obj1) % value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Divisor must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -529,7 +498,6 @@ PyObject * swig_int::__rmod__( PyObject * obj1 ) {
|
|||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,13 +505,13 @@ PyObject * swig_int::__rpow__( PyObject * obj1 ) {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
|
|
||||||
if ( PyFloat_Check(obj1) ) {
|
if ( PyFloat_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
return(PyFloat_FromDouble(pow(PyFloat_AsDouble(obj1) , value))) ;
|
return(PyFloat_FromDouble(pow(PyFloat_AsDouble(obj1) , value))) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
||||||
}
|
}
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
return(PyFloat_FromDouble(pow(PyInt_AsLong(obj1) , value))) ;
|
return(PyFloat_FromDouble(pow(PyInt_AsLong(obj1) , value))) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Power argument must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -563,7 +531,7 @@ PyObject * swig_int::__rlshift__( PyObject * obj1 ) {
|
|||||||
PyErr_SetString(PyExc_TypeError,"Shifted value must be integer");
|
PyErr_SetString(PyExc_TypeError,"Shifted value must be integer");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
result->value = (long long)(PyInt_AsLong(obj1) << value) ;
|
result->value = (long long)(PyInt_AsLong(obj1) << value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -587,7 +555,7 @@ PyObject * swig_int::__rrshift__( PyObject * obj1 ) {
|
|||||||
PyErr_SetString(PyExc_TypeError,"Shifted value must be integer");
|
PyErr_SetString(PyExc_TypeError,"Shifted value must be integer");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
if ( !units.compare("--")) {
|
if ( !units.compare("1")) {
|
||||||
result->value = (long long)(PyInt_AsLong(obj1) >> value) ;
|
result->value = (long long)(PyInt_AsLong(obj1) >> value) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -696,20 +664,12 @@ PyObject * swig_int::__imul__( PyObject * obj1 ) {
|
|||||||
value = (long long)(round(value * PyFloat_AsDouble(obj1))) ;
|
value = (long long)(round(value * PyFloat_AsDouble(obj1))) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value *= temp_m->value ;
|
||||||
value *= temp_m->value ;
|
units += "*(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value = (long long)round(value * temp_m->value) ;
|
||||||
value = (long long)round(value * temp_m->value) ;
|
units += "*(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
value *= PyInt_AsLong(obj1) ;
|
value *= PyInt_AsLong(obj1) ;
|
||||||
}
|
}
|
||||||
@ -727,20 +687,12 @@ PyObject * swig_int::__idiv__( PyObject * obj1 ) {
|
|||||||
value = (long long)(round(value / PyFloat_AsDouble(obj1))) ;
|
value = (long long)(round(value / PyFloat_AsDouble(obj1))) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value /= temp_m->value ;
|
||||||
value /= temp_m->value ;
|
units += "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
value = (long long)round(value / temp_m->value) ;
|
||||||
value = (long long)round(value / temp_m->value) ;
|
units += "/(" + temp_m->units + ")";
|
||||||
} else {
|
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
|
||||||
return NULL ;
|
|
||||||
}
|
|
||||||
} else if ( PyInt_Check(obj1) ) {
|
} else if ( PyInt_Check(obj1) ) {
|
||||||
value /= PyInt_AsLong(obj1) ;
|
value /= PyInt_AsLong(obj1) ;
|
||||||
}
|
}
|
||||||
@ -766,7 +718,7 @@ PyObject * swig_int::__imod__( PyObject * obj1 ) {
|
|||||||
value = (long long)round(fmod( value , PyFloat_AsDouble(obj1))) ;
|
value = (long long)round(fmod( value , PyFloat_AsDouble(obj1))) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value %= temp_m->value ;
|
value %= temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
||||||
@ -774,7 +726,7 @@ PyObject * swig_int::__imod__( PyObject * obj1 ) {
|
|||||||
}
|
}
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = (long long)round(fmod( value , temp_m->value ));
|
value = (long long)round(fmod( value , temp_m->value ));
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Operation must contain at least one unit-less value. Cannot create new unit-ed type.");
|
||||||
@ -793,7 +745,7 @@ PyObject * swig_int::__ipow__( PyObject * obj1 ) {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
void * argp2 ;
|
void * argp2 ;
|
||||||
|
|
||||||
if ( units.compare("--")) {
|
if ( units.compare("1")) {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
@ -802,7 +754,7 @@ PyObject * swig_int::__ipow__( PyObject * obj1 ) {
|
|||||||
value = (long long)round(pow(value , PyFloat_AsDouble(obj1))) ;
|
value = (long long)round(pow(value , PyFloat_AsDouble(obj1))) ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = (long long)(pow(value , temp_m->value)) ;
|
value = (long long)(pow(value , temp_m->value)) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -810,7 +762,7 @@ PyObject * swig_int::__ipow__( PyObject * obj1 ) {
|
|||||||
}
|
}
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_double *"), 0 ))) {
|
||||||
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
swig_double * temp_m = reinterpret_cast< swig_double * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value = (long long)round(pow(value , temp_m->value)) ;
|
value = (long long)round(pow(value , temp_m->value)) ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
PyErr_SetString(PyExc_TypeError,"Both arguments must be unitless. Cannot create new unit-ed type.");
|
||||||
@ -834,7 +786,7 @@ PyObject * swig_int::__ilshift__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value <<= temp_m->value ;
|
value <<= temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
||||||
@ -861,7 +813,7 @@ PyObject * swig_int::__irshift__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value >>= temp_m->value ;
|
value >>= temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Shift value must be unitless.");
|
||||||
@ -889,7 +841,7 @@ PyObject * swig_int::__iand__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value &= temp_m->value ;
|
value &= temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
||||||
@ -916,7 +868,7 @@ PyObject * swig_int::__ixor__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value ^= temp_m->value ;
|
value ^= temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
||||||
@ -943,7 +895,7 @@ PyObject * swig_int::__ior__( PyObject * obj1 ) {
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
} else if (SWIG_IsOK(SWIG_ConvertPtr(obj1, &argp2,SWIG_TypeQuery("swig_int *"), 0 ))) {
|
||||||
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
swig_int * temp_m = reinterpret_cast< swig_int * >(argp2) ;
|
||||||
if ( !temp_m->units.compare("--")) {
|
if ( !temp_m->units.compare("1")) {
|
||||||
value |= temp_m->value ;
|
value |= temp_m->value ;
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
PyErr_SetString(PyExc_TypeError,"Bitmask value must be unitless.");
|
||||||
@ -1197,12 +1149,9 @@ PyObject * swig_int::__neg__() {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
|
|
||||||
result = new swig_int() ;
|
result = new swig_int() ;
|
||||||
|
|
||||||
result->value = -value ;
|
result->value = -value ;
|
||||||
result->units = units ;
|
result->units = units ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1211,12 +1160,9 @@ PyObject * swig_int::__pos__() {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
|
|
||||||
result = new swig_int() ;
|
result = new swig_int() ;
|
||||||
|
|
||||||
result->value = value ;
|
result->value = value ;
|
||||||
result->units = units ;
|
result->units = units ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1225,16 +1171,9 @@ PyObject * swig_int::__abs__() {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
|
|
||||||
result = new swig_int() ;
|
result = new swig_int() ;
|
||||||
|
|
||||||
#if (__GNUC__ <= 3 && (__GNUC_MINOR__ == 3 || __GNUC_MINOR__ == 4))
|
|
||||||
result->value = __gnu_cxx::llabs(value) ;
|
|
||||||
#else
|
|
||||||
result->value = llabs(value) ;
|
result->value = llabs(value) ;
|
||||||
#endif
|
|
||||||
result->units = units ;
|
result->units = units ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,12 +1182,9 @@ PyObject * swig_int::__invert__() {
|
|||||||
PyObject * ret = NULL ;
|
PyObject * ret = NULL ;
|
||||||
|
|
||||||
result = new swig_int() ;
|
result = new swig_int() ;
|
||||||
|
|
||||||
result->value = ~value ;
|
result->value = ~value ;
|
||||||
result->units = units ;
|
result->units = units ;
|
||||||
|
|
||||||
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
ret = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIG_TypeQuery("swig_int *"), SWIG_POINTER_OWN);
|
||||||
|
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user