comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Constant Size Array in Class Init
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Constant Size Array in Class Init [message #76231 is a reply to message #76230] Mon, 23 May 2011 15:03 Go to previous messageGo to previous message
Chris Williams is currently offline  Chris Williams
Messages: 4
Registered: May 2011
Junior Member
On May 23, 5:32 pm, David Fanning <n...@idlcoyote.com> wrote:
> Chris Williams writes:
>> I am creating a class that holds multidimensional data of several
>> different arrays.What I am trying to do is create a class to hold the
>> arrays, and then define the array sizes in the init function since
>> they will be different sizes.
>
>> For example, I want to do something like this
>
>> FUNCTION myclass:init, dim1, dim2, dim3
>
>> myarray = dblarr(dim1, dim2, dim3)
>
>> RETURN,1
>> END
>
>> PRO myclass__define
>
>> void = {myclass, myarray :dblarr } ;NO SIZE ON ARRAY
>
>> RETURN
>> END
>
>> However, I get a conflicting data structure error without first
>> defining the size of the array in the procedure myclass__define. Is
>> there an empty array object that allows me to define the array size at
>> initialization and not at object creation?
>
> You are going to have to define this field as a pointer
> to an array in IDL.
>
>     void = {myclass, myarray :ptr_new() } ;NO SIZE ON ARRAY
>
> Then,
>
>     myArray = Ptr_New(dblarr(dim1,dim2,dim3))
>     Help, *myArray
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

I just realized that all the fields of the class are private by
default and there is no way I am going to write 50 setters and getters
for a data storage class. I'm just going to do what I need to do in
python.

Thanks a ton David.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Constant Size Array in Class Init
Next Topic: Success!! Add and manipulate a visualization in standard iTool - Part II

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:17:53 PDT 2025

Total time taken to generate the page: 0.00588 seconds