Creation of OpenFOAM-dev repository 15/04/2008

This commit is contained in:
OpenFOAM-admin
2008-04-15 18:56:58 +01:00
commit 3170c7c0c9
9896 changed files with 4016171 additions and 0 deletions

View File

@ -0,0 +1,34 @@
include Makefile.in
STRINGSOBJS = $(PRGBUILDDIR)/strings$(OBJEXT)
GKSORTOBJS = $(PRGBUILDDIR)/gksort$(OBJEXT)
HEADERS = $(wildcard $(GKLIBINCDIR)/*.h)
default: $(BUILDDIR)/strings$(EXEEXT) $(BUILDDIR)/gksort$(EXEEXT)
$(BUILDDIR)/strings$(EXEEXT): $(STRINGSOBJS) $(GKLIBBUILDDIR)/libGKlib.a
$(LD) $(LDOPTIONS) $(EXEOUTPUTFILE) $(STRINGSOBJS) $(LIBSDIR) $(LIBS) ; $(MERGEMANIFEST)
chmod 744 $@
$(BUILDDIR)/gksort$(EXEEXT): $(GKSORTOBJS) $(GKLIBBUILDDIR)/libGKlib.a
$(LD) $(LDOPTIONS) $(EXEOUTPUTFILE) $(GKSORTOBJS) $(LIBSDIR) $(LIBS) ; $(MERGEMANIFEST)
chmod 744 $@
clean:
rm -rf $(PRGBUILDDIR)
realclean:
rm -rf $(PRGBUILDDIR) ;\
rm -rf $(BUILDDIR) ;
$(STRINGSOBJS) : $(HEADERS) Makefile.in Makefile $(GKLIBBUILDDIR)/libGKlib.a
$(PRGBUILDDIR)/%$(OBJEXT) : %.c
$(CC) $(CFLAGS) $(SOURCEFILE) $(OUTPUTFILE)

View File

@ -0,0 +1,258 @@
#*************************************************************************
# Global flags
#*************************************************************************
gdb = yes
debug = no
memdbg = no
openmp = no
x86compiler = gcc
VERNUM = 0.1.0
#*************************************************************************
# System-specific compilation flags
#*************************************************************************
# Get some basic information about the system that you are working on
cputype = $(shell uname -m | sed "s/\\ /_/g")
systype = $(shell uname)
ifeq ($(findstring CYGWIN, $(systype)),CYGWIN)
# systype = CYGWIN
systype = MSWIN
cputype = x86
endif
GKLIBINCDIR = $(HOME)/work/algorithms/GKlib/trunk/
GKLIBBUILDDIR = $(HOME)/work/algorithms/GKlib/builds/$(systype)-$(cputype)
ifeq ($(systype),MSWIN)
#-------------------------------------------------------------------
# These defs are very much Visual Studio Specific
#-------------------------------------------------------------------
#Compiler information
CC = cl
OPTFLAGS = /Ox
COPTIONS = -DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE
#Compile input/output file specification
SOURCEFILE = /c $<
OUTPUTFILE = /Fo$@
#Output specification for executables
EXEOUTPUTFILE = /Fe$@ # This option is when cl is used for linking
#EXEOUTPUTFILE = /OUT:$@ # This option is used when link is used for linking
#Linker information
LDOPTIONS = /MT
#LD = /cygdrive/c/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/BIN/link
LD = cl
MERGEMANIFEST =
#Library creation information
AR = lib /OUT:$@
RANLIB =
ifeq ($(openmp),yes)
COPTIONS += -D__OPENMP__ /openmp
LDOPTIONS += /openmp
MERGEMANIFEST = vc_mt -manifest $@.manifest -outputresource:$@\;1
endif
#Library information
ifeq ($(cputype),i386)
LIBPLOTDIR = ../Libplot/Win32
else
LIBPLOTDIR = ../Libplot/Win64
endif
LIBS = $(LIBPLOTDIR)/libplot.lib $(BUILDDIR)/libcluto.lib $(GKLIBBUILDDIR)/libGKlib.lib
# Standard file extensions
OBJEXT = .obj
LIBEXT = .lib
EXEEXT = .exe
else
ifeq ($(systype),Linux)
ifeq ($(x86compiler),gcc)
#Compiler information
CC = gcc
OPTFLAGS = -O6
COPTIONS = -DLINUX -D_FILE_OFFSET_BITS=64 -pedantic -std=c99 -pthread
#Linker information
LDOPTIONS =
LD = gcc
MERGEMANIFEST =
#Library creation information
AR = ar rv
RANLIB = ar -ts
else
#Compiler information
CC = icc
OPTFLAGS = -O3
COPTIONS = -DLINUX -D_FILE_OFFSET_BITS=64 -std=c99
#Linker information
LDOPTIONS =
LD = icc
#Library creation information
AR = ar rv
RANLIB = ar -ts
ifeq ($(openmp),yes)
COPTIONS += -D__OPENMP__ -openmp -openmp-report2
LDOPTIONS += -openmp
endif
endif
#Library information
ifeq ($(cputype),x86_64)
LIBPLOTDIR = ../Libplot/Linux64
else
LIBPLOTDIR = ../Libplot/Linux32
endif
endif
ifeq ($(systype),SunOS)
#Compiler information
CC = /opt/SUNWspro/bin/cc
OPTFLAGS = -xO4
COPTIONS =-DSUNOS
#Linker information
LDOPTIONS =
LD = /opt/SUNWspro/bin/cc
#Library creation information
AR = ar rv
RANLIB = ar -ts
#Library information
LIBPLOTDIR = ../Libplot/SunOS
endif
ifeq ($(systype),Darwin)
#Compiler information
CC = gcc
OPTFLAGS = -O6
COPTIONS = -DDARWIN -D_FILE_OFFSET_BITS=64 -pedantic -std=c99
#Linker information
LDOPTIONS = -fvisibility=default
LD = gcc
#Library creation information
AR = ar rv
RANLIB = ar -ts
#Library information
ifeq ($(cputype),i386)
LIBPLOTDIR = ../Libplot/Darwini386
else
LIBPLOTDIR = ../Libplot/DarwinPPC
endif
endif
ifeq ($(systype),CYGWIN)
#Compiler information
CC = gcc
OPTFLAGS = -O6
COPTIONS = -DCYGWIN -DWIN32 -D_FILE_OFFSET_BITS=64 -Wall -std=c99 -pedantic -mno-cygwin
#Linker information
LDOPTIONS = -mno-cygwin
LD = gcc
#Library creation information
AR = ar crv
RANLIB = ar -ts
#Library information
LIBPLOTDIR = ../Libplot/CYGWIN
endif
#-------------------------------------------------------------------
# These defs are common among the GNU/GCC based systems
#-------------------------------------------------------------------
#Compile input/output file specification
SOURCEFILE = -c $<
OUTPUTFILE = -o $@
#Output specification for executables
EXEOUTPUTFILE = -o $@
#Library creation information
AR = ar crv $@
RANLIB = ar -ts $@
#Libraries needed for linking
LIBSDIR = -L$(BUILDDIR) -L$(GKLIBBUILDDIR) -L$(HOME)/local/lib
LIBS = -lGKlib -lpcreposix -lpcre -lz -lm
# Standard file extensions
OBJEXT = .o
LIBEXT = .a
EXEEXT =
endif
#**************************************************************************
DMALLOCINC =
DMALLOCFLAGS =
DEBUGFLAGS =
ifeq ($(dmalloc),yes)
DMALLOCINC = -I$(HOME)/local/include
DMALLOCFLAGS = -DDMALLOC
OPTFLAGS = -g
endif
ifeq ($(debug),yes)
DEBUGFLAGS = -DDEBUG
OPTFLAGS = -g
endif
ifeq ($(gdb),yes)
OPTFLAGS += -g
endif
#**************************************************************************
#**************************************************************************
# Create the build directory if it does not exist
#**************************************************************************
ifeq ($(systype),Darwin)
BINDIR = $(HOME)
else
BINDIR = $(HOME)/work/bin/$(systype)-$(cputype)
$(shell mkdir -p $(BINDIR))
endif
ifeq ($(openmp),no)
BUILDDIR = ./builds/$(systype)-$(cputype)
else
BUILDDIR = ./builds/$(systype)-$(cputype)-openmp
endif
LIBBUILDDIR = $(BUILDDIR)/lib
PRGBUILDDIR = $(BUILDDIR)/prg
$(shell mkdir -p $(BUILDDIR))
$(shell mkdir -p $(LIBBUILDDIR))
$(shell mkdir -p $(PRGBUILDDIR))
INCLUDES = -I./ -I$(GKLIBINCDIR) -I$(LIBPLOTDIR) -I$(HOME)/local/include
CFLAGS = $(COPTIONS) $(OPTFLAGS) $(DEBUGFLAGS) $(INCLUDES)

View File

@ -0,0 +1,342 @@
/*!
\file gksort.c
\brief Testing module for the various sorting routines in GKlib
\date Started 4/4/2007
\author George
\version\verbatim $Id: gksort.c 1421 2007-04-06 14:37:41Z karypis $ \endverbatim
*/
#include <GKlib.h>
#define N 10000
/*************************************************************************/
/*! Testing module for gk_?isort() routine */
/*************************************************************************/
void test_isort()
{
gk_idx_t i;
int array[N];
/* test the increasing sort */
printf("Testing iisort...\n");
for (i=0; i<N; i++)
array[i] = RandomInRange(123432);
gk_iisort(N, array);
for (i=0; i<N-1; i++) {
if (array[i] > array[i+1])
printf("gk_iisort error at index %jd [%d %d]\n", (intmax_t)i, array[i], array[i+1]);
}
/* test the decreasing sort */
printf("Testing disort...\n");
for (i=0; i<N; i++)
array[i] = RandomInRange(123432);
gk_disort(N, array);
for (i=0; i<N-1; i++) {
if (array[i] < array[i+1])
printf("gk_disort error at index %jd [%d %d]\n", (intmax_t)i, array[i], array[i+1]);
}
}
/*************************************************************************/
/*! Testing module for gk_?fsort() routine */
/*************************************************************************/
void test_fsort()
{
gk_idx_t i;
float array[N];
/* test the increasing sort */
printf("Testing ifsort...\n");
for (i=0; i<N; i++)
array[i] = RandomInRange(123432)/(1.0+RandomInRange(645323));
gk_ifsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i] > array[i+1])
printf("gk_ifsort error at index %jd [%f %f]\n", (intmax_t)i, array[i], array[i+1]);
}
/* test the decreasing sort */
printf("Testing dfsort...\n");
for (i=0; i<N; i++)
array[i] = RandomInRange(123432)/(1.0+RandomInRange(645323));
gk_dfsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i] < array[i+1])
printf("gk_dfsort error at index %jd [%f %f]\n", (intmax_t)i, array[i], array[i+1]);
}
}
/*************************************************************************/
/*! Testing module for gk_?idxsort() routine */
/*************************************************************************/
void test_idxsort()
{
gk_idx_t i;
gk_idx_t array[N];
/* test the increasing sort */
printf("Testing iidxsort...\n");
for (i=0; i<N; i++)
array[i] = RandomInRange(123432);
gk_iidxsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i] > array[i+1])
printf("gk_iidxsort error at index %jd [%jd %jd]\n", (intmax_t)i, array[i], array[i+1]);
}
/* test the decreasing sort */
printf("Testing didxsort...\n");
for (i=0; i<N; i++)
array[i] = RandomInRange(123432);
gk_didxsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i] < array[i+1])
printf("gk_didxsort error at index %jd [%jd %jd]\n", (intmax_t)i, array[i], array[i+1]);
}
}
/*************************************************************************/
/*! Testing module for gk_?ikvsort() routine */
/*************************************************************************/
void test_ikvsort()
{
gk_idx_t i;
gk_ikv_t array[N];
/* test the increasing sort */
printf("Testing iikvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432);
array[i].val = i;
}
gk_iikvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key > array[i+1].key)
printf("gk_iikvsort error at index %jd [%d %d] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
/* test the decreasing sort */
printf("Testing dikvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432);
array[i].val = i;
}
gk_dikvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key < array[i+1].key)
printf("gk_dikvsort error at index %jd [%d %d] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
}
/*************************************************************************/
/*! Testing module for gk_?fkvsort() routine */
/*************************************************************************/
void test_fkvsort()
{
gk_idx_t i;
gk_fkv_t array[N];
/* test the increasing sort */
printf("Testing ifkvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432)/(1.0+RandomInRange(645323));
array[i].val = i;
}
gk_ifkvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key > array[i+1].key)
printf("gk_ifkvsort error at index %jd [%f %f] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
/* test the decreasing sort */
printf("Testing dfkvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432)/(1.0+RandomInRange(645323));
array[i].val = i;
}
gk_dfkvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key < array[i+1].key)
printf("gk_dfkvsort error at index %jd [%f %f] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
}
/*************************************************************************/
/*! Testing module for gk_?dkvsort() routine */
/*************************************************************************/
void test_dkvsort()
{
gk_idx_t i;
gk_dkv_t array[N];
/* test the increasing sort */
printf("Testing idkvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432)/(1.0+RandomInRange(645323));
array[i].val = i;
}
gk_idkvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key > array[i+1].key)
printf("gk_idkvsort error at index %jd [%lf %lf] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
/* test the decreasing sort */
printf("Testing ddkvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432)/(1.0+RandomInRange(645323));
array[i].val = i;
}
gk_ddkvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key < array[i+1].key)
printf("gk_ddkvsort error at index %jd [%lf %lf] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
}
/*************************************************************************/
/*! Testing module for gk_?skvsort() routine */
/*************************************************************************/
void test_skvsort()
{
gk_idx_t i;
gk_skv_t array[N];
char line[256];
/* test the increasing sort */
printf("Testing iskvsort...\n");
for (i=0; i<N; i++) {
sprintf(line, "%d", RandomInRange(123432));
array[i].key = gk_strdup(line);
array[i].val = i;
}
gk_iskvsort(N, array);
for (i=0; i<N-1; i++) {
if (strcmp(array[i].key, array[i+1].key) > 0)
printf("gk_idkvsort error at index %jd [%s %s] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
/* test the decreasing sort */
printf("Testing dskvsort...\n");
for (i=0; i<N; i++) {
sprintf(line, "%d", RandomInRange(123432));
array[i].key = gk_strdup(line);
array[i].val = i;
}
gk_dskvsort(N, array);
for (i=0; i<N-1; i++) {
/*printf("%s\n", array[i].key);*/
if (strcmp(array[i].key, array[i+1].key) < 0)
printf("gk_ddkvsort error at index %jd [%s %s] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
}
/*************************************************************************/
/*! Testing module for gk_?idxkvsort() routine */
/*************************************************************************/
void test_idxkvsort()
{
gk_idx_t i;
gk_idxkv_t array[N];
/* test the increasing sort */
printf("Testing iidxkvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432);
array[i].val = i;
}
gk_iidxkvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key > array[i+1].key)
printf("gk_iidxkvsort error at index %jd [%jd %jd] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
/* test the decreasing sort */
printf("Testing didxkvsort...\n");
for (i=0; i<N; i++) {
array[i].key = RandomInRange(123432);
array[i].val = i;
}
gk_didxkvsort(N, array);
for (i=0; i<N-1; i++) {
if (array[i].key < array[i+1].key)
printf("gk_didxkvsort error at index %jd [%jd %jd] [%jd %jd]\n", (intmax_t)i, array[i].key, array[i+1].key, (intmax_t)array[i].val, (intmax_t)array[i+1].val);
}
}
int main()
{
test_isort();
test_fsort();
test_idxsort();
test_ikvsort();
test_fkvsort();
test_dkvsort();
test_skvsort();
test_idxkvsort();
}

View File

@ -0,0 +1,82 @@
/*!
\file strings.c
\brief Testing module for the string functions in GKlib
\date Started 3/5/2007
\author George
\version\verbatim $Id: strings.c 1413 2007-04-05 02:43:48Z karypis $ \endverbatim
*/
#include <GKlib.h>
/*************************************************************************/
/*! Testing module for gk_strstr_replace() */
/*************************************************************************/
void test_strstr_replace()
{
char *new_str;
int rc;
rc = gk_strstr_replace("This is a simple string", "s", "S", "", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("This is a simple string", "s", "S", "g", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("This is a simple SS & ss string", "s", "T", "g", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("This is a simple SS & ss string", "s", "T", "ig", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("This is a simple SS & ss string", "\\b\\w(\\w+)\\w\\b", "$1", "ig", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("This is a simple SS & ss string", "\\b\\w+\\b", "word", "ig", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("http://www.cs.umn.edu/This-is-something-T12323?pp=20&page=4",
"(http://www\\.cs\\.umn\\.edu/)(.*)-T(\\d+)", "$1$2-P$3", "g", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("http://www.cs.umn.edu/This-is-something-T12323?pp=20&page=4",
"(\\d+)", "number:$1", "ig", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
rc = gk_strstr_replace("http://www.cs.umn.edu/This-is-something-T12323?pp=20&page=4",
"(http://www\\.cs\\.umn\\.edu/)", "[$1]", "g", &new_str);
printf("%d, %s.\n", rc, new_str);
gk_free((void **)&new_str, LTERM);
}
int main()
{
test_strstr_replace();
/*
{
int i;
for (i=0; i<1000; i++)
printf("%d\n", RandomInRange(3));
}
*/
}