From 39cf1ee90be666028360eb2d14c278b57f69fd04 Mon Sep 17 00:00:00 2001
From: Martin Reinecke <martin@mpa-garching.mpg.de>
Date: Wed, 4 Jul 2012 14:01:43 +0200
Subject: [PATCH] missing stuff from last commit

---
 c_utils/c_utils.c              | 66 +---------------------------------
 c_utils/c_utils.h              |  4 ---
 libsharp/oracle.inc            |  2 +-
 libsharp/planck.make           |  2 +-
 libsharp/sharp.c               |  4 +--
 libsharp/sharp_acctest.c       |  3 +-
 libsharp/sharp_bench.c         |  3 +-
 libsharp/sharp_complex_hacks.h |  8 ++---
 libsharp/sharp_core.c          |  6 ++--
 libsharp/sharp_core.h          |  2 +-
 libsharp/sharp_test.c          |  3 +-
 libsharp/sharp_vecsupport.h    |  8 ++---
 libsharp/sharp_vecutil.h       |  6 ++--
 libsharp/sharp_ylmgen_c.c      |  2 +-
 libsharp/sharp_ylmgen_c.h      |  6 ++--
 15 files changed, 30 insertions(+), 95 deletions(-)

diff --git a/c_utils/c_utils.c b/c_utils/c_utils.c
index d8601e7..96bd765 100644
--- a/c_utils/c_utils.c
+++ b/c_utils/c_utils.c
@@ -25,21 +25,12 @@
 /*
  *  Convenience functions
  *
- *  Copyright (C) 2008, 2009, 2010, 2011 Max-Planck-Society
+ *  Copyright (C) 2008, 2009, 2010, 2011, 2012 Max-Planck-Society
  *  Author: Martin Reinecke
  */
 
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include "c_utils.h"
-#include "vec_utils.h"
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-#ifdef USE_MPI
-#include <mpi.h>
-#endif
 
 void util_fail_ (const char *file, int line, const char *func, const char *msg)
   {
@@ -88,58 +79,3 @@ void *util_malloc_ (size_t sz)
 void util_free_ (void *ptr)
   { if ((ptr)!=NULL) free(ptr); }
 #endif
-
-static void OpenMP_status(void)
-  {
-#ifndef _OPENMP
-  printf("OpenMP: not supported by this binary\n");
-#else
-  int threads = omp_get_max_threads();
-  if (threads>1)
-    printf("OpenMP active: max. %d threads.\n",threads);
-  else
-    printf("OpenMP active, but running with 1 thread only.\n");
-#endif
-  }
-
-static void MPI_status(void)
-  {
-#ifndef USE_MPI
-  printf("MPI: not supported by this binary\n");
-#else
-  int tasks;
-  MPI_Comm_size(MPI_COMM_WORLD,&tasks);
-  if (tasks>1)
-    printf("MPI active with %d tasks.\n",tasks);
-  else
-    printf("MPI active, but running with 1 task only.\n");
-#endif
-  }
-
-static void vecmath_status(void)
-  { printf("Supported vector length: %d\n",VLEN); }
-
-void announce_c (const char *name)
-  {
-  size_t m, nlen=strlen(name);
-  printf("\n+-");
-  for (m=0; m<nlen; ++m) printf("-");
-  printf("-+\n");
-  printf("| %s |\n", name);
-  printf("+-");
-  for (m=0; m<nlen; ++m) printf("-");
-  printf("-+\n\n");
-  vecmath_status();
-  OpenMP_status();
-  MPI_status();
-  printf("\n");
-  }
-
-void module_startup_c (const char *name, int argc, int argc_expected,
-  const char *argv_expected, int verbose)
-  {
-  if (verbose) announce_c (name);
-  if (argc==argc_expected) return;
-  if (verbose) fprintf(stderr, "Usage: %s %s\n", name, argv_expected);
-  exit(1);
-  }
diff --git a/c_utils/c_utils.h b/c_utils/c_utils.h
index db6059c..768d2b7 100644
--- a/c_utils/c_utils.h
+++ b/c_utils/c_utils.h
@@ -46,10 +46,6 @@ void util_warn_ (const char *file, int line, const char *func, const char *msg);
 void *util_malloc_ (size_t sz);
 void util_free_ (void *ptr);
 
-void announce_c (const char *name);
-void module_startup_c (const char *name, int argc, int argc_expected,
-  const char *argv_expected, int verbose);
-
 #if defined (__GNUC__)
 #define UTIL_FUNC_NAME__ __func__
 #else
diff --git a/libsharp/oracle.inc b/libsharp/oracle.inc
index 7680861..a977729 100644
--- a/libsharp/oracle.inc
+++ b/libsharp/oracle.inc
@@ -2,7 +2,7 @@ static const int maxtr = 6;
 static const int nv_opt[6][2][3] = {
 {{4,2,-1},{2,1,-1}},
 {{4,2,-1},{2,1,-1}},
-{{5,2,-1},{5,2,-1}},
+{{5,2,-1},{5,1,-1}},
 {{5,2,-1},{5,2,-1}},
 {{5,2,-1},{5,2,-1}},
 {{5,2,-1},{5,2,-1}}
diff --git a/libsharp/planck.make b/libsharp/planck.make
index 23dd2ad..c8621cd 100644
--- a/libsharp/planck.make
+++ b/libsharp/planck.make
@@ -8,7 +8,7 @@ FULL_INCLUDE+= -I$(SD)
 HDR_$(PKG):=$(SD)/*.h
 LIB_$(PKG):=$(LIBDIR)/libsharp.a
 BIN:=sharp_test sharp_acctest sharp_test_mpi sharp_bench
-LIBOBJ:=ylmgen_c.o sharp.o sharp_geomhelpers.o sharp_almhelpers.o sharp_core.o
+LIBOBJ:=sharp_ylmgen_c.o sharp.o sharp_announce.o sharp_geomhelpers.o sharp_almhelpers.o sharp_core.o
 ALLOBJ:=$(LIBOBJ) sharp_test.o sharp_acctest.o sharp_test_mpi.o sharp_bench.o
 LIBOBJ:=$(LIBOBJ:%=$(OD)/%)
 ALLOBJ:=$(ALLOBJ:%=$(OD)/%)
diff --git a/libsharp/sharp.c b/libsharp/sharp.c
index 6f44ffa..e3d7a89 100644
--- a/libsharp/sharp.c
+++ b/libsharp/sharp.c
@@ -31,11 +31,11 @@
 
 #include <math.h>
 #include "ls_fft.h"
-#include "ylmgen_c.h"
+#include "sharp_ylmgen_c.h"
 #include "sharp.h"
 #include "c_utils.h"
 #include "sharp_core.h"
-#include "vec_utils.h"
+#include "sharp_vecutil.h"
 #include "walltime_c.h"
 
 typedef complex double dcmplx;
diff --git a/libsharp/sharp_acctest.c b/libsharp/sharp_acctest.c
index 3f36877..37ee25b 100644
--- a/libsharp/sharp_acctest.c
+++ b/libsharp/sharp_acctest.c
@@ -38,6 +38,7 @@
 #include "sharp_geomhelpers.h"
 #include "sharp_almhelpers.h"
 #include "c_utils.h"
+#include "sharp_announce.h"
 #include "sharp_core.h"
 
 typedef complex double dcmplx;
@@ -183,7 +184,7 @@ int main(void)
 #ifdef USE_MPI
   MPI_Init(NULL,NULL);
 #endif
-  module_startup_c("sharp_acctest",1,1,"",1);
+  sharp_module_startup("sharp_acctest",1,1,"",1);
 
   int lmax=127;
 
diff --git a/libsharp/sharp_bench.c b/libsharp/sharp_bench.c
index 185dc9e..b578b39 100644
--- a/libsharp/sharp_bench.c
+++ b/libsharp/sharp_bench.c
@@ -36,6 +36,7 @@
 #include "sharp_geomhelpers.h"
 #include "sharp_almhelpers.h"
 #include "c_utils.h"
+#include "sharp_announce.h"
 #include "sharp_core.h"
 
 typedef complex double dcmplx;
@@ -94,7 +95,7 @@ int main(void)
 #ifdef USE_MPI
   MPI_Init(NULL,NULL);
 #endif
-  module_startup_c("sharp_bench",1,1,"",1);
+  sharp_module_startup("sharp_bench",1,1,"",1);
 
   printf("Benchmarking SHTs.\n\n");
   FILE *fp=fopen("oracle.inc","w");
diff --git a/libsharp/sharp_complex_hacks.h b/libsharp/sharp_complex_hacks.h
index 99a7c2b..d06741e 100644
--- a/libsharp/sharp_complex_hacks.h
+++ b/libsharp/sharp_complex_hacks.h
@@ -22,19 +22,19 @@
  *  (DLR).
  */
 
-/*  \file complex_hacks.h
+/*  \file sharp_complex_hacks.h
  *  support for converting vector types and complex numbers
  *
  *  Copyright (C) 2012 Max-Planck-Society
  *  Author: Martin Reinecke
  */
 
-#ifndef COMPLEX_HACKS_H
-#define COMPLEX_HACKS_H
+#ifndef SHARP_COMPLEX_HACKS_H
+#define SHARP_COMPLEX_HACKS_H
 
 #include <math.h>
 #include <complex.h>
-#include "vecsupport.h"
+#include "sharp_vecsupport.h"
 
 #define UNSAFE_CODE
 
diff --git a/libsharp/sharp_core.c b/libsharp/sharp_core.c
index ba5cd88..ec02975 100644
--- a/libsharp/sharp_core.c
+++ b/libsharp/sharp_core.c
@@ -32,9 +32,9 @@
 #include <complex.h>
 #include <math.h>
 #include <string.h>
-#include "vecsupport.h"
-#include "complex_hacks.h"
-#include "ylmgen_c.h"
+#include "sharp_vecsupport.h"
+#include "sharp_complex_hacks.h"
+#include "sharp_ylmgen_c.h"
 #include "sharp.h"
 #include "sharp_core.h"
 #include "c_utils.h"
diff --git a/libsharp/sharp_core.h b/libsharp/sharp_core.h
index 0699074..38ec41d 100644
--- a/libsharp/sharp_core.h
+++ b/libsharp/sharp_core.h
@@ -33,7 +33,7 @@
 #define PLANCK_SHARP_CORE_H
 
 #include "sharp.h"
-#include "ylmgen_c.h"
+#include "sharp_ylmgen_c.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/libsharp/sharp_test.c b/libsharp/sharp_test.c
index 6bcd253..bd0fe28 100644
--- a/libsharp/sharp_test.c
+++ b/libsharp/sharp_test.c
@@ -59,6 +59,7 @@
 #include "sharp_geomhelpers.h"
 #include "sharp_almhelpers.h"
 #include "c_utils.h"
+#include "sharp_announce.h"
 #include "sharp_core.h"
 
 typedef complex double dcmplx;
@@ -188,7 +189,7 @@ int main(int argc, char **argv)
 #ifdef USE_MPI
   MPI_Init(NULL,NULL);
 #endif
-  module_startup_c("sharp_test",argc,7,
+  sharp_module_startup("sharp_test",argc,7,
     "<healpix|ecp|gauss> <lmax> <nside|nphi> <niter> <spin> <ntrans>",1);
 
   int lmax=atoi(argv[2]);
diff --git a/libsharp/sharp_vecsupport.h b/libsharp/sharp_vecsupport.h
index ccb9364..0fe7540 100644
--- a/libsharp/sharp_vecsupport.h
+++ b/libsharp/sharp_vecsupport.h
@@ -22,18 +22,18 @@
  *  (DLR).
  */
 
-/*  \file vecsupport.h
+/*  \file sharp_vecsupport.h
  *  Convenience functions for vector arithmetics
  *
  *  Copyright (C) 2012 Max-Planck-Society
  *  Author: Martin Reinecke
  */
 
-#ifndef VECSUPPORT_H
-#define VECSUPPORT_H
+#ifndef SHARP_VECSUPPORT_H
+#define SHARP_VECSUPPORT_H
 
 #include <math.h>
-#include "vec_utils.h"
+#include "sharp_vecutil.h"
 
 typedef double Ts;
 
diff --git a/libsharp/sharp_vecutil.h b/libsharp/sharp_vecutil.h
index 50066f8..5b64c5a 100644
--- a/libsharp/sharp_vecutil.h
+++ b/libsharp/sharp_vecutil.h
@@ -22,15 +22,15 @@
  *  (DLR).
  */
 
-/*! \file vec_utils.h
+/*! \file sharp_vecutil.h
  *  Functionality related to vector instruction support
  *
  *  Copyright (C) 2012 Max-Planck-Society
  *  \author Martin Reinecke
  */
 
-#ifndef PLANCK_VEC_UTILS_H
-#define PLANCK_VEC_UTILS_H
+#ifndef SHARP_VECUTIL_H
+#define SHARP_VECUTIL_H
 
 #if (defined (__AVX__) && (!defined (DISABLE_AVX)) && (!defined (DISABLE_SSE2)))
 #define VLEN 4
diff --git a/libsharp/sharp_ylmgen_c.c b/libsharp/sharp_ylmgen_c.c
index e674e63..48a1f7b 100644
--- a/libsharp/sharp_ylmgen_c.c
+++ b/libsharp/sharp_ylmgen_c.c
@@ -31,7 +31,7 @@
 
 #include <math.h>
 #include <stdlib.h>
-#include "ylmgen_c.h"
+#include "sharp_ylmgen_c.h"
 #include "c_utils.h"
 
 void Ylmgen_init (Ylmgen_C *gen, int l_max, int m_max, int spin)
diff --git a/libsharp/sharp_ylmgen_c.h b/libsharp/sharp_ylmgen_c.h
index 6462478..cbfd42c 100644
--- a/libsharp/sharp_ylmgen_c.h
+++ b/libsharp/sharp_ylmgen_c.h
@@ -22,15 +22,15 @@
  *  (DLR).
  */
 
-/*! \file ylmgen_c.h
+/*! \file sharp_ylmgen_c.h
  *  Code for efficient calculation of Y_lm(phi=0,theta)
  *
  *  Copyright (C) 2005-2012 Max-Planck-Society
  *  \author Martin Reinecke
  */
 
-#ifndef PLANCK_YLMGEN_C_H
-#define PLANCK_YLMGEN_C_H
+#ifndef SHARP_YLMGEN_C_H
+#define SHARP_YLMGEN_C_H
 
 #ifdef __cplusplus
 extern "C" {
-- 
GitLab