freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [pooma-dev] vector access in particles


From: Julian C. Cummings
Subject: RE: [pooma-dev] vector access in particles
Date: Mon, 2 Apr 2001 16:15:31 -0700

Use Method 2 below.  There is a way to
access the x component of a Vector
attribute for all particles, using the 
comp() method of Arrays:

Neutrons.Direction.comp(0)

The result of this component access is
an Array of scalar data, and you can index
elements of that Array just like any other.
So you could do something like

Neutrons.Direction.comp(0)(ipart)

to get element ipart.  However, you
probably want to save the result of 
the component access as a temporary 
Array component view, since there is
a cost associated with creating these.
There is a fairly gnarly syntax used
to get the type of this temporary Array
component view:

ComponentView<Loc<1>,Array_t>::Type_t

where Array_t is the type of the original
DynamicArray that you are viewing a
component of.  The Loc<1> is used to store
the single component index used to reference
a component of a Vector attribute.

My advice is, don't go through the work of
creating a component view unless you need to
pass the component as an Array to some function.
Just access single elements of the Vector 
attribute, then access the component you want:

Neutrons.Direction(ipart)(0)


-- Julian C.


-----Original Message-----
From: Steve Nolen [mailto:address@hidden
Sent: Monday, April 02, 2001 2:59 PM
To: Pooma
Subject: [pooma-dev] vector access in particles


how does one access the x-axis dimension in a particle attribute direction?

1.  Neutrons.Direction( 0 )( ipart )

 -or-

2.  Neutrons.Direction( ipart ) ( 0 );

where ipart is the particle of interest and 0 denotes the x-axis member

-steve


reply via email to

[Prev in Thread] Current Thread [Next in Thread]