[OpendTect_Developers] How to make an outer loop for computeData method ?

Helene Huck helene.huck at dgbes.com
Tue Feb 1 15:39:53 CET 2011


Dear Khaerul Adzany,

After an entire trace has been computed (in different chunks as your
attribute allows multi-threading), there is always a possibility to
post-process it using the virtual function
bool finalizeCalculation(bool scs)
I can see you did already include it in the attribute header file;
however, this function was actually not really designed for this purpose
and thus does not carry the output DataHolder: you will need to store it
as a member of your class to be able to use it later on, still it works.
I did put a small example of this on the ftp at
ftp://ftp.opendtect.org/pub/tmp/example_energy_postprocessed.tar.gz
where my "post-processing" actually consists in replacing part of the
result by the constant value 5 (how useful...).

Reading your email I was actually not sure: does this example correspond
to what you need? or do you plan to do a post-processing on the first
trace depending on the result computed on the last trace? In this last
case this would be more complex since OpendTect is not designed for this
at all: when output trace 1 has being computed (and eventually
post-processed) it is written to disc or in memory in a different
'container' and the corresponding DataHolder is deleted. Hence no way to
modify it afterwards...
This is why I call this more complex: you could not do this sort of
'spatial post-processing'...unless you consider your post-processing as
a second attribute requiring the first one as input and a very large
desired stepout! and then you are done.

Hoping this answers the question,
Best regards,
Helene



On 02/01/2011 07:30 AM, Khaerul Adzany wrote:
> Dear All, 
>
> I'm a newbie here, and my question is related to attribute plugin
> development.
>
> Is there any way so can we apply a outer loop for computeData method
> in our attribute class?
> Because I need to go to the first trace of the DataHolder's output
> after all trace is processed.
>
> Here's the class definition that I've written:
>
> #include "attribprovider.h"
>
> namespace Attrib
> {
> mClass MygAttr : public Provider
> {
> public:
>     static void initClass();
> MyAttr(Desc&);
>     static const char* attribName() { return "My Attribute"; }
>     static const char* modeStr() { return "mode"; }
>     static const char* epchStr() { return "epch"; }
>     static const char* alphaStr() { return "alpha"; }
>     static const char* betaStr() { return "beta"; }
>
> protected:
>      ~MyAttr(){}
>     static WimgProvider* createInstance(Desc&); 
>     static void           updateDesc(Desc&);
>     bool allowParallelComputation() const { return true; }
>     bool getInputData(const BinID&, int zintv);
>     void prepareForComputeData();
>     bool computeData(const DataHolder&, const BinID& relpos, // <-- I
> want to make this method (computeData) loops for n times, defined in
> epch_ variable
>      int z0, int nrsamples, int threadid) const;
>     bool finalizeCalculation(bool scs);
>
>         int mode_;
> int epch_;
> float alph_;
> int beta_;
>
>     ObjectSet<const DataHolder> inpdata_;
>
> };
>
> }
>
>
> Best Regards, 
>
> Khaerul Adzany
>
>
> _______________________________________________
> Developers mailing list
> Developers at opendtect.org
> http://lists.opendtect.org/mailman/listinfo/developers
>   

-- 
--
-- Helene Huck
-- Geophysical software engineer
-- dGB Earth Sciences B.V.
-- Nijverheidstraat 11-2, 7511 JM Enschede, The Netherlands
-- mailto: helene.huck at dgbes.com, http://www.dgbes.com
-- Tel: +31 53 4315155 , Fax: +31 53 4315104

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20110201/3a3847b4/attachment.html>


More information about the Developers mailing list