[GRASS-SVN] r74167 - in grass-addons/grass7/raster: . r.pops.spread r.pops.spread/pops

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 6 11:07:47 PST 2019


Author: annakrat
Date: 2019-03-06 11:07:47 -0800 (Wed, 06 Mar 2019)
New Revision: 74167

Added:
   grass-addons/grass7/raster/r.pops.spread/
   grass-addons/grass7/raster/r.pops.spread/CITATION.cff
   grass-addons/grass7/raster/r.pops.spread/TECHNICALDEBT.md
   grass-addons/grass7/raster/r.pops.spread/pops/
   grass-addons/grass7/raster/r.pops.spread/pops/CHANGELOG.md
   grass-addons/grass7/raster/r.pops.spread/pops/CITATION.cff
   grass-addons/grass7/raster/r.pops.spread/pops/CONTRIBUTING.md
   grass-addons/grass7/raster/r.pops.spread/pops/Doxyfile
   grass-addons/grass7/raster/r.pops.spread/pops/Makefile
   grass-addons/grass7/raster/r.pops.spread/pops/README.md
   grass-addons/grass7/raster/r.pops.spread/pops/TECHNICALDEBT.md
   grass-addons/grass7/raster/r.pops.spread/pops/date.hpp
   grass-addons/grass7/raster/r.pops.spread/pops/raster.hpp
   grass-addons/grass7/raster/r.pops.spread/pops/simulation.hpp
   grass-addons/grass7/raster/r.pops.spread/pops/test_date.cpp
   grass-addons/grass7/raster/r.pops.spread/pops/test_mortality.cpp
   grass-addons/grass7/raster/r.pops.spread/pops/test_raster.cpp
   grass-addons/grass7/raster/r.pops.spread/pops/test_simulation.cpp
   grass-addons/grass7/raster/r.pops.spread/pops/test_treatments.cpp
   grass-addons/grass7/raster/r.pops.spread/pops/treatments.hpp
   grass-addons/grass7/raster/r.pops.spread/pops_logo.png
   grass-addons/grass7/raster/r.pops.spread/r.pops.spread.html
   grass-addons/grass7/raster/r.pops.spread/r_pops_spread.png
Removed:
   grass-addons/grass7/raster/r.pops.spread/Spore.cpp
   grass-addons/grass7/raster/r.pops.spread/Spore.h
   grass-addons/grass7/raster/r.pops.spread/date.h
   grass-addons/grass7/raster/r.pops.spread/r.spread.sod.html
   grass-addons/grass7/raster/r.pops.spread/raster.h
   grass-addons/grass7/raster/r.spread.sod/
Modified:
   grass-addons/grass7/raster/Makefile
   grass-addons/grass7/raster/r.pops.spread/CHANGELOG.md
   grass-addons/grass7/raster/r.pops.spread/Makefile
   grass-addons/grass7/raster/r.pops.spread/README.md
   grass-addons/grass7/raster/r.pops.spread/main.cpp
Log:
r.spread.sod renamed to r.pops.spread, core functions moved to library, sync with 56cde383 master branch of https://github.com/ncsu-landscape-dynamics/r.pops.spread

Modified: grass-addons/grass7/raster/Makefile
===================================================================
--- grass-addons/grass7/raster/Makefile	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/Makefile	2019-03-06 19:07:47 UTC (rev 74167)
@@ -87,6 +87,7 @@
 	r.out.tiff \
 	r.patch.smooth \
 	r.popgrowth \
+	r.pops.spread \
 	r.quantile.ref \
 	r.random.weight \
 	r.recode.attr \
@@ -106,7 +107,6 @@
 	r.skyview \
 	r.smooth.seg \
 	r.soillossbare \
-	r.spread.sod \
 	r.stream.basins \
 	r.stream.channel \
 	r.stream.distance \

Modified: grass-addons/grass7/raster/r.pops.spread/CHANGELOG.md
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/CHANGELOG.md	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/CHANGELOG.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -4,6 +4,21 @@
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/).
 
+## 2018-09-18 - Update to the next generation of PoPS library
+
+### Changed
+
+- The direct support for reading NetCDF removed from the code (Vaclav Petras)
+- Weather coefficient value input removed (Vaclav Petras)
+ - Not considered useful enough to keep around, can be replaced by
+   constant rasters and series of one raster.
+- Using new names in PoPS API (Vaclav Petras)
+- Weather coefficient represented as Raster with doubles (Vaclav Petras)
+ - This or one of the changes above or in the library changed result of
+   one stochastic run slightly (reason unknown, similar change as when
+   multiplying coefficient by 1.000001). The new result is considered to
+   be "more" correct.
+
 ## 2018-09-10 - Seasonality Fixes
 
 ### Added

Added: grass-addons/grass7/raster/r.pops.spread/CITATION.cff
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/CITATION.cff	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/CITATION.cff	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,21 @@
+cff-version: 1.0.3
+message: If you use this software, please cite it as below.
+authors:
+  - family-names: Petras
+    given-names: Vaclav
+    orcid: https://orcid.org/0000-0001-5566-9236
+  - family-names: Petrasova
+    given-names: Anna
+    website: https://petrasovaa.github.io/
+  - family-names: Chen
+    given-names: Zexi
+    website: https://www.linkedin.com/in/zexi-chen/
+  - family-names: Tonini
+    given-names: Francesco
+    website: http://www.francescotonini.com/
+title: r.pops.spread - PoPS model implemented as a GRASS GIS module
+version: 29074a1
+date-released: 2018-06-21
+url: https://grass.osgeo.org/grass74/manuals/addons/r.pops.spread.html
+repository-code: https://github.com/ncsu-landscape-dynamics/r.pops.spread
+license: GPL-2.0-or-later

Modified: grass-addons/grass7/raster/r.pops.spread/Makefile
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/Makefile	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/Makefile	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,11 +1,11 @@
 MODULE_TOPDIR = ../..
 
-PGM = r.spread.sod
+PGM = r.pops.spread
 
 LIBES = $(RASTERLIB) $(GISLIB) $(MATHLIB) $(VECTORLIB)
 DEPENDENCIES = $(RASTERDEP) $(GISDEP) $(VECTORDEP)
 EXTRA_LIBS = $(GDALLIBS) $(OMPLIB)
-EXTRA_CFLAGS = $(GDALCFLAGS) $(OMPCFLAGS) $(VECT_CFLAGS) -std=c++11
+EXTRA_CFLAGS = $(GDALCFLAGS) -std=c++11 -Wall -Wextra -fpermissive $(OMPCFLAGS) $(VECT_CFLAGS)
 EXTRA_INC = $(VECT_INC)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Modified: grass-addons/grass7/raster/r.pops.spread/README.md
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/README.md	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/README.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,10 +1,63 @@
-# SOD-modeling-cpp
+# r.pops.spread
+
+A former name of the r.pops.spread is r.spread.pest and  r.spread.sod.
+
 recoding the model to create a c++ version of the SOD-model base on https://github.com/f-tonini/SOD-modeling.
 This repository contains the c++ version scripts used to develop a stochastic landscape spread model of forest pathogen *P. ramorum*.
 
 The reference paper: Ross K. Meentemeyer, Nik J. Cunniffe, Alex R. Cook, Joao A. N. Filipe, Richard D. Hunter, David M. Rizzo, and Christopher A. Gilligan 2011. Epidemiological modeling of invasion in heterogeneous landscapes: spread of sudden oak death in California (1990–2030). *Ecosphere* 2:art17. [http://dx.doi.org/10.1890/ES10-00192.1] (http://www.esajournals.org/doi/abs/10.1890/ES10-00192.1) 
 
+## Obtaining the latest code
+
+The PoPS library is in a submodule, so use `--recursive` when cloning,
+for example:
+
+```
+git clone --recursive git at github.com:ncsu-landscape-dynamics/r.spread.pest.git
+```
+
+If you have already cloned, you can obtain the submodules using:
+
+```
+git submodule update --init
+```
+
+## Updating submodule to latest version
+
+To update the submodule, i.e. update submodule's commit used in this
+repository, use:
+
+```
+git submodule update --remote
+```
+
+Note that this change is recorded in the repository. In other words,
+the latest commit of a submodule is part of this repository.
+The reason for this is that the code in this repository is linked to a
+particular commit in the submodule repository (rather than the latest
+version). Git works this way to avoid breaking things unexpectedly due
+to changes in the submodule repository.
+
+## Updating the code of the submodule
+
+```
+cd pops
+git checkout master
+git add file.hpp
+git commit -m "this and that change"
+git push
+```
+
+```
+cd ..
+git commit pops -m "update to latest pops commit"
+git push
+```
+
+
+
 ## The files
+
 The main.cpp contains the main program to run.
 
 ## To run the model
@@ -13,7 +66,7 @@
 
 Open an terminal and install dependencies:
 
-    sudo apt-get install libgdal-dev libnetcdf-dev
+    sudo apt-get install grass-dev
 
 Download the model code as ZIP or using Git:
 
@@ -25,19 +78,21 @@
 
 Compile:
 
-    make
+    grass --tmp-location XY --exec g.extension module=r.pops.spread url=.
 
 Run:
 
-    ./a.out > result.txt
+    grass .../modeling/scenario1 --exec r.pops.spread ...
 
 ## Authors
 
 * Francesco Tonini (original R version)
-* Zexi Chen (C++ version)
-* Vaclav Petras (parallelization, GRASS interface)
+* Zexi Chen (initial C++ version)
+* Vaclav Petras (parallelization, GRASS interface, raster handling, ...)
 * Anna Petrasova (single species simulation)
 
+See [CHANGELOG.md](CHANGELOG.md) for details about contributions.
+
 ## License
 
 This program is free software under the GNU General Public License

Deleted: grass-addons/grass7/raster/r.pops.spread/Spore.cpp
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/Spore.cpp	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/Spore.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,333 +0,0 @@
-/*
- * SOD model - spore simulation
- *
- * Copyright (C) 2015-2017 by the authors.
- *
- * Authors: Zexi Chen (zchen22 ncsu edu)
- *          Vaclav Petras (wenzeslaus gmail com)
- *          Anna Petrasova (kratochanna gmail com)
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-
-#include "Spore.h"
-
-#include <cmath>
-#include <tuple>
-
-// PI is used in the code and M_PI is not guaranteed
-// fix it, but prefer the system definition
-#ifndef M_PI
-    #define M_PI 3.14159265358979323846
-#endif
-#ifndef PI
-    #define PI M_PI
-#endif
-
-using std::cerr;
-using std::endl;
-
-/*
-Von Mises Distribution(Circular data distribution)
-
-mu is the mean angle, expressed in radians between 0 and 2*pi,
-and kappa is the concentration parameter, which must be greater
-than or equal to zero. If kappa is equal to zero, this distribution
-reduces to a uniform random angle over the range 0 to 2*pi
-*/
-class von_mises_distribution
-{
-public:
-    von_mises_distribution(double mu, double kappa)
-        : mu(mu), kappa(kappa), distribution(0.0, 1.0)
-    {}
-    template<class Generator>
-    double operator ()(Generator& generator)
-    {
-        double a, b, c, f, r, theta, u1, u2, u3, z;
-
-        if (kappa <= 1.e-06)
-            return 2 * PI * distribution(generator);
-
-        a = 1.0 + sqrt(1.0 + 4.0 * kappa * kappa);
-        b = (a - sqrt(2.0 * a)) / (2.0 * kappa);
-        r = (1.0 + b * b) / (2.0 * b);
-
-        while (true) {
-            u1 = distribution(generator);
-            z = cos(PI * u1);
-            f = (1.0 + r * z) / (r + z);
-            c = kappa * (r - f);
-            u2 = distribution(generator);
-            if (u2 <= c * (2.0 - c) || u2 < c * exp(1.0 - c))
-                break;
-        }
-
-        u3 = distribution(generator);
-        if (u3 > 0.5) {
-            theta = fmod(mu + acos(f), 2 * PI);
-        }
-        else {
-            theta = fmod(mu - acos(f), 2 * PI);
-        }
-        return theta;
-    }
-private:
-    double mu;
-    double kappa;
-    std::uniform_real_distribution<double> distribution;
-};
-
-Sporulation::Sporulation(unsigned random_seed, const Img& size)
-    :
-      width(size.getWidth()),
-      height(size.getHeight()),
-      w_e_res(size.getWEResolution()),
-      n_s_res(size.getNSResolution()),
-      sp(width, height, w_e_res, n_s_res)
-{
-    generator.seed(random_seed);
-}
-
-void Sporulation::SporeRemove(Img& I, Img& S, const DImg& temperature,
-                              double critical_temperature)
-{
-    for (int i = 0; i < height; i++) {
-        for (int j = 0; j < width; j++) {
-            if (temperature(i, j) < critical_temperature) {
-                S(i, j) += I(i, j);  // move back to suseptable pool
-                I(i, j) = 0;  // remove all infection
-            }
-        }
-    }
-}
-
-void Sporulation::SporeGen(const Img& I, const double *weather,
-                           double weather_value, double rate)
-{
-    double lambda = 0;
-    for (int i = 0; i < height; i++) {
-        for (int j = 0; j < width; j++) {
-            if (I(i, j) > 0) {
-                if (weather)
-                    lambda = rate * weather[i * width + j];
-                else
-                    lambda = rate * weather_value;
-                int sum = 0;
-                std::poisson_distribution<int> distribution(lambda);
-
-                for (int k = 0; k < I(i, j); k++) {
-                    sum += distribution(generator);
-                }
-                sp(i, j) = sum;
-            }
-            else {
-                sp(i, j) = 0;
-            }
-        }
-    }
-}
-
-void Sporulation::SporeSpreadDisp_singleSpecies(Img& S, Img& I, Img& I2,
-                                                const Img& lvtree_rast,
-                                                std::vector<std::tuple<int, int> >& outside_spores,
-                                                Rtype rtype, const double *weather,
-                                                double weather_value, double scale1,
-                                                double kappa, Direction wdir, double scale2,
-                                                double gamma)
-{
-    std::cauchy_distribution < double >distribution_cauchy_one(0.0, scale1);
-    std::cauchy_distribution < double >distribution_cauchy_two(0.0, scale2);
-
-    std::bernoulli_distribution distribution_bern(gamma);
-    std::uniform_real_distribution < double >distribution_uniform(0.0, 1.0);
-
-    if (wdir == NONE)
-        kappa = 0;
-    von_mises_distribution vonmisesvariate(wdir * PI / 180, kappa);
-
-    double dist = 0;
-    double theta = 0;
-    bool scale2_used = false;
-
-    for (int i = 0; i < height; i++) {
-        for (int j = 0; j < width; j++) {
-            if (sp(i, j) > 0) {
-                for (int k = 0; k < sp(i, j); k++) {
-
-                    // generate the distance from cauchy distribution or cauchy mixture distribution
-                    if (rtype == CAUCHY) {
-                        dist = abs(distribution_cauchy_one(generator));
-                    }
-                    else if (rtype == CAUCHY_MIX) {
-                        // use bernoulli distribution to act as the sampling with prob(gamma,1-gamma)
-                        if (distribution_bern(generator)) {
-                            dist = abs(distribution_cauchy_one(generator));
-                            scale2_used = false;
-                        }
-                        else {
-                            dist = abs(distribution_cauchy_two(generator));
-                            scale2_used = true;
-                        }
-                    }
-                    else {
-                        cerr <<
-                                "The paramter Rtype muse be set as either CAUCHY OR CAUCHY_MIX"
-                             << endl;
-                        exit(EXIT_FAILURE);
-                    }
-
-                    theta = vonmisesvariate(generator);
-
-                    int row = i - round(dist * cos(theta) / n_s_res);
-                    int col = j + round(dist * sin(theta) / w_e_res);
-
-                    if (row < 0 || row >= height || col < 0 || col >= width) {
-                        // export only spores coming from long-range dispersal kernel outside of modeled area
-                        if (scale2_used)
-                            outside_spores.emplace_back(std::make_tuple(row, col));
-                        continue;
-                    }
-                    if (S(row, col) > 0) {
-                        double prob_S =
-                                (double)(S(row, col)) /
-                                lvtree_rast(row, col);
-                        double U = distribution_uniform(generator);
-
-                        if (weather)
-                            prob_S *= weather[row * width + col];
-                        else
-                            prob_S *= weather_value;
-                        if (U < prob_S) {
-                            I(row, col) += 1;
-                            I2(row, col) += 1;
-                            S(row, col) -= 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-
-void Sporulation::SporeSpreadDisp(Img& S_umca, Img& S_oaks, Img& I_umca,
-                                  Img& I_oaks, const Img& lvtree_rast,
-                                  Rtype rtype, const double *weather,
-                                  double weather_value, double scale1,
-                                  double kappa, Direction wdir, double scale2,
-                                  double gamma)
-{
-    std::cauchy_distribution < double >distribution_cauchy_one(0.0, scale1);
-    std::cauchy_distribution < double >distribution_cauchy_two(0.0, scale2);
-
-    std::bernoulli_distribution distribution_bern(gamma);
-    std::uniform_real_distribution < double >distribution_uniform(0.0, 1.0);
-
-    if (wdir == NONE)
-        kappa = 0;
-    von_mises_distribution vonmisesvariate(wdir * PI / 180, kappa);
-
-    double dist = 0;
-    double theta = 0;
-
-    for (int i = 0; i < height; i++) {
-        for (int j = 0; j < width; j++) {
-            if (sp(i, j) > 0) {
-                for (int k = 0; k < sp(i, j); k++) {
-
-                    // generate the distance from cauchy distribution or cauchy mixture distribution
-                    if (rtype == CAUCHY) {
-                        dist = abs(distribution_cauchy_one(generator));
-                    }
-                    else if (rtype == CAUCHY_MIX) {
-                        // use bernoulli distribution to act as the sampling with prob(gamma,1-gamma)
-                        if (distribution_bern(generator))
-                            dist = abs(distribution_cauchy_one(generator));
-                        else
-                            dist = abs(distribution_cauchy_two(generator));
-                    }
-                    else {
-                        cerr <<
-                                "The paramter Rtype muse be set as either CAUCHY OR CAUCHY_MIX"
-                             << endl;
-                        exit(EXIT_FAILURE);
-                    }
-
-                    theta = vonmisesvariate(generator);
-
-                    int row = i - round(dist * cos(theta) / n_s_res);
-                    int col = j + round(dist * sin(theta) / w_e_res);
-
-                    if (row < 0 || row >= height)
-                        continue;
-                    if (col < 0 || col >= width)
-                        continue;
-
-                    if (row == i && col == j) {
-                        if (S_umca(row, col) > 0 ||
-                                S_oaks(row, col) > 0) {
-                            double prob =
-                                    (double)(S_umca(row, col) +
-                                             S_oaks(row, col)) /
-                                    lvtree_rast(row, col);
-
-                            double U = distribution_uniform(generator);
-
-                            if (weather)
-                                prob = prob * weather[row * width + col];
-                            else
-                                prob = prob * weather_value;
-
-                            // if U < prob, then one host will become infected
-                            if (U < prob) {
-                                double prob_S_umca =
-                                        (double)(S_umca(row, col)) /
-                                        (S_umca(row, col) +
-                                         S_oaks(row, col));
-                                double prob_S_oaks =
-                                        (double)(S_oaks(row, col)) /
-                                        (S_umca(row, col) +
-                                         S_oaks(row, col));
-
-                                std::bernoulli_distribution
-                                    distribution_bern_prob(prob_S_umca);
-                                if (distribution_bern_prob(generator)) {
-                                    I_umca(row, col) += 1;
-                                    S_umca(row, col) -= 1;
-                                }
-                                else {
-                                    I_oaks(row, col) += 1;
-                                    S_oaks(row, col) -= 1;
-                                }
-                            }
-                        }
-                    }
-                    else {
-                        if (S_umca(row, col) > 0) {
-                            double prob_S_umca =
-                                    (double)(S_umca(row, col)) /
-                                    lvtree_rast(row, col);
-                            double U = distribution_uniform(generator);
-
-                            if (weather)
-                                prob_S_umca *= weather[row * width + col];
-                            else
-                                prob_S_umca *= weather_value;
-                            if (U < prob_S_umca) {
-                                I_umca(row, col) += 1;
-                                S_umca(row, col) -= 1;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-}

Deleted: grass-addons/grass7/raster/r.pops.spread/Spore.h
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/Spore.h	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/Spore.h	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,69 +0,0 @@
-/*
- * SOD model - spore simulation
- *
- * Copyright (C) 2015-2017 by the authors.
- *
- * Authors: Zexi Chen (zchen22 ncsu edu)
- *          Vaclav Petras (wenzeslaus gmail com)
- *          Anna Petrasova (kratochanna gmail com)
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-
-#ifndef SPORE_H
-#define SPORE_H
-
-#include "raster.h"
-
-#include <random>
-
-
-enum Rtype
-{
-    CAUCHY, CAUCHY_MIX          // NO means that there is no wind
-};
-
-// NONE means that there is no wind
-enum Direction
-{
-    N = 0, NE = 45, E = 90, SE = 135, S = 180, SW = 225, W = 270, NW = 315, NONE
-};
-
-class Sporulation
-{
-private:
-    int width;
-    int height;
-    // the west-east resolution of the pixel
-    int w_e_res;
-    // the north-south resolution of the pixel
-    int n_s_res;
-    Img sp;
-    std::default_random_engine generator;
-public:
-    Sporulation(unsigned random_seed, const Img &size);
-    void SporeRemove(Img& I, Img& S, const DImg& temperature,
-                     double critical_temperature);
-    void SporeGen(const Img& I, const double *weather,
-                  double weather_value, double rate);
-    void SporeSpreadDisp_singleSpecies(Img& S, Img& I, Img& I2,
-                                       const Img& lvtree_rast, std::vector<std::tuple<int, int> > &outside_spores, Rtype rtype,
-                                       const double *weather, double weather_value,
-                                       double scale1, double kappa = 2,
-                                       Direction wdir = NONE, double scale2 = 0.0,
-                                       double gamma = 0.0);
-    void SporeSpreadDisp(Img& S_umca, Img& S_oaks, Img& I_umca,
-                         Img& I_oaks, const Img& lvtree_rast, Rtype rtype,
-                         const double *weather, double weather_value,
-                         double scale1, double kappa = 2,
-                         Direction wdir = NONE, double scale2 = 0.0,
-                         double gamma = 0.0);
-};
-
-#endif

Added: grass-addons/grass7/raster/r.pops.spread/TECHNICALDEBT.md
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/TECHNICALDEBT.md	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/TECHNICALDEBT.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,111 @@
+# Technical Debt
+
+All issues and imperfections of the code should be documented in this
+file.
+
+The goal is to declare the technical debt as described by
+[Easterbrook 2014](http://doi.org/10.1038/ngeo2283) or Wikipedia
+contributors in
+[Technical debt](https://en.wikipedia.org/wiki/Technical_debt).
+
+The sections are based on sections in CHANGELOG. The version refers to
+when the problem first occurred or was encountered. Entries are divided,
+similarly to CHANGELOG, into what is missing and needs to be added (Add),
+what requires a changes of the current code (Change) and what is an
+issue which needs to be fixed (Fix).
+
+Entries should be removed when resolved. Issue from tracker can be
+optionally linked in an entry.
+
+## 2018-06-20 - Critical Temperature
+
+### Add
+
+- Add (rigorous) tests for the Raster class.
+- Add more tests for the Date class.
+- Documentation of the C++ functions and classes (use Doxygen).
+
+### Change
+
+- Naming and descriptions of parameters related to weather
+  (coefficients versus the actual values)
+- Naming of critical temperature in interface and in code
+
+### Fix
+
+- Temperature raster for critical temperature is represented as integer,
+  not double or float.
+- Even after the upgrade to Raster class, there are still some legacy
+  method names and integers instead of doubles (but does not influence
+  computations).
+- Numerous sign-compare warnings.
+- Spelling in the code and comments.
+
+## 2018-06-13 - Spotted Lanternfly
+
+### Add
+
+- Add SLF parameters to documentation.
+- Update README.
+
+### Change
+
+- The decision if to increase by week or month is done with conditional
+  (ternary) operator on one long line. Maybe enum and universal
+  functions for increase and end of year would make it shorter.
+- Season is just a std::pair, but a function to test if month is in
+  range (or a range class) would make shorter code without the access to
+  first and second members and two queries for month.
+
+### Fix
+
+- Compilation with and without the test module (now the test Makefile
+  needs to be used always)
+
+## 2018-06-04 - Mortality Addition
+
+### Add
+
+- Add mortality to documentation.
+- Update README.
+
+### Change
+
+- Several new lines of mortality model added to already long main
+  function.
+- Mortality cohorts may require better name since the individual can be
+  potentially also a cohort or stand.
+
+### Fix
+
+- Mortality-related objects are always created (and take memory).
+- Mortality-related infection cohort always updated in spore spread and
+  need an additional parameter. However, the update is just a repeating
+  previous line (perhaps some container optionally wrapping two images
+  would be useful).
+
+## 2017-09-05 - September 2017 Update
+
+### Fix
+
+- Dead code for the specific multiple host species.
+- Several new lines of non-trivial saving of escaping spores added to
+  already long main function.
+
+## 2017-01-28 - January 2017 Status
+
+### Add
+
+- Image class is only for integers but the weather is floating point,
+  so it needs a different treatment in code than other data.
+- The date class needs abstraction for the leap years and days in month.
+- Tests needed for the image class.
+
+### Change
+
+- Formatting of text and parameters for the date class (leading zeros).
+- Create dedicated file for the direction enum and helper functions.
+- Some of the Date class methods have still misleading names (e.g.,
+  increased versus increase).
+- Methods and functions should use underscores not camel case (using
+  Python and GRASS GIS convention).

Deleted: grass-addons/grass7/raster/r.pops.spread/date.h
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/date.h	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/date.h	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,191 +0,0 @@
-/*
- * SOD model - date manipulation
- *
- * Copyright (C) 2015-2017 by the authors.
- *
- * Authors: Zexi Chen (zchen22 ncsu edu)
- *          Anna Petrasova
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-
-#ifndef DATE
-#define DATE
-
-#include <iostream>
-
-class Date{
-
-private:
-    int year;
-    int month;
-    int day;
-    int day_in_month[2][13] = {
-        {0,31,28,31,30,31,30,31,31,30,31,30,31},
-        {0,31,29,31,30,31,30,31,31,30,31,30,31}
-    };
-
-public:
-    Date(const Date &d): year(d.year), month(d.month), day(d.day){}
-    Date(int y, int m, int d): year(y), month(m), day(d){}
-    Date(): year(2000), month(1), day(1){}
-    inline void increasedByWeek();
-    inline void increasedByMonth();
-    inline Date getYearEnd();
-    inline Date getNextYearEnd();
-    inline bool isYearEnd();
-    inline bool isLastMonthOfYear();
-    int getMonth() const {return month;}
-    int getYear() const { return year;}
-    int getDay() const {return day;}
-    void setMonth(int m){month = m;}
-    void setYear(int y){year = y;}
-    void setDay(int d){day = d;}
-    inline int weeksFromDate(Date start);
-    inline friend std::ostream& operator<<(std::ostream& os, const Date &d);
-    inline friend bool operator> (const Date &d1, const Date &d2);
-    inline friend bool operator>= (const Date &d1, const Date &d2);
-    inline friend bool operator< (const Date &d1, const Date &d2);
-    inline friend bool operator<= (const Date &d1, const Date &d2);
-};
-
-std::ostream& operator<<(std::ostream& os, const Date &d)
-{
-    os << d.year << '-' << d.month << '-' << d.day;
-    return os;
-}
-
-Date Date::getYearEnd() {
-    return Date(year, 12, 31);
-}
-
-bool Date::isYearEnd(){
-    if (month == 12 && (day + 7) > 31)
-        return true;
-    return false;
-}
-
-bool Date::isLastMonthOfYear(){
-    if (month == 12)
-        return true;
-    return false;
-}
-
-Date Date::getNextYearEnd(){
-    if (month == 1)
-        return Date(year, 12, 31);
-    else
-        return Date(year + 1, 12, 31);
-}
-
-bool operator> (const Date &d1, const Date &d2)
-{
-    if(d1.year < d2.year)
-        return false;
-    else if (d1.year > d2.year)
-        return true;
-    else {
-        if (d1.month < d2.month)
-            return false;
-        else if (d1.month > d2.month)
-            return true;
-        else {
-            if (d1.day <= d2.day)
-                return false;
-            else
-                return true;
-        }
-    }
-}
-
-bool operator<= (const Date &d1, const Date &d2)
-{
-    return !(d1 > d2);
-}
-
-bool operator< (const Date &d1, const Date &d2)
-{
-    if(d1.year > d2.year)
-        return false;
-    else if (d1.year < d2.year)
-        return true;
-    else {
-        if (d1.month > d2.month)
-            return false;
-        else if (d1.month < d2.month)
-            return true;
-        else {
-            if (d1.day >= d2.day)
-                return false;
-            else
-                return true;
-        }
-    }
-}
-
-bool operator>= (const Date &d1, const Date &d2)
-{
-    return !(d1 < d2);
-}
-
-void Date::increasedByWeek()
-{
-    day += 7;
-    if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
-        if (day > day_in_month[1][month]) {
-            day = day - day_in_month[1][month];
-            month++;
-            if (month > 12) {
-                year++;
-                month = 1;
-            }
-        }
-    }
-    else {
-        if (day > day_in_month[0][month]) {
-            day = day - day_in_month[0][month];
-            month++;
-            if (month > 12) {
-                year++;
-                month = 1;
-            }
-        }
-    }
-}
-
-void Date::increasedByMonth()
-{
-    month += 1;
-    if (month > 12) {
-        year++;
-        month = 1;
-    }
-    if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
-        if (day > day_in_month[1][month]) {
-            day = day_in_month[1][month];
-        }
-    }
-    else {
-        if (day > day_in_month[0][month]) {
-            day = day_in_month[0][month];
-        }
-    }
-}
-
-int Date::weeksFromDate(Date start) {
-
-    int week = 0;
-    while (start <= *this) {
-        week++;
-        start.increasedByWeek();
-    }
-    return week - 1;
-}
-
-#endif // DATE

Modified: grass-addons/grass7/raster/r.pops.spread/main.cpp
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/main.cpp	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/main.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -16,13 +16,13 @@
  */
 
 
-// define to support NetCDF format directly
-// (requires linking to netcdf_c++)
-// #define SOD_NETCDF_SUPPORT
+// activate support for GRASS GIS in the PoPS library
+#define POPS_RASTER_WITH_GRASS_GIS
 
-#include "date.h"
-#include "raster.h"
-#include "Spore.h"
+#include "pops/date.hpp"
+#include "pops/raster.hpp"
+#include "pops/simulation.hpp"
+#include "pops/treatments.hpp"
 
 extern "C" {
 #include <grass/gis.h>
@@ -31,10 +31,6 @@
 #include <grass/raster.h>
 }
 
-#ifdef SOD_NETCDF_SUPPORT
-#include <netcdfcpp.h>
-#endif
-
 #include <map>
 #include <iostream>
 #include <memory>
@@ -50,7 +46,15 @@
 using std::cerr;
 using std::endl;
 
+using namespace pops;
 
+// TODO: update names
+// convenient definitions, names for backwards compatibility
+typedef Raster<int> Img;
+typedef Raster<double> DImg;
+// TODO: for backwards compatibility, update eventually
+typedef Simulation<Img, DImg> Sporulation;
+
 #define DIM 1
 
 // check if a file exists
@@ -65,45 +69,12 @@
                       option->key, option->answer);
 }
 
-// Initialize infected trees for each species
-// needed unless empirical info is available
-static Img initialize(Img& img1,Img& img2) {
-    if (img1.getWidth() != img2.getWidth() ||
-            img2.getHeight() != img2.getHeight()) {
-        cerr << "The height or width of one image do not match with that of the other one!" << endl;
-        return Img();
-    }
-    else {
-        auto re_width = img1.getWidth();
-        auto re_height = img1.getHeight();
-        auto out = Img(re_width, re_height, img1.getWEResolution(), img1.getNSResolution());
-
-        for (int i = 0; i < re_height; i++) {
-            for (int j = 0; j < re_width; j++) {
-                if (img2(i, j) > 0) {
-                    if (img1(i, j) > img2(i, j))
-                        out(i, j) =
-                            img1(i, j) <
-                            (img2(i, j) *
-                             2) ? img1(i, j) : (img2(i, j) * 2);
-                    else
-                        out(i, j) = img1(i, j);
-                }
-                else {
-                    out(i, j) = 0;
-                }
-            }
-        }
-        return out;
-    }
-}
-
 string generate_name(const string& basename, const Date& date)
 {
     // counting on year being 4 digits
-    auto year = G_double_to_basename_format(date.getYear(), 4, 0);
-    auto month = G_double_to_basename_format(date.getMonth(), 2, 0);
-    auto day = G_double_to_basename_format(date.getDay(), 2, 0);
+    auto year = G_double_to_basename_format(date.year(), 4, 0);
+    auto month = G_double_to_basename_format(date.month(), 2, 0);
+    auto day = G_double_to_basename_format(date.day(), 2, 0);
     auto sep = G_get_basename_separator();
     string name = basename + sep + year + "_" + month + "_" + day;
     return name;
@@ -124,37 +95,31 @@
     }
 }
 
-Rtype radial_type_from_string(const string& text)
+DispersalKernel radial_type_from_string(const string& text)
 {
     if (text == "cauchy")
         return CAUCHY;
     else if (text == "cauchy_mix")
-        return CAUCHY_MIX;
+        return CAUCHY_DOUBLE_SCALE;
     else
         throw std::invalid_argument("radial_type_from_string: Invalid"
                                     " value '" + text +"' provided");
 }
 
-class Season
-{
-public:
-    Season(int start, int end)
-        : m_start_month(start), m_end_month(end)
-    {}
-    inline bool month_in_season(int month)
-    {
-        return month >= m_start_month && month <= m_end_month;
-    }
-private:
-    int m_start_month;
-    int m_end_month;
-};
-
 inline Season seasonality_from_option(const Option* opt)
 {
     return {std::atoi(opt->answers[0]), std::atoi(opt->answers[1])};
 }
 
+
+unsigned int get_num_answers(struct Option *opt)
+{
+    unsigned int i = 0;
+    if (opt->answers)
+        for (i = 0; opt->answers[i]; i++);
+    return i;
+}
+
 void read_names(std::vector<string>& names, const char* filename)
 {
     std::ifstream file(filename);
@@ -182,8 +147,8 @@
 bool all_infected(Img& S_rast)
 {
     bool allInfected = true;
-    for (int j = 0; j < S_rast.getHeight(); j++) {
-        for (int k = 0; k < S_rast.getWidth(); k++) {
+    for (int j = 0; j < S_rast.rows(); j++) {
+        for (int k = 0; k < S_rast.cols(); k++) {
             if (S_rast(j, k) > 0)
                 allInfected = false;
         }
@@ -191,72 +156,17 @@
     return allInfected;
 }
 
-#ifdef SOD_NETCDF_SUPPORT
-void get_spatial_weather(NcVar *mcf_nc, NcVar *ccf_nc, double* mcf, double* ccf, double* weather, int width, int height, int step)
+struct PoPSOptions
 {
-    // read the weather information
-    if (!mcf_nc->set_cur(step, 0, 0)) {
-        cerr << "Can not read the coefficients from the mcf_nc pointer to mcf array " << step << endl;
-        exit(EXIT_FAILURE);
-    }
-    if (!ccf_nc->set_cur(step, 0, 0)) {
-        cerr << "Can not read the coefficients from the ccf_nc pointer to ccf array "<< step << endl;
-        exit(EXIT_FAILURE);
-    }
-    if (!mcf_nc->get(mcf, 1, height, width)) {
-        cerr << "Can not get the record from mcf_nc " << step << endl;
-        exit(EXIT_FAILURE);
-    }
-    if (!ccf_nc->get(ccf, 1, height, width)) {
-        cerr << "Can not get the record from ccf_nc " << step << endl;
-        exit(EXIT_FAILURE);
-    }
-    for (int j = 0; j < height; j++) {
-        for (int k = 0; k < width; k++) {
-            weather[j * width + k] = mcf[j * width + k] * ccf[j * width + k];
-        }
-    }
-}
-#endif
-
-// TODO: create image which is float/double/template
-void array_from_grass_raster(const char* name, double* array,
-                             unsigned width, unsigned height)
-{
-    int fd = Rast_open_old(name, "");
-
-    for (int row = 0; row < height; row++) {
-        Rast_get_d_row(fd, array + (row * width), row);
-    }
-
-    Rast_close(fd);
-}
-
-void weather_rasters_to_array(const string& moisture_name,
-                              const string& temperature_name,
-                              double* mcf, double* ccf, double* weather,
-                              unsigned width, unsigned height)
-{
-    // read the weather information
-    array_from_grass_raster(moisture_name.c_str(), mcf, width, height);
-    array_from_grass_raster(temperature_name.c_str(), ccf, width, height);
-    for (unsigned j = 0; j < height; j++) {
-        for (unsigned k = 0; k < width; k++) {
-            weather[j * width + k] = mcf[j * width + k] * ccf[j * width + k];
-        }
-    }
-}
-
-struct SodOptions
-{
-    struct Option *species, *lvtree, *infected, *outside_spores;
-    struct Option *nc_weather, *moisture_file, *temperature_file, *weather_value, *weather_file;
-    struct Option *lethal_temperature_value, *lethal_temperature_months;
-    struct Option *actual_temperature_file;
+    struct Option *host, *total_plants, *infected, *outside_spores;
+    struct Option *moisture_coefficient_file, *temperature_coefficient_file;
+    struct Option *lethal_temperature, *lethal_temperature_months;
+    struct Option *temperature_file;
     struct Option *start_time, *end_time, *seasonality;
     struct Option *step;
-    struct Option *spore_rate, *wind;
-    struct Option *radial_type, *scale_1, *scale_2, *kappa, *gamma;
+    struct Option *treatments, *treatment_year;
+    struct Option *reproductive_rate, *wind;
+    struct Option *dispersal_kernel, *short_distance_scale, *long_distance_scale, *kappa, *percent_short_dispersal;
     struct Option *infected_to_dead_rate, *first_year_to_die;
     struct Option *dead_series;
     struct Option *seed, *runs, *threads;
@@ -265,7 +175,7 @@
     struct Option *output_probability;
 };
 
-struct SodFlags
+struct PoPSFlags
 {
     struct Flag *mortality;
     struct Flag *generate_seed;
@@ -275,8 +185,8 @@
 
 int main(int argc, char *argv[])
 {
-    SodOptions opt;
-    SodFlags flg;
+    PoPSOptions opt;
+    PoPSFlags flg;
 
     G_gisinit(argv[0]);
 
@@ -286,22 +196,26 @@
     G_add_keyword(_("spread"));
     G_add_keyword(_("model"));
     G_add_keyword(_("disease"));
-    module->description = _("Stochastic landscape spread model of forest pathogen - Sudden Oak Death (SOD)");
+    G_add_keyword(_("pest"));
+    module->description = _("A dynamic species distribution model for pest or "
+                            "pathogen spread in forest or agricultural ecosystems");
 
-    opt.species = G_define_standard_option(G_OPT_R_INPUT);
-    opt.species->key = "species";
-    opt.species->description = _("Input infected species raster map");
-    opt.species->guisection = _("Input");
+    opt.host = G_define_standard_option(G_OPT_R_INPUT);
+    opt.host->key = "host";
+    opt.host->label = _("Input host raster map");
+    opt.host->description = _("Number of hosts per cell.");
+    opt.host->guisection = _("Input");
 
-    opt.lvtree = G_define_standard_option(G_OPT_R_INPUT);
-    opt.lvtree->key = "lvtree";
-    opt.lvtree->description = _("Input live tree (all) raster map");
-    opt.lvtree->guisection = _("Input");
+    opt.total_plants = G_define_standard_option(G_OPT_R_INPUT);
+    opt.total_plants->key = "total_plants";
+    opt.total_plants->label = _("Input raster map of total plants");
+    opt.total_plants->description = _("Number of all plants per cell");
+    opt.total_plants->guisection = _("Input");
 
-    // TODO: is this oaks?
     opt.infected = G_define_standard_option(G_OPT_R_INPUT);
     opt.infected->key = "infected";
-    opt.infected->description = _("Initial sources of infection raster map");
+    opt.infected->label = _("Input raster map of initial infection");
+    opt.infected->description = _("Number of infected hosts per cell");
     opt.infected->guisection = _("Input");
 
     opt.output = G_define_standard_option(G_OPT_R_OUTPUT);
@@ -343,9 +257,25 @@
 
     opt.outside_spores = G_define_standard_option(G_OPT_V_OUTPUT);
     opt.outside_spores->key = "outside_spores";
+    opt.outside_spores->description = _("Output vector map of spores or pest units outside of modeled area");
     opt.outside_spores->required = NO;
     opt.outside_spores->guisection = _("Output");
 
+    opt.treatments = G_define_standard_option(G_OPT_R_INPUT);
+    opt.treatments->key = "treatments";
+    opt.treatments->multiple = YES;
+    opt.treatments->description = _("Raster map(s) of treatments (treated 1, otherwise 0)");
+    opt.treatments->required = NO;
+    opt.treatments->guisection = _("Treatments");
+
+    opt.treatment_year = G_define_option();
+    opt.treatment_year->key = "treatment_year";
+    opt.treatment_year->type = TYPE_INTEGER;
+    opt.treatment_year->multiple = YES;
+    opt.treatment_year->description = _("Years when treatment rasters are applied");
+    opt.treatment_year->required = NO;
+    opt.treatment_year->guisection = _("Treatments");
+
     opt.wind = G_define_option();
     opt.wind->type = TYPE_STRING;
     opt.wind->key = "wind";
@@ -353,61 +283,38 @@
     opt.wind->description = _("NONE means that there is no wind");
     opt.wind->options = "N,NE,E,SE,S,SW,W,NW,NONE";
     opt.wind->required = YES;
+    opt.wind->answer = const_cast<char*>("NONE");
     opt.wind->guisection = _("Weather");
 
-    opt.nc_weather = G_define_standard_option(G_OPT_F_BIN_INPUT);
-    opt.nc_weather->key = "ncdf_weather";
-    opt.nc_weather->description = _("Weather data");
-    opt.nc_weather->required = NO;
-    opt.nc_weather->guisection = _("Weather");
-
-    opt.moisture_file = G_define_standard_option(G_OPT_F_INPUT);
-    opt.moisture_file->key = "moisture_file";
-    opt.moisture_file->label =
-        _("Input file with one moisture map name per line");
-    opt.moisture_file->description =
+    opt.moisture_coefficient_file = G_define_standard_option(G_OPT_F_INPUT);
+    opt.moisture_coefficient_file->key = "moisture_coefficient_file";
+    opt.moisture_coefficient_file->label =
+        _("Input file with one moisture coefficient map name per line");
+    opt.moisture_coefficient_file->description =
         _("Moisture coefficient");
-    opt.moisture_file->required = NO;
-    opt.moisture_file->guisection = _("Weather");
+    opt.moisture_coefficient_file->required = NO;
+    opt.moisture_coefficient_file->guisection = _("Weather");
 
-    opt.temperature_file = G_define_standard_option(G_OPT_F_INPUT);
-    opt.temperature_file->key = "temperature_file";
-    opt.temperature_file->label =
-        _("Input file with one temperature map name per line");
-    opt.temperature_file->description =
+    opt.temperature_coefficient_file = G_define_standard_option(G_OPT_F_INPUT);
+    opt.temperature_coefficient_file->key = "temperature_coefficient_file";
+    opt.temperature_coefficient_file->label =
+        _("Input file with one temperature coefficient map name per line");
+    opt.temperature_coefficient_file->description =
         _("Temperature coefficient");
-    opt.temperature_file->required = NO;
-    opt.temperature_file->guisection = _("Weather");
+    opt.temperature_coefficient_file->required = NO;
+    opt.temperature_coefficient_file->guisection = _("Weather");
 
-    opt.weather_file = G_define_standard_option(G_OPT_F_INPUT);
-    opt.weather_file->key = "weather_file";
-    opt.weather_file->label = _("Text file with weather");
-    opt.weather_file->description =
-            _("Moisture and temperature");
-    opt.weather_file->required = NO;
-    opt.weather_file->guisection = _("Weather");
-
-    opt.weather_value = G_define_option();
-    opt.weather_value->type = TYPE_INTEGER;
-    opt.weather_value->key = "weather_value";
-    opt.weather_value->label = _("Value to be used as weather coeficient");
-    opt.weather_value->description =
-            _("Spatially and temporally constant weather coeficient"
-              " (usually moisture times temperture)");
-    opt.weather_value->required = NO;
-    opt.weather_value->guisection = _("Weather");
-
-    opt.lethal_temperature_value = G_define_option();
-    opt.lethal_temperature_value->type = TYPE_DOUBLE;
-    opt.lethal_temperature_value->key = "lethal_temperature";
-    opt.lethal_temperature_value->label =
-        _("Temperature when the pest or patogen dies");
-    opt.lethal_temperature_value->description =
+    opt.lethal_temperature = G_define_option();
+    opt.lethal_temperature->type = TYPE_DOUBLE;
+    opt.lethal_temperature->key = "lethal_temperature";
+    opt.lethal_temperature->label =
+        _("Temperature at which the pest or pathogen dies");
+    opt.lethal_temperature->description =
         _("The temerature unit must be the same as for the"
           "temerature raster map (typically degrees of Celsius)");
-    opt.lethal_temperature_value->required = NO;
-    opt.lethal_temperature_value->multiple = NO;
-    opt.lethal_temperature_value->guisection = _("Weather");
+    opt.lethal_temperature->required = NO;
+    opt.lethal_temperature->multiple = NO;
+    opt.lethal_temperature->guisection = _("Weather");
 
     opt.lethal_temperature_months = G_define_option();
     opt.lethal_temperature_months->type = TYPE_INTEGER;
@@ -415,26 +322,26 @@
     opt.lethal_temperature_months->label =
         _("Month when the pest or patogen dies due to low temperature");
     opt.lethal_temperature_months->description =
-        _("The temerature unit must be the same as for the"
-          "temerature raster map (typically degrees of Celsius)");
+        _("The temperature unit must be the same as for the"
+          "temperature raster map (typically degrees of Celsius)");
     // TODO: implement this as multiple
     opt.lethal_temperature_months->required = NO;
     opt.lethal_temperature_months->guisection = _("Weather");
 
     // TODO: rename coefs in interface and improve their descs
-    opt.actual_temperature_file = G_define_standard_option(G_OPT_F_INPUT);
-    opt.actual_temperature_file->key = "actual_temperature_file";
-    opt.actual_temperature_file->label =
+    opt.temperature_file = G_define_standard_option(G_OPT_F_INPUT);
+    opt.temperature_file->key = "temperature_file";
+    opt.temperature_file->label =
         _("Input file with one temperature raster map name per line");
-    opt.actual_temperature_file->description =
+    opt.temperature_file->description =
         _("The temperature should be in actual temperature units (typically degrees of Celsius)");
-    opt.actual_temperature_file->required = NO;
-    opt.actual_temperature_file->guisection = _("Weather");
+    opt.temperature_file->required = NO;
+    opt.temperature_file->guisection = _("Weather");
 
     opt.start_time = G_define_option();
     opt.start_time->type = TYPE_INTEGER;
     opt.start_time->key = "start_time";
-    opt.start_time->label = _("Start year for the simulation");
+    opt.start_time->label = _("Start year of the simulation");
     opt.start_time->description = _("The first day of the year will be used");
     opt.start_time->required = YES;
     opt.start_time->guisection = _("Time");
@@ -442,7 +349,7 @@
     opt.end_time = G_define_option();
     opt.end_time->type = TYPE_INTEGER;
     opt.end_time->key = "end_time";
-    opt.end_time->label = _("End year for the simulation");
+    opt.end_time->label = _("End year of the simulation");
     opt.end_time->description = _("The last day of the year will be used");
     opt.end_time->required = YES;
     opt.end_time->guisection = _("Time");
@@ -465,7 +372,7 @@
     opt.step = G_define_option();
     opt.step->type = TYPE_STRING;
     opt.step->key = "step";
-    opt.step->label = _("Step of simulation");
+    opt.step->label = _("Simulation step");
     opt.step->description = _("How often the simulation computes new step");
     opt.step->options = "week,month";
     opt.step->descriptions = _("week;Compute next simulation step each week;month;Compute next simulation step each month");
@@ -472,76 +379,77 @@
     opt.step->required = YES;
     opt.step->guisection = _("Time");
 
-    opt.spore_rate = G_define_option();
-    opt.spore_rate->type = TYPE_DOUBLE;
-    opt.spore_rate->key = "spore_rate";
-    opt.spore_rate->label = _("Spore production rate per week for each infected tree");
-    opt.spore_rate->answer = const_cast<char*>("4.4");
-    opt.spore_rate->guisection = _("Spores");
+    opt.reproductive_rate = G_define_option();
+    opt.reproductive_rate->type = TYPE_DOUBLE;
+    opt.reproductive_rate->key = "reproductive_rate";
+    opt.reproductive_rate->label = _("Number of spores or pest units produced by a single host");
+    opt.reproductive_rate->description = _("Number of spores or pest units produced by a single host under optimal weather conditions");
+    opt.reproductive_rate->answer = const_cast<char*>("4.4");
+    opt.reproductive_rate->guisection = _("Dispersal");
 
-    opt.radial_type = G_define_option();
-    opt.radial_type->type = TYPE_STRING;
-    opt.radial_type->key = "radial_type";
-    opt.radial_type->label = _("Radial distribution type");
-    opt.radial_type->answer = const_cast<char*>("cauchy");
-    opt.radial_type->options = "cauchy,cauchy_mix";
-    opt.radial_type->guisection = _("Spores");
+    opt.dispersal_kernel = G_define_option();
+    opt.dispersal_kernel->type = TYPE_STRING;
+    opt.dispersal_kernel->key = "dispersal_kernel";
+    opt.dispersal_kernel->label = _("Type of dispersal kernel");
+    opt.dispersal_kernel->answer = const_cast<char*>("cauchy");
+    opt.dispersal_kernel->options = "cauchy,cauchy_mix";
+    opt.dispersal_kernel->guisection = _("Dispersal");
 
-    opt.scale_1 = G_define_option();
-    opt.scale_1->type = TYPE_DOUBLE;
-    opt.scale_1->key = "scale_1";
-    opt.scale_1->label = _("Scale parameter for the first Cauchy distribution");
-    opt.scale_1->answer = const_cast<char*>("20.57");
-    opt.scale_1->guisection = _("Spores");
+    opt.short_distance_scale = G_define_option();
+    opt.short_distance_scale->type = TYPE_DOUBLE;
+    opt.short_distance_scale->key = "short_distance_scale";
+    opt.short_distance_scale->label = _("Distance scale parameter for short range dispersal kernel");
+    opt.short_distance_scale->answer = const_cast<char*>("20.57");
+    opt.short_distance_scale->guisection = _("Dispersal");
 
-    opt.scale_2 = G_define_option();
-    opt.scale_2->type = TYPE_DOUBLE;
-    opt.scale_2->key = "scale_2";
-    opt.scale_2->label = _("Scale parameter for the second Cauchy distribution");
-    opt.scale_2->guisection = _("Spores");
+    opt.long_distance_scale = G_define_option();
+    opt.long_distance_scale->type = TYPE_DOUBLE;
+    opt.long_distance_scale->key = "long_distance_scale";
+    opt.long_distance_scale->label = _("Distance scale parameter for long range dispersal kernel");
+    opt.long_distance_scale->guisection = _("Dispersal");
 
     opt.kappa = G_define_option();
     opt.kappa->type = TYPE_DOUBLE;
     opt.kappa->key = "kappa";
-    opt.kappa->label = _("Concentration parameter for the von Mises distribution");
+    opt.kappa->label = _("Strength of the wind direction in the von-mises distribution");
     opt.kappa->answer = const_cast<char*>("2");
-    opt.kappa->guisection = _("Spores");
+    opt.kappa->guisection = _("Dispersal");
 
-    opt.gamma = G_define_option();
-    opt.gamma->type = TYPE_DOUBLE;
-    opt.gamma->key = "gamma";
-    opt.gamma->label = _("Gamma parameter for Bernoulli distribution");
-    opt.gamma->description = _("Probability of using the first Cauchy distribution");
-    opt.gamma->options = "0-1";
-    opt.gamma->guisection = _("Spores");
+    opt.percent_short_dispersal = G_define_option();
+    opt.percent_short_dispersal->type = TYPE_DOUBLE;
+    opt.percent_short_dispersal->key = "percent_short_dispersal";
+    opt.percent_short_dispersal->label = _("Percentage of short range dispersal");
+    opt.percent_short_dispersal->description = _("What percentage of dispersal is short range versus long range");
+    opt.percent_short_dispersal->options = "0-1";
+    opt.percent_short_dispersal->guisection = _("Dispersal");
 
     opt.infected_to_dead_rate = G_define_option();
     opt.infected_to_dead_rate->type = TYPE_DOUBLE;
     opt.infected_to_dead_rate->key = "mortality_rate";
     opt.infected_to_dead_rate->label =
-        _("Mortality rate of infected trees");
+        _("Mortality rate of infected hosts");
     opt.infected_to_dead_rate->description =
-        _("Percentage of infected trees that die in a given year"
-          " (trees are removed from the infected pool)");
+        _("Percentage of infected hosts that die in a given year"
+          " (hosts are removed from the infected pool)");
     opt.infected_to_dead_rate->options = "0-1";
     opt.infected_to_dead_rate->guisection = _("Mortality");
 
     opt.first_year_to_die = G_define_option();
     opt.first_year_to_die->type = TYPE_INTEGER;
-    opt.first_year_to_die->key = "mortality_start";
+    opt.first_year_to_die->key = "mortality_time_lag";
     opt.first_year_to_die->label =
-        _("Year of simulation when mortality is first applied");
+        _("Time lag from infection until mortality can occur in years");
     opt.first_year_to_die->description =
-        _("How many years it takes for an infected tree to die"
-          " (value 1 for trees dying at the end of the first year)");
+        _("How many years it takes for an infected host to die"
+          " (value 1 for hosts dying at the end of the first year)");
     opt.first_year_to_die->guisection = _("Mortality");
 
     opt.dead_series = G_define_standard_option(G_OPT_R_BASENAME_OUTPUT);
-    opt.dead_series->key = "dead_series";
+    opt.dead_series->key = "mortality_series";
     opt.dead_series->label =
-        _("Basename for series of number of dead trees");
+        _("Basename for series of number of dead hosts");
     opt.dead_series->description =
-        _("Basename for output series of number of dead trees"
+        _("Basename for output series of number of dead hosts"
           " (requires mortality to be activated)");
     opt.dead_series->required = NO;
     opt.dead_series->guisection = _("Mortality");
@@ -551,7 +459,7 @@
     flg.mortality->label =
         _("Apply mortality");
     flg.mortality->description =
-        _("After a given amount of time, start removing dead trees"
+        _("After certain number of years, start removing dead hosts"
           " from the infected pool with a given rate");
     flg.mortality->guisection = _("Mortality");
 
@@ -581,7 +489,7 @@
     opt.runs->label = _("Number of simulation runs");
     opt.runs->description =
         _("The individual runs will obtain different seeds"
-          " and will be avaraged for the output");
+          " and will be averaged for the output");
     opt.runs->guisection = _("Randomness");
 
     opt.threads = G_define_option();
@@ -600,11 +508,7 @@
     G_option_required(opt.seed, flg.generate_seed, NULL);
 
     // weather
-    G_option_exclusive(opt.moisture_file, opt.nc_weather,
-                       opt.weather_file, opt.weather_value, NULL);
-    G_option_exclusive(opt.temperature_file, opt.nc_weather,
-                       opt.weather_file, opt.weather_value, NULL);
-    G_option_collective(opt.moisture_file, opt.temperature_file, NULL);
+    G_option_collective(opt.moisture_coefficient_file, opt.temperature_coefficient_file, NULL);
 
     // mortality
     // flag and rate required always
@@ -614,17 +518,11 @@
     G_option_requires(opt.first_year_to_die, flg.mortality, NULL);
     G_option_requires_all(opt.dead_series, flg.mortality,
                           flg.series_as_single_run, NULL);
+    G_option_requires(opt.treatments, opt.treatment_year, NULL);
 
     if (G_parser(argc, argv))
         exit(EXIT_FAILURE);
 
-#ifndef SOD_NETCDF_SUPPORT
-    if (opt.nc_weather->answer) {
-        G_fatal_error(_("Direct NetCDF support is not available in this"
-                        " installation, import the data instead"));
-    }
-#endif
-
     unsigned num_runs = 1;
     if (opt.runs->answer)
         num_runs = std::stoul(opt.runs->answer);
@@ -634,9 +532,8 @@
         threads = std::stoul(opt.threads->answer);
 
     // check for file existence
-    file_exists_or_fatal_error(opt.moisture_file);
-    file_exists_or_fatal_error(opt.temperature_file);
-    file_exists_or_fatal_error(opt.weather_file);
+    file_exists_or_fatal_error(opt.moisture_coefficient_file);
+    file_exists_or_fatal_error(opt.temperature_coefficient_file);
 
     // Seasonality: Do you want the spread to be limited to certain months?
     if (!opt.seasonality->answer || opt.seasonality->answer[0] == '\0')
@@ -647,24 +544,24 @@
     Direction pwdir = direction_enum_from_string(opt.wind->answer);
 
     // set the spore rate
-    double spore_rate = std::stod(opt.spore_rate->answer);
-    Rtype rtype = radial_type_from_string(opt.radial_type->answer);
-    double scale1 = std::stod(opt.scale_1->answer);
+    double spore_rate = std::stod(opt.reproductive_rate->answer);
+    DispersalKernel rtype = radial_type_from_string(opt.dispersal_kernel->answer);
+    double scale1 = std::stod(opt.short_distance_scale->answer);
     double scale2 = 0;
-    if (rtype == CAUCHY_MIX && !opt.scale_2->answer)
+    if (rtype == CAUCHY_DOUBLE_SCALE && !opt.long_distance_scale->answer)
         G_fatal_error(_("The option %s is required for %s=%s"),
-                      opt.scale_2->key, opt.radial_type->key,
-                      opt.radial_type->answer);
-    else if (opt.scale_2->answer)
-        scale2 = std::stod(opt.scale_2->answer);
+                      opt.long_distance_scale->key, opt.dispersal_kernel->key,
+                      opt.dispersal_kernel->answer);
+    else if (opt.long_distance_scale->answer)
+        scale2 = std::stod(opt.long_distance_scale->answer);
     double kappa = std::stod(opt.kappa->answer);
     double gamma = 0.0;
-    if (rtype == CAUCHY_MIX && !opt.gamma->answer)
+    if (rtype == CAUCHY_DOUBLE_SCALE && !opt.percent_short_dispersal->answer)
         G_fatal_error(_("The option %s is required for %s=%s"),
-                      opt.gamma->key, opt.radial_type->key,
-                      opt.radial_type->answer);
-    else if (opt.gamma->answer)
-        gamma = std::stod(opt.gamma->answer);
+                      opt.percent_short_dispersal->key, opt.dispersal_kernel->key,
+                      opt.dispersal_kernel->answer);
+    else if (opt.percent_short_dispersal->answer)
+        gamma = std::stod(opt.percent_short_dispersal->answer);
 
     // initialize the start Date and end Date object
     // options for times are required ints
@@ -671,14 +568,13 @@
     int start_time = std::stoi(opt.start_time->answer);
     int end_time = std::stoi(opt.end_time->answer);
     if (start_time > end_time) {
-        cerr << "Start date must precede the end date!!!" << endl;
-        exit(EXIT_FAILURE);
+        G_fatal_error(_("Start date must precede the end date"));
     }
 
     Date dd_start(start_time, 01, 01);
     Date dd_end(end_time, 12, 31);
     // difference in years (in dates) but including both years
-    auto num_years = dd_end.getYear() - dd_start.getYear() + 1;
+    unsigned num_years = dd_end.year() - dd_start.year() + 1;
 
     string step = opt.step->answer;
 
@@ -717,13 +613,13 @@
     }
 
     // read the suspectible UMCA raster image
-    Img species_rast = Img::fromGrassRaster(opt.species->answer);
+    Img species_rast = Img::from_grass_raster(opt.host->answer);
 
     // read the living trees raster image
-    Img lvtree_rast = Img::fromGrassRaster(opt.lvtree->answer);
+    Img lvtree_rast = Img::from_grass_raster(opt.total_plants->answer);
 
     // read the initial infected oaks image
-    Img I_species_rast = Img::fromGrassRaster(opt.infected->answer);
+    Img I_species_rast = Img::from_grass_raster(opt.infected->answer);
 
     // create the initial suspectible oaks image
     Img S_species_rast = species_rast - I_species_rast;
@@ -732,90 +628,50 @@
     //Img SOD_rast = umca_rast + oaks_rast;
     //Img IMM_rast = lvtree_rast - SOD_rast;
 
-    // retrieve the width and height of the images
-    int width = species_rast.getWidth();
-    int height = species_rast.getHeight();
-
-#ifdef SOD_NETCDF_SUPPORT
-    std::shared_ptr<NcFile> weather_coeff = nullptr;
-#else
-    bool weather_coeff = false;
-#endif
     std::vector<string> moisture_names;
     std::vector<string> temperature_names;
-    double weather_from_rasters = false;
-    std::vector<double> weather_values;
-    double weather_value = 0;
+    double weather = false;
 
-#ifdef SOD_NETCDF_SUPPORT
-    if (opt.nc_weather->answer)
-        weather_coeff = std::make_shared<NcFile>(opt.nc_weather->answer, NcFile::ReadOnly);
-#else
-    if (false)
-        ;
-    // TODO: switch order of ifs to avoid this
-#endif
-    else if (opt.moisture_file->answer && opt.temperature_file->answer) {
-        read_names(moisture_names, opt.moisture_file->answer);
-        read_names(temperature_names, opt.temperature_file->answer);
-        weather_from_rasters = true;
+    if (opt.moisture_coefficient_file->answer && opt.temperature_coefficient_file->answer) {
+        read_names(moisture_names, opt.moisture_coefficient_file->answer);
+        read_names(temperature_names, opt.temperature_coefficient_file->answer);
+        weather = true;
     }
-    else if (opt.weather_file->answer)
-        weather_values = weather_file_to_list(opt.weather_file->answer);
-    else if (opt.weather_value->answer)
-        weather_value = std::stoi(opt.weather_value->answer);
-    else
-        weather_value = 1;  // no change (used in multiplication)
 
-#ifdef SOD_NETCDF_SUPPORT
-    if (weather_coeff && !weather_coeff->is_valid()) {
-        cerr << "Can not open the weather coefficients file(.cn)!" << endl;
-        exit(EXIT_FAILURE);
-    }
-
-    // TODO: do we need to free this? docs is 404
-    NcVar *mcf_nc = nullptr;
-    NcVar *ccf_nc = nullptr;
-
-    if (weather_coeff && !(mcf_nc = weather_coeff->get_var("Mcoef"))) {
-        cerr << "Can not read the moisture coefficients from the file!" <<
-            endl;
-        exit(EXIT_FAILURE);
-    }
-
-    if (weather_coeff && !(ccf_nc = weather_coeff->get_var("Ccoef"))) {
-        cerr << "Can not read the temperature coefficients from the file!" <<
-            endl;
-        exit(EXIT_FAILURE);
-    }
-#endif
-
     double use_lethal_temperature = false;
     double lethal_temperature_value;
     int lethal_temperature_month = 0;  // invalid value for month
     std::vector<string> actual_temperature_names;
     std::vector<DImg> actual_temperatures;
-    if (opt.lethal_temperature_value->answer)
-        lethal_temperature_value = std::stod(opt.lethal_temperature_value->answer);
+    if (opt.lethal_temperature->answer)
+        lethal_temperature_value = std::stod(opt.lethal_temperature->answer);
     if (opt.lethal_temperature_months->answer)
         lethal_temperature_month = std::stod(opt.lethal_temperature_months->answer);
-    if (opt.actual_temperature_file->answer) {
-        file_exists_or_fatal_error(opt.actual_temperature_file);
-        read_names(actual_temperature_names, opt.actual_temperature_file->answer);
+    if (opt.temperature_file->answer) {
+        file_exists_or_fatal_error(opt.temperature_file);
+        read_names(actual_temperature_names, opt.temperature_file->answer);
         for (string name : actual_temperature_names) {
-            actual_temperatures.push_back(DImg::fromGrassRaster(name.c_str()));
+            actual_temperatures.push_back(DImg::from_grass_raster(name.c_str()));
         }
         use_lethal_temperature = true;
     }
 
     const unsigned max_weeks_in_year = 53;
-    double *mcf = nullptr;
-    double *ccf = nullptr;
-    double *weather = nullptr;
-    if (weather_coeff || weather_from_rasters) {
-        mcf = new double[height * width];
-        ccf = new double[height * width];
-        weather = new double[max_weeks_in_year * height * width];
+    std::vector<DImg> weather_coefficients;
+    if (weather)
+        weather_coefficients.resize(max_weeks_in_year);
+
+    // treatments
+    if (get_num_answers(opt.treatments) != get_num_answers(opt.treatment_year)){
+        G_fatal_error(_("%s= and %s= must have the same number of values"), opt.treatments->key, opt.treatment_year->key);}
+    Treatments<Img, DImg> treatments;
+    bool use_treatments = false;
+    if (opt.treatments->answers) {
+        for (int i_t = 0; opt.treatment_year->answers[i_t]; i_t++) {
+            DImg tr = DImg::from_grass_raster(opt.treatments->answers[i_t]);
+            treatments.add_treatment(std::stoul(opt.treatment_year->answers[i_t]), tr);
+            use_treatments = true;
+        }
     }
 
     // build the Sporulation object
@@ -836,8 +692,10 @@
     Img accumulated_dead(Img(S_species_rast, 0));
 
     sporulations.reserve(num_runs);
+    struct Cell_head window;
+    G_get_window(&window);
     for (unsigned i = 0; i < num_runs; ++i)
-        sporulations.emplace_back(seed_value++, I_species_rast);
+        sporulations.emplace_back(seed_value++, I_species_rast, window.ew_res, window.ns_res);
     std::vector<std::vector<std::tuple<int, int> > > outside_spores(num_runs);
 
     std::vector<unsigned> unresolved_weeks;
@@ -846,27 +704,27 @@
     Date dd_current(dd_start);
 
     // main simulation loop (weekly steps)
-    for (int current_week = 0; ; current_week++, step == "month" ? dd_current.increasedByMonth() : dd_current.increasedByWeek()) {
+    for (int current_week = 0; ; current_week++, step == "month" ? dd_current.increased_by_month() : dd_current.increased_by_week()) {
         if (dd_current < dd_end)
-            if (season.month_in_season(dd_current.getMonth()))
+            if (season.month_in_season(dd_current.month()))
                 unresolved_weeks.push_back(current_week);
 
         // removal is out of sync with the actual runs but it does
         // not matter as long as removal happends out of season
         if (use_lethal_temperature
-                && dd_current.getMonth() == lethal_temperature_month
-                && (dd_current.getYear() <= dd_end.getYear())) {
+                && dd_current.month() == lethal_temperature_month
+                && (dd_current.year() <= dd_end.year())) {
             // to avoid problem with Jan 1 of the following year
             // we explicitely check if we are in a valid year range
-            unsigned simulation_year = dd_current.getYear() - dd_start.getYear();
+            unsigned simulation_year = dd_current.year() - dd_start.year();
             if (simulation_year >= actual_temperatures.size())
                 G_fatal_error(_("Not enough temperatures"));
             #pragma omp parallel for num_threads(threads)
             for (unsigned run = 0; run < num_runs; run++) {
-                sporulations[run].SporeRemove(inf_species_rasts[run],
-                                              sus_species_rasts[run],
-                                              actual_temperatures[simulation_year],
-                                              lethal_temperature_value);
+                sporulations[run].remove(inf_species_rasts[run],
+                                         sus_species_rasts[run],
+                                         actual_temperatures[simulation_year],
+                                         lethal_temperature_value);
             }
         }
 
@@ -877,28 +735,17 @@
         }
 
         // check whether the spore occurs in the month
-        if ((step == "month" ? dd_current.isLastMonthOfYear() : dd_current.isYearEnd()) || dd_current >= dd_end) {
+        if ((step == "month" ? dd_current.is_last_month_of_year() : dd_current.is_last_week_of_year()) || dd_current >= dd_end) {
             if (!unresolved_weeks.empty()) {
 
                 unsigned week_in_chunk = 0;
                 // get weather for all the weeks
                 for (auto week : unresolved_weeks) {
-                    double *week_weather = weather + week_in_chunk * width * height;
-#ifdef SOD_NETCDF_SUPPORT
-                    if (weather_coeff) {
-                        get_spatial_weather(mcf_nc, ccf_nc, mcf, ccf, week_weather, width, height, week);
+                    if (weather) {
+                        DImg moisture(DImg::from_grass_raster(moisture_names[week].c_str()));
+                        DImg temperature(DImg::from_grass_raster(temperature_names[week].c_str()));
+                        weather_coefficients[week_in_chunk] = moisture * temperature;
                     }
-#else
-                    if (false)
-                        ;
-                    // TODO: switch order of ifs to avoid this
-#endif
-                    else if (weather_from_rasters) {
-                        weather_rasters_to_array(moisture_names[week],
-                                                 temperature_names[week],
-                                                 mcf, ccf, week_weather,
-                                                 width, height);
-                    }
                     ++week_in_chunk;
                 }
 
@@ -907,32 +754,32 @@
                 for (unsigned run = 0; run < num_runs; run++) {
                     unsigned week_in_chunk = 0;
                     // actual runs of the simulation per week
-                    for (auto week : unresolved_weeks) {
-                        double *week_weather = 0;
-                        if (weather) {
-                            week_weather = weather + week_in_chunk * width * height;
-                        }
-                        if (!weather_coeff && !weather_values.empty()) {
-                            weather_value = weather_values[week];
-                        }
-                        sporulations[run].SporeGen(inf_species_rasts[run], week_weather, weather_value, spore_rate);
+                    for (unsigned week : unresolved_weeks) {
+                        sporulations[run].generate(inf_species_rasts[run],
+                                                   weather,
+                                                   weather_coefficients[week_in_chunk],
+                                                   spore_rate);
 
-                        auto current_age = dd_current.getYear() - dd_start.getYear();
-                        sporulations[run].SporeSpreadDisp_singleSpecies(sus_species_rasts[run], inf_species_rasts[run],
-                                                                        inf_species_cohort_rasts[run][current_age],
-                                                                        lvtree_rast, outside_spores[run],
-                                                                        rtype, week_weather,
-                                                                        weather_value, scale1, kappa, pwdir, scale2,
-                                                                        gamma);
+                        auto current_age = dd_current.year() - dd_start.year();
+                        sporulations[run].disperse(sus_species_rasts[run],
+                                                   inf_species_rasts[run],
+                                                   inf_species_cohort_rasts[run][current_age],
+                                                   lvtree_rast,
+                                                   outside_spores[run],
+                                                   weather,
+                                                   weather_coefficients[week_in_chunk],
+                                                   rtype, scale1,
+                                                   gamma, scale2,
+                                                   pwdir, kappa);
                         ++week_in_chunk;
                     }
                 }
                 unresolved_weeks.clear();
             }
-            if (mortality && (dd_current.getYear() <= dd_end.getYear())) {
+            if (mortality && (dd_current.year() <= dd_end.year())) {
                 // to avoid problem with Jan 1 of the following year
                 // we explicitely check if we are in a valid year range
-                unsigned simulation_year = dd_current.getYear() - dd_start.getYear();
+                unsigned simulation_year = dd_current.year() - dd_start.year();
                 // only run to the current year of simulation
                 // (first year is 0):
                 //   max index == sim year
@@ -953,11 +800,18 @@
                             Img dead_in_cohort = infected_to_dead_rate * inf_species_cohort_rasts[run][age];
                             inf_species_cohort_rasts[run][age] -= dead_in_cohort;
                             dead_in_current_year[run] += dead_in_cohort;
+                            if (use_treatments)
+                                treatments.apply_treatment_infected(dd_current.year(), inf_species_cohort_rasts[run][age]);
                         }
                         inf_species_rasts[run] -= dead_in_current_year[run];
                     }
                 }
             }
+            if (use_treatments && (dd_current.year() <= dd_end.year())) {
+                for (unsigned run = 0; run < num_runs; run++) {
+                    treatments.apply_treatment_host(dd_current.year(), inf_species_rasts[run], sus_species_rasts[run]);
+                }
+            }
             if ((opt.output_series->answer && !flg.series_as_single_run->answer)
                      || opt.stddev_series->answer) {
                 // aggregate in the series
@@ -971,13 +825,12 @@
                 // date is always end of the year, even for seasonal spread
                 string name = generate_name(opt.output_series->answer, dd_current);
                 if (flg.series_as_single_run->answer)
-                    inf_species_rasts[0].toGrassRaster(name.c_str());
+                    inf_species_rasts[0].to_grass_raster(name.c_str());
                 else
-                    I_species_rast.toGrassRaster(name.c_str());
+                    I_species_rast.to_grass_raster(name.c_str());
             }
             if (opt.stddev_series->answer) {
-                Img stddev(I_species_rast.getWidth(), I_species_rast.getHeight(),
-                           I_species_rast.getWEResolution(), I_species_rast.getNSResolution(), 0);
+                Img stddev(I_species_rast, 0);
                 for (unsigned i = 0; i < num_runs; i++) {
                     Img tmp = inf_species_rasts[i] - I_species_rast;
                     stddev += tmp * tmp;
@@ -985,13 +838,13 @@
                 stddev /= num_runs;
                 stddev.for_each([](int& a){a = std::sqrt(a);});
                 string name = generate_name(opt.stddev_series->answer, dd_current);
-                stddev.toGrassRaster(name.c_str());
+                stddev.to_grass_raster(name.c_str());
             }
             if (mortality && opt.dead_series->answer) {
                 accumulated_dead += dead_in_current_year[0];
                 if (opt.dead_series->answer) {
                     string name = generate_name(opt.dead_series->answer, dd_current);
-                    accumulated_dead.toGrassRaster(name.c_str());
+                    accumulated_dead.to_grass_raster(name.c_str());
                 }
             }
         }
@@ -1009,11 +862,10 @@
     }
     if (opt.output->answer) {
         // write final result
-        I_species_rast.toGrassRaster(opt.output->answer);
+        I_species_rast.to_grass_raster(opt.output->answer);
     }
     if (opt.stddev->answer) {
-        Img stddev(I_species_rast.getWidth(), I_species_rast.getHeight(),
-                   I_species_rast.getWEResolution(), I_species_rast.getNSResolution(), 0);
+        Img stddev(I_species_rast, 0);
         for (unsigned i = 0; i < num_runs; i++) {
             Img tmp = inf_species_rasts[i] - I_species_rast;
             stddev += tmp * tmp;
@@ -1020,11 +872,10 @@
         }
         stddev /= num_runs;
         stddev.for_each([](int& a){a = std::sqrt(a);});
-        stddev.toGrassRaster(opt.stddev->answer);
+        stddev.to_grass_raster(opt.stddev->answer);
     }
     if (opt.output_probability->answer) {
-        Img probability(I_species_rast.getWidth(), I_species_rast.getHeight(),
-                        I_species_rast.getWEResolution(), I_species_rast.getNSResolution(), 0);
+        Img probability(I_species_rast, 0);
         for (unsigned i = 0; i < num_runs; i++) {
             Img tmp = inf_species_rasts[i];
             tmp.for_each([](int& a){a = bool(a);});
@@ -1032,7 +883,7 @@
         }
         probability *= 100;  // prob from 0 to 100 (using ints)
         probability /= num_runs;
-        probability.toGrassRaster(opt.output_probability->answer);
+        probability.to_grass_raster(opt.output_probability->answer);
     }
     if (opt.outside_spores->answer) {
         Cell_head region;
@@ -1065,12 +916,5 @@
         Vect_destroy_cats_struct(Cats);
     }
 
-    // clean the allocated memory
-    if (weather) {
-        delete[] mcf;
-        delete[] ccf;
-        delete[] weather;
-    }
-
     return 0;
 }

Added: grass-addons/grass7/raster/r.pops.spread/pops/CHANGELOG.md
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/CHANGELOG.md	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/CHANGELOG.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,135 @@
+# Change Log
+
+All notable changes to this project should be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/).
+
+## 2018-11-17
+
+- Added mortality function to simulation class
+
+## 2018-10-31 - Minor Refactoring
+
+### Added
+
+- Added Season class to manage seasonality
+
+### Changed
+
+- Removed resolution from the Raster class
+
+## 2018-09-20 - Variable Rename
+
+### Added
+
+- Created a style guide in a CONTRIBUTING file. (Vaclav Petras)
+
+### Changed
+
+- Renamed variables and functions to make the model more clear and easy
+  to understand. (Chris Jones)
+- Renaming and partial unification of styles across all files. (Vaclav Petras)
+ - All is now in namespace called pops.
+ - Private variables use trailing underscore if needed.
+- Removed unused and legacy functions and types. (Vaclav Petras)
+
+## 2018-08-02 - PoPS Model Separation
+
+### Changed
+
+- The general part of the simulation is now a separate library called
+  PoPS. GRASS GIS module code was removed together with some parts of
+  this file completely unrelated to the library. (Vaclav Petras)
+- All files which were not supposed to be part of the repository
+  were removed and purged from the history. However, all the relevant
+  history is preserved. (Vaclav Petras)
+
+## 2018-06-21 - Spotted Lanternfly
+
+### Added
+
+- The date class now supports also month increments. (Vaclav Petras)
+- Critical temperature as the lowest temperature spores can survive
+  in a provided month (Vaclav Petras)
+ - Temperature rasters are used at a specified month to check against
+   a provided critical temperature and if the condition is met,
+   infected trees become susceptible again.
+
+### Changed
+
+- Img was replaced by a generalized Raster template class which can
+  handle both integers and floating point numbers. (Vaclav Petras)
+
+## 2018-06-04 - Mortality Addition
+
+### Added
+
+- Mortality (Vaclav Petras)
+- Image class constructor taking another image using its dimensions
+  and a provided value (Vaclav Petras)
+- Multiply for image class is commutative (Vaclav Petras)
+
+## 2018-03-26 - March 2018 Update
+
+### Changed
+
+- Explicitly include necessary standard C++ headers (Vaclav Petras)
+
+## 2017-09-05 - September 2017 Update
+
+### Added
+
+- Long-range dispersal kernel (Anna Petrasova)
+ - Events are recorded.
+ - The affected points are exported as a vector map.
+- Output probability of cell being infected (Vaclav Petras)
+- Optionally output one run for series instead of an average (Vaclav Petras)
+
+### Changed
+
+- Spread of SOD based on a single species (Anna Petrasova)
+ - Spread for UMCA and oak replaced by single species, assumed tanoak.
+
+## 2017-01-28 - January 2017 Status
+
+### Added
+
+- Simplified weather inputs (Vaclav Petras)
+ - Weather can be supplied as as a text file (spatially constant)
+ - Weather can be supplied as one variable (non-spatial and non-temporal)
+
+### Changed
+
+- Efficiency improvements (Vaclav Petras)
+ - Enable inlining of size getters of Img class which makes all_infected
+   function much faster.
+ - Move constructor and assignment operator added for cases when RVO
+   is not applied.
+ - Internal storage changed to one array (usually faster allocation).
+- Code cleanup (Vaclav Petras)
+ - Use same API style for Von Mises as for std lib distributions.
+ - Creating data for Img outside of the object is avoided.
+ - Indexing the Img done using operator ().
+ - Using operators for all operations which fit semantically.
+ - Remove unused variables from the code.
+ - The 'using namespace' statement replaced by explicit use 'using' for
+   string and other classes or objects.
+- Date class API extended to provide readable comparison operators
+  replacing usage of method with unclear name (Anna Petrasova)
+- The cpl_string dependency was removed. (Vaclav Petras)
+- The sporulation object is now seeded only once in the beginning.
+  This changes the stochastic output of one run. (Anna Petrasova)
+
+### Fixed
+
+- Initialize memory for the sporulation object for the cases when it is
+  zero cases to fix conditional jump which depends on uninitialised
+  value. (Vaclav Petras)
+- Memory allocation and deallocation is done by the right pair of
+  malloc-free or new-delete. (Vaclav Petras)
+- Compilation output and other non-repository files removed from the
+  repository. (Vaclav Petras)
+- Von Mises distribution concentration parameter is float not integer.
+  (Vaclav Petras)
+- Copy of GDAL code was removed from the repository, using system GDAL
+  includes now. (Vaclav Petras)

Added: grass-addons/grass7/raster/r.pops.spread/pops/CITATION.cff
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/CITATION.cff	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/CITATION.cff	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,21 @@
+cff-version: 1.0.3
+message: If you use this software, please cite it as below.
+authors:
+  - family-names: Petras
+    given-names: Vaclav
+    orcid: https://orcid.org/0000-0001-5566-9236
+  - family-names: Petrasova
+    given-names: Anna
+    website: https://petrasovaa.github.io/
+  - family-names: Chen
+    given-names: Zexi
+    website: https://www.linkedin.com/in/zexi-chen/
+  - family-names: Tonini
+    given-names: Francesco
+    website: http://www.francescotonini.com/
+title: r.spread.sod - SOD spread model implemented as GRASS GIS module
+version: 29074a1
+date-released: 2018-06-21
+url: https://grass.osgeo.org/grass74/manuals/addons/r.spread.sod.html
+repository-code: https://github.com/ncsu-landscape-dynamics/SOD-modeling-cpp
+license: GPL-2.0-or-later

Added: grass-addons/grass7/raster/r.pops.spread/pops/CONTRIBUTING.md
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/CONTRIBUTING.md	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/CONTRIBUTING.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,65 @@
+# Contributing to PoPS
+
+## Style guide
+
+### C++ code
+
+The style is inspired by well-defined Python's PEP8 and for C++ specific
+items by mix of LLVM and Qt.
+
+#### Curly brackets
+
+Put the opening curly bracket on a newline for functions and classes.
+This makes the function or class separate from the rest of the code.
+Exception are oneliner functions such as setters and getters
+where all can be one line.
+
+Loops, if-statements, and namespaces can have the opening bracket on
+the same line to save vertical space.
+
+#### Functions and methods
+
+Use underscores to separate words.
+
+For setters use `set_name()`. Don't overuse the `set` prefix, e.g. in
+case of `set_open()` it is not clear if just a property is being set
+or if some opening action is being performed as a result of the call
+(simple `open()` would likely express it better).
+
+For getters use just `name()` like e.g. in Qt.
+For getters of boolean properties, it is usually appropriate to
+use `is` prefix like in `is_empty()` or `is_open()` especially
+when it would not be clear if it refers to an action or property,
+e.g. `empty()` versus `is_empty()`.
+
+#### Member variables
+
+Use trailing underscore, i.e. `name_`, or nothing, i.e. `name` for
+member variables. No special marking is nice
+when used internally but not exposed to the outside
+world. However, if you need to distinguish a private member variable
+from a getter method, use trailing underscore for the private variable.
+The underscore, as opposed to using nothing, makes it easier to
+distinguish member variables from other variables when reading code
+of a method (and `this->` is not used).
+
+Do not use leading underscore, i.e. `_name`, like in Python because that might
+be reserved or used by standard library. Do not use leading letter m with out
+without underscore, i.e. `m_name` or `mname`, because it is harder to read.
+The trailing underscore is the closest thing to Python's marking of
+private members.
+
+#### Types
+
+Make the `*` or `&` for pointer or reference a part of the variable type
+by putting no space before and one space after, i.e. `Type& value` and
+not `Type &value`.
+
+### Documentation
+
+Don't document obvious things like in "this like assigns a variable"
+but keep in mind that people unfamiliar with C++ will read or even use
+or change the code, so point out some things which might be obvious to
+a C++ developer, but are unexpected coming from a different programming
+language, for example that a function parameter which is not a pointer
+or reference actually copies the whole object.

Added: grass-addons/grass7/raster/r.pops.spread/pops/Doxyfile
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/Doxyfile	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/Doxyfile	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,2427 @@
+# Doxyfile 1.8.11
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = "PoPS"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = "Pest or Pathogen Spread Simulation"
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
+# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = README.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse-libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = NO
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sf.net) file that captures the
+# structure of the code including all documentation. Note that this feature is
+# still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: YES.
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = YES
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
+# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
+# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = YES
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES

Added: grass-addons/grass7/raster/r.pops.spread/pops/Makefile
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/Makefile	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/Makefile	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,30 @@
+CXXFLAGS := $(CXXFLAGS) -std=c++11 -pedantic -Wall -Wextra
+COMMON_DEFINES := -D POPS_TEST
+
+all: test_date test_raster test_simulation test_treatments
+
+test_date: test_date.cpp date.hpp
+	g++ $(CXXFLAGS) $(COMMON_DEFINES) test_date.cpp -o test_date
+
+test_raster: test_raster.cpp *.hpp
+	g++ $(CXXFLAGS) $(COMMON_DEFINES) test_raster.cpp -o test_raster
+
+test_simulation: test_simulation.cpp *.hpp
+	g++ $(CXXFLAGS) $(COMMON_DEFINES) test_simulation.cpp -o test_simulation
+
+test_treatments: test_treatments.cpp *.hpp
+	g++ $(CXXFLAGS) $(COMMON_DEFINES) test_treatments.cpp -o test_treatments
+test:
+	./test_date
+	./test_raster
+	./test_simulation
+	./test_treatments
+
+doc:
+	doxygen
+
+clean:
+	rm -f test_date
+	rm -f test_raster
+	rm -f test_simulation
+	rm -f test_treatments

Added: grass-addons/grass7/raster/r.pops.spread/pops/README.md
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/README.md	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/README.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,170 @@
+# PoPS (Pest or Pathogen Spread) Model
+
+[![Build Status](https://travis-ci.org/ncsu-landscape-dynamics/PoPS.svg?branch=master)](https://travis-ci.org/ncsu-landscape-dynamics/PoPS)
+
+PoPS library
+
+PoPS (Pest or Pathogen Spread) is a C++ library for a stochastic spread model of pests and pathogens in forest and agricultural landscapes. It has been generalized and new features added but was originally developed for *Phytophthora ramorum* and the original version of the model was based on this reference paper: Ross K. Meentemeyer, Nik J. Cunniffe, Alex R. Cook, Joao A. N. Filipe, Richard D. Hunter, David M. Rizzo, and Christopher A. Gilligan 2011. Epidemiological modeling of invasion in heterogeneous landscapes: spread of sudden oak death in California (1990–2030). *Ecosphere* 2:art17. [http://dx.doi.org/10.1890/ES10-00192.1] (http://www.esajournals.org/doi/abs/10.1890/ES10-00192.1) 
+
+PoPS is a header-only C++ library. It is using templates to be universal and it makes use of C++11 features, so C++11 is the minimal
+required version.
+
+## Contributing
+
+This section is designed to clarify the branch structure of this repository and where new features and bug fixes should go.
+
+### Branch Structure
+
+1. **master** is the stable version of the model that is used for official releases. 
+2. **bugfix/thingnotworking** are branched off of master then merged back once bug is fixed.
+3. **feature/new_feature** is where new features are developed before they are merged into Development. For example, infect and vector are currently being developed and will be merged together prior to being merged to master for an official major version release.
+
+### Bug Fixes
+
+Most bugs/issues will be found in the **master** branch as it is the branch being used in the R package and Grass Module. Thus bug fixes should be merged into **master** once tested on both R and Grass. Bug fixes should be released as minor versions (e.g. if major release is 1.0 then the first bug fix would be released as version 1.1).
+
+### New Features
+
+When creating new features create a branch from **master** using the following syntax **feature/new_feature**. For example, we want to add a transportation network model for human assisted dispersal, the branch created would be named feature/transportation_network_model (or similar). New features will be merged into **master** once tested based on the priorities of our stakeholders first. Once new features are tested in R and Grass with the latest bug fixes and any other new features being included in the next major release we will merge them into **master** and create an official major release version (e.g. update from version 1.1 to version 2.0). 
+
+If you are interested in contributing to PoPS development and are not a core developer on the model, please take a look at following
+documents to make the process as seamless as possible.
+
+1. [Contributor Code of Conduct](contributing_docs/CODE_OF_CONDUCT.md)
+1. [PoPS Style Guide](contributing_docs/STYLE_GUIDE.md)
+1. [Contributor Guide](contributing_docs/CONTRIBUTING.md)
+
+## Main Functions
+
+simulation.remove : removes the pest or pathogen from the infested hosts based on some environmental threshold (currently only temperature is accounted for).
+
+simulation.generate : generates dispersing indivduls from all infested cells based as a function of local infected hosts and weather.
+
+simulation.disperse : creates dispersal locations for the dispersing individuals from the generate function.
+
+simulation.mortality : causes mortality in infested/infected hosts based on mortality rate
+
+The custom date class is used to easily manage different time steps within the model and account for differences in the way frequently used weather data sets treat leap years (DAYMET drops December 31st from leap years, PRISM keeps all days even for leap years)
+
+## Using the model
+
+The PoPS library can be used directly in a C++ program or through other
+programs. It is used in an experimental version of a GRASS GIS module
+called r.spread.pest.
+
+* https://github.com/ncsu-landscape-dynamics/r.pops.spread
+
+It is also used in the pops_model function in R.
+
+* https://github.com/ncsu-landscape-dynamics/rpops
+
+## Integrating the library into your own project
+
+### As a Git submodule
+
+This is a convenient way, if you are using Git and you can use the C++
+header files directly.
+
+Git supports inclusion of other repositories into your own code using
+a mechanism called submodules. In your repository, run:
+
+```
+git submodule add https://github.com/ncsu-landscape-dynamics/PoPS pops
+```
+
+If you want a specific branch of the PoPS library. After adding the 
+PoPS submodule, run the following commands (with branch-name being
+the branch of the PoPS library you want to use):
+
+```
+cd pops
+git checkout origin/branch-name
+```
+
+The will create a directory called `pops` in your repository which will
+now contain all the files from this repository. You can use the two
+following commands to see the changes to your repository:
+
+```
+git status
+git diff --cached
+```
+
+Git added a file called `.gitmodules` with the link to this repository
+and linked a specific commit in this repository. The commit linked is
+the currently latest commit to PoPS library.
+
+You can now commit and push changes to your repository.
+
+When someone else clones our project, they need to run the two following
+commands to get the content of the `pops` directory:
+
+```
+git submodule init
+git submodule update
+```
+
+Alternatively, the `pops` directory can be populated during cloning
+when `git clone` is used with the `--recurse-submodules` parameter.
+
+If you want to update the specific PoPS commit your repository is using
+to the latest one, you the following command:
+
+```
+git submodule update --remote
+```
+
+## Testing the model in this repository
+
+Here we are assuming that you use Linux command line or equivalent,
+i.e., you have `make` (e.g. GNU make) and GNU GCC with `g++`
+(or something compatible with the same command line interface).
+If you don't have it, you may need to modify the `Makefile` or configure
+your system.
+
+First download the source code (as a ZIP file and unpack it or use Git
+to get it from the Git repository).
+
+Then compile the code:
+
+    make
+
+The library itself does not need compilation since it is header only
+(it is compiled later with your project), but this compiles several
+test programs.
+
+Finally, run the tests:
+
+    make test
+
+This will generate some test output, to see if all was right, you will
+need to examine the source code. The tests are not fully automatic
+and currently cover only the bare minimum.
+
+Additionally, if you have Doxygen, to generate documentation run:
+
+    make doc
+
+The HTML documentation will appear in the `html` directory. Open the
+file called `index.html` to access it in a web browser.
+
+## Authors
+
+* Vaclav Petras (raster handling, critical temperature, library, ...)
+* Anna Petrasova (single species simulation)
+* Chris Jones (rename, SEID, ...)
+
+## Previous Contributors
+
+* Francesco Tonini (original R version)
+* Zexi Chen (initial C++ version)
+
+## License
+
+Permission to use, copy, modify, and distribute this software and
+its documentation under the terms of the GNU General Public License
+is hereby granted. No representations are made about the suitability
+of this software for any purpose. It is provided "as is" without express
+or implied warranty. See the
+[GNU General Public License](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+for more details.

Added: grass-addons/grass7/raster/r.pops.spread/pops/TECHNICALDEBT.md
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/TECHNICALDEBT.md	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/TECHNICALDEBT.md	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,108 @@
+# Technical Debt
+
+All issues and imperfections of the code should be documented in this
+file.
+
+The goal is to declare the technical debt as described by
+[Easterbrook 2014](http://doi.org/10.1038/ngeo2283) or Wikipedia
+contributors in
+[Technical debt](https://en.wikipedia.org/wiki/Technical_debt).
+
+The sections are based on sections in CHANGELOG. The version refers to
+when the problem first occurred or was encountered. Entries are divided,
+similarly to CHANGELOG, into what is missing and needs to be added (Add),
+what requires a changes of the current code (Change) and what is an
+issue which needs to be fixed (Fix).
+
+Entries should be removed when resolved. Issue from tracker can be
+optionally linked in an entry.
+
+
+## 2018-09-14 - SEID and multiple host handling
+
+### Add
+
+- Exposed and Diseased classes should be added (need to think about how to handle in disperse).
+- 3-D array for Susceptible, Exposed, Infected, Diseased classes to handle multiple species up to N.
+- Host-compentency score for handling multiple hosts.
+
+## 2018-08-02 - PoPS Model Separation
+
+### Add
+
+- Most of mortality handling is now done outside of the library.
+- A lot of post processing code may need to be repeated unless added to
+  the library.
+- There is no code in the library to help with seasonality.
+
+## 2018-06-20 - Critical Temperature
+
+### Add
+
+- Add (rigorous) tests for the Raster class.
+- Add more tests for the Date class.
+- Documentation of the C++ functions and classes (use Doxygen).
+
+### Change
+
+- Naming and descriptions of parameters related to weather
+  (coefficients versus the actual values)
+- Naming of critical and actual temperature in code
+
+### Fix
+
+- Even after the upgrade to Raster class, there are still some legacy
+  method names and integers instead of doubles (but does not influence
+  computations).
+- Numerous sign-compare warnings.
+- Spelling in the code and comments.
+
+## 2018-06-13 - Spotted Lanternfly
+
+### Add
+
+- Add SLF parameters to documentation.
+- Update README.
+
+## 2018-06-04 - Mortality Addition
+
+### Add
+
+- Add mortality to documentation.
+- Update README.
+
+### Change
+
+- Mortality cohorts may require better name since the individual can be
+  potentially also a cohort or stand.
+
+### Fix
+
+- Mortality-related infection cohort always updated in spore spread and
+  need an additional parameter. However, the update is just a repeating
+  previous line (perhaps some container optionally wrapping two images
+  would be useful).
+
+## 2017-09-05 - September 2017 Update
+
+### Fix
+
+- Dead code for the specific multiple host species.
+
+## 2017-01-28 - January 2017 Status
+
+### Add
+
+- Image class is only for integers but the weather is floating point,
+  so it needs a different treatment in code than other data.
+- The date class needs abstraction for the leap years and days in month.
+- Tests needed for the image class.
+
+### Change
+
+- Formatting of text and parameters for the date class (leading zeros).
+- Create dedicated file for the direction enum and helper functions.
+- Some of the Date class methods have still misleading names (e.g.,
+  increased versus increase).
+- Methods and functions should use underscores not camel case (using
+  Python and GRASS GIS convention).

Added: grass-addons/grass7/raster/r.pops.spread/pops/date.hpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/date.hpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/date.hpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,233 @@
+/*
+ * SOD model - date manipulation
+ *
+ * Copyright (C) 2015-2017 by the authors.
+ *
+ * Authors: Zexi Chen (zchen22 ncsu edu)
+ *          Anna Petrasova
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+
+#ifndef POPS_DATE_HPP
+#define POPS_DATE_HPP
+
+#include <iostream>
+
+namespace pops {
+
+/*! Representation and manipulation of a date for the simulation.
+ *
+ * This class represents and manipulates dates in way which is most
+ * useful for the PoPS simulation, i.e. by weeks and months.
+ */
+class Date
+{
+
+private:
+    int year_;
+    int month_;
+    int day_;
+    int day_in_month[2][13] = {
+        {0,31,28,31,30,31,30,31,31,30,31,30,31},
+        {0,31,29,31,30,31,30,31,31,30,31,30,31}
+    };
+
+public:
+    Date(const Date& d): year_(d.year_), month_(d.month_), day_(d.day_) {}
+    Date(int y, int m, int d): year_(y), month_(m), day_(d) {}
+    inline void increased_by_week();
+    inline void increased_by_month();
+    inline Date get_year_end();
+    inline Date get_next_year_end();
+    inline bool is_last_week_of_year();
+    inline bool is_last_month_of_year();
+    int month() const { return month_; }
+    int year() const { return year_; }
+    int day() const { return day_; }
+    inline int weeks_from_date(Date start);
+    inline friend std::ostream& operator<<(std::ostream& os, const Date &d);
+    inline friend bool operator> (const Date &d1, const Date &d2);
+    inline friend bool operator>= (const Date &d1, const Date &d2);
+    inline friend bool operator< (const Date &d1, const Date &d2);
+    inline friend bool operator<= (const Date &d1, const Date &d2);
+};
+
+std::ostream& operator<<(std::ostream& os, const Date &d)
+{
+    os << d.year_ << '-' << d.month_ << '-' << d.day_;
+    return os;
+}
+
+Date Date::get_year_end()
+{
+    return Date(year_, 12, 31);
+}
+
+bool Date::is_last_week_of_year()
+{
+    if (month_ == 12 && (day_ + 7) > 31)
+        return true;
+    return false;
+}
+
+bool Date::is_last_month_of_year()
+{
+    if (month_ == 12)
+        return true;
+    return false;
+}
+
+Date Date::get_next_year_end()
+{
+    if (month_ == 1)
+        return Date(year_, 12, 31);
+    else
+        return Date(year_ + 1, 12, 31);
+}
+
+bool operator> (const Date &d1, const Date &d2)
+{
+    if(d1.year_ < d2.year_)
+        return false;
+    else if (d1.year_ > d2.year_)
+        return true;
+    else {
+        if (d1.month_ < d2.month_)
+            return false;
+        else if (d1.month_ > d2.month_)
+            return true;
+        else {
+            if (d1.day_ <= d2.day_)
+                return false;
+            else
+                return true;
+        }
+    }
+}
+
+bool operator<= (const Date &d1, const Date &d2)
+{
+    return !(d1 > d2);
+}
+
+bool operator< (const Date &d1, const Date &d2)
+{
+    if(d1.year_ > d2.year_)
+        return false;
+    else if (d1.year_ < d2.year_)
+        return true;
+    else {
+        if (d1.month_ > d2.month_)
+            return false;
+        else if (d1.month_ < d2.month_)
+            return true;
+        else {
+            if (d1.day_ >= d2.day_)
+                return false;
+            else
+                return true;
+        }
+    }
+}
+
+bool operator>= (const Date &d1, const Date &d2)
+{
+    return !(d1 < d2);
+}
+
+void Date::increased_by_week()
+{
+    day_ += 7;
+    if (year_ % 4 == 0 && (year_ % 100 != 0 || year_ % 400 == 0)) {
+        if (day_ > day_in_month[1][month_]) {
+            day_ = day_ - day_in_month[1][month_];
+            month_++;
+            if (month_ > 12) {
+                year_++;
+                month_ = 1;
+            }
+        }
+    }
+    else {
+        if (day_ > day_in_month[0][month_]) {
+            day_ = day_ - day_in_month[0][month_];
+            month_++;
+            if (month_ > 12) {
+                year_++;
+                month_ = 1;
+            }
+        }
+    }
+}
+
+void Date::increased_by_month()
+{
+    month_ += 1;
+    if (month_ > 12) {
+        year_++;
+        month_ = 1;
+    }
+    if (year_ % 4 == 0 && (year_ % 100 != 0 || year_ % 400 == 0)) {
+        if (day_ > day_in_month[1][month_]) {
+            day_ = day_in_month[1][month_];
+        }
+    }
+    else {
+        if (day_ > day_in_month[0][month_]) {
+            day_ = day_in_month[0][month_];
+        }
+    }
+}
+
+/*!
+ * Gets number of weeks between start date and this date.
+ *
+ * The parameter is copied and untouched.
+ *
+ * \param start date to start from
+ * \return Number of weeks
+ */
+int Date::weeks_from_date(Date start)
+{
+
+    int week = 0;
+    while (start <= *this) {
+        week++;
+        start.increased_by_week();
+    }
+    return week - 1;
+}
+
+/*!
+ * Holds begining and end of a season and decides what is in season
+ */
+class Season
+{
+public:
+    Season(int start, int end)
+        : start_month_(start), end_month_(end)
+    {}
+    /*!
+     * \brief Decides if a month is in season or not
+     * \param month A month in year (1-12)
+     * \return true if in season, false otherwise
+     */
+    inline bool month_in_season(int month)
+    {
+        return month >= start_month_ && month <= end_month_;
+    }
+private:
+    int start_month_;
+    int end_month_;
+};
+
+} // namespace pops
+
+#endif // POPS_DATE_HPP

Added: grass-addons/grass7/raster/r.pops.spread/pops/raster.hpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/raster.hpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/raster.hpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,510 @@
+#ifndef POPS_RASTER_HPP
+#define POPS_RASTER_HPP
+
+/*
+ * SOD model - raster manipulation
+ *
+ * Copyright (C) 2015-2018 by the authors.
+ *
+ * Authors: Vaclav Petras <wenzeslaus gmail com>
+ *          Completely rewritten by Vaclav Petras based on
+ *          version by Zexi Chen <zchen22 ncsu edu>.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <iostream>
+#include <ostream>
+#include <string>
+#include <cmath>
+#include <algorithm>
+#include <stdexcept>
+#include <initializer_list>
+#include <stdlib.h>
+
+#ifdef POPS_RASTER_WITH_GRASS_GIS
+
+extern "C" {
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include <grass/raster.h>
+}
+
+#endif // POPS_RASTER_WITH_GRASS_GIS
+
+using std::string;
+using std::cerr;
+using std::endl;
+
+namespace pops {
+
+/*! Iterate over two ranges and apply a binary function which modifies
+ *  the first parameter.
+ */
+template<class InputIt1, class InputIt2, class BinaryOperation>
+BinaryOperation for_each_zip(InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryOperation f) {
+    for (; first1 != last1; ++first1, ++first2) {
+        f(*first1, *first2);
+    }
+    return f;
+}
+
+/*! Representation of a raster image.
+ *
+ * The object support raster algebra operations:
+ *
+ * ```
+ * Raster<int> a = {{1, 2}, {3, 4}};
+ * auto b = 2 * (a + 1);
+ * ```
+ *
+ * The raster algebra operations sometimes overlap with matrix
+ * operations, e.g. for plus operator or multiplication by scalar.
+ * However, in some cases, the behavior is different, e.g.,
+ * multiplication of the rasters results in a new raster with cell
+ * values which are result of multiplying cell values in the relevant
+ * positions of the two raster.
+ *
+ * ```
+ * Raster<int> a = {{1, 2}, {3, 4}};
+ * auto b = 2 * (a + 1);
+ * ```
+ *
+ * The template parameter Number is the numerical type of the raster,
+ * typically int, float, or double.
+ *
+ * The direct support for reading and writing GRASS GIS rasters can be
+ * enabled by `POPS_RASTER_WITH_GRASS_GIS` macro:
+ *
+ * ```
+ * #define POPS_RASTER_WITH_GRASS_GIS
+ * ```
+ */
+template<typename Number>
+class Raster
+{
+private:
+    unsigned width;
+    unsigned height;
+    Number *data;
+public:
+    Raster()
+    {
+        width = 0;
+        height = 0;
+        data = NULL;
+    }
+
+    Raster(const Raster& other)
+    {
+        width = other.width;
+        height = other.height;
+        data = new Number[width * height];
+        std::copy(other.data, other.data + (width * height), data);
+    }
+
+    /*! Initialize size using another raster, but use given value
+     *
+     * The values in the other raster are not used.
+     */
+    Raster(const Raster& other, Number value)
+    {
+        width = other.width;
+        height = other.height;
+        data = new Number[width * height]{value};
+    }
+
+    Raster(Raster&& other)
+    {
+        width = other.width;
+        height = other.height;
+        data = other.data;
+        other.data = nullptr;
+    }
+
+    Raster(int rows, int cols)
+    {
+        this->width = cols;
+        this->height = rows;
+        this->data = new Number[width * height];
+    }
+
+    // TODO: size is unsigned?
+    Raster(int rows, int cols, Number value)
+    {
+        this->width = cols;
+        this->height = rows;
+        this->data = new Number[width * height]{value};
+    }
+
+    // maybe remove from the class, or make it optional together with
+    // a reference
+    Raster(std::initializer_list<std::initializer_list<Number>> l)
+        : Raster(l.size(), l.begin()->size())
+    {
+         unsigned i = 0;
+         unsigned j = 0;
+         for (const auto& subl : l)
+         {
+            for (const auto& value : subl)
+            {
+               data[width * i + j] = value;
+               ++j;
+            }
+            j = 0;
+            ++i;
+         }
+    }
+
+    ~Raster()
+    {
+        if (data) {
+            delete[] data;
+        }
+    }
+
+    unsigned cols() const
+    {
+        return width;
+    }
+
+    unsigned rows() const
+    {
+        return height;
+    }
+
+    void fill(Number value)
+    {
+        std::fill(data, data + (width * height), value);
+    }
+
+    void zero()
+    {
+        std::fill(data, data + (width * height), 0);
+    }
+
+    template<class UnaryOperation>
+    void for_each(UnaryOperation op)
+    {
+        std::for_each(data, data + (width * height), op);
+    }
+
+    const Number& operator()(unsigned row, unsigned col) const
+    {
+        return data[row * width + col];
+    }
+
+    Number& operator()(unsigned row, unsigned col)
+    {
+        return data[row * width + col];
+    }
+
+    Raster& operator=(const Raster& other)
+    {
+        if (this != &other)
+        {
+            if (data)
+                delete[] data;
+            width = other.width;
+            height = other.height;
+            data = new Number[width * height];
+            std::copy(other.data, other.data + (width * height), data);
+        }
+        return *this;
+    }
+
+    Raster& operator=(Raster&& other)
+    {
+        if (this != &other)
+        {
+            if (data)
+                delete[] data;
+            width = other.width;
+            height = other.height;
+            data = other.data;
+            other.data = nullptr;
+        }
+        return *this;
+    }
+
+    Raster operator+(const Raster& image) const
+    {
+        if (this->width != image.cols() || this->height != image.rows()) {
+            cerr << "The height or width of one image do not match with that of the other one!" << endl;
+            return Raster();
+        }
+        else {
+            auto re_width = this->width;
+            auto re_height = this->height;
+            auto out = Raster(re_height, re_width);
+
+            for (unsigned i = 0; i < re_height; i++) {
+                for (unsigned j = 0; j < re_width; j++) {
+                    out.data[i * width + j] = this->data[i * width + j] + image.data[i * width + j];
+                }
+            }
+            return out;
+        }
+    }
+
+    Raster operator-(const Raster& image) const
+    {
+        if (this->width != image.cols() || this->height != image.rows()) {
+            cerr << "The height or width of one image do not match with that of the other one!" << endl;
+            return Raster();
+        }
+        else {
+            auto re_width = this->width;
+            auto re_height = this->height;
+            auto out = Raster(re_height, re_width);
+
+            for (unsigned i = 0; i < re_height; i++) {
+                for (unsigned j = 0; j < re_width; j++) {
+                    out.data[i * width + j] = this->data[i * width + j] - image.data[i * width + j];
+                }
+            }
+            return out;
+        }
+    }
+
+    Raster operator*(const Raster& image) const
+    {
+        if (width != image.cols() || height != image.rows()) {
+            throw std::runtime_error("The height or width of one image do"
+                                     " not match with that of the other one.");
+        }
+        auto out = Raster(height, width);
+
+        std::transform(data, data + (width * height), image.data, out.data,
+                       [](const Number& a, const Number& b) { return a * b; });
+        return out;
+    }
+
+    Raster operator/(const Raster& image) const
+    {
+        if (width != image.cols() || height != image.rows()) {
+            throw std::runtime_error("The height or width of one image do"
+                                     " not match with that of the other one.");
+        }
+        auto out = Raster(height, width);
+
+        std::transform(data, data + (width * height), image.data, out.data,
+                       [](const Number& a, const Number& b) { return a / b; });
+        return out;
+    }
+
+    Raster operator*(double value) const
+    {
+        auto out = Raster(height, width);
+
+        std::transform(data, data + (width * height), out.data,
+                       [&value](const Number& a) { return a * value; });
+        return out;
+    }
+
+    Raster operator/(double value) const
+    {
+        auto out = Raster(height, width);
+
+        std::transform(data, data + (width * height), out.data,
+                       [&value](const Number& a) { return a / value; });
+        return out;
+    }
+
+    Raster& operator+=(Number value)
+    {
+        std::for_each(data, data + (width * height),
+                      [&value](Number& a) { a += value; });
+        return *this;
+    }
+
+    Raster& operator-=(Number value)
+    {
+        std::for_each(data, data + (width * height),
+                      [&value](Number& a) { a -= value; });
+        return *this;
+    }
+
+    Raster& operator*=(double value)
+    {
+        std::for_each(data, data + (width * height),
+                      [&value](Number& a) { a *= value; });
+        return *this;
+    }
+
+    Raster& operator/=(double value)
+    {
+        std::for_each(data, data + (width * height),
+                      [&value](Number& a) { a /= value; });
+        return *this;
+    }
+
+    Raster& operator+=(const Raster& image)
+    {
+        for_each_zip(data, data + (width * height), image.data,
+                     [](Number& a, Number& b) { a += b; });
+        return *this;
+    }
+
+    Raster& operator-=(const Raster& image)
+    {
+        for_each_zip(data, data + (width * height), image.data,
+                     [](Number& a, Number& b) { a -= b; });
+        return *this;
+    }
+
+    Raster& operator*=(const Raster& image)
+    {
+        for_each_zip(data, data + (width * height), image.data,
+                     [](Number& a, Number& b) { a *= b; });
+        return *this;
+    }
+
+    Raster& operator/=(const Raster& image)
+    {
+        for_each_zip(data, data + (width * height), image.data,
+                     [](Number& a, Number& b) { a /= b; });
+        return *this;
+    }
+
+    bool operator==(const Raster& other) const
+    {
+        // TODO: assumes same sizes
+        for (unsigned i = 0; i < width; i++) {
+            for (unsigned j = 0; j < width; j++) {
+                if (this->data[i * width + j] != other.data[i * width + j])
+                    return false;
+            }
+        }
+        return true;
+    }
+
+    bool operator!=(const Raster& other) const
+    {
+        // TODO: assumes same sizes
+        for (unsigned i = 0; i < width; i++) {
+            for (unsigned j = 0; j < width; j++) {
+                if (this->data[i * width + j] != other.data[i * width + j])
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    friend inline Raster operator*(double factor, const Raster& image)
+    {
+        return image * factor;
+    }
+
+    friend inline Raster pow(Raster image, double value) {
+        image.for_each([value](Number& a){a = std::pow(a, value);});
+        return image;
+    }
+    friend inline Raster sqrt(Raster image) {
+        image.for_each([](Number& a){a = std::sqrt(a);});
+        return image;
+    }
+
+    friend inline std::ostream& operator<<(std::ostream& stream, const Raster& image) {
+        stream << "[[";
+        for (unsigned i = 0; i < image.height; i++) {
+            if (i != 0)
+                stream << "],\n [";
+            for (unsigned j = 0; j < image.width; j++) {
+                if (j != 0)
+                    stream << ", ";
+                stream << image.data[i * image.width + j];
+            }
+        }
+        stream << "]]\n";
+        return stream;
+    }
+
+    #ifdef POPS_RASTER_WITH_GRASS_GIS
+
+    /** Read a GRASS GIS raster map to the Raster.
+     */
+    static inline Raster from_grass_raster(const char *name)
+    {
+        int fd = Rast_open_old(name, "");
+
+        Raster img;
+
+        img.width = Rast_window_cols();
+        img.height = Rast_window_rows();
+
+        img.data = new Number[img.height * img.width];
+
+        for (unsigned row = 0; row < img.height; row++) {
+            Rast_get_d_row(fd, img.data + (row * img.width), row);
+        }
+
+        Rast_close(fd);
+        return img;
+    }
+
+    /** Write the Raster to a GRASS GIS raster map.
+     */
+    void inline to_grass_raster(const char *name)
+    {
+        int fd = Rast_open_new(name, DCELL_TYPE);
+        for (unsigned i = 0; i < height; i++)
+            Rast_put_d_row(fd, data + (i * width));
+        Rast_close(fd);
+    }
+
+    #endif // POPS_RASTER_WITH_GRASS_GIS
+};
+
+#ifdef POPS_RASTER_WITH_GRASS_GIS
+
+/** Read a GRASS GIS raster map to the Raster.
+ *
+ * This is a specialization for reading using int.
+ */
+template <>
+inline Raster<int> Raster<int>::from_grass_raster(const char *name)
+{
+    int fd = Rast_open_old(name, "");
+
+    Raster img;
+
+    img.width = Rast_window_cols();
+    img.height = Rast_window_rows();
+
+    Cell_head region;
+    Rast_get_window(&region);
+
+    img.data = new int[img.height * img.width];
+
+    for (unsigned row = 0; row < img.height; row++) {
+        Rast_get_c_row(fd, img.data + (row * img.width), row);
+    }
+
+    Rast_close(fd);
+    return img;
+}
+
+/** Write the Raster to a GRASS GIS raster map.
+ *
+ * This is a specialization for reading using int.
+ */
+template <>
+inline void Raster<int>::to_grass_raster(const char *name)
+{
+    int fd = Rast_open_new(name, CELL_TYPE);
+    for (unsigned i = 0; i < height; i++)
+        Rast_put_c_row(fd, data + (i * width));
+    Rast_close(fd);
+}
+
+#endif // POPS_RASTER_WITH_GRASS_GIS
+
+} // namespace pops
+
+#endif // POPS_RASTER_HPP

Added: grass-addons/grass7/raster/r.pops.spread/pops/simulation.hpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/simulation.hpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/simulation.hpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,294 @@
+/*
+ * SOD model - spore simulation
+ *
+ * Copyright (C) 2015-2017 by the authors.
+ *
+ * Authors: Zexi Chen (zchen22 ncsu edu)
+ *          Vaclav Petras (wenzeslaus gmail com)
+ *          Anna Petrasova (kratochanna gmail com)
+ *          Chris Jones (cjones1688 gmail com)
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef POPS_SIMULATION_HPP
+#define POPS_SIMULATION_HPP
+
+#include "raster.hpp"
+
+#include <cmath>
+#include <tuple>
+#include <random>
+
+// PI is used in the code and M_PI is not guaranteed
+// fix it, but prefer the system definition
+#ifndef M_PI
+    #define M_PI 3.14159265358979323846
+#endif
+#ifndef PI
+    #define PI M_PI
+#endif
+
+using std::cerr;
+using std::endl;
+
+namespace pops {
+
+/*! Von Mises Distribution (Circular data distribution)
+
+    mu is the mean angle, expressed in radians between 0 and 2*pi,
+    and kappa is the concentration parameter, which must be greater
+    than or equal to zero. If kappa is equal to zero, this distribution
+    reduces to a uniform random angle over the range 0 to 2*pi.
+*/
+class von_mises_distribution
+{
+public:
+    von_mises_distribution(double mu, double kappa)
+        : mu(mu), kappa(kappa), distribution(0.0, 1.0)
+    {}
+    template<class Generator>
+    double operator ()(Generator& generator)
+    {
+        double a, b, c, f, r, theta, u1, u2, u3, z;
+
+        if (kappa <= 1.e-06)
+            return 2 * PI * distribution(generator);
+
+        a = 1.0 + sqrt(1.0 + 4.0 * kappa * kappa);
+        b = (a - sqrt(2.0 * a)) / (2.0 * kappa);
+        r = (1.0 + b * b) / (2.0 * b);
+
+        while (true) {
+            u1 = distribution(generator);
+            z = cos(PI * u1);
+            f = (1.0 + r * z) / (r + z);
+            c = kappa * (r - f);
+            u2 = distribution(generator);
+            if (u2 <= c * (2.0 - c) || u2 < c * exp(1.0 - c))
+                break;
+        }
+
+        u3 = distribution(generator);
+        if (u3 > 0.5) {
+            theta = fmod(mu + acos(f), 2 * PI);
+        }
+        else {
+            theta = fmod(mu - acos(f), 2 * PI);
+        }
+        return theta;
+    }
+private:
+    double mu;
+    double kappa;
+    std::uniform_real_distribution<double> distribution;
+};
+
+enum DispersalKernel
+{
+    CAUCHY, CAUCHY_DOUBLE_SCALE
+};
+
+// NONE means that there is no wind
+enum Direction
+{
+    N = 0, NE = 45, E = 90, SE = 135, S = 180, SW = 225, W = 270, NW = 315, NONE
+};
+
+/*! The main class to control the spread simulation.
+ *
+ * The template parameters IntegerRaster and FloatRaster are raster
+ * image or matrix types. Any 2D numerical array should work as long as
+ * it uses function call operator to access the values, i.e. it provides
+ * indexing for reading and writing values using `()`. In other words,
+ * the two following operations should be possible:
+ *
+ * ```
+ * a(i, j) = 1;
+ * a(i, j) == 1;
+ * ```
+ *
+ * The PoPS library offers a Raster template class to fill this role,
+ * but other classes can be used as well.
+ */
+template<typename IntegerRaster, typename FloatRaster>
+class Simulation
+{
+private:
+    int width;
+    int height;
+    // the west-east resolution of the pixel
+    int west_east_resolution;
+    // the north-south resolution of the pixel
+    int north_south_resolution;
+    IntegerRaster dispersers;
+    std::default_random_engine generator;
+public:
+
+    Simulation(unsigned random_seed, const IntegerRaster &size, double ew_res, double ns_res)
+        :
+          width(size.cols()),
+          height(size.rows()),
+          west_east_resolution(ew_res),
+          north_south_resolution(ns_res),
+          dispersers(height, width)
+    {
+        generator.seed(random_seed);
+    }
+
+    Simulation() = delete;
+
+    void remove(IntegerRaster& infected, IntegerRaster& susceptible,
+                const FloatRaster& temperature,
+                double lethal_temperature)
+    {
+        for (int i = 0; i < height; i++) {
+            for (int j = 0; j < width; j++) {
+                if (temperature(i, j) < lethal_temperature) {
+                    susceptible(i, j) += infected(i, j);  // move infested/infected host back to suseptible pool
+                    infected(i, j) = 0;  // remove all infestation/infection in the infected class
+                }
+            }
+        }
+    }
+    
+    void mortality(IntegerRaster& infected, double mortality_rate, 
+                   int current_year, int first_mortality_year,
+                   IntegerRaster& mortality, std::vector<IntegerRaster>& mortality_tracker_vector)
+    {
+        if (current_year >= (first_mortality_year)) {
+            int mortality_current_year = 0;
+            int max_year_index = current_year - first_mortality_year;
+            
+            for (int i = 0; i < height; i++) {
+                for (int j = 0; j < width; j++) {
+                    for (unsigned year_index = 0; year_index <= max_year_index; year_index++) {
+                      int mortality_in_year_index = 0;
+                        if (mortality_tracker_vector[year_index](i, j) > 0) {
+                            mortality_in_year_index = mortality_rate*mortality_tracker_vector[year_index](i,j);
+                            mortality_tracker_vector[year_index](i,j) -= mortality_in_year_index;
+                            mortality(i,j) += mortality_in_year_index;
+                            mortality_current_year += mortality_in_year_index;
+                            if (infected(i,j) > 0) {
+                                infected(i,j) -= mortality_in_year_index;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    void generate(const IntegerRaster& infected,
+                  bool weather, const FloatRaster& weather_coefficient,
+                  double reproductive_rate)
+    {
+        double lambda = reproductive_rate;
+        for (int i = 0; i < height; i++) {
+            for (int j = 0; j < width; j++) {
+                if (infected(i, j) > 0) {
+                    if (weather)
+                        lambda = reproductive_rate * weather_coefficient(i, j); // calculate 
+                    int dispersers_from_cell = 0;
+                    std::poisson_distribution<int> distribution(lambda);
+                    
+                    for (int k = 0; k < infected(i, j); k++) {
+                        dispersers_from_cell += distribution(generator);
+                    }
+                    dispersers(i, j) = dispersers_from_cell;
+                }
+                else {
+                    dispersers(i, j) = 0;
+                }
+            }
+        }
+    }
+
+    void disperse(IntegerRaster& susceptible, IntegerRaster& infected,
+                  IntegerRaster& mortality_tracker,
+                  const IntegerRaster& total_plants,
+                  std::vector<std::tuple<int, int>>& outside_dispersers,
+                  bool weather, const FloatRaster& weather_coefficient,
+                  DispersalKernel dispersal_kernel, double short_distance_scale,
+                  double percent_short_distance_dispersal = 0.0,
+                  double long_distance_scale = 0.0,
+                  Direction wind_direction = NONE, double kappa = 2)
+    {
+        std::cauchy_distribution < double >distribution_cauchy_one(0.0, short_distance_scale);
+        std::cauchy_distribution < double >distribution_cauchy_two(0.0, long_distance_scale);
+    
+        std::bernoulli_distribution distribution_bern(percent_short_distance_dispersal);
+        std::uniform_real_distribution < double >distribution_uniform(0.0, 1.0);
+
+        if (wind_direction == NONE)
+            kappa = 0;
+        von_mises_distribution vonmisesvariate(wind_direction * PI / 180, kappa);
+
+        double distance = 0;
+        double theta = 0;
+
+        for (int i = 0; i < height; i++) {
+            for (int j = 0; j < width; j++) {
+                if (dispersers(i, j) > 0) {
+                    for (int k = 0; k < dispersers(i, j); k++) {
+
+                        // generate the distance from cauchy distribution or cauchy mixture distribution
+                        if (dispersal_kernel == CAUCHY) {
+                            distance = abs(distribution_cauchy_one(generator));
+                        }
+                        else if (dispersal_kernel == CAUCHY_DOUBLE_SCALE) {
+                            // use bernoulli distribution to act as the sampling with prob(gamma,1-gamma)
+                            if (distribution_bern(generator)) {
+                                distance = abs(distribution_cauchy_one(generator));
+                            }
+                            else {
+                                distance = abs(distribution_cauchy_two(generator));
+                            }
+                        }
+                        else {
+                            cerr <<
+                                    "The paramter dispersal_kernel muse be set as either CAUCHY OR CAUCHY_DOUBLE_SCALE"
+                                 << endl;
+                            exit(EXIT_FAILURE);
+                        }
+
+                        theta = vonmisesvariate(generator);
+
+                        int row = i - round(distance * cos(theta) / north_south_resolution);
+                        int col = j + round(distance * sin(theta) / west_east_resolution);
+
+                        if (row < 0 || row >= height || col < 0 || col >= width) {
+                            // export dispersers dispersed outside of modeled area
+                            outside_dispersers.emplace_back(std::make_tuple(row, col));
+                            continue;
+                        }
+                        if (susceptible(row, col) > 0) {
+                            double probability_of_establishment =
+                                    (double)(susceptible(row, col)) /
+                                    total_plants(row, col);
+                            double establishment_tester = distribution_uniform(generator);
+
+                            if (weather)
+                                probability_of_establishment *= weather_coefficient(i, j);
+                            if (establishment_tester < probability_of_establishment) {
+                                infected(row, col) += 1;
+                                mortality_tracker(row, col) += 1;
+                                susceptible(row, col) -= 1;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+};
+
+} // namespace pops
+
+#endif // POPS_SIMULATION_HPP
\ No newline at end of file

Added: grass-addons/grass7/raster/r.pops.spread/pops/test_date.cpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/test_date.cpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/test_date.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,65 @@
+#ifdef POPS_TEST
+
+/*
+ * Test for PoPS Date class.
+ *
+ * Copyright (C) 2018 by the authors.
+ *
+ * Authors: Vaclav Petras <wenzeslaus gmail com>
+
+ * This file is part of PoPS.
+
+ * PoPS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+
+ * PoPS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with PoPS. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "date.hpp"
+
+#include <map>
+#include <iostream>
+#include <memory>
+#include <stdexcept>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+using std::string;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+using pops::Date;
+
+void test_years_by_month()
+{
+    Date start(2018, 1, 1);
+    Date end(2020, 12, 31);
+
+    while (start < end) {
+        cout << start << endl;
+        if (start.is_last_month_of_year()) {
+            cout << "End of year" << endl;
+        }
+        start.increased_by_month();
+    }
+}
+
+int main()
+{
+    // Test of date computations for SOD model
+    test_years_by_month();
+
+    return 0;
+}
+
+#endif  // POPS_TEST

Added: grass-addons/grass7/raster/r.pops.spread/pops/test_mortality.cpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/test_mortality.cpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/test_mortality.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,64 @@
+#ifdef POPS_TEST
+
+/*
+ * Simple compilation test for the PoPS Simulation class.
+ *
+ * Copyright (C) 2018 by the authors.
+ *
+ * Authors: Vaclav Petras <wenzeslaus gmail com>
+ *          Chris Jones <cmjone25 gmail com>
+ *
+ * This file is part of PoPS.
+
+ * PoPS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+
+ * PoPS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with PoPS. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "raster.hpp"
+#include "simulation.hpp"
+
+#include <map>
+#include <iostream>
+#include <memory>
+#include <stdexcept>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+using std::string;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+using namespace pops;
+
+int main(int argc, char *argv[])
+{
+    Raster<int> infected = {{5, 0}, {0, 0}};
+    Raster<int> mortality_tracker = {{{3, 0}, {0, 0}},
+                                     {{0, 0}, {0, 0}}};
+    Raster<int> mortality = {{0, 0}, {0, 0}};
+    int ew_res = 30;
+    int ns_res = 30;
+    double mortality_rate = 0.50;
+    int current_year = 2018;
+    int first_mortality_year = 2018;
+    Simulation<Raster<int>, Raster<double>> simulation(42, infected, ew_res, ns_res);
+    simulation.mortality(infected, mortality_rate, 
+                   current_year, first_mortality_year,
+                   mortality, mortality_tracker_vector)
+    cout << mortality << endl;
+    return 0;
+}
+
+#endif  // POPS_TEST
\ No newline at end of file

Added: grass-addons/grass7/raster/r.pops.spread/pops/test_raster.cpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/test_raster.cpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/test_raster.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,132 @@
+#ifdef POPS_TEST
+
+/*
+ * Simple compilation test for the PoPS Raster class.
+ *
+ * Copyright (C) 2018 by the authors.
+ *
+ * Authors: Vaclav Petras <wenzeslaus gmail com>
+ *
+ * This file is part of PoPS.
+
+ * PoPS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+
+ * PoPS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with PoPS. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "raster.hpp"
+#include "simulation.hpp"
+
+#include <map>
+#include <iostream>
+#include <memory>
+#include <stdexcept>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+using std::string;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+using pops::Raster;
+
+void test_constructor_by_type()
+{
+    Raster<int> a(10, 10);
+    Raster<float> b(10, 10);
+    Raster<double> c(10, 10);
+}
+
+void test_constructor_dimensions()
+{
+    int x = 5;
+    int y = 3;
+    // new based on dimensions, with zeros, one value in the corner
+    Raster<int> a(x, y);
+    a.zero();
+    a(x - 1, y - 1) = 2;
+    std::cout << x << "x" << y << ":" << std::endl << a;
+    // same as above, but with the dimensions swapped
+    Raster<int> b(y, x);
+    b.zero();
+    b(y - 1, x - 1) = 2;
+    std::cout << y << "x" << x << ":" << std::endl << b;
+}
+
+void test_initializer_and_output()
+{
+    Raster<int> a = {{1, 2},
+                     {3, 4},
+                     {5, 6}};
+    std::cout << "3x2:" << std::endl << a;
+
+    Raster<int> b = {{0, 0, 0, 5, 5},
+                     {0, 0, 0, 5, 5},
+                     {0, 0, 0, 10, 0}};
+    std::cout << "3x5:" << std::endl << b;
+}
+
+void test_equal_operator()
+{
+    Raster<int> a = {{1, 2}, {3, 4}, {5, 6}};
+    Raster<int> b = {{1, 2}, {3, 4}, {5, 6}};
+    if (a == b)
+        std::cout << "Operator equal works" << std::endl;
+    else
+        std::cout << "Operator equal does not work" << std::endl;
+}
+
+void test_not_equal_operator()
+{
+    Raster<int> a = {{1, 2}, {3, 4}, {5, 6}};
+    Raster<int> b = {{1, 2}, {3, 5}, {5, 6}};
+    if (a != b)
+        std::cout << "Operator not-equal works" << std::endl;
+    else
+        std::cout << "Operator not-equal does not work" << std::endl;
+}
+
+void test_plus_operator()
+{
+    Raster<int> d = {{1, 2}, {3, 4}, {5, 6}};
+    Raster<int> e = {{8, 9}, {10, 11}, {12, 13}};
+    auto f = d + e;
+    std::cout << f;
+}
+
+void test_sqrt()
+{
+    Raster<int> a = {{16, 25}, {4, 9}};
+    Raster<int> b = {{4, 5}, {2, 3}};
+    auto c = sqrt(a);
+    std::cout << "sqrt function: ";
+    if (b == c)
+        std::cout << "OK" << std::endl;
+    else
+        std::cout << "\n" << a << "!=\n" << b << std::endl;
+}
+
+int main()
+{
+    test_constructor_by_type();
+    test_constructor_dimensions();
+    test_initializer_and_output();
+    test_equal_operator();
+    test_not_equal_operator();
+    test_sqrt();
+
+    return 0;
+}
+
+#endif  // POPS_TEST

Added: grass-addons/grass7/raster/r.pops.spread/pops/test_simulation.cpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/test_simulation.cpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/test_simulation.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,71 @@
+#ifdef POPS_TEST
+
+/*
+ * Simple compilation test for the PoPS Simulation class.
+ *
+ * Copyright (C) 2018 by the authors.
+ *
+ * Authors: Vaclav Petras <wenzeslaus gmail com>
+ *
+ * This file is part of PoPS.
+
+ * PoPS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+
+ * PoPS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with PoPS. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "raster.hpp"
+#include "simulation.hpp"
+
+#include <map>
+#include <iostream>
+#include <memory>
+#include <stdexcept>
+#include <fstream>
+#include <sstream>
+#include <string>
+
+using std::string;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+using namespace pops;
+
+int main()
+{
+    Raster<int> infected = {{5, 0}, {0, 0}};
+    Raster<int> mortality_tracker = {{0, 0}, {0, 0}};
+    Raster<int> susceptible = {{10, 6}, {14, 15}};
+    Raster<int> total_plants = {{15, 6}, {14, 15}};
+    Raster<double> temperature = {{5, 0}, {0, 0}};
+    Raster<double> weather_coefficient = {{0.6, 0.8}, {0.2, 0.8}};
+    std::vector<std::tuple<int, int>> outside_dispersers;
+    DispersalKernel dispersal_kernel = CAUCHY;
+    bool weather = true;
+    double lethal_temperature = -4.5;
+    double reproductive_rate = 4.5;
+    double short_distance_scale = 0.0;
+    int ew_res = 30;
+    int ns_res = 30;
+    Simulation<Raster<int>, Raster<double>> simulation(42, infected, ew_res, ns_res);
+    simulation.remove(infected, susceptible, temperature, lethal_temperature);
+    simulation.generate(infected, weather, weather_coefficient, reproductive_rate);
+    simulation.disperse(susceptible, infected,
+                        mortality_tracker, total_plants,
+                        outside_dispersers, weather, weather_coefficient,
+                        dispersal_kernel, short_distance_scale);
+    cout << outside_dispersers.size() << endl;
+    return 0;
+}
+
+#endif  // POPS_TEST

Added: grass-addons/grass7/raster/r.pops.spread/pops/test_treatments.cpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/test_treatments.cpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/test_treatments.cpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,58 @@
+#ifdef POPS_TEST
+
+/*
+ * Simple compilation test for the PoPS Treatments class.
+ *
+ * Copyright (C) 2018 by the authors.
+ *
+ * Authors: Anna Petrasova <akratoc gmail com>
+ *
+ * This file is part of PoPS.
+
+ * PoPS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+
+ * PoPS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with PoPS. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "raster.hpp"
+#include "treatments.hpp"
+
+
+using namespace pops;
+
+int main()
+{
+    Treatments<Raster<int>, Raster<double>> treatments;
+    treatments.clear_all();
+    Raster<double> tr1 = {{1, 0}, {0, 0}};
+    Raster<double> tr2 = {{0, 1}, {0, 0}};
+    Raster<double> tr3 = {{0, 0}, {1, 0}};
+    Raster<int> susceptible = {{10, 6}, {14, 15}};
+    Raster<int> infected = {{1, 2}, {1, 1}};
+    treatments.add_treatment(2000, tr1);
+    treatments.add_treatment(2001, tr2);
+    treatments.add_treatment(2002, tr3);
+    treatments.apply_treatment_host(2000, infected, susceptible);
+    treatments.apply_treatment_infected(2001, infected);
+
+    Raster<int> treated = {{0, 6}, {14, 15}};
+    Raster<int> inf_treated = {{0, 0}, {1, 1}};
+    if (susceptible == treated && infected == inf_treated)
+        std::cout << "Treatment works" << std::endl;
+    else
+        std::cout << "Treatment does not work" << std::endl;
+
+    treatments.clear_after_year(2001);
+    return 0;
+}
+
+#endif  // POPS_TEST

Added: grass-addons/grass7/raster/r.pops.spread/pops/treatments.hpp
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/pops/treatments.hpp	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/pops/treatments.hpp	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,75 @@
+/*
+ * PoPS model - treatments
+ *
+ * Copyright (C) 2015-2018 by the authors.
+ *
+ * Authors: Anna Petrasova
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef POPS_TREATMENTS_HPP
+#define POPS_TREATMENTS_HPP
+
+#include "raster.hpp"
+
+#include <map>
+
+namespace pops {
+
+template<typename IntegerRaster, typename FloatRaster>
+class Treatments
+{
+private:
+    std::map<int, FloatRaster> treatments;
+public:
+    void add_treatment(int year, const FloatRaster &map)
+    {
+        treatments[year] = map;
+    }
+    void clear_all()
+    {
+        treatments.erase(treatments.begin(), treatments.end());
+    }
+    void clear_after_year(int year)
+    {
+        for (auto it = treatments.begin(); it != treatments.end();) {
+            if (it->first > year) {
+                treatments.erase(it++);
+            }
+            else {
+                ++it;
+            }
+        }
+    }
+    void apply_treatment_host(int year, IntegerRaster &infected, IntegerRaster &susceptible)
+    {
+        // this expression fails in rcpp
+        // host = host - (host * treatments[year]);
+        if (treatments.find(year) != treatments.end()) {
+            for(unsigned i = 0; i < infected.rows(); i++)
+                for(unsigned j = 0; j < infected.cols(); j++) {
+                    infected(i, j) = treatments[year](i, j) ? 0 : infected(i, j);
+                    susceptible(i, j) = susceptible(i, j) - (susceptible(i, j) * treatments[year](i, j));
+                }
+        }
+        // otherwise no treatment for that year
+    }
+    void apply_treatment_infected(int year, IntegerRaster &infected)
+    {
+        if (treatments.find(year) != treatments.end()) {
+            for(unsigned i = 0; i < infected.rows(); i++)
+                for(unsigned j = 0; j < infected.cols(); j++)
+                    infected(i, j) = treatments[year](i, j) ? 0 : infected(i, j);
+        }
+    }
+};
+
+}
+#endif // POPS_TREATMENTS_HPP
+

Added: grass-addons/grass7/raster/r.pops.spread/pops_logo.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.pops.spread/pops_logo.png
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/pops_logo.png	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/pops_logo.png	2019-03-06 19:07:47 UTC (rev 74167)

Property changes on: grass-addons/grass7/raster/r.pops.spread/pops_logo.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Copied: grass-addons/grass7/raster/r.pops.spread/r.pops.spread.html (from rev 74166, grass-addons/grass7/raster/r.spread.sod/r.spread.sod.html)
===================================================================
--- grass-addons/grass7/raster/r.pops.spread/r.pops.spread.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.pops.spread/r.pops.spread.html	2019-03-06 19:07:47 UTC (rev 74167)
@@ -0,0 +1,175 @@
+<h2>DESCRIPTION</h2>
+
+
+Module <em>r.pops.spread</em> 
+is a dynamic species distribution model for pest or pathogen spread in forest
+or agricultural ecosystems. The model is process based
+meaning that it uses understanding of the effect of weather on reproduction
+and survival of the pest/pathogen in order to simulate
+spread of the pest/pathogen into the future.
+
+
+<div align="center" style="margin: 10px">
+<a href="r_pops_spread.png">
+<img src="r_pops_spread.png" width="600"  alt="r.pops.spread example" border="0">
+</a><br>
+</div>
+
+<p>
+Module <em>r.pops.spread</em> is using <a href="https://github.com/ncsu-landscape-dynamics/PoPS">
+    Pest or Pathogen Spread library</a>.
+<div align="center" style="margin: 10px">
+    <a href="pops_logo.png">
+    <img src="pops_logo.png" width="100"  alt="PoPS logo" border="0">
+    </a><br>
+    <i>Figure: Logo of Pest or Pathogen Spread simulation</i>
+</div>
+
+
+<h2>NOTES</h2>
+
+<ul>
+
+<li>
+The directions of wind consider north (N) to be grid north, if your
+true north is different direction, you need to make an adjustment.
+
+<li>
+The module currently does not handle NULL (no data) as input, so you
+need to change the NULLs to (most likely) zeros, for example:
+<code>r.null map=infection null=0</code>.
+
+</ul>
+
+
+<h2>EXAMPLES</h2>
+
+<h3>Obtaining list of rasters</h3>
+Use <a href="https://github.com/ncsu-landscape-dynamics/weather-coefficient">
+    R script</a> to create weather coefficients based on a defined polynomial.
+<p>
+Example of creating file with list of input maps (unix-like command
+line):
+
+<div class="code"><pre>
+g.list type=raster pattern="moisture_*" mapset=climate -m > moistures.txt
+g.list type=raster pattern="temperature_*" mapset=climate -m > temperatures.txt
+</pre></div>
+
+Note that the above assumes that the names will be ordered by time.
+This will happen automatically if they are, e.g. numbered as 001, 002,
+etc. (e.g. <tt>temperature_001</tt> and not <tt>temperature_1</tt>).
+If they are numbered without the zero-padding, i.e. 1, 2, ..., 10,
+11, ..., then in a unix-like command line, you can do pipe the result
+through <em>sort</em> with <tt>-n</tt> (<tt>| sort -n</tt>).
+For example, for map names like <tt>temperature_1</tt>, the following
+unix-like command will do the sorting:
+
+<div class="code"><pre>
+g.list type=raster pattern="temperature_*" mapset=climate | sort -k2 -t_ -n > temperatures.txt
+</pre></div>
+
+Note the underscore which tells sort where to split the name for sorting
+and the number 2 which indicates which part of the name to use for
+sorting after splitting.
+
+If you have the weather-related timeseries in a separate mapset, you
+can add this mapset to the search path of your current mapset so that
+you can have the rasters in the list without specifying the mapset.
+To add to the search path, use for example:
+
+<div class="code"><pre>
+g.mapsets mapset=climate
+</pre></div>
+
+
+<h3>Generating a constant coefficient</h3>
+
+In case the moisture coefficient is not used, we can generate a constant
+raster map to be used as the coefficient:
+
+<div class="code"><pre>
+r.mapcalc "const_1 = 1"
+</pre></div>
+
+Then using unix-like command line, we can create a list of these rasters
+in a file based on the number of lines in a temperature list files we
+created earlier:
+
+<div class="code"><pre>
+NUM_LINES=`cat temperatures.txt | wc -l`
+echo const_1 > moistures.txt
+for LINE in `seq 2 $NUM_LINES`; do echo const_1 >> moistures.txt; done;
+</pre></div>
+
+<h3>Creating treatments</h3>
+To account for (vector) treatments partially covering host cells:
+
+<div class="code"><pre>
+# set resolution for treatments and convert to raster
+g.region res=10 -ap
+v.to.rast input=treatment output=treatment use=val
+
+# resample to lower resolution (match host map resolution)
+g.region align=host_map -p
+r.resamp.stats -w input=treatment output=treatment_resampled method=count
+# get maximum value, which is dependent on resolution
+# e.g. when resampling from 10m to 100m, max will be 100 (100 small cells in 1 big cell)
+r.info -r treatment_resampled
+# result will be 0 to 1
+r.mapcalc "treatment_float = test_treatment_resampled / 100"
+# adjust host layer
+r.mapcalc "treated_host = host - host * treatment_float"
+</pre></div>
+
+<h3>Running the model</h3>
+
+Example of the run of the model (unix-like command line):
+
+<div class="code"><pre>
+r.spread.pest host=host total_plants=all infected=infected_2005 \
+    moisture_coefficient_file=moistures.txt temperature_coefficient_file=temperatures.txt \
+    output=spread step=week start_time=2005 end_time=2010 \
+    reproductive_rate=4 dispersal_kernel=cauchy wind=NE random_seed=4
+</pre></div>
+
+
+<h2>REFERENCES</h2>
+
+<ul>
+<li>
+    Ross K. Meentemeyer, Nik J. Cunniffe, Alex R. Cook,
+    Joao A. N. Filipe, Richard D. Hunter, David M. Rizzo,
+    and Christopher A. Gilligan 2011.
+    Epidemiological modeling of invasion in heterogeneous landscapes:
+    spread of sudden oak death in California (1990-2030).
+    <em>Ecosphere</em> 2:art17.
+    <a href="http://dx.doi.org/10.1890/ES10-00192.1">DOI: 10.1890/ES10-00192.1</a>
+<li>
+    Tonini, Francesco, Douglas Shoemaker, Anna Petrasova, Brendan Harmon,
+    Vaclav Petras, Richard C. Cobb, Helena Mitasova,
+    and Ross K. Meentemeyer.
+    Tangible geospatial modeling for collaborative solutions
+    to invasive species management.
+    <em>Environmental Modelling & Software</em> 92 (2017): 176-188.
+    <a href="https://doi.org/10.1016/j.envsoft.2017.02.020">DOI: 10.1016/j.envsoft.2017.02.020</a>
+</ul>
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+    <a href="https://github.com/ncsu-landscape-dynamics/r.pops.spread">r.pops.spread on GitHub</a><br>
+    <a href="r.spread.html">r.spread</a>
+</em>
+
+
+<h2>AUTHORS</h2>
+
+Francesco Tonini* (original R version)<br>
+Zexi Chen* (C++ version)<br>
+Vaclav Petras* (parallelization, GRASS interface)<br>
+Anna Petrasova* (single species simulation)<br>
+
+<br>
+* <a href="http://geospatial.ncsu.edu/">Center for Geospatial Analytics, NCSU</a>

Deleted: grass-addons/grass7/raster/r.pops.spread/r.spread.sod.html
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/r.spread.sod.html	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/r.spread.sod.html	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,77 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.spread.sod</em> simulates spread of a plant pathogen, specifically
-it simulates spread of Sudden Oak Death disease in California and Oregon
-(USA).
-
-
-<h2>NOTES</h2>
-
-The directions of wind consider north (N) to be grid north, if your
-true north is different direction, you need to make an adjustment.
-
-
-<h2>EXAMPLES</h2>
-
-Example of creating file with list of input maps (unix-like command
-line):
-
-<div class="code"><pre>
-g.list type=raster pattern="moisture_*" mapset=PRISM -m > moistures.txt
-g.list type=raster pattern="temperature_*" mapset=PRISM -m > temperatures.txt
-</pre></div>
-
-Note that the above assumes that the names will be ordered by time.
-You may need to pipe the result through <em>sort</em> with <tt>-n</tt>
-(<tt>| sort -n</tt>) to achieve this if filenames contain ordinal
-numbers but are not zero-padded (<tt>temperature_001</tt> versus
-<tt>temperature_1</tt>).
-
-Example of the run of the model (unix-like command line):
-
-<div class="code"><pre>
-r.spread.sod species=lide lvtree=all infected=infected_2005 \
-    moisture_file=moistures.txt temperature_file=temperatures.txt \
-    output=spread_sod start_time=2005 end_time=2010 \
-    rtype=cauchy wind=NE rseed=4
-</pre></div>
-
-
-<h2>REFERENCES</h2>
-
-<ul>
-<li>
-    Ross K. Meentemeyer, Nik J. Cunniffe, Alex R. Cook,
-    Joao A. N. Filipe, Richard D. Hunter, David M. Rizzo,
-    and Christopher A. Gilligan 2011.
-    Epidemiological modeling of invasion in heterogeneous landscapes:
-    spread of sudden oak death in California (1990-2030).
-    <em>Ecosphere</em> 2:art17.
-    <a href="http://dx.doi.org/10.1890/ES10-00192.1">DOI: 10.1890/ES10-00192.1</a>
-<li>
-    Tonini, Francesco, Douglas Shoemaker, Anna Petrasova, Brendan Harmon,
-    Vaclav Petras, Richard C. Cobb, Helena Mitasova,
-    and Ross K. Meentemeyer.
-    Tangible geospatial modeling for collaborative solutions
-    to invasive species management.
-    <em>Environmental Modelling & Software</em> 92 (2017): 176-188.
-    <a href="https://doi.org/10.1016/j.envsoft.2017.02.020">DOI: 10.1016/j.envsoft.2017.02.020</a>
-</ul>
-
-
-<h2>SEE ALSO</h2>
-
-<em>
-    <a href="r.spread.html">r.spread</a>
-</em>
-
-
-<h2>AUTHORS</h2>
-
-Francesco Tonini* (original R version)<br>
-Zexi Chen* (C++ version)<br>
-Vaclav Petras* (parallelization, GRASS interface)<br>
-Anna Petrasova* (single species simulation)<br>
-
-<br>
-* <a href="http://geospatial.ncsu.edu/">Center for Geospatial Analytics, NCSU</a>

Added: grass-addons/grass7/raster/r.pops.spread/r_pops_spread.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.pops.spread/r_pops_spread.png
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/r_pops_spread.png	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/r_pops_spread.png	2019-03-06 19:07:47 UTC (rev 74167)

Property changes on: grass-addons/grass7/raster/r.pops.spread/r_pops_spread.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Deleted: grass-addons/grass7/raster/r.pops.spread/raster.h
===================================================================
--- grass-addons/grass7/raster/r.spread.sod/raster.h	2019-03-06 16:59:15 UTC (rev 74166)
+++ grass-addons/grass7/raster/r.pops.spread/raster.h	2019-03-06 19:07:47 UTC (rev 74167)
@@ -1,438 +0,0 @@
-#ifndef RASTER_H
-#define RASTER_H
-
-/*
- * SOD model - raster manipulation
- *
- * Copyright (C) 2015-2018 by the authors.
- *
- * Authors: Vaclav Petras <wenzeslaus gmail com>
- *          Completely rewritten by Vaclav Petras based on
- *          version by Zexi Chen <zchen22 ncsu edu>.
- *
- * The code contained herein is licensed under the GNU General Public
- * License. You may obtain a copy of the GNU General Public License
- * Version 2 or later at the following locations:
- *
- * http://www.opensource.org/licenses/gpl-license.html
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-#include <iostream>
-#include <string>
-#include <cmath>
-#include <algorithm>
-#include <stdlib.h>
-
-extern "C" {
-#include <grass/gis.h>
-#include <grass/glocale.h>
-#include <grass/raster.h>
-}
-
-#include <algorithm>
-#include <stdexcept>
-
-using std::string;
-using std::cerr;
-using std::endl;
-
-/* Iterate over two ranges and apply a binary function which modifies
- * the first parameter.
- */
-template<class InputIt1, class InputIt2, class BinaryOperation>
-BinaryOperation for_each_zip(InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryOperation f) {
-    for (; first1 != last1; ++first1, ++first2) {
-        f(*first1, *first2);
-    }
-    return f;
-}
-
-template<typename Number>
-class Raster
-{
-private:
-    unsigned width;
-    unsigned height;
-    // the west-east resolution of the pixel
-    double w_e_res;
-    // the north-south resolution of the pixel
-    double n_s_res;
-    Number *data;
-public:
-    Raster()
-    {
-        width = 0;
-        height = 0;
-        w_e_res = 0;
-        n_s_res = 0;
-        data = NULL;
-    }
-
-    Raster(const Raster& other)
-    {
-        width = other.width;
-        height = other.height;
-        w_e_res = other.w_e_res;
-        n_s_res = other.n_s_res;
-        data = new Number[width * height];
-        std::copy(other.data, other.data + (width * height), data);
-    }
-
-    Raster(const Raster& other, Number value)
-    {
-        width = other.width;
-        height = other.height;
-        w_e_res = other.w_e_res;
-        n_s_res = other.n_s_res;
-        data = new Number[width * height]{value};
-    }
-
-    Raster(Raster&& other)
-    {
-        width = other.width;
-        height = other.height;
-        w_e_res = other.w_e_res;
-        n_s_res = other.n_s_res;
-        data = other.data;
-        other.data = nullptr;
-    }
-
-    Raster(int width, int height, int w_e_res, int n_s_res)
-    {
-        this->width = width;
-        this->height = height;
-        this->w_e_res = w_e_res;
-        this->n_s_res = n_s_res;
-        this->data = new Number[width * height];
-    }
-
-    // TODO: res are doubles
-    // TODO: size is unsigned?
-    Raster(int width, int height, int w_e_res, int n_s_res, int value)
-    {
-        this->width = width;
-        this->height = height;
-        this->w_e_res = w_e_res;
-        this->n_s_res = n_s_res;
-        this->data = new Number[width * height]{value};
-    }
-
-    int getWidth() const
-    {
-        return width;
-    }
-
-    int getHeight() const
-    {
-        return height;
-    }
-
-    int getWEResolution() const
-    {
-        return w_e_res;
-    }
-
-    int getNSResolution() const
-    {
-        return n_s_res;
-    }
-
-    void fill(Number value)
-    {
-        std::fill(data, data + (width * height), value);
-    }
-
-    void zero()
-    {
-        std::fill(data, data + (width * height), 0);
-    }
-
-    template<class UnaryOperation>
-    void for_each(UnaryOperation op)
-    {
-        std::for_each(data, data + (width * height), op);
-    }
-
-    const Number& operator()(unsigned row, unsigned col) const
-    {
-        return data[row * width + col];
-    }
-
-    Number& operator()(unsigned row, unsigned col)
-    {
-        return data[row * width + col];
-    }
-
-    Raster& operator=(const Raster& other)
-    {
-        if (this != &other)
-        {
-            if (data)
-                delete[] data;
-            width = other.width;
-            height = other.height;
-            w_e_res = other.w_e_res;
-            n_s_res = other.n_s_res;
-            data = new Number[width * height];
-            std::copy(other.data, other.data + (width * height), data);
-        }
-        return *this;
-    }
-
-    Raster& operator=(Raster&& other)
-    {
-        if (this != &other)
-        {
-            if (data)
-                delete[] data;
-            width = other.width;
-            height = other.height;
-            w_e_res = other.w_e_res;
-            n_s_res = other.n_s_res;
-            data = other.data;
-            other.data = nullptr;
-        }
-        return *this;
-    }
-
-    Raster operator+(const Raster& image) const
-    {
-        if (this->width != image.getWidth() || this->height != image.getHeight()) {
-            cerr << "The height or width of one image do not match with that of the other one!" << endl;
-            return Raster();
-        }
-        else {
-            auto re_width = this->width;
-            auto re_height = this->height;
-            auto out = Raster(re_width, re_height, this->w_e_res, this->n_s_res);
-
-            for (int i = 0; i < re_height; i++) {
-                for (int j = 0; j < re_width; j++) {
-                    out.data[i * width + j] = this->data[i * width + j] + image.data[i * width + j];
-                }
-            }
-            return out;
-        }
-    }
-
-    Raster operator-(const Raster& image) const
-    {
-        if (this->width != image.getWidth() || this->height != image.getHeight()) {
-            cerr << "The height or width of one image do not match with that of the other one!" << endl;
-            return Raster();
-        }
-        else {
-            auto re_width = this->width;
-            auto re_height = this->height;
-            auto out = Raster(re_width, re_height, this->w_e_res, this->n_s_res);
-
-            for (int i = 0; i < re_height; i++) {
-                for (int j = 0; j < re_width; j++) {
-                    out.data[i * width + j] = this->data[i * width + j] - image.data[i * width + j];
-                }
-            }
-            return out;
-        }
-    }
-
-    Raster operator*(const Raster& image) const
-    {
-        if (width != image.getWidth() || height != image.getHeight()) {
-            throw std::runtime_error("The height or width of one image do"
-                                     " not match with that of the other one.");
-        }
-        auto out = Raster(width, height, w_e_res, n_s_res);
-
-        std::transform(data, data + (width * height), image.data, out.data,
-                       [](const Number& a, const Number& b) { return a * b; });
-        return out;
-    }
-
-    Raster operator/(const Raster& image) const
-    {
-        if (width != image.getWidth() || height != image.getHeight()) {
-            throw std::runtime_error("The height or width of one image do"
-                                     " not match with that of the other one.");
-        }
-        auto out = Raster(width, height, w_e_res, n_s_res);
-
-        std::transform(data, data + (width * height), image.data, out.data,
-                       [](const Number& a, const Number& b) { return a / b; });
-        return out;
-    }
-
-    Raster operator*(double value) const
-    {
-        auto out = Raster(width, height, w_e_res, n_s_res);
-
-        std::transform(data, data + (width * height), out.data,
-                       [&value](const Number& a) { return a * value; });
-        return out;
-    }
-
-    Raster operator/(double value) const
-    {
-        auto out = Raster(width, height, w_e_res, n_s_res);
-
-        std::transform(data, data + (width * height), out.data,
-                       [&value](const Number& a) { return a / value; });
-        return out;
-    }
-
-    Raster& operator+=(Number value)
-    {
-        std::for_each(data, data + (width * height),
-                      [&value](Number& a) { a += value; });
-        return *this;
-    }
-
-    Raster& operator-=(Number value)
-    {
-        std::for_each(data, data + (width * height),
-                      [&value](Number& a) { a -= value; });
-        return *this;
-    }
-
-    Raster& operator*=(double value)
-    {
-        std::for_each(data, data + (width * height),
-                      [&value](Number& a) { a *= value; });
-        return *this;
-    }
-
-    Raster& operator/=(double value)
-    {
-        std::for_each(data, data + (width * height),
-                      [&value](Number& a) { a /= value; });
-        return *this;
-    }
-
-    Raster& operator+=(const Raster& image)
-    {
-        for_each_zip(data, data + (width * height), image.data,
-                     [](Number& a, Number& b) { a += b; });
-        return *this;
-    }
-
-    Raster& operator-=(const Raster& image)
-    {
-        for_each_zip(data, data + (width * height), image.data,
-                     [](Number& a, Number& b) { a -= b; });
-        return *this;
-    }
-
-    Raster& operator*=(const Raster& image)
-    {
-        for_each_zip(data, data + (width * height), image.data,
-                     [](Number& a, Number& b) { a *= b; });
-        return *this;
-    }
-
-    Raster& operator/=(const Raster& image)
-    {
-        for_each_zip(data, data + (width * height), image.data,
-                     [](Number& a, Number& b) { a /= b; });
-        return *this;
-    }
-
-    friend inline Raster operator*(double factor, const Raster& image)
-    {
-        return image * factor;
-    }
-
-    friend inline Raster pow(Raster image, double value) {
-        image.for_each([value](Number& a){a = std::pow(a, value);});
-        return image;
-    }
-    friend inline Raster sqrt(Raster image) {
-        image.for_each([](Number& a){a = std::sqrt(a);});
-        return image;
-    }
-
-
-    ~Raster()
-    {
-        if (data) {
-            delete[] data;
-        }
-    }
-
-    static inline Raster fromGrassRaster(const char *name)
-    {
-        int fd = Rast_open_old(name, "");
-
-        Raster img;
-
-        img.width = Rast_window_cols();
-        img.height = Rast_window_rows();
-
-        Cell_head region;
-        Rast_get_window(&region);
-        img.w_e_res = region.ew_res;
-        img.n_s_res = region.ns_res;
-
-        img.data = new Number[img.height * img.width];
-
-        for (int row = 0; row < img.height; row++) {
-            Rast_get_d_row(fd, img.data + (row * img.width), row);
-        }
-
-        Rast_close(fd);
-        return img;
-    }
-
-    void inline toGrassRaster(const char *name)
-    {
-        int fd = Rast_open_new(name, DCELL_TYPE);
-        for (int i = 0; i < height; i++)
-            Rast_put_d_row(fd, data + (i * width));
-        Rast_close(fd);
-    }
-
-};
-
-template <>
-inline Raster<int> Raster<int>::fromGrassRaster(const char *name)
-{
-    int fd = Rast_open_old(name, "");
-
-    Raster img;
-
-    img.width = Rast_window_cols();
-    img.height = Rast_window_rows();
-
-    Cell_head region;
-    Rast_get_window(&region);
-    img.w_e_res = region.ew_res;
-    img.n_s_res = region.ns_res;
-
-    img.data = new int[img.height * img.width];
-
-    for (int row = 0; row < img.height; row++) {
-        Rast_get_c_row(fd, img.data + (row * img.width), row);
-    }
-
-    Rast_close(fd);
-    return img;
-}
-
-template <>
-inline void Raster<int>::toGrassRaster(const char *name)
-{
-    int fd = Rast_open_new(name, CELL_TYPE);
-    for (int i = 0; i < height; i++)
-        Rast_put_c_row(fd, data + (i * width));
-    Rast_close(fd);
-    /* write metadata */
-    struct History history;
-    Rast_short_history(name, "raster", &history);
-    Rast_command_history(&history);
-    Rast_write_history(name, &history);
-}
-
-// convenient definitions, names for backwards compatibility
-typedef Raster<int> Img;
-typedef Raster<double> DImg;
-
-#endif



More information about the grass-commit mailing list