Houdini VEX Groups
When you group stuff together with a Group SOP, Houdini simply creates an attribute called @group_{name} whose value is 1 or 0.
So to manually add an element to a group, just create the attribute on the element:
i@group_fuckheads = 1; // Remember to declare i!
When acting on a point or prim from a detail:
setpointgroup(0, "selected", ptnum, 1);
To check whether an element is in a group, just check for the attribute:
inpointgroup(geoself(), "selected", @ptnum); // The long way
Or simply:
if (@group_selected); // The short way
@Cd = @group_selected ? red : blue; // Ternary