← Back to team overview

yade-dev team mailing list archive

Re: Body::groupMask could be unsigned int

 

Hi Jan,

thanks for your commit. Some minor notes:

1) Please, add an option to CMakeLists, it can be a "feature" probably,
    disabled by default. There are a lot of examples there.

2) [2]
+ bool maskOk(int mask) const {return (mask==0 || (bool)(groupMask & mask));}
+ bool maskCompatible(int mask) const { return (bool)(groupMask & mask); }
+#ifdef BODY_GROUP_MASK_ARBITRARY_PRECISION
+ bool maskOk(const boost::python::long_& mask) const {return (mask==0
|| (bool)(groupMask & mask));}
+ bool maskCompatible(const boost::python::long_& mask) const { return
(bool)(groupMask & mask); }
+#endif

Do you want to have both of these definitions if
BODY_GROUP_MASK_ARBITRARY_PRECISION
enabled ?

[2] https://github.com/yade/trunk/commit/15bca1969f43e883bfe9835d4a985a2ead337a77#diff-e6b228e5bbf5122a3adb4478cf4effa2R78

3) [3]
+ namespace bp = boost::python;
You are there already in a namespace boost, you can just use
python:: instead of bp::.

[3 ]https://github.com/yade/trunk/commit/15bca1969f43e883bfe9835d4a985a2ead337a77#diff-e6b228e5bbf5122a3adb4478cf4effa2R144

Best regards


Anton


2014-06-01 16:07 GMT+02:00 Jan Stránský <honzik.stransky@xxxxxxxxx>:
> Most likely yes, now I am thinking of most clean way (btw. if you have any
> idea or experience, I would be grateful for any advice :-). Anyway it would
> be only optional feature..
> Jan
>
>
> 2014-06-01 15:58 GMT+02:00 Anton Gladky <gladky.anton@xxxxxxxxx>:
>
>> Ok, but you still want to increase the type of variables to something
>> larger as int?
>>
>> Anton
>>
>>
>> 2014-06-01 14:51 GMT+02:00 Jan Stránský <honzik.stransky@xxxxxxxxx>:
>> > Hi Antom,
>> > I changed my opinion such that using signed types and default value to
>> > -1 is
>> > the best choice (as -1 = 0b1111111... in unsigned equivalent, I missed
>> > this
>> > feature before). To handle this in python one can use ctypes (c_int and
>> > c_uint) to make the value signed/unsigned)
>> > cheers
>> > Jan
>> >
>> >
>> >
>> >
>> >
>> > 2014-05-26 21:08 GMT+02:00 Anton Gladky <gladky.anton@xxxxxxxxx>:
>> >
>> >> Hi Jan,
>> >>
>> >> I agree with that. The problem is that we use in many parts of code
>> >> the default mask value -1 [1]. All of them should be changed (probably
>> >> also in some if-constructions). But I do not think it is a difficult,
>> >> "grep/sed" should do thinks well.
>> >>
>> >> [1]
>> >>
>> >> https://github.com/yade/trunk/blob/master/pkg/dem/NewtonIntegrator.hpp#L79
>> >>
>> >> Best regards
>> >>
>> >> Anton
>> >>
>> >>
>> >> 2014-05-26 20:54 GMT+02:00 Jan Stránský <honzik.stransky@xxxxxxxxx>:
>> >> > Hello,
>> >> >
>> >> > currently I am running out of size of groupMask (I would need more
>> >> > bits), so
>> >> > I am planning to introduce optional compilation with some larger
>> >> > type.
>> >> > Anyway, even the size is the same, working with the full range of
>> >> > unsigned
>> >> > int bitmask is much more natural than standard signed int.
>> >> >
>> >> > Would anybody be against changing the type to unsigned int with
>> >> > default
>> >> > value UINT_MAX = 0b11111..., i.e. the body would interact with
>> >> > anything
>> >> > by
>> >> > default?
>> >> >
>> >> > Thanks for the feedback
>> >> > Jan
>> >> >
>> >> > _______________________________________________
>> >> > Mailing list: https://launchpad.net/~yade-dev
>> >> > Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
>> >> > Unsubscribe : https://launchpad.net/~yade-dev
>> >> > More help   : https://help.launchpad.net/ListHelp
>> >> >
>> >
>> >
>> >
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~yade-dev
>> > Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
>> > Unsubscribe : https://launchpad.net/~yade-dev
>> > More help   : https://help.launchpad.net/ListHelp
>> >
>
>


Follow ups

References