Re: Representing structures for simulations



justabeginner wrote:
> It still seems that none of them are particularly suited to
> representing physical structures. For my problem, I will need to:
> 1) Record the states (velocity, temperature, phase, etc.) of different
> particles;
> 2) Be able to quickly run proximity searches to locate neighbouring
> particles.

The way to quickly run proximity searches is to have most of the work
already done, by storing a set of information such that you don't need
to search through all the particles. This set of data is something that
you'll want to put a fair bit of work into figuring out how to store,
because it doesn't look anything like a fixed-dimensional array.

> It still seems like the best option is to record a N-dimensional
> structure in an N-dimensional array, with the N+1th dimension storing
> the state variables.

This is called a structured mesh. I was under the impression you were
wanting to implement a meshless method. :)

Implementing things in an N-dimensional array works well, _only_ if the
points at which the states are stored are lined up in rows and columns
in a very structured manner. If the data points are not structured in
that way, then there is no obvious way to map them into the cells of the
N-dimensional array.

Also, as mentioned earlier, don't use the N+1th dimension for the state
variables. Define a data type that contains named components for each
state variable, and make an array of that -- it's much clearer to read.

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
.