gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 3e8bbf1 1/2: New gal_convolve_spatial_general


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 3e8bbf1 1/2: New gal_convolve_spatial_general sanity check
Date: Wed, 26 Dec 2018 16:02:36 -0500 (EST)

branch: master
commit 3e8bbf190be82e567d711ca97069e48eff4fdc97
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    New gal_convolve_spatial_general sanity check
    
    When the input dataset is part of a linked list, but they don't point to
    any block, `gal_convolve_spatial_general' will crash because it is
    optimized to deal with a list of tiles. So with this commit, a sanity check
    is added to check for this scenario and inform the user and abort.
---
 lib/convolve.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/convolve.c b/lib/convolve.c
index 5fd9b62..0423b55 100644
--- a/lib/convolve.c
+++ b/lib/convolve.c
@@ -501,6 +501,17 @@ gal_convolve_spatial_general(gal_data_t *tiles, gal_data_t 
*kernel,
     error(EXIT_FAILURE, 0, "%s: only accepts `float32' type input and "
           "kernel currently", __func__);
 
+  /* It may happen that an input dataset is part of a linked list, but it
+     is not actually a tile structure (the user wants to convolve the whole
+     dataset without using tiles)! In that case, this function should break
+     beacuse a linked list is interpretted as a tile structure here.*/
+  if( tiles->block==NULL && tiles->next && tiles->next->block==NULL )
+    error(EXIT_FAILURE, 0, "%s: the input is a linked list but not a "
+          "tessellation (a list of tiles). This function is optimized to "
+          "work on a list of tiles. Please (temporarily) set the `next' "
+          "element of the input to `NULL' and call this funciton again",
+          __func__);
+
 
   /* Set the output datastructure.  */
   if(tocorrect) out=tocorrect;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]