ports/99259: small update to cad/tochnog

Pedro F. Giffuni giffunip at asme.org
Wed Jun 21 16:30:27 UTC 2006


>Number:         99259
>Category:       ports
>Synopsis:       small update to cad/tochnog
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 21 16:30:19 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Pedro F. Giffuni
>Release:        6.1-Release
>Organization:
>Environment:
FreeBSD etoile.cable.net.co 6.1-RELEASE FreeBSD 6.1-RELEASE #1: Fri May 12 00:18:58 COT 2006     root at etoile.cable.net.co:/usr/src/sys/amd64/compile/DIMENSION  amd64
>Description:
- use standard BLAS instead of ATLAS so this can be packaged. Of course we still have a WITH_ATLAS knob.
- Minor changes to better match the CVS version.
- Add GETOPT_LONG support.
>How-To-Repeat:

>Fix:
diff -ruN tochnog.orig/Makefile tochnog/Makefile
--- tochnog.orig/Makefile	Mon Jun 19 01:07:04 2006
+++ tochnog/Makefile	Wed Jun 21 11:01:12 2006
@@ -16,14 +16,19 @@
 MAINTAINER=	ports at FreeBSD.org
 COMMENT=	A free explicit/implicit Finite Element Program
 
+.ifdef WITH_ATLAS
+LIB_DEPENDS=	atlas:${PORTSDIR}/math/atlas
+.else
+LIB_DEPENDS=	blas:${PORTSDIR}/math/blas
+.endif
 BUILD_DEPENDS=	${LOCALBASE}/lib/libf2c.a:${PORTSDIR}/lang/f2c
 .ifdef WITH_THREADS
 BUILD_DEPENDS+=	${LOCALBASE}/lib/libsuperlu_mt.a:${PORTSDIR}/math/superlu_mt
 .else
 BUILD_DEPENDS+=	${LOCALBASE}/lib/libsuperlu.a:${PORTSDIR}/math/superlu
 .endif
-LIB_DEPENDS=	atlas:${PORTSDIR}/math/atlas
 
+USE_GETOPT_LONG=	yes
 WRKSRC=		${WRKDIR}/${PORTNAME}/src
 MAKEFILE=	makefile
 
@@ -35,31 +40,34 @@
 PLIST_SUB+=	GIDDIR=${GIDDIR}
 GID_PTYPES=	${PREFIX}/${GIDDIR}/problemtypes
 
+.ifdef WITH_ATLAS
+.ifdef WITH_THREADS
+BLAS_LIBS=	-lptf77blas -latlas_r
+.else
+BLAS_LIBS=	-lf77blas -latlas
+.endif
+.else	#BLAS
+BLAS_LIBS?=	-lblas
+.endif
+
 .ifdef WITH_THREADS
-BLAS_LIBS?=	-L${LOCALBASE}/lib -lptf77blas -latlas_r
 SUPERLU=	superlu_mt
 ALL_TARGET=	freebsd_parallel
 .else
-BLAS_LIBS?=	-L${LOCALBASE}/lib -lf77blas -latlas
 SUPERLU=	superlu
 ALL_TARGET=	freebsd_old
 .endif
 
-.ifndef WITH_THREADS
-pre-everything::
-	@${ECHO_MSG} "make WITH_THREADS=yes for threaded version"
-.endif
-
 pre-build:
 	@${REINPLACE_CMD} -e 's,%%LOCALBASE%%,${LOCALBASE},g ; \
 	s,%%PTHREAD_CFLAGS%%,${PTHREAD_CFLAGS},g ; s,%%PTHREAD_LIBS%%,${PTHREAD_LIBS},g ; \
 	s,%%SUPERLU%%,${SUPERLU},g ; \
-	s,%%BLAS_LIBS%%,${BLAS_LIBS},g' \
+	s,%%BLAS_LIBS%%,-L${LOCALBASE}/lib ${BLAS_LIBS},g' \
 	${WRKSRC}/makefile
 .ifdef WITH_THREADS
 	@${REINPLACE_CMD} -e 's,SUPERLU_MT_USE 0,SUPERLU_MT_USE 1,' \
 	${WRKSRC}/tnsuplu.h
-.else
+.else	# Serial
 	@${REINPLACE_CMD} -e 's,SUPERLU_USE 0,SUPERLU_USE 1,' \
 	${WRKSRC}/tnsuplu.h
 .endif
diff -ruN tochnog.orig/files/patch-so_petsc.c tochnog/files/patch-so_petsc.c
--- tochnog.orig/files/patch-so_petsc.c	Wed Dec 31 19:00:00 1969
+++ tochnog/files/patch-so_petsc.c	Wed Jun 21 00:34:30 2006
@@ -0,0 +1,20 @@
+--- so_petsc.c.orig	Wed Jun 21 00:31:58 2006
++++ so_petsc.c	Wed Jun 21 00:33:30 2006
+@@ -21,14 +21,14 @@
+ 
+ #if PETSC_USE 
+ 
+-/* before version 2.2.29 of petsc use these two lines */
++/* before version 2.2.29 of petsc use these two lines
+ #include "sles.h"
+ #include "mg.h"    
++*/
+ 
+-/* version 2.2.29 and further of petsc use these two lines
++/* version 2.2.29 and further of petsc use these two lines */
+ #include "petscsles.h"
+ #include "petscmg.h"
+-*/
+ 
+ extern double *solve_solution;
+ 
diff -ruN tochnog.orig/files/patch-tn.cc tochnog/files/patch-tn.cc
--- tochnog.orig/files/patch-tn.cc	Wed Dec 31 19:00:00 1969
+++ tochnog/files/patch-tn.cc	Wed Jun 21 10:34:30 2006
@@ -0,0 +1,172 @@
+--- tn.cc	2002/06/01 13:47:34	1.1
++++ tn.cc	2002/07/25 14:32:17	1.2
+@@ -33,40 +33,145 @@
+   int PetscFinalize(void);
+ #endif
+ 
++#include "getopt.h"
++
++bool enable_gid;
++bool enable_test;
++
++struct option long_options [] =
++{
++  {"version", no_argument, NULL, 'v'},
++  {"help", no_argument, NULL, 'h'},
++  {"gid", no_argument, NULL, 'G'},
++  {"test", no_argument, NULL, 't'}, // Not yet implemented
++  {NULL, 0, 0, 0}
++};
++
++int usage ()
++{
++  cout << "Usage: tochnog [options]\n"
++    "or:    tochnog [options] file.dat\n"
++    "or:    tochnog [options] file.dat > file.out\n\n"
++    "options: --version  print the version of the tochnog program\n"
++    "         --help     print a short options overview and exit\n"
++    "         --gid      generate the files necessary for GID interaction\n"
++    "         --test     notify if target_item/_value could be meet\n"
++    "                    (not very usefull now)\n";
++  return 1;
++}
++
++int version ()
++{
++  cout << TOCHNOG_VERSION << '\n';
++  return 1;
++}
++
+ int main( int argc, char* argv[] )
+ 
+ {
+-  long int i=0, l=0, any_point=0;
++
++  extern char *optarg;
++  extern int optind, opterr, optopt;
++  
++  int opt_index, option, error_count = 0;
++  bool print_usage = false, print_version = false;
++
++  size_t i=0, l=0, s_len=0, any_point=0;
+ 
+     // initialise static variables
+   initialize();
+ 
+     // test arguments
++  while ((option = getopt_long (argc, argv, "hvGt", long_options, &opt_index))
++	 != EOF)
++    {
++      switch (option)
++	{
++	  // Options without argument
++
++	case 'h':	  // print a short help message and exit
++	  print_usage = true;
++	  break;
++	case 'v':         // print the version string and exit 
++	  print_version = true;
++	  break;
++	case 'G':         // use the *flavia* for interaction with gid 
++	  enable_gid = true;
++	  break;
++	case 't':         // use the *flavia* for interaction with gid 
++	  enable_test = true;
++	  break;
++	  // Options with 1 argument
++	default:
++	  cerr << "tochnog: unrecognized option " << optarg << '\n';
++	  error_count++;
++	}
++    }
++
++  if (error_count > 0)
++    {
++      cerr << "Try tochnog --help for more information";
++      exit(TN_EXIT_STATUS);      
++    }
++
++  if (print_usage)
++    {
++      usage();
++    }
++  if (print_version || print_usage)
++    {
++      version();
++      exit(TN_EXIT_STATUS);
++    }
++
++  // No comand argument
++
++  if (argc == optind)
++    {
++      strncpy( data_file, "tn.dat", 6 );
++    }
++
++  // 1 command line argument, should be input file name
++
++  else if (argc == optind + 1)
++    {
++      s_len = strlen (argv[optind]);
++      strncpy(data_file, argv[optind], s_len);
++
++      // Check if input file name containes already ".dat" suffix
++
++      if (strncmp(&data_file[s_len - 4], ".dat", 4) != 0)
++	{
++
++	  // to preserve compatibility
++
++	  if (strncmp(&data_file[s_len - 4], ".dbs", 4) != 0)
++	    {
++	      strncpy(data_file_base, data_file, s_len);
++	      strncpy(&data_file[s_len], ".dat", 4);
++	    }
++	  else
++	    {
++	      strncpy(data_file_base, data_file, s_len - 4);
++	    }
++	}
++      else
++	{
++	  // to preserve compatibility
++
++	  strncpy(data_file_base, data_file, s_len - 4);
++	}
++    }
++  else
++    {
++      usage();
++      exit(TN_EXIT_STATUS);
++    }
++
+ #if MPI_USE
+   strcpy( data_file, "tn.dat" );
+-#else
+-  if ( argc==1 ) strcpy( data_file, "tn.dat" );
+-  else if ( argc==2 ) strcpy( data_file, argv[1] );
+-  else {
+-    pri( "Usage: tochnog" );
+-    pri( "or:    tochnog file.dat" );
+-    pri( "or:    tochnog file.dat > file.out" );
+-    exit(TN_EXIT_STATUS);
+-  }
+-#endif
+-
+-    // append .dat to input file name
+-  l = strlen( data_file );
+-  strcpy( data_file_base, "" );
+-  for ( i=0; i<l && !any_point; i++ ) {
+-    if ( data_file[i]=='.' ) any_point = 1;
+-    else strncat( data_file_base, &data_file[i], 1 );
+-  }
+-  if ( !any_point ) strcat( data_file, ".dat" );
+-
+-    // empty the tn.dvd file at the start of calculation
+-  ofstream outdvd( "tn.dvd" );
+-  outdvd.close();
++#endif
++
+ 
+     // read input file
+   input();
diff -ruN tochnog.orig/files/patch-tochnog.h tochnog/files/patch-tochnog.h
--- tochnog.orig/files/patch-tochnog.h	Mon Jun 19 01:07:04 2006
+++ tochnog/files/patch-tochnog.h	Wed Jun 21 10:28:03 2006
@@ -1,5 +1,5 @@
---- tochnog.h.orig	Sun Feb 11 05:05:27 2001
-+++ tochnog.h	Fri Feb  3 15:15:51 2006
+--- tochnog.h	2002/06/01 13:50:03	1.1.1.1
++++ tochnog.h	2002/08/01 08:44:35	1.3
 @@ -17,12 +17,16 @@
      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
@@ -20,12 +20,12 @@
  #include <math.h>
  #include <limits.h>
  #include <stdio.h>
-@@ -48,6 +53,8 @@
-   VERSION_MACRO,        // mesh for control_macro
+@@ -49,6 +53,8 @@
    MVERSION              // maximum number of versions, this must be the last item
  }; 
-+
-+#define TOCHNOG_VERSION "July_25_2002"
  
++#define TOCHNOG_VERSION "July_25_2002"
++
    // constants
  #define MCHAR 100  // maximum length of names
+ #define MDIM 3 // maximum number of space dimensions

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list