|
Boost Users : |
From: Pascal Bauer (pascal.bauer_at_[hidden])
Date: 2004-08-12 06:39:16
Hi,
I have some (strange?) problems with the ublas: I'm writing a SPH-Code
for fluids and brittle solids. I use a uBLAS matrix to store all the
particle-Data. Now, since the SPH code itself includes a lot of physics,
i wrote a "particle" class, that give me access to the values stored in
the matrix in an intuitive way. As template argument, i'll give a
matrix, so i do no have to take care about matrix internals. It looks
somehow thatlike:
template <typename T>
class Particle
{
static T& SPHData; //Matrix where the values are stored
typename T::size_type GID; //Particle ID
(...)
matrix_row<T> LData; // Proxy to the particle data
vector_range<matrix_row<T> > Pos; // Position vector, for //
calculations...
(...)
typename T::value_type& mass; // Reference to physical values...
Particle(typename T::size_type ParticleID); // Constructor, needs
// Particle ID
}
template <typename T>
Particle<T>::Particle(typename T::size_type ParticleID) :
mass(SPHData(ParticleID, MASS)) // Set the references...
{
LData.reset(SPHData, ParticleID); // OK, works fine...
Pos.reset(LData, range(0, 2)); // Give strange error message:
// (at the end of this mail...)
}
I tried different methods to get the Pos to the right place in my
matrix, but if i use the "=" operator, i've got some strange run-time
assertion errors.
My thing is, that i'd like to have a range of a matrix_row or column,
that i can use later for vector-operations. How can I do that?
- Pascal Bauer
PS: Compile Error for my example code.
*/home/pbauer/oosph/src/particlecontainer.h:103: instantiated from
`sph::Particle<T>::Particle(typename T::size_type) [with T =
ParticleTest()::Matrix]'
*/home/pbauer/oosph/src/test.cpp:36: instantiated from here
*/usr/include/boost/numeric/ublas/vector_proxy.hpp:126: error: no
matching function for call to `
boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double> > >::reset(
boost::numeric::ublas::matrix_row<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double> > >&)'
*/usr/include/boost/numeric/ublas/matrix_proxy.hpp:112: error:
candidates are: void boost::numeric::ublas::matrix_row<E>::reset(M&)
[with M = boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double> >]
*/usr/include/boost/numeric/ublas/matrix_proxy.hpp:117: error: void
boost::numeric::ublas::matrix_row<E>::reset(M&, typename M::size_type)
[with M = boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double> >]
-- \ | Pascal Bauer | | Space Research & Planetary Sciences | Research Division | | University of Bern | | Phone: +41316314416 | | e-mail: mailto:pascal.bauer_at_[hidden] /
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net