Commit 947bf9a3 authored by Thimo Neubauer's avatar Thimo Neubauer

added internal grid check. Doesn't check much yet but the

infrastructure exists now

[[Imported from SVN: r1006]]
parent 9e866054
# $Id$
# don't follow the full GNU-standard
AUTOMAKE_OPTIONS = foreign
# need automake >= 1.5
AUTOMAKE_OPTIONS = foreign 1.5
SUBDIRS = common fem grid operator solver lib istl doc m4
......
DUNE-library
============
[descriptional text missing]
Getting started
---------------
The easiest way to use Dune is to rename this directory "dune" if it
has a different name and tell the application about it. That's
it. Really. :)
To compile a small library Dune has to check several components of
your system. Run
./configure
to commence those tests. Don't worry about messages telling you that
libraries are missing: they are only needed for grid-self-checks we
need for developing.
You can use
./configure --prefix=PATH
if you don't want Dune to be installed into /usr/local
If you want to install the Dune-headers globally on your system run
the following as "root":
After configuration
./configure && make install
make
make install
build and install Dune (you may need root-permissions for the install
part depending on the prefix set)
License
-------
......
......@@ -10,11 +10,87 @@ following programs installed on your system:
libtool
Run the script
For the documentation to build you'll need doxygen and latex
installed.
Dune also features a self-test. As some grid-components (e.g. Albert,
UG) depend on external libraries their self-tests will only run if
those libraries are found. The pathes would then need to be passed via
--with-...= parameters.
Important! If you don't want to develop Dune itself you won't need to
provide external components! The Dune-library and -headers are
independent of other libraries, instead the applications can choose
what parts to use.
Getting started
---------------
If these preliminaries are met, you should run the script
./autogen.sh
to get a ./configure-script.
which calls the GNU autoconf/automake to create a ./configure-script
and the Makefiles. The configure-script is automatically called and
you're ready to perform a
make
to build the library and documentation. Dune can be installed into
your system via
make install
You can provide a --prefix=PATH parameter to autogen to install the
components into PATH/lib, PATH/include, ... instead of the default
/usr/local/lib, /usr/local/include
Passing options to ./configure
------------------------------
autogen.sh also calls the newly created configure-script to
conveniently pass on options about the used compiler. Thus you'll have
to provide autogen.sh any options you want configure to get, e.g.
./autogen.sh --with-albert=... --with-ug=...
Choosing the compiler and the options
-------------------------------------
The selection of the compiler works as follows: if --gnu or --intel is
passed to autogen it reads the content of gcc.opts or icc.opts to get
the default compiler flags. With the option --optim you can switch the
compiler-specific optimization parameters on.
If you want to change the compiler options to your favourites you can
either
- adapt the appropriate .opts-file and rerun autogen.sh. Please don't
commit this changed file to CVS if you're not sure if the options
work for everybody.
- copy an existing .opts-file to a new name, change the options and
use
./autogen.sh --opts=my.opts
More info
---------
See
./autogen.sh --help
and (if it exists)
./configure --help
for further options.
The full build-system is described in the doc/Buildsystem
$Id$
......
......@@ -88,7 +88,7 @@ libtoolize --force
# prepare everything
echo "--> aclocal..."
aclocal$AMVERS
aclocal$AMVERS -I m4
# applications should provide a config.h for now
#echo "--> autoheader..."
......
......@@ -9,6 +9,7 @@ AC_CONFIG_SRCDIR([grid/common/grid.hh])
# Checks for programs.
AC_PROG_CXX
AC_LANG_PUSH([C++])
# don't build shared libs per default, this is way better for debugging...
AC_DISABLE_SHARED
......@@ -21,6 +22,20 @@ AC_CHECK_PROGS([BIBTEX], [bibtex], [true])
AC_CHECK_PROGS([DVIPDF], [dvipdf], [true])
AC_CHECK_PROGS([DVIPS], [dvips], [true])
echo
echo Checking for libraries the self-test could use:
echo
# -- check for other grid-libs so that they may be included into tests
# Albert-check
DUNE_PATH_ALBERT
DUNE_PATH_ALBERTA
# UG-check
DUNE_PATH_UG
DUNE_PATH_AMIRAMESH
# Yaspgrid-check
DUNE_MPI
# create symlink for consistent paths even when $(top_srcdir) is not
# called dune/ (if filesystem/OS supports symlinks)
AC_PROG_LN_S
......@@ -61,6 +76,12 @@ fi
# preset variable to path such that #include <dune/...> works
AC_SUBST(AM_CPPFLAGS)
echo
echo Note: the libraries checked for above are only used for the self-test of Dune.
echo The library itself will build and the headers will work even if
echo Albert, UG, Amiramesh, MPI, etc. cannot be found.
echo
# write output
AC_CONFIG_FILES([Makefile
common/Makefile
......@@ -71,8 +92,11 @@ AC_CONFIG_FILES([Makefile
fem/operator/Makefile
grid/Makefile
grid/albertgrid/Makefile
grid/bsgrid/Makefile
grid/common/Makefile
grid/sgrid/Makefile
grid/test/Makefile
grid/uggrid/Makefile
grid/yaspgrid/Makefile
istl/Makefile
istl/doc/Makefile
......
# $Id$
SUBDIRS = albertgrid common sgrid yaspgrid
SUBDIRS = albertgrid bsgrid common sgrid uggrid yaspgrid . test
griddir = $(includedir)/dune/grid
grid_HEADERS = albertgrid.hh \
bsgrid.hh \
sgrid.hh \
simplegrid.hh \
uggrid.hh \
yaspgrid.hh
Makefile
Makefile.in
semantic.cache
\ No newline at end of file
# $Id$
bsgriddir = $(includedir)/dune/grid/bsgrid/
bsgrid_HEADERS = bsgrid.cc bsinclude.hh leafwalk.hh myautoptr.hh systemincludes.hh
Makefile
Makefile.in
.deps
.libs
test-albert
test-sgrid
test-ug
test-yaspgrid
semantic.cache
\ No newline at end of file
# $Id$
# need two lists because yaspgrid needs small shell-wrapper to start with MPI
PROGLIST = test-sgrid
RUNLIST = test-sgrid
if MPI
PROGLIST += test-yaspgrid
RUNLIST += run-yaspgrid
endif
if ALBERT
PROGLIST += test-albert
RUNLIST += test-albert
endif
# UGGrid needs AmiraMeshReader for now...
# !!! trick around to beat automake
if AMIRAMESH
DO_UGTEST = test-ug
else
DO_UGTEST =
endif
if UG
PROGLIST += $(DO_UGTEST)
RUNLIST += $(DO_UGTEST)
endif
# which tests to run
TESTS = $(RUNLIST)
# programs just to build when "make check" is used
check_PROGRAMS = $(PROGLIST)
# define the programs
test_sgrid_SOURCES = test-sgrid.cc
test_yaspgrid_SOURCES = test-yaspgrid.cc
test_yaspgrid_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CPPFLAGS)
# !! last lib a bit weird...
test_yaspgrid_LDFLAGS = $(MPI_LDFLAGS) $(MPI_LIBS) ../../common/libcommon.la
# this implicitly checks the autoconf-test as well...
test_albert_SOURCES = test-albert.cc
test_albert_CPPFLAGS = $(AM_CPPFLAGS) $(ALBERT_CPPFLAGS)
test_albert_LDFLAGS = $(ALBERT_LDFLAGS) $(ALBERT_LIBS)
test_ug_SOURCES = test-ug.cc
test_ug_CPPFLAGS = $(AM_CPPFLAGS) $(UG_CPPFLAGS) $(AMIRAMESH_CPPFLAGS)
test_ug_LDFLAGS = $(UG_LDFLAGS) $(UG_LIBS) $(AMIRAMESH_LDFLAGS) $(AMIRAMESH_LIBS)
DIM: 2
DIM_OF_WORLD: 2
number of elements: 2
number of vertices: 4
vertex coordinates:
0.0 0.0
1.0 0.0
1.0 1.0
0.0 1.0
element vertices:
2 0 1
0 2 3
element boundaries:
1 1 0
1 1 0
DIM: 3
DIM_OF_WORLD: 3
number of vertices: 8
number of elements: 6
vertex coordinates:
0.0 0.0 0.0
1.0 0.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
1.0 1.0 0.0
1.0 1.0 1.0
0.0 1.0 0.0
0.0 1.0 1.0
element vertices:
0 5 4 1
0 5 3 1
0 5 3 2
0 5 4 6
0 5 7 6
0 5 7 2
element boundaries:
1 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
1 1 0 0
element neighbours:
-1 -1 1 3
-1 -1 0 2
-1 -1 5 1
-1 -1 4 0
-1 -1 3 5
-1 -1 2 4
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id$
/*
Implements a generic grid check
*/
template <class Grid>
void gridcheck (Grid &g) {
// internal check if interface is complete
g.checkIF();
};
#!/bin/sh
# run lamboot if possible
lamboot 2>&1 > /dev/null
# start test and abort on fail
set -e
mpirun -np 1 test-yaspgrid
set +e
# possibly stop LAM again
lamhalt 2>&1 > /dev/null
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id$
/*
Instantiate Albert-Grid and feed it to the generic gridcheck()
Note: Albert needs the defines DIM and DIM_OF_WORLD on the
commandline anyway thus we can use them to select the correct class
*/
#include <iostream>
#include <sstream>
#include <dune/grid/albertgrid.hh>
#include "gridcheck.cc"
int main () {
try {
/* use grid-file appropriate for dimensions */
std::ostringstream filename;
filename << "albert-testgrid-" << DIM << "-" << DIM_OF_WORLD << ".al";
std::cout << std::endl << "AlbertGrid<" << DIM << "," << DIM_OF_WORLD
<< "> with grid file: " << filename.str()
<< std::endl << std::endl;
// extra-environment to check destruction
{
Dune::AlbertGrid<DIM,DIM_OF_WORLD> grid(filename.str().c_str());
gridcheck(grid);
};
} catch (Dune::Exception &e) {
std::cerr << e << std::endl;
return 1;
} catch (...) {
std::cerr << "Generic exception!" << std::endl;
return 2;
}
return 0;
};
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id$
#include <iostream>
#include <dune/grid/sgrid.hh>
#include "gridcheck.cc"
int main () {
try {
int n[] = { 10, 10, 10 };
double h[] = { 1.0, 2.0, 3.0 };
// extra-environment to check destruction
{
std::cout << std::endl << "SGrid<2,2>" << std::endl << std::endl;
Dune::SGrid<2,2> g1(n, h);
gridcheck(g1);
};
{
std::cout << std::endl << "SGrid<3,3>" << std::endl << std::endl;
Dune::SGrid<3,3> g2(n, h);
gridcheck(g2);
};
} catch (Dune::Exception &e) {
std::cerr << e << std::endl;
return 1;
} catch (...) {
std::cerr << "Generic exception!" << std::endl;
return 2;
}
return 0;
};
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id$
/*
Instantiate UG-Grid and feed it to the generic gridcheck()
Note: UG needs -D_2 or -D_3 defined anyway, use it to select correct
gridfile and class
Currently UGGrid can only be initialized via the AmiraMeshReader
*/
#include <iostream>
// transform define to value
#ifdef _2
static const int DIM = 2;
#else
static const int DIM = 3;
#endif
#include <dune/grid/uggrid.hh>
#include <dune/io/file/amirameshreader.hh>
#include "gridcheck.cc"
int main () {
try {
/* use grid-file appropriate for dimensions */
std::ostringstream filename;
filename << "ug-testgrid-" << DIM << ".am";
std::cout << std::endl << "UGGrid<" << DIM << "," << DIM
<< "> with grid file: " << filename.str()
<< std::endl << std::endl;
// extra-environment to check destruction
{
typedef Dune::UGGrid<DIM,DIM> Grid;
Grid grid;
Dune::AmiraMeshReader<Grid>::read(grid, filename.str());
gridcheck(grid);
};
} catch (Dune::Exception &e) {
std::cerr << e << std::endl;
return 1;
} catch (...) {
std::cerr << "Generic exception!" << std::endl;
return 2;
}
return 0;
};
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id$
#include <iostream>
#include <dune/grid/yaspgrid.hh>
#include "gridcheck.cc"
template <int dim>
void check_yasp() {
typedef Dune::FieldVector<int,dim> iTupel;
typedef Dune::FieldVector<double,dim> fTupel;
typedef Dune::FieldVector<bool,dim> bTupel;
std::cout << std::endl << "YaspGrid<" << dim << "," << dim << ">"
<< std::endl << std::endl;
fTupel Len; Len = 1.0;
iTupel s; s = 10;
bTupel p; p = false;
int overlap = 1;
Dune::YaspGrid<dim,dim> grid(MPI_COMM_WORLD,Len,s,p,overlap);
gridcheck(grid);
};
int main (int argc , char **argv) {
try {
// initialize MPI
MPI_Init(&argc,&argv);
// get own rank
/* int rank;
MPI_Comm_rank(MPI_COMM_WORLD,&rank); */
check_yasp<2>();
check_yasp<3>();
} catch (Dune::Exception &e) {
std::cerr << e << std::endl;
return 1;
} catch (...) {
std::cerr << "Generic exception!" << std::endl;
return 2;
}
// Terminate MPI
MPI_Finalize();
return 0;
};
# AmiraMesh 3D ASCII 2.0
# CreationDate: Mon Jun 28 11:41:40 2004
nNodes 184
nTriangles 350
Parameters {
Materials {
Substrat1 {
Color 0.8 0.1 0.1
}
Substrat2 {
Color 0.1 0.1 0.8
}
}
ContentType "HxTriangularGrid",
CreateMagnitude 1
}
Nodes { float[2] Coordinates } @1
TriangleData { int[3] Nodes } @2
TriangleData { byte Materials } @3
# Data section follows
@1
-6.74712 -7.23423
-10 -10
-5 -10
-10 -5
-3.29672 -6.92638
-5.44939 -4.24873
0 -10
-7.33975 -2.17986
-2.30707 -4.13178
-10 0
-0.295065 -5.95143
-5.01616 -1.7186
-3.47772 -2.56409
-6.2583 0.060481
2.7777 -6.73409
-0.419931 -3.91606
5 -10
-2.1147 -2.47284
-6.8306 2.84988
-3.45931 -1.21214
-1.1336 -2.85857
-4.16406 -0.183054
1.46268 -4.0076
-10 5
-2.56818 -1.61737
6.44284 -6.43305
-4.23751 1.58408
0.158393 -2.63911
4.05796 -4.01423
-1.41226 -2.07143
-3.01335 -0.346542
10 -10
-6.44466 6.43386
-1.82522 -1.60806
-2.56939 -0.859834
-4.0637 4.01707
-0.73046 -1.93106
-3.05215 0.519542
1.34254 -2.32424
2.6174 -2.47719
6.82883 -2.84894
-10 10
10 -5
-2 -1
-2.62794 2.48432
-1.27643 -1.49457
-0.057279 -1.71607
-2.70823 1.33052
-2.40705 -0.39289
0.634644 -1.72502
-2.78232 6.73571
-2.47246 0.035811
4.2342 -1.58194
-5 10
-1.6 -1
1.92013 -1.60395
-2 -0.6
-1.47796 4.0131
-0.901469 -1.36127
10 0
-0.504954 -1.38233
-2.42626 0.776375
1.26566 -1.49211
-2.38698 0.4273
-1.93012 1.61307
2.70417 -1.32731
6.25716 -0.059932
0.238141 -1.33331
-1.73428 -0.747698
-2 -0.2
-1.2 -1
-1.3709 2.34565
0 10
-0.144485 -1.28641
0.287877 5.95276
-2 1
0.898961 -1.29792
-2 0.2
0.594455 -1.27146
1.6 -1
3.05079 -0.518581
-0.8 -1
4.16284 0.183609
2 -1
-1.41128 -0.703531
-2 0.6
-1.65962 -0.435143
7.33906 2.17994
-0.197616 2.64307
0.403381 3.91756
-0.4 -1
-1.28514 1.51612
1.2 -1
-1.6 1
0 -1
0.4 -1
2.42522 -0.775554
10 5
-1.55571 -0.000143
3.29413 6.92652
5.01489 1.71866
-1.01744 -0.679007
0.8 -1
-0.714791 1.80497
-1.73435 0.74761
1.73546 -0.747663
-1.65972 0.434956
3.0127 0.346763
2.2996 4.1315
-1.25534 -0.359754
-0.608933 -0.670481
1.41405 -0.703472
5 10
2.38652 -0.426954
1.11567 2.85598
2 -0.6
3.45803 1.21206
-1.2 1
-0.199917 -0.668009
5.44742 4.24866
2.47211 -0.035592
0.208158 -0.667996
-0.036356 1.65276
1.02238 -0.678945
-0.899959 1.33233
0.615908 -0.670439
-1.41141 0.703345
0.701443 1.91699
-1.25551 0.359352
-1.05787 -0.000284
-0.82841 -0.340841
6.74635 7.23424
1.66225 -0.435078
3.47451 2.56364
2.10716 2.47108
2.56876 0.859748
-0.501653 1.34002
2.40682 0.392941
2 -0.2
10 10
-0.408379 -0.335688
1.26162 -0.35965
0.007161 -0.334589
-0.8 1
1.39921 2.0665
-1.01764 0.678714
0.421583 -0.335641
0.838605 -0.340752
0.481727 1.36264
2.56561 1.61669
2 0.2
-0.828638 0.340261
-0.160087 1.24929
-0.622004 -0.000371
1.55984 -5.9e-05
0.137086 1.25302
1.26704 1.48987
2 0.6
0.889521 1.35363
1.82022 1.60611
-0.4 1
-0.20068 -0.000407
2 1
-0.609185 0.670108