From cef76ee3e6a129ad197b5f5f9d50544812cebea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Mon, 23 Aug 2010 08:04:06 +0000 Subject: [PATCH] Add SVN infrastructure for upscaling solvers. --- Makefile.am | 22 +++++++++++ README | 73 +++++++++++++++++++++++++++++++++++++ configure.ac | 33 +++++++++++++++++ doc/Makefile.am | 12 ++++++ doc/doxygen/Doxylocal | 30 +++++++++++++++ doc/doxygen/Makefile.am | 7 ++++ dune-upscaling.pc.in | 15 ++++++++ dune.module | 10 +++++ dune/Makefile.am | 3 ++ dune/upscaling/Makefile.am | 4 ++ dune/upscaling/upscaling.hh | 6 +++ m4/Makefile.am | 8 ++++ m4/dune-upscaling.m4 | 17 +++++++++ src/Makefile.am | 42 +++++++++++++++++++++ src/dune_upscaling.cc | 27 ++++++++++++++ stamp-vc | 1 + 16 files changed, 310 insertions(+) create mode 100644 Makefile.am create mode 100644 README create mode 100644 configure.ac create mode 100644 doc/Makefile.am create mode 100644 doc/doxygen/Doxylocal create mode 100644 doc/doxygen/Makefile.am create mode 100644 dune-upscaling.pc.in create mode 100644 dune.module create mode 100644 dune/Makefile.am create mode 100644 dune/upscaling/Makefile.am create mode 100644 dune/upscaling/upscaling.hh create mode 100644 m4/Makefile.am create mode 100644 m4/dune-upscaling.m4 create mode 100644 src/Makefile.am create mode 100644 src/dune_upscaling.cc create mode 100644 stamp-vc diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8104012 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,22 @@ +# $Id: duneproject 5842 2010-01-20 18:48:34Z joe $ + +# we need the module file to be able to build via dunecontrol +EXTRA_DIST=dune.module + +SUBDIRS = src m4 dune doc + +if BUILD_DOCS +# TODO: set up documentation tree automatically +#SUBDIRS += doc +endif + +# don't follow the full GNU-standard +# we need automake 1.5 +AUTOMAKE_OPTIONS = foreign 1.5 + +# pass most important options when "make distcheck" is used +DISTCHECK_CONFIGURE_FLAGS = --with-dune-common=$(DUNE_COMMON_ROOT) --with-dune-grid=$(DUNE_GRID_ROOT) --with-dune-istl=$(DUNE_ISTL_ROOT) --with-dune-cornerpoint=$(DUNE_CORNERPOINT_ROOT) --with-dune-porsol=$(DUNE_PORSOL_ROOT) CXX="$(CXX)" CC="$(CC)" + +include $(top_srcdir)/am/top-rules +include $(top_srcdir)/am/global-rules + diff --git a/README b/README new file mode 100644 index 0000000..004f5a4 --- /dev/null +++ b/README @@ -0,0 +1,73 @@ +Preparing the Sources +========================= + +Additional to the software mentioned in README you'll need the +following programs installed on your system: + + automake >= 1.5 + + autoconf >= 2.50 + + libtool + +Getting started +--------------- + +If these preliminaries are met, you should run + + dunecontrol all + +which will find all installed dune modules as well as all dune modules +(not installed) which sources reside in a subdirectory of the current +directory. Note that if dune is not installed properly you will either +have to add the directory where the dunecontrol script resides (probably +./dune-common/bin) to your path or specify the relative path of the script. + +On your project and all uninstalled DUNE source modules found the script +will then calls the GNU autoconf/automake to create a ./configure-script +and the Makefiles. Afterwards that configure script will be called and the +modules will be build using make all + +Most probably you'll have to provide additional information to dunecontrol +(e. g. compilers, configure options) and/or make options. + +The most convenient way is to use options files in this case. The files +defining three variables: + +AUTOGEN_FLAGS flags passed to autogen +CONFIGURE_FLAGS flags passed to configure +MAKE_FLAGS flags passed to make + +An example options file might look like this: + +#use this options to autogen, configure and make if no other options are given +AUTOGEN_FLAGS="--ac=2.50 --ac=1.8" #Forces automake 2,50 and autoconf 1.8 +CONFIGURE_FLAGS="CXX=g++-3.4 --prefix=/install/path" #force g++-3.4 as compiler +MAKE_FLAGS=install #Per default run make install instead of simply make + +If you save this information into example.opts you can path the opts file to +dunecontrol via the --opts option, e. g. + + dunecontrol --opts=example.opts all + +To get a full list of available configure flags just run + + dunecontrol configure --help + +after running at least + dunecontrol autogen + +More info +--------- + +See + + dunecontrol --help + +for further options. + + +The full build-system is described in the dune-common/doc/buildsystem (SVN version) or under share/doc/dune-common/buildsystem if you installed DUNE! + +$Id: duneproject 5842 2010-01-20 18:48:34Z joe $ + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..1c03159 --- /dev/null +++ b/configure.ac @@ -0,0 +1,33 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. +AC_PREREQ(2.50) +DUNE_AC_INIT # gets module version from dune.module file +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([src/dune_upscaling.cc]) +AM_CONFIG_HEADER([config.h]) + + +# we need no more than the standard DE-stuff +# this module depends on dune-common dune-grid dune-istl dune-cornerpoint dune-porsol +# this implies checking for [dune-common], [dune-grid], [dune-istl], [dune-cornerpoint], [dune-porsol] +DUNE_CHECK_ALL + +# implicitly set the Dune-flags everywhere +AC_SUBST(AM_CPPFLAGS, $DUNE_CPPFLAGS) +AC_SUBST(AM_LDFLAGS, $DUNE_LDFLAGS) +LIBS="$DUNE_LIBS" + +AC_CONFIG_FILES([ + Makefile + src/Makefile + doc/Makefile + doc/doxygen/Makefile + doc/doxygen/Doxyfile + dune/Makefile + dune/upscaling/Makefile + m4/Makefile + dune-upscaling.pc +]) +AC_OUTPUT +# finally print the summary information +DUNE_SUMMARY_ALL diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..c162461 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,12 @@ + +SUBDIRS = doxygen +CURDIR = doc +BASEDIR = .. + +# add list of html files to generate from wml +PAGES= + +docdir=$(datadir)/doc/dune-upscaling + +include $(top_srcdir)/am/webstuff +include $(top_srcdir)/am/global-rules diff --git a/doc/doxygen/Doxylocal b/doc/doxygen/Doxylocal new file mode 100644 index 0000000..d8f6249 --- /dev/null +++ b/doc/doxygen/Doxylocal @@ -0,0 +1,30 @@ +# This file contains local changes to the doxygen configuration +# please us '+=' to add file/directories to the lists + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT += @top_srcdir@/dune/ +# see e.g. dune-grid for the examples of mainpage and modules +# INPUT += @srcdir@/mainpage # @srcdir@/modules + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +# EXCLUDE += @top_srcdir@/dune/upscaling/test + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +# EXAMPLE_PATH += @top_srcdir@/src + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +# IMAGE_PATH += @top_srcdir@/dune/upscaling/pics + diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am new file mode 100644 index 0000000..d94c751 --- /dev/null +++ b/doc/doxygen/Makefile.am @@ -0,0 +1,7 @@ + +BASEDIR=../.. +CURDIR=doc/doxygen + +include $(top_srcdir)/am/doxygen +include $(top_srcdir)/am/global-rules + diff --git a/dune-upscaling.pc.in b/dune-upscaling.pc.in new file mode 100644 index 0000000..4fc53f2 --- /dev/null +++ b/dune-upscaling.pc.in @@ -0,0 +1,15 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +CXX=@CXX@ +CC=@CC@ +DEPENDENCIES=@REQUIRES@ + +Name: @PACKAGE_NAME@ +Version: @VERSION@ +Description: dune-upscaling module +URL: http://dune-project.org/ +Requires: dune-common dune-grid dune-istl dune-cornerpoint dune-porsol +Libs: -L +Cflags: -I diff --git a/dune.module b/dune.module new file mode 100644 index 0000000..2bf06bb --- /dev/null +++ b/dune.module @@ -0,0 +1,10 @@ +################################ +# Dune module information file # +################################ + +#Name of the module +Module: dune-upscaling +Version: 0.1 +Maintainer: atgeirr@sintef.no +#depending on +Depends: dune-common dune-grid dune-istl dune-cornerpoint dune-porsol diff --git a/dune/Makefile.am b/dune/Makefile.am new file mode 100644 index 0000000..011b7d9 --- /dev/null +++ b/dune/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = upscaling + +include $(top_srcdir)/am/global-rules diff --git a/dune/upscaling/Makefile.am b/dune/upscaling/Makefile.am new file mode 100644 index 0000000..3bd8cb5 --- /dev/null +++ b/dune/upscaling/Makefile.am @@ -0,0 +1,4 @@ +upscalingincludedir = $(includedir)/dune/upscaling +upscalinginclude_HEADERS = upscaling.hh + +include $(top_srcdir)/am/global-rules diff --git a/dune/upscaling/upscaling.hh b/dune/upscaling/upscaling.hh new file mode 100644 index 0000000..260bf0b --- /dev/null +++ b/dune/upscaling/upscaling.hh @@ -0,0 +1,6 @@ +#ifndef DUNE_upscaling.hh +#define DUNE_upscaling.hh + +// add your classes here + +#endif // DUNE_upscaling.hh diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..f4008cc --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,8 @@ +M4FILES = dune-upscaling.m4 + +aclocaldir = $(datadir)/aclocal +aclocal_DATA = $(M4FILES) + +EXTRA_DIST = $(M4FILES) + +include $(top_srcdir)/am/global-rules diff --git a/m4/dune-upscaling.m4 b/m4/dune-upscaling.m4 new file mode 100644 index 0000000..cc8305d --- /dev/null +++ b/m4/dune-upscaling.m4 @@ -0,0 +1,17 @@ +dnl -*- autoconf -*- +# Macros needed to find dune-upscaling and dependent libraries. They are called by +# the macros in ${top_src_dir}/dependencies.m4, which is generated by +# "dunecontrol autogen" + +# Additional checks needed to build dune-upscaling +# This macro should be invoked by every module which depends on dune-upscaling, as +# well as by dune-upscaling itself +AC_DEFUN([DUNE_UPSCALING_CHECKS]) + +# Additional checks needed to find dune-upscaling +# This macro should be invoked by every module which depends on dune-upscaling, but +# not by dune-upscaling itself +AC_DEFUN([DUNE_UPSCALING_CHECK_MODULE], +[ + DUNE_CHECK_MODULES([dune-upscaling],[upscaling/upscaling.hh]) +]) diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..6f6085d --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,42 @@ + +SUBDIRS = + +noinst_PROGRAMS = dune_upscaling + +dune_upscaling_SOURCES = dune_upscaling.cc + +dune_upscaling_CPPFLAGS = $(AM_CPPFLAGS) \ + $(DUNEMPICPPFLAGS) \ + $(UG_CPPFLAGS) \ + $(AMIRAMESH_CPPFLAGS) \ + $(ALBERTA_CPPFLAGS) \ + $(ALUGRID_CPPFLAGS) +# The libraries have to be given in reverse order (most basic libraries +# last). Also, due to some misunderstanding, a lot of libraries include the +# -L option in LDFLAGS instead of LIBS -- so we have to include the LDFLAGS +# here as well. +dune_upscaling_LDADD = \ + $(DUNE_LDFLAGS) $(DUNE_LIBS) \ + $(ALUGRID_LDFLAGS) $(ALUGRID_LIBS) \ + $(ALBERTA_LDFLAGS) $(ALBERTA_LIBS) \ + $(AMIRAMESH_LDFLAGS) $(AMIRAMESH_LIBS) \ + $(UG_LDFLAGS) $(UG_LIBS) \ + $(DUNEMPILIBS) \ + $(LDADD) +dune_upscaling_LDFLAGS = $(AM_LDFLAGS) \ + $(DUNEMPILDFLAGS) \ + $(UG_LDFLAGS) \ + $(AMIRAMESH_LDFLAGS) \ + $(ALBERTA_LDFLAGS) \ + $(ALUGRID_LDFLAGS) \ + $(DUNE_LDFLAGS) + +# don't follow the full GNU-standard +# we need automake 1.5 +AUTOMAKE_OPTIONS = foreign 1.5 + +# pass most important options when "make distcheck" is used +DISTCHECK_CONFIGURE_FLAGS = --with-dune-common=$(DUNE_COMMON_ROOT) --with-dune-grid=$(DUNE_GRID_ROOT) --with-dune-istl=$(DUNE_ISTL_ROOT) --with-dune-cornerpoint=$(DUNE_CORNERPOINT_ROOT) --with-dune-porsol=$(DUNE_PORSOL_ROOT) CXX="$(CXX)" CC="$(CC)" + +include $(top_srcdir)/am/global-rules + diff --git a/src/dune_upscaling.cc b/src/dune_upscaling.cc new file mode 100644 index 0000000..07311e9 --- /dev/null +++ b/src/dune_upscaling.cc @@ -0,0 +1,27 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include"dune/common/mpihelper.hh" // An initializer of MPI +#include"dune/common/exceptions.hh" // We use exceptions + +int main(int argc, char** argv) +{ + try{ + //Maybe initialize Mpi + Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv); + std::cout << "Hello World! This is dune-upscaling." << std::endl; + if(Dune::MPIHelper::isFake) + std::cout<< "This is a sequential program." << std::endl; + else + std::cout<<"I am rank "<