[vsipl++] Generator expr blocks using cyclic blocks

Jules Bergmann jules at codesourcery.com
Thu Apr 26 18:23:36 UTC 2007


Assem Salama wrote:
 > Everyone,
 >  This patch allows Generator expr blocks to get assigned to cyclic 
blocks.


Assem,

This looks good.  I have a couple of comments, once you address them,
please check it in.

As I read it, the Distributed_generator_block isn't a generator block,
but instead a Subset block that uses a map to convert the subset index
back into the parent block index insead of a domain (as Subset_block
does).  It could be used with an existing Generator_block, or with any
other block type.

This is compared to a Generator_block, which converts a generator
function object into a block.  Because the function object's
operator() looks like a get() call, they are similar.

Fortunately, this is just a matter of naming for the most part.  It
would be better if 'Distributed_generator_block' had a name that
emphasized its more general capability, such as 'Map_subset_block' or
'Map_subblock_block'.  Also, since the 'Generator' template parameter
needs to be a block, it should be 'BlockT'.  Likewise, the 'op_'
member variable should be something along the lines of 'blk_' or
'block_'.

Also, the new class should go into its own header file, probably in
the same directory as par/expr.hpp.

			thanks,
			-- Jules



 > Index: src/vsip/core/expr/generator_block.hpp
 > ===================================================================

 > +template <typename Generator,
 > +          typename MapT>
 > +class Distributed_generator_block
 > +{

 > +  // Constructors.
 > +public:
 > +  Distributed_generator_block(Domain<dim> const& dom, Generator& op,
 > +                              MapT const& map)
 > +    : op_(op),
 > +      dom_(dom),
 > +      map_(map)
 > +    {}

Because dom is entirely determined from map (i.e. it is 'map.template
impl_subblock_domain<Dim>(map.subblock())'), and because it has to be
that way (i.e. it wouldn't make sense to set it to something else),
it would be better for Map_subset_block's constructor to take two
parameters (blk and map) and then determine dom_ from map.



-- 
Jules Bergmann
CodeSourcery
jules at codesourcery.com
(650) 331-3385 x705



More information about the vsipl++ mailing list