Execute h file


aboucher - Posted on 02 February 2009

In writing this function the following parameters are identified:

  • grid_ : it represents the grid the algorithm is applied to
  • neighborhood_ : the object that will retrieve the neighbors of a given grid node. The user will have to provide the size of the neighborhood (three parameters in 3D).
  • prop_name_ : the moving average will be applied to this property
  • new_prop_name_ : the result of the moving average will be stored into a new property called "new_prop_name_"

These parameters are declared as member variable to the MovingAverage class (the changes are highlighted in red):




#include <GsTLAppli/geostat/geostat_algo.h>
#include <GsTL/utils/smartptr.h>

#include <string>

class Geostat_grid;
class Neighborhood;

class MovingAverage : public Geostat_algo {
public:
  // initializes the parameters of the algorithm
  virtual bool initialize( const Parameters_handler* parameters,
                           Error_messages_handler* errors );

  // Runs the algorithm.
  virtual int execute() ;

  // Tells the name of the algorithm
  virtual std::string name() const { return "moving_average"; }

public:
  static Named_interface* create_new_interface(std::string&);

private:
  // declare here all the parameters used by the algorithm
  // (i.e. the execute function)

  Geostat_grid* grid_;
  SmartPtr<Neighborhood> neighborhood_;
  std::string new_prop_name_;
  std::string prop_name_;
};