aboutsummaryrefslogtreecommitdiff
path: root/cad/tochnog
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2006-06-23 13:11:39 +0000
committerPav Lucistnik <pav@FreeBSD.org>2006-06-23 13:11:39 +0000
commit81106d48d93cdc53e0b97937cc805ffe424a924d (patch)
tree16172773fe669d8bbc2d8caadd3d237f75018288 /cad/tochnog
parente4307343f54e7cc99d637c02b4f8f0cd140ad3da (diff)
downloadports-81106d48d93cdc53e0b97937cc805ffe424a924d.tar.gz
ports-81106d48d93cdc53e0b97937cc805ffe424a924d.zip
- 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 PR: ports/99259 Submitted by: Pedro F. Giffuni <giffunip@asme.org>
Notes
Notes: svn path=/head/; revision=166115
Diffstat (limited to 'cad/tochnog')
-rw-r--r--cad/tochnog/Makefile28
-rw-r--r--cad/tochnog/files/patch-so_petsc.c20
-rw-r--r--cad/tochnog/files/patch-tn.cc172
-rw-r--r--cad/tochnog/files/patch-tochnog.h12
4 files changed, 216 insertions, 16 deletions
diff --git a/cad/tochnog/Makefile b/cad/tochnog/Makefile
index f6c8961a3bd8..61d295d06c78 100644
--- a/cad/tochnog/Makefile
+++ b/cad/tochnog/Makefile
@@ -16,14 +16,19 @@ DISTNAME= ${PORTNAME}_feb11_2001
MAINTAINER= ports@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 @@ GIDDIR?= share/${PORTNAME}
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 --git a/cad/tochnog/files/patch-so_petsc.c b/cad/tochnog/files/patch-so_petsc.c
new file mode 100644
index 000000000000..68c33a12ddb3
--- /dev/null
+++ b/cad/tochnog/files/patch-so_petsc.c
@@ -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 --git a/cad/tochnog/files/patch-tn.cc b/cad/tochnog/files/patch-tn.cc
new file mode 100644
index 000000000000..fdfee0d4afab
--- /dev/null
+++ b/cad/tochnog/files/patch-tn.cc
@@ -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 --git a/cad/tochnog/files/patch-tochnog.h b/cad/tochnog/files/patch-tochnog.h
index 8bfb5a88b51d..634267c69636 100644
--- a/cad/tochnog/files/patch-tochnog.h
+++ b/cad/tochnog/files/patch-tochnog.h
@@ -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