From 75205cb772fd887ebcc148f49370300d34bed771 Mon Sep 17 00:00:00 2001 From: Alexandre Barreto Date: Thu, 5 Jan 2023 13:44:24 -0500 Subject: [PATCH] r.terrafow: explicit use of default constructors (#2660) Fixes -Wclass-memaccess and -Wdeprecated-declaration warnings. Use 'default' for implicitly-declared constructors and use default (implicit) destructor. Simplify; modernise constructs. --- Makefile | 4 + REQUIREMENTS.html | 2 +- configure.ac | 4 + grasslib.dox | 8 ++ gui/wxpython/gui_core/goutput.py | 81 ++++++++++++ gui/wxpython/gui_core/prompt.py | 22 ++++ imagery/i.maxlik/main.c | 5 + imagery/i.maxlik/testsuite/test_i_maxlik.py | 4 + include/VERSION | 4 + include/grass/gis.h | 4 + lib/gis/env.c | 4 + lib/gis/gislib_cmdline_parsing.dox | 4 + lib/gis/parser_html.c | 4 + lib/init/grass.py | 4 + lib/init/grass.sh | 4 + man/build_graphical_index.py | 4 + man/build_html.py | 4 + man/build_rest.py | 8 ++ man/sphinx/conf.py | 8 ++ python/grass/docs/conf.py | 8 ++ python/grass/script/core.py | 4 + python/grass/script/setup.py | 4 + raster/r.resamp.filter/Makefile | 6 + raster/r.resamp.filter/main.c | 137 ++++++++++++++++---- raster/r.resamp.filter/r.resamp.filter.html | 6 + raster/r.terraflow/ccforest.h | 9 ++ raster/r.terraflow/genericWindow.h | 3 + raster/r.terraflow/sweep.h | 55 ++++++-- utils/mkhtml.py | 4 + 29 files changed, 378 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 6d6f3a293a1..c359bcebaec 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ # See INSTALL.md file for usage. <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # COPYRIGHT: (C) 2002-2024 by the GRASS Development Team ======= # COPYRIGHT: (C) 2002-2022 by the GRASS Development Team @@ -18,6 +19,9 @@ ======= # COPYRIGHT: (C) 2002-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# COPYRIGHT: (C) 2002-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # # This program is free software under the GNU General Public # License (>=v2). Read the file COPYING that comes with GRASS diff --git a/REQUIREMENTS.html b/REQUIREMENTS.html index e22ac0837d1..f6b828e6b5b 100644 --- a/REQUIREMENTS.html +++ b/REQUIREMENTS.html @@ -234,7 +234,7 @@

Note:


-© GRASS Development Team 1997-2022 +© GRASS Development Team 1997-2023

Please report bugs here:
https://grass.osgeo.org/contribute/ diff --git a/configure.ac b/configure.ac index 509bd9ecb8e..3368bed106d 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,7 @@ # configuration variables for compilation and installation. <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # COPYRIGHT: (C) 2000-2024 by the GRASS Development Team ======= # COPYRIGHT: (C) 2000-2022 by the GRASS Development Team @@ -18,6 +19,9 @@ ======= # COPYRIGHT: (C) 2000-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # # This program is free software under the GNU General # Public License (>=v2). Read the file COPYING that diff --git a/grasslib.dox b/grasslib.dox index b4d0f517b3a..f46c19bfd36 100644 --- a/grasslib.dox +++ b/grasslib.dox @@ -4,6 +4,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD * updated 8/2005, 2006-2024 ======= @@ -18,6 +19,9 @@ ======= * updated 8/2005, 2006-2008, 2010-2011, 2017-2022 >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + * updated 8/2005, 2006-2008, 2010-2011, 2017-2023 +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) --> GRASS GIS (Geographic @@ -39,6 +43,7 @@ Team, an international team of programmers, GRASS module authors are cited within their module's source code and the contributed manual pages. +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD © 2000-2024 by the GRASS Development Team @@ -48,6 +53,9 @@ pages. ======= © 2000-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +© 2000-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) This manual is published under GNU Free Documentation diff --git a/gui/wxpython/gui_core/goutput.py b/gui/wxpython/gui_core/goutput.py index 6676eb69935..bf6c6060203 100644 --- a/gui/wxpython/gui_core/goutput.py +++ b/gui/wxpython/gui_core/goutput.py @@ -44,7 +44,11 @@ ) from core.globalvar import CheckWxVersion, wxPythonPhoenix from gui_core.prompt import GPromptSTC +<<<<<<< HEAD from gui_core.wrap import Button, ClearButton, StaticText +======= +from gui_core.wrap import Button, ClearButton, StaticText, StaticBox +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) from core.settings import UserSettings @@ -144,10 +148,28 @@ def __init__( self.btnOutputSave.SetToolTip(_("Save output to a file")) self.btnCmdAbort = Button(parent=self.panelProgress, id=wx.ID_STOP) self.btnCmdAbort.SetToolTip(_("Abort running command")) +<<<<<<< HEAD self.btnClear.Bind(wx.EVT_BUTTON, self.OnClear) self.btnOutputSave.Bind(wx.EVT_BUTTON, self.OnOutputSave) self.btnCmdAbort.Bind(wx.EVT_BUTTON, self._gconsole.OnCmdAbort) +======= + self.btnCmdExportHistory = Button(parent=self.panelOutput, id=wx.ID_ANY) + self.btnCmdExportHistory.SetLabel(_("&Export history")) + self.btnCmdExportHistory.SetToolTip( + _("Export history of executed commands to a file") + ) + + if not self._gcstyle & GC_PROMPT: + self.btnCmdClear.Hide() + self.btnCmdExportHistory.Hide() + + self.btnCmdClear.Bind(wx.EVT_BUTTON, self.cmdPrompt.OnCmdErase) + self.btnOutputClear.Bind(wx.EVT_BUTTON, self.OnOutputClear) + self.btnOutputSave.Bind(wx.EVT_BUTTON, self.OnOutputSave) + self.btnCmdAbort.Bind(wx.EVT_BUTTON, self._gconsole.OnCmdAbort) + self.btnCmdExportHistory.Bind(wx.EVT_BUTTON, self.OnCmdExportHistory) +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) self._layout() @@ -189,6 +211,39 @@ def _layout(self): self.cmdOutput, proportion=1, flag=wx.EXPAND | wx.ALL, border=3 ) +<<<<<<< HEAD +======= + outBtnSizer.Add( + self.btnOutputClear, + proportion=proportion, + flag=wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.BOTTOM, + border=5, + ) + + outBtnSizer.Add( + self.btnOutputSave, + proportion=proportion, + flag=wx.RIGHT | wx.BOTTOM, + border=5, + ) + + cmdBtnSizer.Add( + self.btnCmdExportHistory, + proportion=1, + flag=wx.ALIGN_CENTER + | wx.ALIGN_CENTER_VERTICAL + | wx.LEFT + | wx.RIGHT + | wx.BOTTOM, + border=5, + ) + cmdBtnSizer.Add( + self.btnCmdClear, + proportion=1, + flag=wx.ALIGN_CENTER | wx.RIGHT | wx.BOTTOM, + border=5, + ) +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) progressSizer.Add( self.btnCmdAbort, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=5 ) @@ -403,6 +458,32 @@ def OnCmdProgress(self, event): self.progressbar.SetValue(event.value) event.Skip() +<<<<<<< HEAD +======= + def OnCmdExportHistory(self, event): + """Export the history of executed commands stored + in a .wxgui_history file to a selected file.""" + dlg = wx.FileDialog( + self, + message=_("Save file as..."), + defaultFile="grass_cmd_log.txt", + wildcard=_("{txt} (*.txt)|*.txt|{files} (*)|*").format( + txt=_("Text files"), files=_("Files") + ), + style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT, + ) + + if dlg.ShowModal() == wx.ID_OK: + path = dlg.GetPath() + if self.cmdPrompt.CopyHistory(path): + self.showNotification.emit( + message=_("Command history saved to '{}'".format(path)) + ) + + dlg.Destroy() + event.Skip() + +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) def OnCmdRun(self, event): """Run command""" self.outputSizer.Show(self.panelProgress) diff --git a/gui/wxpython/gui_core/prompt.py b/gui/wxpython/gui_core/prompt.py index 37909ed3e6c..85d74f265eb 100644 --- a/gui/wxpython/gui_core/prompt.py +++ b/gui/wxpython/gui_core/prompt.py @@ -20,6 +20,7 @@ import difflib import sys +import shutil import wx import wx.stc @@ -141,6 +142,27 @@ def _runCmd(self, cmdString): self.CmdErase() self.ShowStatusText("") + def CopyHistory(self, targetFile): + """Copy history file to the target location. + Returns True if file is successfully copied.""" + env = grass.gisenv() + historyFile = os.path.join( + env["GISDBASE"], + env["LOCATION_NAME"], + env["MAPSET"], + ".wxgui_history", + ) + try: + shutil.copyfile(historyFile, targetFile) + except (IOError, OSError) as e: + GError( + _("Unable to copy file {} to {}'.\n\nDetails: {}").format( + historyFile, targetFile, e + ) + ) + return False + return True + def GetCommands(self): """Get list of launched commands""" return self.commands diff --git a/imagery/i.maxlik/main.c b/imagery/i.maxlik/main.c index 768beec00e8..b01ff5973c4 100644 --- a/imagery/i.maxlik/main.c +++ b/imagery/i.maxlik/main.c @@ -139,6 +139,7 @@ int main(int argc, char *argv[]) /* Predicted classes start at 1 but signature array is 0 based */ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD if (Rast_is_c_null_value(&class_cell[col]) == 0) class_cell[col] = S.sig[class_cell[col] - 1].oclass; @@ -148,6 +149,10 @@ int main(int argc, char *argv[]) ======= class_cell[col] = S.sig[class_cell[col] - 1].oclass; >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + if (Rast_is_c_null_value(&class_cell[col]) == 0) + class_cell[col] = S.sig[class_cell[col] - 1].oclass; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) } } Rast_put_row(class_fd, class_cell, CELL_TYPE); diff --git a/imagery/i.maxlik/testsuite/test_i_maxlik.py b/imagery/i.maxlik/testsuite/test_i_maxlik.py index 4628e749bd7..62251c1263a 100644 --- a/imagery/i.maxlik/testsuite/test_i_maxlik.py +++ b/imagery/i.maxlik/testsuite/test_i_maxlik.py @@ -68,6 +68,7 @@ def setUpClass(cls): cls.runModule( "r.mapcalc", <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD expression=f"{cls.b2}=if(row() == 3 && col() == 3, null(), 5.0+rand(-1.0,1.0))", ======= @@ -76,6 +77,9 @@ def setUpClass(cls): ======= expression=f"{cls.b2}=5.0+rand(-1.0,1.0)", >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + expression=f"{cls.b2}=if(row() == 3 && col() == 3, null(), 5.0+rand(-1.0,1.0))", +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) flags="s", quiet=True, ) diff --git a/include/VERSION b/include/VERSION index 288064f9376..dee29f0e9b0 100644 --- a/include/VERSION +++ b/include/VERSION @@ -26,6 +26,7 @@ dev ======= 3 dev +<<<<<<< HEAD 2022 >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= @@ -33,3 +34,6 @@ dev dev 2022 >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +2023 +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) diff --git a/include/grass/gis.h b/include/grass/gis.h index 073d09d0055..4da7877d792 100644 --- a/include/grass/gis.h +++ b/include/grass/gis.h @@ -9,6 +9,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD * COPYRIGHT: (C) 2000-2024 by the GRASS Development Team ======= @@ -23,6 +24,9 @@ ======= * COPYRIGHT: (C) 2000-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + * COPYRIGHT: (C) 2000-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) * * This program is free software under the GNU General Public * License (>=v2). Read the file COPYING that comes with GRASS diff --git a/lib/gis/env.c b/lib/gis/env.c index 6c2b3cee9ee..2bc1a6d9029 100644 --- a/lib/gis/env.c +++ b/lib/gis/env.c @@ -3,6 +3,7 @@ \brief GIS library - environment routines +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD (C) 2001-2024 by the GRASS Development Team @@ -12,6 +13,9 @@ ======= (C) 2001-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + (C) 2001-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. diff --git a/lib/gis/gislib_cmdline_parsing.dox b/lib/gis/gislib_cmdline_parsing.dox index 59945df52be..58e2d214ec1 100644 --- a/lib/gis/gislib_cmdline_parsing.dox +++ b/lib/gis/gislib_cmdline_parsing.dox @@ -4,6 +4,7 @@ diff --git a/lib/gis/parser_html.c b/lib/gis/parser_html.c index e2f7687cdf2..eb3266e185a 100644 --- a/lib/gis/parser_html.c +++ b/lib/gis/parser_html.c @@ -3,6 +3,7 @@ \brief GIS Library - Argument parsing functions (HTML output) +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD (C) 2001-2024 by the GRASS Development Team @@ -12,6 +13,9 @@ ======= (C) 2001-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + (C) 2001-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. diff --git a/lib/init/grass.py b/lib/init/grass.py index 88e5fcbf5a2..f379f820537 100755 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -20,6 +20,7 @@ # user interface and cleans up after it is finished. <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # COPYRIGHT: (C) 2000-2024 by the GRASS Development Team ======= # COPYRIGHT: (C) 2000-2022 by the GRASS Development Team @@ -27,6 +28,9 @@ ======= # COPYRIGHT: (C) 2000-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # # This program is free software under the GNU General # Public License (>=v2). Read the file COPYING that diff --git a/lib/init/grass.sh b/lib/init/grass.sh index de91eb05e3f..1480be5d372 100755 --- a/lib/init/grass.sh +++ b/lib/init/grass.sh @@ -15,6 +15,7 @@ # interface and cleans up after it is finished. <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # COPYRIGHT: (C) 2000-2024 by the GRASS Development Team ======= # COPYRIGHT: (C) 2000-2022 by the GRASS Development Team @@ -22,6 +23,9 @@ ======= # COPYRIGHT: (C) 2000-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # # This program is free software under the GNU General # Public License (>=v2). Read the file COPYING that diff --git a/man/build_graphical_index.py b/man/build_graphical_index.py index 4827025d8cf..2bef3cf0d1a 100755 --- a/man/build_graphical_index.py +++ b/man/build_graphical_index.py @@ -7,6 +7,7 @@ # PURPOSE: Build graphical index <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # COPYRIGHT: (C) 2015-2024 by Vaclav Petras and the GRASS Development Team ======= # COPYRIGHT: (C) 2015-2022 by Vaclav Petras and the GRASS Development Team @@ -14,6 +15,9 @@ ======= # COPYRIGHT: (C) 2015-2022 by Vaclav Petras and the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# COPYRIGHT: (C) 2015-2023 by Vaclav Petras and the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # # This program is free software under the GNU General Public # License (>=v2). Read the file COPYING that comes with GRASS diff --git a/man/build_html.py b/man/build_html.py index 90c9e5c3dee..a0b692d99de 100644 --- a/man/build_html.py +++ b/man/build_html.py @@ -3,6 +3,7 @@ # utilities for generating HTML indices <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # (C) 2003-2024 Markus Neteler and the GRASS Development Team ======= # (C) 2003-2022 Markus Neteler and the GRASS Development Team @@ -10,6 +11,9 @@ ======= # (C) 2003-2022 Markus Neteler and the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# (C) 2003-2023 Markus Neteler and the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # Authors: # Markus Neteler # Glynn Clements diff --git a/man/build_rest.py b/man/build_rest.py index 5975d5b91ba..97298896fb0 100644 --- a/man/build_rest.py +++ b/man/build_rest.py @@ -11,6 +11,7 @@ # utilities for generating HTML indices <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # (C) 2003-2024 by Luca Delucchi and the GRASS Development Team ======= # (C) 2003-2022 by Luca Delucchi and the GRASS Development Team @@ -18,6 +19,9 @@ ======= # (C) 2003-2022 by Luca Delucchi and the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# (C) 2003-2023 by Luca Delucchi and the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) import os import string @@ -178,6 +182,7 @@ :doc:`Manual main page ` \| :doc:`Full Index ` <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD 2003-2024 `GRASS Development Team `_, GRASS GIS ${grass_version} Reference Manual """ # noqa: E501 @@ -185,6 +190,9 @@ ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) 2003-2022 `GRASS Development Team `_, GRASS GIS ${grass_version} Reference Manual +======= + 2003-2023 `GRASS Development Team `_, GRASS GIS ${grass_version} Reference Manual +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) """ >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ) diff --git a/man/sphinx/conf.py b/man/sphinx/conf.py index 435f67bb755..d8fbcaaca0a 100644 --- a/man/sphinx/conf.py +++ b/man/sphinx/conf.py @@ -69,12 +69,16 @@ >>>>>>> 227cbcebbf (Programmer's manual: update GRASS GIS arch drawing (#1610)) ======= project = "GRASS GIS 8.3 Documentation" +<<<<<<< HEAD copyright = "2022, GRASS Development Team" >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= project = "GRASS GIS 8.3 Documentation" copyright = "2022, GRASS Development Team" >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +copyright = "2023, GRASS Development Team" +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -415,6 +419,7 @@ epub_title = "GRASS GIS 8.3 Documentation" epub_author = "GRASS Development Team" epub_publisher = "GRASS Development Team" +<<<<<<< HEAD epub_copyright = "2022, GRASS Development Team" >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= @@ -423,6 +428,9 @@ epub_publisher = "GRASS Development Team" epub_copyright = "2022, GRASS Development Team" >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +epub_copyright = "2023, GRASS Development Team" +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/python/grass/docs/conf.py b/python/grass/docs/conf.py index 48f5227dbe6..71e1f7f563e 100644 --- a/python/grass/docs/conf.py +++ b/python/grass/docs/conf.py @@ -130,6 +130,7 @@ project = "Python library documentation" <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD copyright = "2024, GRASS Development Team" ======= copyright = "2022, GRASS Development Team" @@ -137,6 +138,9 @@ ======= copyright = "2022, GRASS Development Team" >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +copyright = "2023, GRASS Development Team" +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -374,11 +378,15 @@ epub_copyright = copyright ======= epub_publisher = "GRASS Development Team" +<<<<<<< HEAD epub_copyright = "2022, GRASS Development Team" <<<<<<< HEAD >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +epub_copyright = "2023, GRASS Development Team" +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # The basename for the epub file. It defaults to the project name. # epub_basename = u'wxGUI' diff --git a/python/grass/script/core.py b/python/grass/script/core.py index 79d1d09b8a4..b022a3191fa 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -12,6 +12,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD (C) 2008-2024 by the GRASS Development Team ======= (C) 2008-2021 by the GRASS Development Team @@ -25,6 +26,9 @@ ======= (C) 2008-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +(C) 2008-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. diff --git a/python/grass/script/setup.py b/python/grass/script/setup.py index d6d7600bd3a..29ed1994fd0 100644 --- a/python/grass/script/setup.py +++ b/python/grass/script/setup.py @@ -142,6 +142,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD (C) 2010-2024 by the GRASS Development Team ======= (C) 2010-2021 by the GRASS Development Team @@ -155,6 +156,9 @@ ======= (C) 2010-2022 by the GRASS Development Team >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +(C) 2010-2023 by the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details. diff --git a/raster/r.resamp.filter/Makefile b/raster/r.resamp.filter/Makefile index 339d339581c..f796559d0cc 100644 --- a/raster/r.resamp.filter/Makefile +++ b/raster/r.resamp.filter/Makefile @@ -2,10 +2,16 @@ MODULE_TOPDIR = ../.. PGM = r.resamp.filter +<<<<<<< HEAD LIBES = $(RASTERLIB) $(GISLIB) $(MATHLIB) $(OPENMP_LIBPATH) $(OPENMP_LIB) DEPENDENCIES = $(RASTERDEP) $(GISDEP) EXTRA_CFLAGS = $(OPENMP_CFLAGS) EXTRA_INC = $(OPENMP_INCPATH) +======= +LIBES = $(RASTERLIB) $(GISLIB) $(MATHLIB) $(OMPLIB) +DEPENDENCIES = $(RASTERDEP) $(GISDEP) +EXTRA_CFLAGS = $(OMPCFLAGS) +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) include $(MODULE_TOPDIR)/include/Make/Module.make diff --git a/raster/r.resamp.filter/main.c b/raster/r.resamp.filter/main.c index 1548b491778..90e08dc1606 100644 --- a/raster/r.resamp.filter/main.c +++ b/raster/r.resamp.filter/main.c @@ -3,6 +3,7 @@ * MODULE: r.resamp.filter * AUTHOR(S): Glynn Clements <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD * Aaron Saw Min Sern (OpenMP parallelization) * PURPOSE: @@ -13,6 +14,11 @@ * PURPOSE: * COPYRIGHT: (C) 2010 by Glynn Clements and the GRASS Development Team >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) +======= + * Aaron Saw Min Sern (OpenMP parallelization) + * PURPOSE: + * COPYRIGHT: (C) 2010-2023 by Glynn Clements and the GRASS Development Team +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) * * This program is free software under the GNU General Public * License (>=v2). Read the file COPYING that comes with GRASS @@ -116,6 +122,7 @@ static const struct filter_type menu[] = { {"hamming", f_hamming, 0}, {"blackman", f_blackman, 0}, <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD {NULL, NULL, 0}, ======= @@ -123,6 +130,9 @@ static const struct filter_type menu[] = { >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) {NULL}, >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) +======= + {NULL, NULL, 0}, +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) }; static char *build_filter_list(void) @@ -339,6 +349,7 @@ static void filter(void) make_h_weights(); make_v_weights(); +<<<<<<< HEAD <<<<<<< HEAD while (written_row < dst_w.rows) { int range = bufrows; @@ -419,39 +430,81 @@ static void filter(void) int row1 = maprow1[row]; int rows = row1 - row0; int i; +======= + while (written_row < dst_w.rows) { + int range = bufrows; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) + + if (range > dst_w.rows - written_row) { + range = dst_w.rows - written_row; + } + int start = written_row; + int end = written_row + range; + +#pragma omp parallel private(row) + { + int read_row = 0; + int num_rows = 0; + int t_id = 0; - G_percent(row, dst_w.rows, 2); +#if defined(_OPENMP) + t_id = omp_get_thread_num(); +#endif - if (row0 >= cur_row && row0 < cur_row + num_rows) { - int m = row0 - cur_row; - int n = cur_row + num_rows - row0; - int i; +#pragma omp for schedule(static, 1) + for (row = start; row < end; row++) { + int row0 = maprow0[row]; + int row1 = maprow1[row]; + int rows = row1 - row0; + int i; - for (i = 0; i < n; i++) { - DCELL *tmp = bufs[i]; + G_percent(computed_row, dst_w.rows, 2); - bufs[i] = bufs[m + i]; - bufs[m + i] = tmp; - } + if (row0 >= read_row && row0 < read_row + num_rows) { + int m = row0 - read_row; + int n = read_row + num_rows - row0; + int i; - cur_row = row0; - num_rows = n; - } - else { - cur_row = row0; - num_rows = 0; + for (i = 0; i < n; i++) { + DCELL *tmp = bufs[t_id][i]; + + bufs[t_id][i] = bufs[t_id][m + i]; + bufs[t_id][m + i] = tmp; + } + + read_row = row0; + num_rows = n; + } + else { + read_row = row0; + num_rows = 0; + } + + for (i = num_rows; i < rows; i++) { + G_debug(5, "read: %p = %d", bufs[t_id][i], row0 + i); + /* enlarging the source window to the North and South is + * not possible for global maps in ll */ + if (row0 + i >= 0 && row0 + i < src_w.rows) + Rast_get_d_row(infile[t_id], inbuf[t_id], row0 + i); + else + Rast_set_d_null_value(inbuf[t_id], src_w.cols); + h_filter(bufs[t_id][i], inbuf[t_id]); + } + + num_rows = rows; + + v_filter(&outbuf[(row - start) * dst_w.cols], bufs[t_id], row, + rows); +#pragma omp atomic update + computed_row++; + } } - for (i = num_rows; i < rows; i++) { - G_debug(5, "read: %p = %d", bufs[i], row0 + i); - /* enlarging the source window to the North and South is - * not possible for global maps in ll */ - if (row0 + i >= 0 && row0 + i < src_w.rows) - Rast_get_d_row(infile, inbuf, row0 + i); - else - Rast_set_d_null_value(inbuf, src_w.cols); - h_filter(bufs[i], inbuf); + for (row = start; row < end; row++) { + Rast_put_d_row(outfile, &outbuf[(row - start) * dst_w.cols]); + G_debug(5, "write: %d", row); } +<<<<<<< HEAD num_rows = rows; @@ -463,6 +516,9 @@ static void filter(void) >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + written_row = end; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) } G_percent(dst_w.rows, dst_w.rows, 2); } @@ -472,6 +528,7 @@ int main(int argc, char *argv[]) struct GModule *module; struct { <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD struct Option *rastin, *rastout, *method, *radius, *x_radius, *y_radius, *memory, *nprocs; @@ -481,6 +538,10 @@ int main(int argc, char *argv[]) ======= struct Option *rastin, *rastout, *method, *radius, *x_radius, *y_radius; >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + struct Option *rastin, *rastout, *method, *radius, *x_radius, *y_radius, + *memory, *nprocs; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) } parm; struct { struct Flag *nulls; @@ -488,7 +549,10 @@ int main(int argc, char *argv[]) char title[64]; int i, t; int nprocs; +<<<<<<< HEAD size_t in_buf_size, out_buf_size; +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) G_gisinit(argv[0]); @@ -568,10 +632,19 @@ int main(int argc, char *argv[]) "threads setting.")); nprocs = 1; #endif +<<<<<<< HEAD if (nprocs > 1 && Rast_mask_is_present()) { G_warning(_("Parallel processing disabled due to active make.")); +======= +<<<<<<< HEAD + if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) { + G_warning(_("Parallel processing disabled due to active MASK.")); +>>>>>>> fa1324421c (r.terrafow: explicit use of default constructors (#2660)) nprocs = 1; } +======= + +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) if (parm.radius->answer) { if (parm.x_radius->answer || parm.y_radius->answer) G_fatal_error(_("%s= and %s=/%s= are mutually exclusive"), @@ -691,12 +764,16 @@ int main(int argc, char *argv[]) /* allocate buffers for intermediate rows */ <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) bufs = G_malloc(nprocs * sizeof(DCELL **)); for (t = 0; t < nprocs; t++) { bufs[t] = G_malloc(row_scale * sizeof(DCELL *)); for (i = 0; i < row_scale; i++) bufs[t][i] = Rast_allocate_d_buf(); } +<<<<<<< HEAD ======= bufs = G_malloc(row_scale * sizeof(DCELL *)); for (i = 0; i < row_scale; i++) @@ -705,10 +782,13 @@ int main(int argc, char *argv[]) >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) Rast_set_input_window(&src_w); Rast_set_output_window(&dst_w); +<<<<<<< HEAD /* memory reserved for input */ in_buf_size = dst_w.cols * sizeof(DCELL) * row_scale * nprocs; /* memory available for output buffer */ @@ -728,6 +808,13 @@ int main(int argc, char *argv[]) if (bufrows < nprocs) { bufrows = nprocs; } +======= + bufrows = + atoi(parm.memory->answer) * (((1 << 20) / sizeof(DCELL)) / dst_w.cols); + if (bufrows > dst_w.rows) { + bufrows = dst_w.rows; + } +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) inbuf = G_malloc(nprocs * sizeof(DCELL *)); for (t = 0; t < nprocs; t++) diff --git a/raster/r.resamp.filter/r.resamp.filter.html b/raster/r.resamp.filter/r.resamp.filter.html index 11cf89a92cb..9880b92c7c6 100644 --- a/raster/r.resamp.filter/r.resamp.filter.html +++ b/raster/r.resamp.filter/r.resamp.filter.html @@ -78,6 +78,9 @@

NOTES

<<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))

PERFORMANCE

By specifying the number of parallel processes with nprocs option, r.resamp.filter can run faster, see benchmarks below. @@ -93,10 +96,13 @@

PERFORMANCE

needs to compiled with OpenMP enabled. +<<<<<<< HEAD ======= >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))

SEE ALSO

diff --git a/raster/r.terraflow/ccforest.h b/raster/r.terraflow/ccforest.h index 3e08df22fae..74ee430fd6e 100644 --- a/raster/r.terraflow/ccforest.h +++ b/raster/r.terraflow/ccforest.h @@ -40,6 +40,7 @@ class keyvalue { T src() const { return key; }; T dst() const { return value; }; +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD ======= @@ -55,6 +56,8 @@ class keyvalue { >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) int operator!=(const keyvalue &e2) const { return (key != e2.key) || (value != e2.value); @@ -158,18 +161,24 @@ class ccforest { ccforest(); <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) ccforest(const ccforest &) = delete; ccforest &operator=(const ccforest &) = delete; ccforest(ccforest &&) = delete; ccforest &operator=(ccforest &&) = delete; ~ccforest(); +<<<<<<< HEAD ======= ~ccforest(); >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= ~ccforest(); >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) void insert(const T &i, const T &j); /* insert edge (i,j) */ T findNextRoot(const T &i); /* find root where i >= prev i */ void printRootStream(); diff --git a/raster/r.terraflow/genericWindow.h b/raster/r.terraflow/genericWindow.h index 37a64a83590..6463698944b 100644 --- a/raster/r.terraflow/genericWindow.h +++ b/raster/r.terraflow/genericWindow.h @@ -87,6 +87,9 @@ class genericWindow { /***************************************************************/ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) /* get specified neighbour di,dj in {-1,0,1} */ T get(short di, short dj) const { diff --git a/raster/r.terraflow/sweep.h b/raster/r.terraflow/sweep.h index 8cdb460a73d..e7dead0028b 100644 --- a/raster/r.terraflow/sweep.h +++ b/raster/r.terraflow/sweep.h @@ -177,6 +177,7 @@ class gridPosition { class flowPriority { public: <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD elevation_type h{0.0}; toporank_type toporank{0}; @@ -188,11 +189,16 @@ class flowPriority { elevation_type h; toporank_type toporank; >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= + elevation_type h{0.0}; + toporank_type toporank{0}; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) /* points at same heights are processed in increasing order of their topological rank; overall, this gives topological order and guarantees that flow is never puhsed backwards. Note: of course, this is a way of waving hands on topological sorting. */ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD dimension_type i{0}, j{0}; @@ -238,20 +244,24 @@ class flowPriority { ======= dimension_type i, j; +======= + dimension_type i{0}, j{0}; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) public: - flowPriority(elevation_type a = 0, toporank_type b = 0, - dimension_type c = 0, dimension_type d = 0) - : h(a), toporank(b), i(c), j(d) - { - } - - flowPriority(const flowPriority &p) - : h(p.h), toporank(p.toporank), i(p.i), j(p.j) + flowPriority() {} + flowPriority(elevation_type a) : h{a} {} + flowPriority(elevation_type a, toporank_type b, dimension_type c, + dimension_type d) + : h{a}, toporank{b}, i{c}, j{d} { } - ~flowPriority() {} + flowPriority(const flowPriority &) = default; + flowPriority &operator=(const flowPriority &) = default; + flowPriority(flowPriority &&) = default; + flowPriority &operator=(flowPriority &&) = default; + ~flowPriority() = default; elevation_type field1() const { return h; } @@ -427,6 +437,7 @@ class sweepItemBaseType { /***************************************************************/ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD /* return the elevation window */ genericWindow getElevWindow() const { return elevwin; } @@ -447,6 +458,8 @@ class sweepItemBaseType { ~sweepItemBaseType() {} /***************************************************************/ +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) /* return the elevation window */ genericWindow getElevWindow() const { return elevwin; } @@ -566,6 +579,7 @@ class PrioCmpSweepItem { class flowValue { public: <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD flowaccumulation_type value{0}; @@ -575,11 +589,13 @@ class flowValue { ======= flowaccumulation_type value; +======= + flowaccumulation_type value{0}; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) public: - flowValue(flowaccumulation_type x = 0) : value(x) {} - - ~flowValue() {} + flowValue() {} + flowValue(flowaccumulation_type x) : value{x} {} >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= @@ -607,6 +623,7 @@ class flowValue { } <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) @@ -619,6 +636,8 @@ class flowValue { >>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704)) ======= >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) flowValue operator!=(const flowValue &elt) { return value != elt.value; } flowValue operator==(const flowValue &elt) { return value == elt.value; } @@ -644,6 +663,7 @@ class flowValue { class flowStructure { private: <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD flowPriority prio{}; flowValue val{}; @@ -659,13 +679,18 @@ class flowStructure { ======= flowPriority prio; flowValue val; +======= + flowPriority prio{}; + flowValue val{}; +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) public: - flowStructure(const flowPriority &p = 0, const flowValue &e = 0) - : prio(p), val(e) + flowStructure() {} + flowStructure(const flowPriority &p, const flowValue &e) : prio{p}, val{e} { } +<<<<<<< HEAD /* flowStructure(const flowValue &e, const flowPriority &p): prio(p), val(e) {} */ @@ -689,6 +714,8 @@ class flowStructure { >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) ~flowStructure() {} +======= +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) flowPriority getPriority() const { return prio; } <<<<<<< HEAD diff --git a/utils/mkhtml.py b/utils/mkhtml.py index 3a4e3c4c353..5c0fd9b0944 100644 --- a/utils/mkhtml.py +++ b/utils/mkhtml.py @@ -9,6 +9,7 @@ # PURPOSE: Create HTML manual page snippets <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD # COPYRIGHT: (C) 2007-2024 by Glynn Clements ======= # COPYRIGHT: (C) 2007-2022 by Glynn Clements @@ -16,6 +17,9 @@ ======= # COPYRIGHT: (C) 2007-2022 by Glynn Clements >>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704)) +======= +# COPYRIGHT: (C) 2007-2023 by Glynn Clements +>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660)) # and the GRASS Development Team # # This program is free software under the GNU General