Boost logo

Boost Users :

Subject: Re: [Boost-users] multi-array and pdes
From: pmamales_at_[hidden]
Date: 2011-05-24 01:35:34


Hi Pierre-Andre,
Thank you for your response.
For a moment, I thought that the cyclic_storage_order was already avail..
A question:
why does it have to derive for the general_storage class? there is the implicit conversion operator, no?

I did something like:

  class cyclic_storage_order
  {
    typedef detail::multi_array::size_type size_type;
  public:
          cyclic_storage_order( const std::size_t shift )
                  :shift_(shift)
          {}
    template <std::size_t NumDims>
    operator general_storage_order<NumDims>() const {
      boost::array<size_type,NumDims> ordering;
      boost::array<bool,NumDims> ascending;

      for (size_type i=0; i != NumDims; ++i) {
        ordering[i] = (i+shift_)%NumDims;
        ascending[i] = true;
      }
      return general_storage_order<NumDims>(ordering.begin(),
                                            ascending.begin());
    }
  private:
          std::size_t shift_;
  };

Is this what you meant?
Thank you very much for all your help,
P-

---- Pierre-Andre Noel <noel.pierre.andre_at_[hidden]> wrote:
> I forgot a detail: once you got your "cyclic_storage_order", you should make
> a normal multi_array as usual then access it through a multi_array_ref that
> uses "cyclic_storage_order".
>
> On Sun, May 22, 2011 at 12:17 PM, Pierre-Andre Noel <
> noel.pierre.andre_at_[hidden]> wrote:
>
> > Hello Petros,
> >
> > I think that what you are looking for is a different storage order.
> >
> > Take a look at "boost/multi_array/storage_order.hpp". 3 classes are
> > defined: general_storage_order, c_storage_order and fortran_storage_order.
> >
> > You need to make a "cyclic_storage_order" (or something like that) that
> > receives an integer. When receiving zero, it should behave like
> > c_storage_order. When receiving 1, everything should be permuted by 1 etc.
> > This new class should inherit from general_storage_order. Use
> > c_storage_order and fortran_storage_order as examples.
> >
> > Keep "ascending" true, only "ordering" has to be changed. A modulo should
> > do it.
> >
> > Hope it helps,
> >
> > Pierre-André Noël
> >
> >
> > On Sun, May 22, 2011 at 11:53 AM, petros <pmamales_at_[hidden]> wrote:
> >
> >> Hi Larry,
> >> apologies, for not being clear.
> >> Yes, MA is boost::multi_array. M, N, L are the dimensions
> >> (this is only a "logical" statement, rather than a proper code snippet).
> >> I think I have pretty much sorted out the calling practices wrt multi-aray
> >> and looking
> >> for if certain functionality exists.
> >> My problem amounts to having a view that would allow for the permutation
> >> (if not rotation) of axes.
> >> As I begun to explain, the operator splitting methods decompose a problem
> >> in N dimensions
> >> into N 1-dimensional problems.
> >> The problem itself is stated, though, in a certain reference system (this
> >> means that the discretized
> >> operators (stencils) and the boundary conditions are expressed in terms of
> >> these boundary conditions.
> >> However, the linear equation systems that are produced, are in tridiagonal
> >> form, only in one of these steps
> >> ( the first step of the 1-D problems ). Otherwise it produces a
> >> block-banded system of equations, that can
> >> be reduced back to the familiar tridiagonal ( conceptually), through axes
> >> permutation (or rotation).
> >> If one things in terms of the 2D problem analog, while conceptually it
> >> would amount to exchange the two axes,
> >> in matrix form, and because of the storage alignment it would involve a
> >> much bigger operation. Since, these
> >> operators/systems are created from the problem, it would be very nice to
> >> have this view functionality to exploit
> >> for keeping the storage of the operators in the desired form.
> >>
> >> I hope this is clearer now - don't mean to drag you into my problem.
> >> Thank you for your response,
> >> Petros
> >>
> >>
> >> -----Original Message----- From: Larry Evans
> >> Sent: Sunday, May 22, 2011 10:43 AM
> >> To: boost-users_at_[hidden]
> >> Subject: Re: [Boost-users] multi-array and pdes
> >>
> >>
> >> On 05/21/11 15:02, petros wrote:
> >> Hi Petros,
> >>
> >> [snip]
> >>
> >>> Suppose then that I have a MA( M, N, L ):
> >>>
> >>
> >> Please be more specific. I assume:
> >>
> >> MA means boost::multi_array
> >>
> >> however, I've no idea what M, N, and L are. Could you please
> >> explain further?
> >>
> >> -regards,
> >> Larry
> >>
> >>
> >> _______________________________________________
> >> Boost-users mailing list
> >> Boost-users_at_[hidden]
> >> http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >> _______________________________________________
> >> Boost-users mailing list
> >> Boost-users_at_[hidden]
> >> http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >>
> >
> >


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