[Sidefx-houdini-list] Getting fluid field type using an expression

Pablo Giménez pablogipi at gmail.com
Wed Apr 4 11:03:40 EDT 2012


Finally I got this working using Python. I made this function in the python
module of my OTL:
def fieldType(node, fieldName, objectName='fluid'):
    '''
    Return whether or not the field is scalar or vector
    @parm node dopnet node for simulation
    @oarm fieldName name for field to scan
    @parm objectNode object to process
    @return 0 if field is scalar, 1 if it is vector. None is an error
happens.
    '''
    sim = node.simulation()
    data = sim.findData(objectName + '/' + fieldName)
    if data is None:
        return None
    else:
        if data.dataType() == 'SIM_SopScalarField':
            return 0
        elif data.dataType() == 'SIM_SopVectorField':
            return 1
        else:
            return None

Then I have a switch inside my dopnet that use the next python expression
that calls to the former function:
pwd().parent().parent().hdaModule().fieldType(pwd().parent(),
pwd().parent().parent().parm('dstfield0').eval())
I wonder if I can make the previous expression more compact.

But seems to work.


El 4 de abril de 2012 10:41, Pablo Giménez <pablogipi at gmail.com> escribió:

> So seems the way to go here in DOPs is using python rather than
> expressions ?
>
>
> 2012/4/3 Michael O'Brien <mobrien at pixar.com>
>
>> Hola~
>>
>> In the sop land, each volume primitive is separate, and it's only a naming
>> convention and adhering to that convention that makes it a scalar versus a
>> vector. So, things that end in *.{x,y,z} are usually considered a vector.
>>
>> In dop land, it's up to the code in the micro solver to do the
>> interpretation. You could pull the record's detail in HOM and see how many
>> primitives are in it.
>>
>> MO
>>
>> > -----Original Message-----
>> > From: sidefx-houdini-list-bounces at sidefx.com [mailto:sidefx-houdini-
>> > list-bounces at sidefx.com] On Behalf Of Pablo Giménez
>> > Sent: Tuesday, April 03, 2012 10:28 AM
>> > To: Houdini Mailing List
>> > Subject: [Sidefx-houdini-list] Getting fluid field type using an
>> > expression
>> >
>> > Hi all.
>> > I am trying to use an expression to know if a field in a fluid object
>> > is
>> > scalar or vector.
>> > I got some more or less working using this:
>> > strcmp("[0, 1, 2]", dopoptions(".", "fluid", chs("../../dstfield0"),
>> > "primnum")) == 0
>> > It is a ilittel bit clunky but works with some fields.
>> > Problem is that it relies in the "primnum" option. This exists in vel,
>> > density, temperature and fuel.
>> > But not in others, like divergence or burn.
>> > So somebody know any way using expression to know whether a field is
>> > scalar
>> > or vector?
>> > Thanks.
>> >
>> > --
>> > Un saludo
>> > Best Regards
>> > Pablo Giménez
>> > _______________________________________________
>> > Sidefx-houdini-list mailing list
>> > Sidefx-houdini-list at sidefx.com
>> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>
>
>
>
> --
> Un saludo
> Best Regards
> Pablo Giménez
>



-- 
Un saludo
Best Regards
Pablo Giménez



More information about the Sidefx-houdini-list mailing list