[Developers] Computing and saving multiple outputs at the same time
Helene Huck
helene.huck at dgb-group.com
Thu Mar 6 11:02:42 CET 2008
Hi all,
A recent post to our opendTect Users list raised an interesting question:
how can a user compute multiple outputs of a single attribute in one go ?
This is, of course, of great interest especially if the algorithms
involved are computationally intensive: computing all the outputs at
once would then save a lot of time.
>From the user side, there is always the possibility to 'hack' the job
*.par file to achieve this goal, in case you want more info on that, you
can have a look at my last post to the users list:
http://lists.opendtect.org/pipermail/users/2008-March/000142.html
For those of you who develop plugins to opendTect, there is even a much
faster (and easier) way to compute all the possible outputs of an
attribute at once, just by adding a few lines of code; here is the
procedure:
in the attribute header file you will have to add the function:
bool prepPriorToOutputSetup();
this is a virtual function on the provider, for more info please have a
look at the subject posted on 16/11/2007 ("Prepare an attribute for
computation: 3 specific functions",
http://lists.opendtect.org/pipermail/developers/2007-November/000094.html)
and in you .cc file you will then have to implement it:
bool MyAttrib::prepPriorToOutputSetup()
{
enableAllOutputs( true );
return true;
}
As a remark: in case you do not want all outputs but some specific ones,
you can use
enableOutput( outputnr )
as many times as you want / need to.
And this is enough, it will create an output cube with multiple
components that you can reuse as input for some other attribute.
Presently there is no GUI support in OpendTect for multiple components
cubes, we plan to implement all kinds of facilities around multiple
components but are waiting for sponsors to start the project.
But as you are developers there is still a trick you can use to display
all the 'hidden' components: you will just have to create a specific
attribute for that, probably the smallest attribute we can think of... :
it would have only one parameter, the output number required by the
user, let's call it outnr_;
and the computeData function would look like:
bool DispMultiCompAttrib::computeData( const DataHolder& output, const BinID& relpos,
int z0, int nrsamples, int threadid ) const
{
float val = getInputValue( *inputdata_, outnr_, idx, z0 );
setOutputValue( output, 0, idx, z0, val );
}
This is of course not what we want to use on the long term but it will
still allow you to display all the components of multiple components
cubes until those new features are developed in opendTect.
Best regards,
Hélène
--
-- Helene Huck
-- Geophysical software engineer
-- dGB Earth Sciences B.V.
-- Nijverheidstraat 11-2, 7511 JM Enschede, The Netherlands
-- mailto: helene.huck at dgb-group.com, http://www.dgb-group.com
-- Tel: +31 53 4315155 , Fax: +31 53 4315104
More information about the Developers
mailing list