GollyGang / ready

A cross-platform implementation of various reaction-diffusion systems and PDEs.
GNU General Public License v3.0
761 stars 60 forks source link

Refactored FormulaOpenCLImageRD::AssembleKernelSourceFromFormula() #108

Closed timhutton closed 3 years ago

timhutton commented 3 years ago

Refactored FormulaOpenCLImageRD::AssembleKernelSourceFromFormula() into two stages:

  1. Parsing the formula and collecting all the inputs needed: DetectInputsNeeded() returns an InputsNeeded (see below)
  2. Writing the OpenCL code: AssembleKernelSource().
struct InputsNeeded {
    vector<AppliedStencil> stencils_needed;
    set<InputPoint> cells_needed;
    map<string, int> gradient_mag_squared;
    bool using_x_pos;
    bool using_y_pos;
    bool using_z_pos;
    vector<string> deltas_needed;
};