[OpenDX2-users] Can DX count from 1 instead of 0?

2008-07-16 Thread Mark Gesing
Hi,

I have some data which is on a grid of cube shaped volume elements.
The grid is an 8x8 grid (64 elements), made-up of two layers of nodes
(9x9x2=162).

My problem is that DX by default numbers the nodes starting at 0-161,
whereas the application generating the data (LS-Dyna) numbers the nodes
1-162.

Therefore when I try to import the data (following the example on page 254
of the user's guide) I get the error:

Begin Execution
ERROR: Import:  Invalid data: 573rd item in `connections' component (162) is
not between 0 and 161  / file 'd3plot.dx' line 14

My .dx file d3plot.dx is as follows:

 object 1 class array type float rank 1 shape 3 items 162 lsb binary
 data file d3plot, 260
 attribute dep string positions
 object 2 class array type int rank 1 shape 9 items  64 lsb binary
 data file d3plot,2204
 attribute element type string cubes
 attribute ref string positions
 object 3 class array type float rank 0 items 162 lsb binary
 data file d3plot,4560
 attribute dep string positions
 object irreg positions irreg connections binary file class field
 component positions value 1
 component connections value 2
 component data value 3
 end

(forgive the wierd spacing,  I have written a code to auto-generate the .dx
file for d3plots with different sized meshes, and I haven't bothered to
tweak the format statements yet)

Can I get DX to number it's nodes from 1-162 instead of 0-161? If not, is
there a way to get DX to subtract 1 from each of the numbers in the
connectivity list?

I am also open to other solutions.

If anyone would like to try things out on my binary file (d3plot) ask me
and I'll e-mail it to you, I would attach it to this e-mail, however, it is
3.6 megabytes and I decided it would be poor form to send a large attachment
to a list.

Thank you very much

-- 
Mark Gesing,
MASc. Candidate,
Mechanical and Mechatronics Engineering,
University of Waterloo
[EMAIL PROTECTED]
(519) 888-4567 x32309
___
OpenDX2-users mailing list
OpenDX2-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/opendx2-users


Re: [OpenDX2-users] Can DX count from 1 instead of 0?

2008-07-16 Thread Joel Richardson
Mark,

OpenDX array indexing always starts at 0.  You can
easily subtract 1 from all the index numbers in the
connections component. To do that, you'll have to
import that array as something other than the connections
component (maybe as a separate object - put the field
and the array in a group and import that). Then inside
of dx, run the array through Compute(a-1) and then
use Replace to put it back into the field as the connections
component. You'll probably also have to set the ref
and element type attributes after the Compute, using
the Options module.

Hope that helps.
Cheers,
Joel

Mark Gesing wrote:
 Hi,
 
 I have some data which is on a grid of cube shaped volume elements.
 The grid is an 8x8 grid (64 elements), made-up of two layers of nodes 
 (9x9x2=162).
 
 My problem is that DX by default numbers the nodes starting at 0-161, 
 whereas the application generating the data (LS-Dyna) numbers the nodes 
 1-162.
 
 Therefore when I try to import the data (following the example on page 
 254 of the user's guide) I get the error:
 
 Begin Execution
 ERROR: Import:  Invalid data: 573rd item in `connections' component 
 (162) is not between 0 and 161  / file 'd3plot.dx' line 14
 
 My .dx file d3plot.dx is as follows:
 
  object 1 class array type float rank 1 shape 3 items 162 lsb binary
  data file d3plot, 260
  attribute dep string positions
  object 2 class array type int rank 1 shape 9 items  64 lsb binary
  data file d3plot,2204
  attribute element type string cubes
  attribute ref string positions
  object 3 class array type float rank 0 items 162 lsb binary
  data file d3plot,4560
  attribute dep string positions
  object irreg positions irreg connections binary file class field
  component positions value 1
  component connections value 2
  component data value 3
  end
 
 (forgive the wierd spacing,  I have written a code to auto-generate the 
 .dx file for d3plots with different sized meshes, and I haven't bothered 
 to tweak the format statements yet)
 
 Can I get DX to number it's nodes from 1-162 instead of 0-161? If not, 
 is there a way to get DX to subtract 1 from each of the numbers in the 
 connectivity list?
 
 I am also open to other solutions.
 
 If anyone would like to try things out on my binary file (d3plot) ask 
 me and I'll e-mail it to you, I would attach it to this e-mail, however, 
 it is 3.6 megabytes and I decided it would be poor form to send a large 
 attachment to a list.
 
 Thank you very much
 
 -- 
 Mark Gesing,
 MASc. Candidate,
 Mechanical and Mechatronics Engineering,
 University of Waterloo
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 (519) 888-4567 x32309
 
 
 
 
 ___
 OpenDX2-users mailing list
 OpenDX2-users@lists.berlios.de
 https://lists.berlios.de/mailman/listinfo/opendx2-users

-- 

===
Joel Richardson, Ph.D.
Sr. Research Scientist
Mouse Genome Informatics
The Jackson Laboratory   Phone: (207) 288-6435
600 Main Street  Fax:   (207) 288-6132
Bar Harbor, Maine 04609  URL:   www.informatics.jax.org
===
___
OpenDX2-users mailing list
OpenDX2-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/opendx2-users