create 5.2 branch

This commit is contained in:
Joachim Schoeberl 2014-01-09 09:19:48 +00:00
commit dfd50a0b24
448 changed files with 269672 additions and 0 deletions

1
AUTHORS Normal file
View File

@ -0,0 +1 @@
Joachim Schoeberl <joachim.schoeberl@tuwien.ac.at>

0
ChangeLog Normal file
View File

167
INSTALL Normal file
View File

@ -0,0 +1,167 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Type `make install' to install the programs and any data files and
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

10
Makefile.am Normal file
View File

@ -0,0 +1,10 @@
ACLOCAL_AMFLAGS = -I m4
METASOURCES = AUTO
SUBDIRS = libsrc ng tutorials doc windows nglib
# nglib
# TESTS = ng/netgen -batchmode

802
Makefile.in Normal file
View File

@ -0,0 +1,802 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS ChangeLog INSTALL NEWS TODO \
config.guess config.sub depcomp install-sh ltmain.sh missing \
mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/tcl.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLEANFILES = @CLEANFILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH = @CYGPATH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FFMPEG_INCLUDES = @FFMPEG_INCLUDES@
FFMPEG_LIBS = @FFMPEG_LIBS@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JPEGLIB_INCLUDES = @JPEGLIB_INCLUDES@
JPEGLIB_LIBS = @JPEGLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGLU = @LIBGLU@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPI_INCLUDES = @MPI_INCLUDES@
MPI_LIBS = @MPI_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OCCFLAGS = @OCCFLAGS@
OCCLIBS = @OCCLIBS@
OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CFLAGS = @PKG_CFLAGS@
PKG_HEADERS = @PKG_HEADERS@
PKG_INCLUDES = @PKG_INCLUDES@
PKG_LIBS = @PKG_LIBS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_DEFS = @TCL_DEFS@
TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
TCL_INCLUDES = @TCL_INCLUDES@
TCL_LD_FLAGS = @TCL_LD_FLAGS@
TCL_LIBS = @TCL_LIBS@
TCL_LIB_FILE = @TCL_LIB_FILE@
TCL_LIB_FLAG = @TCL_LIB_FLAG@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
TCL_SRC_DIR = @TCL_SRC_DIR@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_VERSION = @TCL_VERSION@
TK_BIN_DIR = @TK_BIN_DIR@
TK_INCLUDES = @TK_INCLUDES@
TK_LIBS = @TK_LIBS@
TK_LIB_FILE = @TK_LIB_FILE@
TK_LIB_FLAG = @TK_LIB_FLAG@
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_SRC_DIR = @TK_SRC_DIR@
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
TK_VERSION = @TK_VERSION@
TK_XINCLUDES = @TK_XINCLUDES@
TOGLLIBDIR = @TOGLLIBDIR@
TOGL_WINDOWINGSYSTEM = @TOGL_WINDOWINGSYSTEM@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
METASOURCES = AUTO
SUBDIRS = libsrc ng tutorials doc windows nglib
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am
# nglib
# TESTS = ng/netgen -batchmode
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

0
NEWS Normal file
View File

0
TODO Normal file
View File

977
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,977 @@
# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
[m4_warning([this file was generated for autoconf 2.68.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11.3], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11.3])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
# 2010, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
am__universal=false
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac])
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 5
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 16
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.62])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 6
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
fi
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[[\\\"\#\$\&\'\`$am_lf]]*)
AC_MSG_ERROR([unsafe absolute working directory name]);;
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
esac
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4_if([$1], [v7],
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])
m4_include([m4/ltversion.m4])
m4_include([m4/lt~obsolete.m4])
m4_include([m4/tcl.m4])

1530
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

80
config.h.in Normal file
View File

@ -0,0 +1,80 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the `matherr' function. */
#undef HAVE_MATHERR
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Are we building against Mac OS X TkAqua? */
#undef MAC_OSX_TK
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

1773
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

19190
configure vendored Executable file

File diff suppressed because it is too large Load Diff

255
configure.ac Normal file
View File

@ -0,0 +1,255 @@
AC_INIT([netgen],[5.2-alpha],[],[])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_MACRO_DIR([m4])
AC_PREFIX_DEFAULT(["/opt/netgen"])
# AC_HEADER_STDC
AC_CONFIG_HEADERS(config.h)
AC_DISABLE_STATIC
AC_LANG([C++])
AC_PROG_CXX
AC_OPENMP
CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
# LDFLAGS="$LDFLAGS $OPENMP_CXXFLAGS"
AC_PROG_LIBTOOL
LT_INIT
# OpenCASCADE configuration
occon=false
AC_ARG_ENABLE([occ],
[AC_HELP_STRING([--enable-occ],[compile with OpenCascade geometry kernel])],
[occon=true])
AC_ARG_WITH([occ],
[AC_HELP_STRING([--with-occ=dir],[use OpenCascade installed in directory dir])],
[occdir=$withval]
[occon=true],
[occdir=/opt/OpenCASCADE]
)
if test a$occon = atrue ; then
AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"])
AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"])
# -lTKDCAF
if test a$build_cpu = ax86_64 ; then
AC_SUBST([OCCFLAGS],["$OCCFLAGS -D_OCC64"])
fi
AC_CHECK_HEADER([iostream],[OCCFLAGS="$OCCFLAGS -DHAVE_IOSTREAM"])
AC_CHECK_HEADER([iostream.h],[OCC_FLAGS="$OCCFLAGS -DHAVE_IOSTREAM_H"])
AC_CHECK_HEADER([limits],[OCCFLAGS="$OCCFLAGS -DHAVE_LIMITS"])
AC_CHECK_HEADER([limits.h],[OCCFLAGS="$OCCFLAGS -DHAVE_LIMITS_H"])
AC_CHECK_HEADER([iomanip],[OCCFLAGS="$OCCFLAGS -DHAVE_IOMANIP"])
AC_CHECK_HEADER([iomanip.h],[OCCFLAGS="$OCCFLAGS -DHAVE_IOMANIP_H"])
echo "OCCFLAGS = $OCCFLAGS"
echo "OCCLIBS = $OCCLIBS"
fi
AC_ARG_WITH([togl],
[AC_HELP_STRING([--with-togl=dir],[directory containing libTogl1.7])],
[togldir=$withval]
[togllibfl="-L$withval$"]
)
# [togllibfl="-L$(TK_BIN_DIR)/Togl1.7"]
# [togllibfl="-L/usr/local/lib/Togl1.7"]
nglibon=true
AC_ARG_ENABLE([nglib],
[AC_HELP_STRING([--enable-nglib],[generate shared library nglib])],
[if test "$enableval" = yes; then nglibon=true; else nglibon=false; fi])
ngguion=true
AC_ARG_ENABLE([gui],
[AC_HELP_STRING([--disable-gui],[don't build netgen with GUI])],
[if test "$enableval" = yes; then ngguion=true; else ngguion=false; fi])
metisdir=/usr/local
AC_ARG_WITH([metis],
[AC_HELP_STRING([--with-metis=dir],[path to metis 5.x])],
[metisdir=$withval],
[metisdir=/usr/local]
)
AC_ARG_ENABLE([parallel],
[AC_HELP_STRING([--enable-parallel],[enable mpi parallelization])],
[AC_SUBST([MPI_INCLUDES], "-I$metisdir/include -DMETIS")]
[CXXFLAGS="$CXXFLAGS -DPARALLEL"]
[AC_SUBST([MPI_LIBS], "-L$metisdir/lib -lmetis")]
)
# -DVTRACE
# -lvt-hyb
# [AC_SUBST([MPI_INCLUDES], "-I/opt/mpich/include -I/usr/include/mpich2 -I/usr/include/metis -DPARALLEL -I/usr/share/metis/Lib -DMETIS -DVTRACE -I/usr/local/include/vampirtrace")
# AC_SUBST([MPI_LIBS], "-lmetis -L/opt/mpich/ch-p4/lib -lmpich")
# -lvt -lvt-mpi -lvt-mpi-unify")
# [AC_SUBST([MPI_INCLUDES], "-I/opt/mpich/include -DPARALLEL -I/usr/include/metis -DMETIS")
# AC_SUBST([MPI_LIBS], " -L/opt/mpich/ch-p4/lib64 -lmpich -lmetis")
# [AC_SUBST([MPI_INCLUDES], "-DPARALLEL -DNO_PARALLEL_THREADS -I/opt/mpich/include")
# AC_SUBST([MPI_LIBS], "")
# -lmetis
# [AC_SUBST([MPI_INCLUDES], "-I/opt/mpich/include -DPARALLEL -I/home/joachim/download/metis-4.0/Lib -DMETIS")
# AC_SUBST([MPI_LIBS], "-L/home/joachim/download/metis-4.0 -lmetis -L/opt/mpich/ch-p4/lib64 -lmpich")
jpeglibon=false
AC_ARG_ENABLE([jpeglib],
[AS_HELP_STRING([--enable-jpeglib],[enable snapshots using library libjpeg])],
[AC_SUBST([JPEGLIB_INCLUDES], "-DJPEGLIB")
AC_CHECK_LIB(jpeg, jpeg_start_compress,
AC_SUBST([JPEGLIB_LIBS], "-ljpeg") ,
AC_MSG_ERROR([no usable library libjpeg found]))
[if test "$enableval" = yes; then jpeglibon=true; else jpeglibon=false; fi]
]
)
ffmpegon=false
AC_ARG_ENABLE([ffmpeg],
[AS_HELP_STRING([--enable-ffmpeg],[enable video recording with FFmpeg, uses libavcodec])],
[AC_SUBST([FFMPEG_INCLUDES], "-DFFMPEG -D__STDC_CONSTANT_MACROS")
AC_SUBST([FFMPEG_LIBS], "-lavutil -lavformat -lavcodec -lavutil -lswscale -lz -lbz2")
[if test "$enableval" = yes; then ffmpegon=true; else ffmpegon=false; fi]
]
)
mklon=false
AC_ARG_ENABLE([mkl],
[AS_HELP_STRING([--enable-mkl],[link Intel's mkl library, necessary for ngsolve and mkl 11.x])],
[if test "$enableval" = yes; then mklon=true; else mklon=false; fi]
)
# only for GUI version
if test a$ngguion = atrue ; then
# Tcl/Tk configuration:
TEA_INIT([3.9])
TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG
TEA_PATH_TKCONFIG
TEA_LOAD_TKCONFIG
TEA_PUBLIC_TCL_HEADERS
TEA_PUBLIC_TK_HEADERS
AC_SUBST([TOGLLIBDIR], ["$togllibfl"])
AC_CHECK_HEADER([togl.h])
AC_CHECK_HEADER([GL/gl.h])
#--------------------------------------------------------------------
# __CHANGE__
# Choose OpenGL platform (borrowed from Togl1.7)
#--------------------------------------------------------------------
case "${TEA_WINDOWINGSYSTEM}" in
aqua)
AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_AGL)
TEA_ADD_LIBS([-framework AGL -framework OpenGL -framework ApplicationServices])
# libGLU is implicit in OpenGL framework
LIBGLU=
;;
x11)
AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_X11)
TEA_ADD_LIBS([-lGL -lXmu])
LIBGLU=-lGLU
;;
win32)
AC_SUBST(TOGL_WINDOWINGSYSTEM,TOGL_WGL)
TEA_ADD_LIBS([opengl32.lib user32.lib gdi32.lib])
if test "$GCC" = "yes" ; then
LIBGLU=-lglu32
else
LIBGLU=glu32.lib
fi
;;
*)
AC_MSG_ERROR([Unsupported windowing system: ${TEA_WINDOWINGSYSTEM}])
;;
esac
AC_SUBST(LIBGLU)
fi
AM_CONDITIONAL([NGLIB], [test x$nglibon = xtrue])
AM_CONDITIONAL([NGGUI], [test x$ngguion = xtrue])
AM_CONDITIONAL([NGMKL], [test x$mklon = xtrue])
AC_CHECK_HEADER(pthread.h)
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([floor])
AC_CHECK_FUNCS([matherr])
AC_CHECK_HEADERS([limits.h])
AC_CHECK_LIB(pthread, pthread_create)
AC_CONFIG_FILES(Makefile libsrc/Makefile libsrc/csg/Makefile
libsrc/general/Makefile libsrc/geom2d/Makefile libsrc/gprim/Makefile
libsrc/include/Makefile libsrc/interface/Makefile
libsrc/linalg/Makefile libsrc/meshing/Makefile libsrc/occ/Makefile
libsrc/stlgeom/Makefile
libsrc/visualization/Makefile ng/Makefile nglib/Makefile
tutorials/Makefile doc/Makefile windows/Makefile )
AC_OUTPUT
AC_MSG_RESULT([
------------------------------------------------------------------------
$PACKAGE $VERSION: Automatic configuration OK.
Enabled functionality:
OCC: ............... $occon
JPEGlib: ........... $jpeglibon
FFMPEG: ............ $ffmpegon
NGLIB: ............. $nglibon
GUI: ............... $ngguion
Building:
Type 'make' to compile $PACKAGE.
Type 'make install' to install $PACKAGE.
Example programs will be built but not installed.
------------------------------------------------------------------------
])

441
depcomp Executable file
View File

@ -0,0 +1,441 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Must come before tru64.
# Intel's C compiler understands `-MD -MF file'. However
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
tmpdepfile1="$object.d"
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
if test "$libtool" = yes; then
"$@" -Wc,-MD
else
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
test -z "$dashmflag" && dashmflag=-M
( IFS=" "
case " $* " in
*" --mode=compile "*) # this is libtool, let us make it quiet
for arg
do # cycle over the arguments
case "$arg" in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
# X makedepend
(
shift
cleared=no
for arg in "$@"; do
case $cleared in no)
set ""; shift
cleared=yes
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift;;
-*)
;;
*)
set fnord "$@" "$arg"; shift;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tail +3 "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
( IFS=" "
case " $* " in
*" --mode=compile "*)
for arg
do # cycle over the arguments
case $arg in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
( IFS=" "
case " $* " in
*" --mode=compile "*)
for arg
do # cycle over the arguments
case $arg in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

1
doc/Makefile.am Normal file
View File

@ -0,0 +1 @@
dist_doc_DATA = ng4.pdf

468
doc/Makefile.in Normal file
View File

@ -0,0 +1,468 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = doc
DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/tcl.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(docdir)"
DATA = $(dist_doc_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLEANFILES = @CLEANFILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH = @CYGPATH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FFMPEG_INCLUDES = @FFMPEG_INCLUDES@
FFMPEG_LIBS = @FFMPEG_LIBS@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JPEGLIB_INCLUDES = @JPEGLIB_INCLUDES@
JPEGLIB_LIBS = @JPEGLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGLU = @LIBGLU@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPI_INCLUDES = @MPI_INCLUDES@
MPI_LIBS = @MPI_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OCCFLAGS = @OCCFLAGS@
OCCLIBS = @OCCLIBS@
OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CFLAGS = @PKG_CFLAGS@
PKG_HEADERS = @PKG_HEADERS@
PKG_INCLUDES = @PKG_INCLUDES@
PKG_LIBS = @PKG_LIBS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_DEFS = @TCL_DEFS@
TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
TCL_INCLUDES = @TCL_INCLUDES@
TCL_LD_FLAGS = @TCL_LD_FLAGS@
TCL_LIBS = @TCL_LIBS@
TCL_LIB_FILE = @TCL_LIB_FILE@
TCL_LIB_FLAG = @TCL_LIB_FLAG@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
TCL_SRC_DIR = @TCL_SRC_DIR@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_VERSION = @TCL_VERSION@
TK_BIN_DIR = @TK_BIN_DIR@
TK_INCLUDES = @TK_INCLUDES@
TK_LIBS = @TK_LIBS@
TK_LIB_FILE = @TK_LIB_FILE@
TK_LIB_FLAG = @TK_LIB_FLAG@
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_SRC_DIR = @TK_SRC_DIR@
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
TK_VERSION = @TK_VERSION@
TK_XINCLUDES = @TK_XINCLUDES@
TOGLLIBDIR = @TOGLLIBDIR@
TOGL_WINDOWINGSYSTEM = @TOGL_WINDOWINGSYSTEM@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
dist_doc_DATA = ng4.pdf
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-dist_docDATA: $(dist_doc_DATA)
@$(NORMAL_INSTALL)
test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
done
uninstall-dist_docDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-dist_docDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-dist_docDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dist_docDATA install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-dist_docDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

BIN
doc/ng4.pdf Normal file

Binary file not shown.

520
install-sh Executable file
View File

@ -0,0 +1,520 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

5
libsrc/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AM_CPPFLAGS =
METASOURCES = AUTO
SUBDIRS = general gprim linalg include meshing interface csg geom2d occ stlgeom visualization

619
libsrc/Makefile.in Normal file
View File

@ -0,0 +1,619 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libsrc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/tcl.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLEANFILES = @CLEANFILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH = @CYGPATH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FFMPEG_INCLUDES = @FFMPEG_INCLUDES@
FFMPEG_LIBS = @FFMPEG_LIBS@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JPEGLIB_INCLUDES = @JPEGLIB_INCLUDES@
JPEGLIB_LIBS = @JPEGLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGLU = @LIBGLU@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPI_INCLUDES = @MPI_INCLUDES@
MPI_LIBS = @MPI_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OCCFLAGS = @OCCFLAGS@
OCCLIBS = @OCCLIBS@
OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CFLAGS = @PKG_CFLAGS@
PKG_HEADERS = @PKG_HEADERS@
PKG_INCLUDES = @PKG_INCLUDES@
PKG_LIBS = @PKG_LIBS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_DEFS = @TCL_DEFS@
TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
TCL_INCLUDES = @TCL_INCLUDES@
TCL_LD_FLAGS = @TCL_LD_FLAGS@
TCL_LIBS = @TCL_LIBS@
TCL_LIB_FILE = @TCL_LIB_FILE@
TCL_LIB_FLAG = @TCL_LIB_FLAG@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
TCL_SRC_DIR = @TCL_SRC_DIR@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_VERSION = @TCL_VERSION@
TK_BIN_DIR = @TK_BIN_DIR@
TK_INCLUDES = @TK_INCLUDES@
TK_LIBS = @TK_LIBS@
TK_LIB_FILE = @TK_LIB_FILE@
TK_LIB_FLAG = @TK_LIB_FLAG@
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_SRC_DIR = @TK_SRC_DIR@
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
TK_VERSION = @TK_VERSION@
TK_XINCLUDES = @TK_XINCLUDES@
TOGLLIBDIR = @TOGLLIBDIR@
TOGL_WINDOWINGSYSTEM = @TOGL_WINDOWINGSYSTEM@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS =
METASOURCES = AUTO
SUBDIRS = general gprim linalg include meshing interface csg geom2d occ stlgeom visualization
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libsrc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

32
libsrc/csg/Makefile.am Normal file
View File

@ -0,0 +1,32 @@
noinst_HEADERS = algprim.hpp csgparser.hpp extrusion.hpp manifold.hpp \
singularref.hpp surface.hpp brick.hpp curve2d.hpp gencyl.hpp \
meshsurf.hpp solid.hpp triapprox.hpp csgeom.hpp edgeflw.hpp geoml.hpp \
polyhedra.hpp specpoin.hpp csg.hpp explicitcurve2d.hpp identify.hpp \
revolution.hpp spline3d.hpp vscsg.hpp
AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES)
METASOURCES = AUTO
lib_LTLIBRARIES = libcsg.la
if NGGUI
lib_LTLIBRARIES += libcsgvis.la
endif
libcsg_la_SOURCES = algprim.cpp brick.cpp \
bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp \
explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp \
manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \
solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp
libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp
libcsgvis_la_LIBADD = libcsg.la
libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
# $(top_builddir)/libsrc/geom2d/libgeom2d.la

639
libsrc/csg/Makefile.in Normal file
View File

@ -0,0 +1,639 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@NGGUI_TRUE@am__append_1 = libcsgvis.la
subdir = libsrc/csg
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/tcl.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libcsg_la_DEPENDENCIES = $(top_builddir)/libsrc/meshing/libmesh.la
am_libcsg_la_OBJECTS = algprim.lo brick.lo bspline2d.lo csgeom.lo \
csgparser.lo curve2d.lo edgeflw.lo explicitcurve2d.lo \
extrusion.lo gencyl.lo genmesh.lo identify.lo manifold.lo \
meshsurf.lo polyhedra.lo revolution.lo singularref.lo solid.lo \
specpoin.lo spline3d.lo surface.lo triapprox.lo
libcsg_la_OBJECTS = $(am_libcsg_la_OBJECTS)
libcsgvis_la_DEPENDENCIES = libcsg.la
am_libcsgvis_la_OBJECTS = vscsg.lo csgpkg.lo
libcsgvis_la_OBJECTS = $(am_libcsgvis_la_OBJECTS)
@NGGUI_TRUE@am_libcsgvis_la_rpath = -rpath $(libdir)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libcsg_la_SOURCES) $(libcsgvis_la_SOURCES)
DIST_SOURCES = $(libcsg_la_SOURCES) $(libcsgvis_la_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLEANFILES = @CLEANFILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH = @CYGPATH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FFMPEG_INCLUDES = @FFMPEG_INCLUDES@
FFMPEG_LIBS = @FFMPEG_LIBS@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JPEGLIB_INCLUDES = @JPEGLIB_INCLUDES@
JPEGLIB_LIBS = @JPEGLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGLU = @LIBGLU@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPI_INCLUDES = @MPI_INCLUDES@
MPI_LIBS = @MPI_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OCCFLAGS = @OCCFLAGS@
OCCLIBS = @OCCLIBS@
OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CFLAGS = @PKG_CFLAGS@
PKG_HEADERS = @PKG_HEADERS@
PKG_INCLUDES = @PKG_INCLUDES@
PKG_LIBS = @PKG_LIBS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_DEFS = @TCL_DEFS@
TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
TCL_INCLUDES = @TCL_INCLUDES@
TCL_LD_FLAGS = @TCL_LD_FLAGS@
TCL_LIBS = @TCL_LIBS@
TCL_LIB_FILE = @TCL_LIB_FILE@
TCL_LIB_FLAG = @TCL_LIB_FLAG@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
TCL_SRC_DIR = @TCL_SRC_DIR@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_VERSION = @TCL_VERSION@
TK_BIN_DIR = @TK_BIN_DIR@
TK_INCLUDES = @TK_INCLUDES@
TK_LIBS = @TK_LIBS@
TK_LIB_FILE = @TK_LIB_FILE@
TK_LIB_FLAG = @TK_LIB_FLAG@
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_SRC_DIR = @TK_SRC_DIR@
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
TK_VERSION = @TK_VERSION@
TK_XINCLUDES = @TK_XINCLUDES@
TOGLLIBDIR = @TOGLLIBDIR@
TOGL_WINDOWINGSYSTEM = @TOGL_WINDOWINGSYSTEM@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_HEADERS = algprim.hpp csgparser.hpp extrusion.hpp manifold.hpp \
singularref.hpp surface.hpp brick.hpp curve2d.hpp gencyl.hpp \
meshsurf.hpp solid.hpp triapprox.hpp csgeom.hpp edgeflw.hpp geoml.hpp \
polyhedra.hpp specpoin.hpp csg.hpp explicitcurve2d.hpp identify.hpp \
revolution.hpp spline3d.hpp vscsg.hpp
AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES)
METASOURCES = AUTO
lib_LTLIBRARIES = libcsg.la $(am__append_1)
libcsg_la_SOURCES = algprim.cpp brick.cpp \
bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp \
explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp \
manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \
solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp
libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp
libcsgvis_la_LIBADD = libcsg.la
libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrc/csg/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libsrc/csg/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libcsg.la: $(libcsg_la_OBJECTS) $(libcsg_la_DEPENDENCIES) $(EXTRA_libcsg_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libcsg_la_OBJECTS) $(libcsg_la_LIBADD) $(LIBS)
libcsgvis.la: $(libcsgvis_la_OBJECTS) $(libcsgvis_la_DEPENDENCIES) $(EXTRA_libcsgvis_la_DEPENDENCIES)
$(CXXLINK) $(am_libcsgvis_la_rpath) $(libcsgvis_la_OBJECTS) $(libcsgvis_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/algprim.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/brick.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bspline2d.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csgeom.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csgparser.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csgpkg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curve2d.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edgeflw.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/explicitcurve2d.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extrusion.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gencyl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genmesh.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/identify.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manifold.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meshsurf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/polyhedra.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/revolution.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/singularref.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solid.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/specpoin.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spline3d.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/triapprox.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vscsg.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES
# $(top_builddir)/libsrc/geom2d/libgeom2d.la
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

1727
libsrc/csg/algprim.cpp Normal file

File diff suppressed because it is too large Load Diff

446
libsrc/csg/algprim.hpp Normal file
View File

@ -0,0 +1,446 @@
#ifndef FILE_ALGPRIM
#define FILE_ALGPRIM
/**************************************************************************/
/* File: algprim.hpp */
/* Author: Joachim Schoeberl */
/* Date: 1. Dez. 95 */
/**************************************************************************/
namespace netgen
{
/*
Quadric Surfaces (Plane, Sphere, Cylinder)
*/
/**
A quadric surface.
surface defined by
cxx x^2 + cyy y^2 + czz z^2 + cxy x y + cxz x z + cyz y z +
cx x + cy y + cz z + c1 = 0.
**/
class QuadraticSurface : public OneSurfacePrimitive
{
protected:
double cxx, cyy, czz, cxy, cxz, cyz, cx, cy, cz, c1;
public:
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
/*
virtual int RootInBox (const Box<3> & box)
const { return 0; }
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box)
const { return DOES_INTERSECT; }
*/
virtual double HesseNorm () const { return cxx + cyy + czz; }
virtual Point<3> GetSurfacePoint () const;
virtual void Print (ostream & ist) const;
virtual void Read (istream & ist);
void PrintCoeff (ostream & ost) const;
};
/// A Plane (i.e., the plane and everything behind it).
class Plane : public QuadraticSurface
{
/// a point in the plane
Point<3> p;
/// outward normal vector
Vec<3> n;
double eps_base;
public:
///
Plane (const Point<3> & ap, Vec<3> an);
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
virtual void Transform (Transformation<3> & trans);
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
///
virtual void DefineTangentialPlane (const Point<3> & ap1,
const Point<3> & ap2);
///
virtual void ToPlane (const Point<3> & p3d,
Point<2> & pplane, double h,
int & zone) const;
///
virtual void FromPlane (const Point<2> & pplane,
Point<3> & p3d,
double h) const;
///
virtual void Project (Point<3> & p) const;
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
///
inline virtual double CalcFunctionValue (const Point<3> & p3d) const
{return cx * p3d(0) + cy * p3d(1) + cz * p3d(2) + c1;}
///
virtual void CalcGradient (const Point<3> & point,
Vec<3> & grad) const;
///
virtual void CalcHesse (const Point<3> & point,
Mat<3> & hesse) const;
///
virtual double HesseNorm () const;
///
virtual Point<3> GetSurfacePoint () const;
///
virtual void GetTriangleApproximation
(TriangleApproximation & tas,
const Box<3> & boundingbox, double facets) const;
protected:
void CalcData();
};
// typedef Plane Plane;
///
class Sphere : public QuadraticSurface
{
///
Point<3> c;
///
double r, invr;
public:
///
Sphere (const Point<3> & ac, double ar);
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
virtual void Transform (Transformation<3> & trans);
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
///
virtual void DefineTangentialPlane (const Point<3> & ap1,
const Point<3> & ap2);
///
virtual void ToPlane (const Point<3> & p3d,
Point<2> & pplane, double h,
int & zone) const;
///
virtual void FromPlane (const Point<2> & pplane,
Point<3> & p, double h) const;
///
virtual void Project (Point<3> & p) const;
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
///
virtual double HesseNorm () const;
///
virtual Point<3> GetSurfacePoint () const;
///
const Point<3> & Center () const { return c; }
///
double Radius () const { return r; }
///
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox,
double facets) const;
};
///
class Cylinder : public QuadraticSurface
{
///
Point<3> a, b;
///
double r;
///
Vec<3> vab;
public:
Cylinder (const Point<3> & aa, const Point<3> & ab, double ar);
Cylinder (Array<double> & coeffs);
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
virtual void Transform (Transformation<3> & trans);
///
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
///
virtual void DefineTangentialPlane (const Point<3> & ap1,
const Point<3> & ap2);
///
virtual void ToPlane (const Point<3> & p,
Point<2> & pplane,
double h,
int & zone) const;
///
virtual void FromPlane (const Point<2> & pplane,
Point<3> & p,
double h) const;
///
virtual void Project (Point<3> & p) const;
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
///
virtual double HesseNorm () const;
///
virtual Point<3> GetSurfacePoint () const;
///
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox,
double facets) const;
};
///
class EllipticCylinder : public QuadraticSurface
{
private:
///
Point<3> a;
///
Vec<3> vl, vs;
///
Vec<3> vab, t0vec, t1vec;
///
double vabl, t0, t1;
public:
///
EllipticCylinder (const Point<3> & aa,
const Vec<3> & avl, const Vec<3> & avs);
EllipticCylinder (Array<double> & coeffs);
// static Primitive * CreateDefault ();
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
///
virtual double HesseNorm () const;
///
virtual Point<3> GetSurfacePoint () const;
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox,
double facets) const;
virtual double MaxCurvature () const;
virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
double /* rad */) const;
private:
void CalcData();
};
///
class Ellipsoid : public QuadraticSurface
{
private:
///
Point<3> a;
///
Vec<3> v1, v2, v3;
///
double rmin;
public:
///
Ellipsoid (const Point<3> & aa,
const Vec<3> & av1,
const Vec<3> & av2,
const Vec<3> & av3);
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
///
virtual double HesseNorm () const;
///
virtual double MaxCurvature () const;
///
virtual Point<3> GetSurfacePoint () const;
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox,
double facets) const;
private:
void CalcData();
};
///
class Cone : public QuadraticSurface
{
///
Point<3> a, b;
///
double ra, rb, minr;
///
Vec<3> vab, t0vec, t1vec;
///
double vabl, t0, t1;
double cosphi;
public:
///
Cone (const Point<3> & aa, const Point<3> & ab, double ara, double arb);
///
static Primitive * CreateDefault ();
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
///
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
///
virtual double HesseNorm () const;
virtual double LocH (const Point<3> & p, double x,
double c, double hmax) const;
///
virtual Point<3> GetSurfacePoint () const;
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox,
double facets) const;
private:
void CalcData();
};
/** Torus
/// Lorenzo Codecasa (codecasa@elet.polimi.it)
/// April 27th, 2005
*/
class Torus : public OneSurfacePrimitive
{
/// center of the torus
Point<3> c;
/// vector normal to the symmetry plane of the torus
Vec<3> n;
/// Large radius of the torus
double R;
/// Small radius of the torus
double r;
public:
/// OK
Torus (const Point<3> & ac, const Vec<3> & an, double aR, double ar);
/// OK
const Point<3> & Center () const { return c; }
/// OK
const Vec<3> & NormalToPlane () const { return n; }
/// OK
double LargeRadius () const { return R; }
/// OK
double SmallRadius () const { return r; }
/// OK
virtual double CalcFunctionValue (const Point<3> & point) const;
/// OK
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
/// OK
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
/// OK
virtual double HesseNorm () const;
/// OK
virtual Point<3> GetSurfacePoint () const;
/// OK
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
/// OK
virtual void SetPrimitiveData (Array<double> & coeffs);
/// OK
static Primitive * CreateDefault ();
/// OK
virtual Primitive * Copy () const;
/// OK
virtual void Transform (Transformation<3> & trans);
/// OK
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
/// OK
/// virtual void DefineTangentialPlane (const Point<3> & ap1,
// const Point<3> & ap2);
/// OK
/// virtual void ToPlane (const Point<3> & p3d,
/// Point<2> & pplane,
/// double h, int & zone) const;
/// OK
/// virtual void FromPlane (const Point<2> & pplane,
// Point<3> & p, double h) const;
/// OK
/// virtual void Project (Point<3> & p) const;
/// OK
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
/// OK
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & bbox,
double facets) const;
/// OK
virtual void Print (ostream & ist) const;
/// OK
virtual void Read (istream & ist);
};
/// ...end
}
#endif

526
libsrc/csg/brick.cpp Normal file
View File

@ -0,0 +1,526 @@
#include <mystdlib.h>
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
Parallelogram3d :: Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3)
{
p1 = ap1;
p2 = ap2;
p3 = ap3;
CalcData();
}
Parallelogram3d ::~Parallelogram3d ()
{
;
}
void Parallelogram3d :: SetPoints (Point<3> ap1,
Point<3> ap2,
Point<3> ap3)
{
p1 = ap1;
p2 = ap2;
p3 = ap3;
CalcData();
}
void Parallelogram3d :: CalcData()
{
v12 = p2 - p1;
v13 = p3 - p1;
p4 = p2 + v13;
n = Cross (v12, v13);
n.Normalize();
}
int Parallelogram3d ::
IsIdentic (const Surface & s2, int & inv, double eps) const
{
int id =
(fabs (s2.CalcFunctionValue (p1)) <= eps) &&
(fabs (s2.CalcFunctionValue (p2)) <= eps) &&
(fabs (s2.CalcFunctionValue (p3)) <= eps);
if (id)
{
Vec<3> n2;
n2 = s2.GetNormalVector(p1);
inv = (n * n2) < 0;
}
return id;
}
double Parallelogram3d :: CalcFunctionValue (const Point<3> & point) const
{
return n * (point - p1);
}
void Parallelogram3d :: CalcGradient (const Point<3> & /* point */,
Vec<3> & grad) const
{
grad = n;
}
void Parallelogram3d :: CalcHesse (const Point<3> & /* point */, Mat<3> & hesse) const
{
hesse = 0;
}
double Parallelogram3d :: HesseNorm () const
{
return 0;
}
Point<3> Parallelogram3d :: GetSurfacePoint () const
{
return p1;
}
void Parallelogram3d :: Print (ostream & str) const
{
str << "Parallelogram3d " << p1 << " - " << p2 << " - " << p3 << endl;
}
void Parallelogram3d ::
GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & /* bbox */,
double /* facets */) const
{
tas.AddPoint (p1);
tas.AddPoint (p2);
tas.AddPoint (p3);
tas.AddPoint (p4);
tas.AddTriangle (TATriangle (0, 0, 1, 2));
tas.AddTriangle (TATriangle (0, 2, 1, 3));
}
Brick :: Brick (Point<3> ap1, Point<3> ap2,
Point<3> ap3, Point<3> ap4)
{
faces.SetSize (6);
surfaceids.SetSize (6);
surfaceactive.SetSize(6);
p1 = ap1; p2 = ap2;
p3 = ap3; p4 = ap4;
for (int i = 0; i < 6; i++)
{
faces[i] = new Plane (Point<3>(0,0,0), Vec<3> (0,0,1));
surfaceactive[i] = 1;
}
CalcData();
}
Brick :: ~Brick ()
{
for (int i = 0; i < 6; i++)
delete faces[i];
}
Primitive * Brick :: CreateDefault ()
{
return new Brick (Point<3> (0,0,0),
Point<3> (1,0,0),
Point<3> (0,1,0),
Point<3> (0,0,1));
}
Primitive * Brick :: Copy () const
{
return new Brick (p1, p2, p3, p4);
}
void Brick :: Transform (Transformation<3> & trans)
{
trans.Transform (p1);
trans.Transform (p2);
trans.Transform (p3);
trans.Transform (p4);
CalcData();
}
INSOLID_TYPE Brick :: BoxInSolid (const BoxSphere<3> & box) const
{
/*
int i;
double maxval;
for (i = 1; i <= 6; i++)
{
double val = faces.Get(i)->CalcFunctionValue (box.Center());
if (i == 1 || val > maxval)
maxval = val;
}
if (maxval > box.Diam()) return IS_OUTSIDE;
if (maxval < -box.Diam()) return IS_INSIDE;
return DOES_INTERSECT;
*/
bool inside = 1;
bool outside = 0;
Point<3> p[8];
for (int j = 0; j < 8; j++)
p[j] = box.GetPointNr(j);
for (int i = 0; i < 6; i++)
{
bool outsidei = 1;
for (int j = 0; j < 8; j++)
{
// Point<3> p = box.GetPointNr (j);
double val = faces[i]->Plane::CalcFunctionValue (p[j]);
if (val > 0) inside = 0;
if (val < 0) outsidei = 0;
}
if (outsidei) outside = 1;
}
if (outside) return IS_OUTSIDE;
if (inside) return IS_INSIDE;
return DOES_INTERSECT;
}
INSOLID_TYPE Brick :: PointInSolid (const Point<3> & p,
double eps) const
{
double maxval = faces[0] -> Plane::CalcFunctionValue (p);
for (int i = 1; i < 6; i++)
{
double val = faces[i] -> Plane::CalcFunctionValue (p);
if (val > maxval) maxval = val;
}
if (maxval > eps) return IS_OUTSIDE;
if (maxval < -eps) return IS_INSIDE;
return DOES_INTERSECT;
}
INSOLID_TYPE Brick :: VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const
{
INSOLID_TYPE result = IS_INSIDE;
for (int i = 0; i < faces.Size(); i++)
{
INSOLID_TYPE hres = faces[i]->VecInSolid(p, v, eps);
if (hres == IS_OUTSIDE || result == IS_OUTSIDE) result = IS_OUTSIDE;
else if (hres == DOES_INTERSECT || result == DOES_INTERSECT) result = DOES_INTERSECT;
else result = IS_INSIDE;
}
return result;
/*
INSOLID_TYPE is = IS_INSIDE;
Vec<3> grad;
double scal;
for (int i = 0; i < faces.Size(); i++)
{
if (faces[i] -> PointOnSurface (p, eps))
{
GetSurface(i).CalcGradient (p, grad);
scal = v * grad;
if (scal >= eps)
is = IS_OUTSIDE;
if (scal >= -eps && is == IS_INSIDE)
is = DOES_INTERSECT;
}
}
return is;
*/
/*
Point<3> p2 = p + 1e-2 * v;
return PointInSolid (p2, eps);
*/
}
INSOLID_TYPE Brick :: VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
INSOLID_TYPE result = IS_INSIDE;
for (int i = 0; i < faces.Size(); i++)
{
INSOLID_TYPE hres = faces[i]->VecInSolid2(p, v1, v2, eps);
if (hres == IS_OUTSIDE || result == IS_OUTSIDE) result = IS_OUTSIDE;
else if (hres == DOES_INTERSECT || result == DOES_INTERSECT) result = DOES_INTERSECT;
else result = IS_INSIDE;
}
return result;
}
INSOLID_TYPE Brick :: VecInSolid3 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
INSOLID_TYPE result = IS_INSIDE;
for (int i = 0; i < faces.Size(); i++)
{
INSOLID_TYPE hres = faces[i]->VecInSolid3(p, v1, v2, eps);
if (hres == IS_OUTSIDE || result == IS_OUTSIDE) result = IS_OUTSIDE;
else if (hres == DOES_INTERSECT || result == DOES_INTERSECT) result = DOES_INTERSECT;
else result = IS_INSIDE;
}
return result;
}
INSOLID_TYPE Brick :: VecInSolid4 (const Point<3> & p,
const Vec<3> & v,
const Vec<3> & v2,
const Vec<3> & m,
double eps) const
{
INSOLID_TYPE result = IS_INSIDE;
for (int i = 0; i < faces.Size(); i++)
{
INSOLID_TYPE hres = faces[i]->VecInSolid4(p, v, v2, m, eps);
if (hres == IS_OUTSIDE || result == IS_OUTSIDE) result = IS_OUTSIDE;
else if (hres == DOES_INTERSECT || result == DOES_INTERSECT) result = DOES_INTERSECT;
else result = IS_INSIDE;
}
return result;
}
void Brick ::
GetPrimitiveData (const char *& classname, Array<double> & coeffs) const
{
classname = "brick";
coeffs.SetSize(12);
coeffs.Elem(1) = p1(0);
coeffs.Elem(2) = p1(1);
coeffs.Elem(3) = p1(2);
coeffs.Elem(4) = p2(0);
coeffs.Elem(5) = p2(1);
coeffs.Elem(6) = p2(2);
coeffs.Elem(7) = p3(0);
coeffs.Elem(8) = p3(1);
coeffs.Elem(9) = p3(2);
coeffs.Elem(10) = p4(0);
coeffs.Elem(11) = p4(1);
coeffs.Elem(12) = p4(2);
}
void Brick :: SetPrimitiveData (Array<double> & coeffs)
{
p1(0) = coeffs.Elem(1);
p1(1) = coeffs.Elem(2);
p1(2) = coeffs.Elem(3);
p2(0) = coeffs.Elem(4);
p2(1) = coeffs.Elem(5);
p2(2) = coeffs.Elem(6);
p3(0) = coeffs.Elem(7);
p3(1) = coeffs.Elem(8);
p3(2) = coeffs.Elem(9);
p4(0) = coeffs.Elem(10);
p4(1) = coeffs.Elem(11);
p4(2) = coeffs.Elem(12);
CalcData();
}
void Brick :: CalcData()
{
v12 = p2 - p1;
v13 = p3 - p1;
v14 = p4 - p1;
Point<3> pi[8];
int i1, i2, i3;
int i, j;
i = 0;
for (i3 = 0; i3 <= 1; i3++)
for (i2 = 0; i2 <= 1; i2++)
for (i1 = 0; i1 <= 1; i1++)
{
pi[i] = p1 + i1 * v12 + i2 * v13 + i3 * v14;
i++;
}
static int lface[6][4] =
{ { 1, 3, 2, 4 },
{ 5, 6, 7, 8 },
{ 1, 2, 5, 6 },
{ 3, 7, 4, 8 },
{ 1, 5, 3, 7 },
{ 2, 4, 6, 8 } };
Array<double> data(6);
for (i = 0; i < 6; i++)
{
const Point<3> lp1 = pi[lface[i][0]-1];
const Point<3> lp2 = pi[lface[i][1]-1];
const Point<3> lp3 = pi[lface[i][2]-1];
Vec<3> n = Cross ((lp2-lp1), (lp3-lp1));
n.Normalize();
for (j = 0; j < 3; j++)
{
data[j] = lp1(j);
data[j+3] = n(j);
}
faces[i] -> SetPrimitiveData (data);
/*
{
faces.Elem(i+1) -> SetPoints
(pi[lface[i][0]-1],
pi[lface[i][1]-1],
pi[lface[i][2]-1]);
}
*/
}
}
void Brick :: Reduce (const BoxSphere<3> & box)
{
double val;
// Point<3> p;
Point<3> p[8];
for(int j=0;j<8;j++)
p[j]=box.GetPointNr(j);
for (int i = 0; i < 6; i++)
{
bool hasout = 0;
bool hasin = 0;
for (int j = 0; j < 8; j++)
{
// p = box.GetPointNr (j);
val = faces[i]->Plane::CalcFunctionValue (p[j]);
if (val > 0) hasout = 1;
else if (val < 0) hasin = 1;
if (hasout && hasin) break;
}
surfaceactive[i] = hasout && hasin;
}
}
void Brick :: UnReduce ()
{
for (int i = 0; i < 6; i++)
surfaceactive[i] = 1;
}
OrthoBrick :: OrthoBrick (const Point<3> & ap1, const Point<3> & ap2)
: Brick (ap1,
Point<3> (ap2(0), ap1(1), ap1(2)),
Point<3> (ap1(0), ap2(1), ap1(2)),
Point<3> (ap1(0), ap1(1), ap2(2)))
{
pmin = ap1;
pmax = ap2;
}
INSOLID_TYPE OrthoBrick :: BoxInSolid (const BoxSphere<3> & box) const
{
if (pmin(0) > box.PMax()(0) ||
pmin(1) > box.PMax()(1) ||
pmin(2) > box.PMax()(2) ||
pmax(0) < box.PMin()(0) ||
pmax(1) < box.PMin()(1) ||
pmax(2) < box.PMin()(2))
return IS_OUTSIDE;
if (pmin(0) < box.PMin()(0) &&
pmin(1) < box.PMin()(1) &&
pmin(2) < box.PMin()(2) &&
pmax(0) > box.PMax()(0) &&
pmax(1) > box.PMax()(1) &&
pmax(2) > box.PMax()(2))
return IS_INSIDE;
return DOES_INTERSECT;
}
void OrthoBrick :: Reduce (const BoxSphere<3> & box)
{
surfaceactive.Elem(1) =
(box.PMin()(2) < pmin(2)) && (pmin(2) < box.PMax()(2));
surfaceactive.Elem(2) =
(box.PMin()(2) < pmax(2)) && (pmax(2) < box.PMax()(2));
surfaceactive.Elem(3) =
(box.PMin()(1) < pmin(1)) && (pmin(1) < box.PMax()(1));
surfaceactive.Elem(4) =
(box.PMin()(1) < pmax(1)) && (pmax(1) < box.PMax()(1));
surfaceactive.Elem(5) =
(box.PMin()(0) < pmin(0)) && (pmin(0) < box.PMax()(0));
surfaceactive.Elem(6) =
(box.PMin()(0) < pmax(0)) && (pmax(0) < box.PMax()(0));
}
}

126
libsrc/csg/brick.hpp Normal file
View File

@ -0,0 +1,126 @@
#ifndef FILE_BRICK
#define FILE_BRICK
/**************************************************************************/
/* File: brick.hpp */
/* Author: Joachim Schoeberl */
/* Date: 11. Mar. 98 */
/**************************************************************************/
namespace netgen
{
/*
brick geometry, has several surfaces
*/
class Parallelogram3d : public Surface
{
Point<3> p1, p2, p3, p4;
Vec<3> v12, v13;
Vec<3> n;
public:
Parallelogram3d (Point<3> ap1, Point<3> ap2, Point<3> ap3);
virtual ~Parallelogram3d ();
void SetPoints (Point<3> ap1, Point<3> ap2, Point<3> ap3);
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
virtual double HesseNorm () const;
virtual Point<3> GetSurfacePoint () const;
virtual void Print (ostream & str) const;
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & boundingbox,
double facets) const;
protected:
void CalcData();
};
class Brick : public Primitive
{
Point<3> p1, p2, p3, p4;
Vec<3> v12, v13, v14;
// Array<OneSurfacePrimitive*> faces;
Array<Plane*> faces;
public:
Brick (Point<3> ap1, Point<3> ap2, Point<3> ap3, Point<3> ap4);
virtual ~Brick ();
static Primitive * CreateDefault ();
virtual Primitive * Copy () const;
virtual void Transform (Transformation<3> & trans);
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const;
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual INSOLID_TYPE VecInSolid3 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual INSOLID_TYPE VecInSolid4 (const Point<3> & p,
const Vec<3> & v,
const Vec<3> & v2,
const Vec<3> & m,
double eps) const;
virtual int GetNSurfaces() const
{ return 6; }
virtual Surface & GetSurface (int i)
{ return *faces[i]; }
virtual const Surface & GetSurface (int i) const
{ return *faces[i]; }
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();
protected:
void CalcData();
};
class OrthoBrick : public Brick
{
protected:
Point<3> pmin, pmax;
public:
OrthoBrick (const Point<3> & ap1, const Point<3> & ap2);
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual void Reduce (const BoxSphere<3> & box);
};
}
#endif

242
libsrc/csg/bspline2d.cpp Normal file
View File

@ -0,0 +1,242 @@
#include <mystdlib.h>
#include <csg.hpp>
namespace netgen
{
BSplineCurve2d :: BSplineCurve2d ()
{
redlevel = 0;
}
void BSplineCurve2d :: AddPoint (const Point<2> & apoint)
{
points.Append (apoint);
intervallused.Append (0);
}
bool BSplineCurve2d :: Inside (const Point<2> & p, double & dist) const
{
Point<2> hp = p;
double t = ProjectParam (p);
hp = Eval(t);
Vec<2> v = EvalPrime (t);
Vec<2> n (v(0), -v(1));
cout << "p = " << p << ", hp = " << hp << endl;
dist = Dist (p, hp);
double scal = (hp-p) * n;
cout << "scal = " << scal << endl;
return scal >= 0;
}
double BSplineCurve2d :: ProjectParam (const Point<2> & p) const
{
double t, dt, mindist, mint = 0.0;
int n1;
mindist = 1e10;
dt = 0.2;
for (n1 = 1; n1 <= points.Size(); n1++)
if (intervallused.Get(n1) == 0)
for (t = n1; t <= n1+1; t += dt)
if (Dist (Eval(t), p) < mindist)
{
mint = t;
mindist = Dist (Eval(t), p);
}
if (mindist > 1e9)
{
for (t = 0; t <= points.Size(); t += dt)
if (Dist (Eval(t), p) < mindist)
{
mint = t;
mindist = Dist (Eval(t), p);
}
}
while (Dist (Eval (mint-dt), p) < mindist)
{
mindist = Dist (Eval (mint-dt), p);
mint -= dt;
}
while (Dist (Eval (mint+dt), p) < mindist)
{
mindist = Dist (Eval (mint+dt), p);
mint += dt;
}
return NumericalProjectParam (p, mint-dt, mint+dt);
}
// t \in (n1, n2)
Point<2> BSplineCurve2d :: Eval (double t) const
{
int n, n1, n2, n3, n4;
double loct, b1, b2, b3, b4;
Point<2> hp;
static int cnt = 0;
cnt++;
if (cnt % 100000 == 0) (*mycout) << "cnt = " << cnt << endl;
n = int(t);
loct = t - n;
b1 = 0.25 * (1 - loct) * (1 - loct);
b4 = 0.25 * loct * loct;
b2 = 0.5 - b4;
b3 = 0.5 - b1;
n1 = (n + 10 * points.Size() -1) % points.Size() + 1;
n2 = n1+1;
if (n2 > points.Size()) n2 = 1;
n3 = n2+1;
if (n3 > points.Size()) n3 = 1;
n4 = n3+1;
if (n4 > points.Size()) n4 = 1;
// (*mycout) << "t = " << t << " n = " << n << " loct = " << loct
// << " n1 = " << n1 << endl;
hp(0) = b1 * points.Get(n1)(0) + b2 * points.Get(n2)(0) +
b3 * points.Get(n3)(0) + b4 * points.Get(n4)(0);
hp(1) = b1 * points.Get(n1)(1) + b2 * points.Get(n2)(1) +
b3 * points.Get(n3)(1) + b4 * points.Get(n4)(1);
return hp;
}
Vec<2> BSplineCurve2d :: EvalPrime (double t) const
{
int n, n1, n2, n3, n4;
double loct, db1, db2, db3, db4;
Vec<2> hv;
n = int(t);
loct = t - n;
db1 = 0.5 * (loct - 1);
db4 = 0.5 * loct;
db2 = -db4;
db3 = -db1;
n1 = (n + 10 * points.Size() -1) % points.Size() + 1;
n2 = n1+1;
if (n2 > points.Size()) n2 = 1;
n3 = n2+1;
if (n3 > points.Size()) n3 = 1;
n4 = n3+1;
if (n4 > points.Size()) n4 = 1;
hv(0) = db1 * points.Get(n1)(0) + db2 * points.Get(n2)(0) +
db3 * points.Get(n3)(0) + db4 * points.Get(n4)(0);
hv(1) = db1 * points.Get(n1)(1) + db2 * points.Get(n2)(1) +
db3 * points.Get(n3)(1) + db4 * points.Get(n4)(1);
return hv;
}
Vec<2> BSplineCurve2d :: EvalPrimePrime (double t) const
{
int n, n1, n2, n3, n4;
double ddb1, ddb2, ddb3, ddb4;
Vec<2> hv;
n = int(t);
// double loct = t - n;
ddb1 = 0.5;
ddb4 = 0.5;
ddb2 = -0.5;
ddb3 = -0.5;
n1 = (n + 10 * points.Size() -1) % points.Size() + 1;
n2 = n1+1;
if (n2 > points.Size()) n2 = 1;
n3 = n2+1;
if (n3 > points.Size()) n3 = 1;
n4 = n3+1;
if (n4 > points.Size()) n4 = 1;
hv(0) = ddb1 * points.Get(n1)(0) + ddb2 * points.Get(n2)(0) +
ddb3 * points.Get(n3)(0) + ddb4 * points.Get(n4)(0);
hv(1) = ddb1 * points.Get(n1)(1) + ddb2 * points.Get(n2)(1) +
ddb3 * points.Get(n3)(1) + ddb4 * points.Get(n4)(1);
return hv;
}
int BSplineCurve2d :: SectionUsed (double t) const
{
int n1 = int(t);
n1 = (n1 + 10 * points.Size() - 1) % points.Size() + 1;
return (intervallused.Get(n1) == 0);
}
void BSplineCurve2d :: Reduce (const Point<2> & p, double rad)
{
int n1, n;
int j;
double minx, miny, maxx, maxy;
// (*testout) << "Reduce: " << p << "," << rad << endl;
redlevel++;
for (n1 = 1; n1 <= points.Size(); n1++)
{
if (intervallused.Get(n1) != 0) continue;
minx = maxx = points.Get(n1)(0);
miny = maxy = points.Get(n1)(1);
n = n1;
for (j = 1; j <= 3; j++)
{
n++;
if (n > points.Size()) n = 1;
if (points.Get(n)(0) < minx) minx = points.Get(n)(0);
if (points.Get(n)(1) < miny) miny = points.Get(n)(1);
if (points.Get(n)(0) > maxx) maxx = points.Get(n)(0);
if (points.Get(n)(1) > maxy) maxy = points.Get(n)(1);
}
if (minx > p(0) + rad || maxx < p(0) - rad ||
miny > p(1) + rad || maxy < p(1) - rad)
{
intervallused.Elem(n1) = redlevel;
// (*testout) << 0;
}
else
{
// (*testout) << 1;
intervallused.Elem(n1) = 0;
}
}
// (*testout) << endl;
}
void BSplineCurve2d :: UnReduce ()
{
int i;
for (i = 1; i <= intervallused.Size(); i++)
if (intervallused.Get(i) == redlevel)
intervallused.Set (i, 0);
redlevel--;
}
void BSplineCurve2d :: Print (ostream & ost) const
{
ost << "SplineCurve: " << points.Size() << " points." << endl;
for (int i = 1; i <= points.Size(); i++)
ost << "P" << i << " = " << points.Get(i) << endl;
}
}

44
libsrc/csg/csg.hpp Normal file
View File

@ -0,0 +1,44 @@
#ifndef FILE_CSG
#define FILE_CSG
/* *************************************************************************/
/* File: geoml.hpp */
/* Author: Joachim Schoeberl */
/* Date: 21. Jun. 98 */
/* *************************************************************************/
#include <myadt.hpp>
#include <gprim.hpp>
#include <meshing.hpp>
// #include <geometry2d.hpp>
#include "../gprim/spline.hpp"
#include "../gprim/splinegeometry.hpp"
#include "surface.hpp"
#include "solid.hpp"
#include "identify.hpp"
#include "singularref.hpp"
#include "csgeom.hpp"
#include "csgparser.hpp"
#include "triapprox.hpp"
#include "algprim.hpp"
#include "brick.hpp"
#include "spline3d.hpp"
#include "manifold.hpp"
#include "curve2d.hpp"
#include "explicitcurve2d.hpp"
#include "gencyl.hpp"
#include "polyhedra.hpp"
#include "extrusion.hpp"
#include "revolution.hpp"
#include "specpoin.hpp"
#include "edgeflw.hpp"
#include "meshsurf.hpp"
#endif

1562
libsrc/csg/csgeom.cpp Normal file

File diff suppressed because it is too large Load Diff

329
libsrc/csg/csgeom.hpp Normal file
View File

@ -0,0 +1,329 @@
#ifndef FILE_CSGEOM
#define FILE_CSGEOM
/**************************************************************************/
/* File: csgeom.hh */
/* Author: Joachim Schoeberl */
/* Date: 27. Nov. 97 */
/**************************************************************************/
namespace netgen
{
/**
Constructive Solid Geometry
*/
class TriangleApproximation;
class TATriangle;
/**
A top level object is an entity to be meshed.
I can be either a solid, or one surface patch of a solid.
*/
class TopLevelObject
{
Solid * solid;
Surface * surface;
double red, blue, green;
bool visible, transp;
double maxh;
string material;
int layer;
int bc; // for surface patches, only
string bcname;
public:
TopLevelObject (Solid * asolid,
Surface * asurface = NULL);
const Solid * GetSolid() const { return solid; }
Solid * GetSolid() { return solid; }
const Surface * GetSurface () const { return surface; }
Surface * GetSurface () { return surface; }
void GetData (ostream & ost);
void SetData (istream & ist);
void SetMaxH (double amaxh) { maxh = amaxh; }
double GetMaxH () const { return maxh; }
void SetRGB (double ared, double agreen, double ablue)
{
red = ared;
green = agreen;
blue = ablue;
}
double GetRed () const { return red; }
double GetGreen () const { return green; }
double GetBlue () const { return blue; }
void SetTransparent (bool atransp)
{ transp = atransp; }
bool GetTransparent () const { return transp; }
void SetVisible (bool avisible)
{ visible = avisible; }
bool GetVisible () const { return visible; }
const string GetMaterial () const { return material; }
void SetMaterial (const string & mat) { material = mat; }
int GetLayer () const { return layer; }
void SetLayer (int alayer) { layer = alayer; }
void SetBCProp (int abc) { bc = abc; }
int GetBCProp () const { return bc; }
void SetBCName (string abc) { bcname = abc; }
const string GetBCName () const { return bcname; }
};
/**
CSGeometry has the whole geometric information
*/
class CSGeometry : public NetgenGeometry
{
private:
/// all surfaces
SYMBOLTABLE<Surface*> surfaces;
public:
/// primitive of surface
Array<const Primitive*> surf2prim;
private:
Array<Surface*> delete_them;
/// all named solids
SYMBOLTABLE<Solid*> solids;
/// all 2d splinecurves
SYMBOLTABLE< SplineGeometry<2>* > splinecurves2d;
/// all 3d splinecurves
SYMBOLTABLE< SplineGeometry<3>* > splinecurves3d;
/// all top level objects: solids and surfaces
Array<TopLevelObject*> toplevelobjects;
/// additional points specified by user
Array<Point<3> > userpoints;
Array<double> userpoints_ref_factor;
mutable Array<Point<3> > identpoints;
/// triangular approximation of top level objects
Array<TriangleApproximation*> triapprox;
/// increment, if geometry is changed
static int changeval;
/// bounding box of geometry
Box<3> boundingbox;
/// bounding box, if not set by input file
static Box<3> default_boundingbox;
/// identic surfaces are stored by pair of indizes, val = inverse
INDEX_2_HASHTABLE<int> identicsurfaces;
Array<int> isidenticto;
/// identification of boundaries (periodic, thin domains, ...)
double ideps;
/// filename of inputfile
string filename;
public:
CSGeometry ();
CSGeometry (const string & afilename);
virtual ~CSGeometry ();
void Clean ();
virtual void Save (string filename) const;
void Save (ostream & ost) const;
void Load (istream & ist);
void SaveSurfaces (ostream & out) const;
void LoadSurfaces (istream & in);
virtual void SaveToMeshFile (ostream & ost) const;
int GetChangeVal() { return changeval; }
void Change() { changeval++; }
void AddSurface (Surface * surf);
void AddSurface (char * name, Surface * surf);
void AddSurfaces (Primitive * prim);
int GetNSurf () const { return surfaces.Size(); }
const Surface * GetSurface (const char * name) const;
const Surface * GetSurface (int i) const
{ return surfaces[i]; }
void SetSolid (const char * name, Solid * sol);
const Solid * GetSolid (const char * name) const;
const Solid * GetSolid (const string & name) const;
int GetNSolids () const { return solids.Size(); }
const Solid * GetSolid (int i) const { return solids[i]; }
const SYMBOLTABLE<Solid*> & GetSolids () const { return solids; }
void SetSplineCurve (const char * name, SplineGeometry<2> * spl);
void SetSplineCurve (const char * name, SplineGeometry<3> * spl);
const SplineGeometry<2> * GetSplineCurve2d (const string & name) const;
const SplineGeometry<3> * GetSplineCurve3d (const string & name) const;
void SetFlags (const char * solidname, const Flags & flags);
int GetNTopLevelObjects () const
{ return toplevelobjects.Size(); }
int SetTopLevelObject (Solid * sol, Surface * surf = NULL);
void GetTopLevelObject (int nr, Solid *& sol, Surface *& surf)
{
sol = toplevelobjects[nr]->GetSolid();
surf = toplevelobjects[nr]->GetSurface();
}
void GetTopLevelObject (int nr, const Solid *& sol, const Surface *& surf) const
{
sol = toplevelobjects[nr]->GetSolid();
surf = toplevelobjects[nr]->GetSurface();
}
TopLevelObject * GetTopLevelObject (const Solid * sol, const Surface * surf = NULL);
TopLevelObject * GetTopLevelObject (int nr) const
{ return toplevelobjects[nr]; }
// const TopLevelObject * GetTopLevelObject (int nr) const
// { return toplevelobjects[nr]; }
void RemoveTopLevelObject (Solid * sol, Surface * surf = NULL);
void AddUserPoint (const Point<3> & p, double ref_factor = 0)
{ userpoints.Append (p); userpoints_ref_factor.Append (ref_factor); }
int GetNUserPoints () const
{ return userpoints.Size(); }
const Point<3> & GetUserPoint (int nr) const
{ return userpoints[nr]; }
double GetUserPointRefFactor (int nr) const
{ return userpoints_ref_factor[nr]; }
void AddIdentPoint (const Point<3> & p) const
{ identpoints.Append(p);}
int GetNIdentPoints (void) const
{ return identpoints.Size();}
const Point<3> & GetIdentPoint(int nr) const
{ return identpoints[nr]; }
void DeleteIdentPoints(void) const
{ identpoints.DeleteAll();}
// quick implementations:
Array<SingularFace*> singfaces;
Array<SingularEdge*> singedges;
Array<SingularPoint*> singpoints;
Array<Identification*> identifications;
int GetNIdentifications (void) const { return identifications.Size(); }
void AddIdentification (Identification * ident);
///
void CalcTriangleApproximation(double detail, double facets);
///
void FindIdenticSurfaces (double eps);
///
void GetSurfaceIndices (const Solid * sol,
const BoxSphere<3> & box,
Array<int> & locsurf) const;
///
void GetIndependentSurfaceIndices (const Solid * sol,
const BoxSphere<3> & box,
Array<int> & locsurf) const;
///
/*
void GetIndependentSurfaceIndices (const Solid * sol,
const Point<3> & p, Vec<3> & v,
Array<int> & locsurf) const;
*/
///
void GetIndependentSurfaceIndices (Array<int> & locsurf) const;
///
int GetSurfaceClassRepresentant (int si) const
{ return isidenticto[si]; }
///
const TriangleApproximation * GetTriApprox (int msnr)
{
if (msnr < triapprox.Size())
return triapprox[msnr];
return 0;
}
void IterateAllSolids (SolidIterator & it, bool only_once = false) const;
void RefineTriangleApprox (Solid * locsol,
int surfind,
const BoxSphere<3> & box,
double detail,
const TATriangle & tria,
TriangleApproximation & tams,
IndexSet & iset,
int level);
const Box<3> & BoundingBox () const { return boundingbox; }
void SetBoundingBox (const Box<3> & abox)
{
boundingbox = abox;
}
static void SetDefaultBoundingBox (const Box<3> & abox)
{
default_boundingbox = abox;
}
double MaxSize () const;
void SetIdEps(double eps){ideps = eps;}
double GetIdEps(void) const {return ideps;}
class BCModification {
public:
int si;
int tlonr;
int bcnr;
string * bcname;
};
Array<BCModification> bcmodifications;
virtual int GenerateMesh (Mesh*& mesh, MeshingParameters & mparam,
int perfstepsstart, int perfstepsend);
virtual const Refinement & GetRefinement () const;
};
}
#endif

1390
libsrc/csg/csgparser.cpp Normal file

File diff suppressed because it is too large Load Diff

101
libsrc/csg/csgparser.hpp Normal file
View File

@ -0,0 +1,101 @@
#ifndef _CSGPARSER_HPP
#define _CSGPARSER_HPP
namespace netgen
{
enum TOKEN_TYPE
{
TOK_MINUS = '-', TOK_LP = '(', OK_RP = ')', TOK_LSP = '[', TOK_RSP = ']',
TOK_EQU = '=', TOK_COMMA = ',', TOK_SEMICOLON = ';',
TOK_NUM = 100, TOK_STRING, TOK_NAMED_SOLID, TOK_PRIMITIVE,
TOK_OR, TOK_AND, TOK_NOT,
TOK_SINGULAR, TOK_EDGE, TOK_POINT, TOK_FACE, TOK_IDENTIFY, TOK_CLOSESURFACES,
TOK_CLOSEEDGES, TOK_PERIODIC,
TOK_SOLID, TOK_RECO, TOK_TLO, TOK_CURVE2D, TOK_CURVE3D, TOK_BOUNDINGBOX,
TOK_BOUNDARYCONDITION, TOK_BOUNDARYCONDITIONNAME,
TOK_DEFINE, TOK_CONSTANT,
TOK_END };
struct kwstruct
{
TOKEN_TYPE kw;
const char * name;
};
enum PRIMITIVE_TYPE
{
TOK_SPHERE = 1, TOK_CYLINDER, TOK_PLANE, TOK_ELLIPTICCYLINDER,
TOK_ELLIPSOID, TOK_CONE,
TOK_ORTHOBRICK, TOK_POLYHEDRON,
TOK_TORUS,
TOK_TUBE, TOK_GENCYL, TOK_EXTRUSION, TOK_REVOLUTION,
TOK_TRANSLATE, TOK_MULTITRANSLATE, TOK_ROTATE, TOK_MULTIROTATE
};
struct primstruct
{
PRIMITIVE_TYPE kw;
const char * name;
};
class CSGScanner
{
TOKEN_TYPE token;
PRIMITIVE_TYPE prim_token;
double num_value;
string string_value;
int linenum;
istream * scanin;
public:
CSGScanner (istream & ascanin);
TOKEN_TYPE GetToken() const
{ return token; }
double GetNumValue() const
{ return num_value; }
const string & GetStringValue() const
{ return string_value; }
char GetCharValue() const
{ return string_value[0]; }
PRIMITIVE_TYPE GetPrimitiveToken() const
{ return prim_token; }
void ReadNext();
/*
CSGScanner & Parse (char ch);
CSGScanner & Parse (int & i);
CSGScanner & Parse (double & d);
CSGScanner & Parse (Point<3> & p);
CSGScanner & Parse (Vec<3> & p);
*/
void Error (const string & err);
};
CSGScanner & operator>> (CSGScanner & scan, char ch);
CSGScanner & operator>> (CSGScanner & scan, double & d);
CSGScanner & operator>> (CSGScanner & scan, int & i);
CSGScanner & operator>> (CSGScanner & scan, Point<3> & p);
CSGScanner & operator>> (CSGScanner & scan, Vec<3> & v);
}
#endif

720
libsrc/csg/csgpkg.cpp Normal file
View File

@ -0,0 +1,720 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <csg.hpp>
#include <incvis.hpp>
#include <visual.hpp>
#include "vscsg.hpp"
extern "C" int Ng_CSG_Init (Tcl_Interp * interp);
namespace netgen
{
// extern DLL_HEADER NetgenGeometry * ng_geometry;
extern DLL_HEADER AutoPtr<NetgenGeometry> ng_geometry;
extern DLL_HEADER AutoPtr<Mesh> mesh;
static VisualSceneGeometry vsgeom;
char * err_needscsgeometry = (char*) "This operation needs an CSG geometry";
extern char * err_needsmesh;
extern char * err_jobrunning;
int Ng_ParseGeometry (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * csgeom = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (csgeom)
{
double detail = atof (Tcl_GetVar (interp, "::geooptions.detail", 0));
double facets = atof (Tcl_GetVar (interp, "::geooptions.facets", 0));
if (atoi (Tcl_GetVar (interp, "::geooptions.drawcsg", 0)))
csgeom->CalcTriangleApproximation(detail, facets);
}
return TCL_OK;
}
int Ng_GeometryOptions (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
const char * command = argv[1];
if (strcmp (command, "get") == 0)
{
if (geometry)
{
char buf[20];
Point3d pmin = geometry->BoundingBox ().PMin();
Point3d pmax = geometry->BoundingBox ().PMax();
sprintf (buf, "%5.1lf", pmin.X());
Tcl_SetVar (interp, "::geooptions.minx", buf, 0);
sprintf (buf, "%5.1lf", pmin.Y());
Tcl_SetVar (interp, "::geooptions.miny", buf, 0);
sprintf (buf, "%5.1lf", pmin.Z());
Tcl_SetVar (interp, "::geooptions.minz", buf, 0);
sprintf (buf, "%5.1lf", pmax.X());
Tcl_SetVar (interp, "::geooptions.maxx", buf, 0);
sprintf (buf, "%5.1lf", pmax.Y());
Tcl_SetVar (interp, "::geooptions.maxy", buf, 0);
sprintf (buf, "%5.1lf", pmax.Z());
Tcl_SetVar (interp, "::geooptions.maxz", buf, 0);
}
}
else if (strcmp (command, "set") == 0)
{
Point<3> pmin (atof (Tcl_GetVar (interp, "::geooptions.minx", 0)),
atof (Tcl_GetVar (interp, "::geooptions.miny", 0)),
atof (Tcl_GetVar (interp, "::geooptions.minz", 0)));
Point<3> pmax (atof (Tcl_GetVar (interp, "::geooptions.maxx", 0)),
atof (Tcl_GetVar (interp, "::geooptions.maxy", 0)),
atof (Tcl_GetVar (interp, "::geooptions.maxz", 0)));
Box<3> box (pmin, pmax);
if (geometry)
geometry -> SetBoundingBox (box);
CSGeometry::SetDefaultBoundingBox (box);
}
return TCL_OK;
}
// attempt of a simple modeller
int Ng_CreatePrimitive (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * classname = argv[1];
tcl_const char * name = argv[2];
cout << "Create primitive, class = " << classname
<< ", name = " << name << endl;
Primitive * nprim = Primitive::CreatePrimitive (classname);
Solid * nsol = new Solid (nprim);
char sname[100];
for (int j = 1; j <= nprim->GetNSurfaces(); j++)
{
sprintf (sname, "%s,%d", name, j);
geometry -> AddSurface (sname, &nprim->GetSurface(j));
nprim -> SetSurfaceId (j, geometry->GetNSurf());
}
geometry->SetSolid (name, nsol);
return TCL_OK;
}
int Ng_SetPrimitiveData (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * name = argv[1];
tcl_const char * value = argv[2];
Array<double> coeffs;
cout << "Set primitive data, name = " << name
<< ", value = " << value << endl;
istringstream vst (value);
double val;
while (!vst.eof())
{
vst >> val;
coeffs.Append (val);
}
((Primitive*)
geometry->GetSolid (name)->GetPrimitive())->SetPrimitiveData (coeffs);
return TCL_OK;
}
int Ng_SetSolidData (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * name = argv[1];
tcl_const char * val = argv[2];
cout << "Set Solid Data, name = " << name
<< ", value = " << val << endl;
istringstream vst (val);
Solid * nsol = Solid::CreateSolid (vst, geometry->GetSolids());
geometry->SetSolid (name, nsol);
return TCL_OK;
}
int Ng_GetPrimitiveData (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * name = argv[1];
tcl_const char * classnamevar = argv[2];
tcl_const char * valuevar = argv[3];
const char * classname;
Array<double> coeffs;
geometry->GetSolid (name)->GetPrimitive()->GetPrimitiveData (classname, coeffs);
ostringstream vst;
for (int i = 1; i <= coeffs.Size(); i++)
vst << coeffs.Get(i) << " ";
cout << "GetPrimitiveData, name = " << name
<< ", classnamevar = " << classnamevar
<< ", classname = " << classname << endl
<< " valuevar = " << valuevar
<< ", values = " << vst.str() << endl;
Tcl_SetVar (interp, classnamevar, (char*)classname, 0);
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
return TCL_OK;
}
int Ng_GetSolidData (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * name = argv[1];
tcl_const char * valuevar = argv[2];
ostringstream vst;
const Solid * sol = geometry->GetSolid (name);
sol->GetSolidData (vst);
cout << "GetSolidData, name = " << name << ", data = " << vst.str() << endl;
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
return TCL_OK;
}
int Ng_GetPrimitiveList (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * valuevar = argv[1];
int i;
stringstream vst;
for (i = 1; i <= geometry->GetNSolids(); i++)
{
const Solid * sol = geometry->GetSolid(i);
if (sol->GetPrimitive())
vst << sol->Name() << " ";
}
cout << "primnames = " << vst.str() << endl;
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
return TCL_OK;
}
int Ng_GetSurfaceList (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * valuevar = argv[1];
int i;
stringstream vst;
for (i = 1; i <= geometry->GetNSurf(); i++)
{
const Surface * surf = geometry->GetSurface(i);
vst << surf->Name() << " ";
}
cout << "surfnames = " << vst.str() << endl;
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
return TCL_OK;
}
int Ng_GetSolidList (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * valuevar = argv[1];
int i;
stringstream vst;
for (i = 1; i <= geometry->GetNSolids(); i++)
{
const Solid * sol = geometry->GetSolid(i);
if (!sol->GetPrimitive())
vst << sol->Name() << " ";
}
cout << "solnames = " << vst.str() << endl;
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
return TCL_OK;
}
int Ng_TopLevel (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
int i;
/*
for (i = 0; i < argc; i++)
cout << argv[i] << ", ";
cout << endl;
*/
if (strcmp (argv[1], "getlist") == 0)
{
stringstream vst;
for (i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
const Solid * sol;
const Surface * surf;
geometry->GetTopLevelObject (i, sol, surf);
if (!surf)
vst << "{ " << sol->Name() << " } ";
else
vst << "{ " << sol->Name() << " " << surf->Name() << " } ";
}
tcl_const char * valuevar = argv[2];
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
}
if (strcmp (argv[1], "set") == 0)
{
tcl_const char * solname = argv[2];
tcl_const char * surfname = argv[3];
Solid * sol = (Solid*)geometry->GetSolid (solname);
Surface * surf = (Surface*)geometry->GetSurface (surfname);
geometry->SetTopLevelObject (sol, surf);
}
if (strcmp (argv[1], "remove") == 0)
{
tcl_const char * solname = argv[2];
tcl_const char * surfname = argv[3];
Solid * sol = (Solid*)geometry->GetSolid (solname);
Surface * surf = (Surface*)geometry->GetSurface (surfname);
geometry->RemoveTopLevelObject (sol, surf);
}
if (strcmp (argv[1], "setprop") == 0)
{
tcl_const char * solname = argv[2];
tcl_const char * surfname = argv[3];
tcl_const char * propvar = argv[4];
Solid * sol = (Solid*)geometry->GetSolid (solname);
Surface * surf = (Surface*)geometry->GetSurface (surfname);
TopLevelObject * tlo = geometry->GetTopLevelObject (sol, surf);
if (!tlo) return TCL_OK;
char varname[50];
sprintf (varname, "%s(red)", propvar);
double red = atof (Tcl_GetVar (interp, varname, 0));
sprintf (varname, "%s(blue)", propvar);
double blue = atof (Tcl_GetVar (interp, varname, 0));
sprintf (varname, "%s(green)", propvar);
double green = atof (Tcl_GetVar (interp, varname, 0));
tlo -> SetRGB (red, green, blue);
sprintf (varname, "%s(visible)", propvar);
tlo -> SetVisible (bool(atoi (Tcl_GetVar (interp, varname, 0))));
sprintf (varname, "%s(transp)", propvar);
tlo -> SetTransparent (bool(atoi (Tcl_GetVar (interp, varname, 0))));
}
if (strcmp (argv[1], "getprop") == 0)
{
tcl_const char * solname = argv[2];
tcl_const char * surfname = argv[3];
tcl_const char * propvar = argv[4];
Solid * sol = (Solid*)geometry->GetSolid (solname);
Surface * surf = (Surface*)geometry->GetSurface (surfname);
TopLevelObject * tlo = geometry->GetTopLevelObject (sol, surf);
if (!tlo) return TCL_OK;
char varname[50], varval[10];
sprintf (varname, "%s(red)", propvar);
sprintf (varval, "%lf", tlo->GetRed());
Tcl_SetVar (interp, varname, varval, 0);
sprintf (varname, "%s(green)", propvar);
sprintf (varval, "%lf", tlo->GetGreen());
Tcl_SetVar (interp, varname, varval, 0);
sprintf (varname, "%s(blue)", propvar);
sprintf (varval, "%lf", tlo->GetBlue());
Tcl_SetVar (interp, varname, varval, 0);
sprintf (varname, "%s(visible)", propvar);
sprintf (varval, "%d", tlo->GetVisible());
Tcl_SetVar (interp, varname, varval, 0);
sprintf (varname, "%s(transp)", propvar);
sprintf (varval, "%d", tlo->GetTransparent());
Tcl_SetVar (interp, varname, varval, 0);
}
return TCL_OK;
}
int Ng_SingularEdgeMS (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
if (!mesh.Ptr())
{
Tcl_SetResult (interp, err_needsmesh, TCL_STATIC);
return TCL_ERROR;
}
if (multithread.running)
{
Tcl_SetResult (interp, err_jobrunning, TCL_STATIC);
return TCL_ERROR;
}
double globh = mparam.maxh;
for (int i = 1; i <= geometry->singedges.Size(); i++)
geometry->singedges.Get(i)->SetMeshSize (*mesh, globh);
return TCL_OK;
}
int Ng_SingularPointMS (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
double globh = mparam.maxh;
for (int i = 1; i <= geometry->singpoints.Size(); i++)
geometry->singpoints.Get(i)->SetMeshSize (*mesh, globh);
return TCL_OK;
}
int Ng_SelectSurface (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
int surfnr = atoi (argv[1]);
vsgeom.SelectSurface (surfnr);
return TCL_OK;
}
/*
class CSGeometryRegister : public GeometryRegister
{
public:
virtual NetgenGeometry * Load (string filename) const;
virtual NetgenGeometry * LoadFromMeshFile (istream & ist) const;
virtual VisualScene * GetVisualScene (const NetgenGeometry * geom) const;
};
extern CSGeometry * ParseCSG (istream & istr);
NetgenGeometry * CSGeometryRegister :: Load (string filename) const
{
const char * cfilename = filename.c_str();
if (strcmp (&cfilename[strlen(cfilename)-3], "geo") == 0)
{
PrintMessage (1, "Load CSG geometry file ", cfilename);
ifstream infile(cfilename);
CSGeometry * hgeom = ParseCSG (infile);
if (!hgeom)
throw NgException ("geo-file should start with 'algebraic3d'");
hgeom -> FindIdenticSurfaces(1e-8 * hgeom->MaxSize());
return hgeom;
}
if (strcmp (&cfilename[strlen(cfilename)-3], "ngg") == 0)
{
PrintMessage (1, "Load new CSG geometry file ", cfilename);
ifstream infile(cfilename);
CSGeometry * hgeom = new CSGeometry("");
hgeom -> Load (infile);
return hgeom;
}
return NULL;
}
NetgenGeometry * CSGeometryRegister :: LoadFromMeshFile (istream & ist) const
{
string auxstring;
if (ist.good())
{
ist >> auxstring;
if (auxstring == "csgsurfaces")
{
CSGeometry * geometry = new CSGeometry ("");
geometry -> LoadSurfaces(ist);
return geometry;
}
// else
// ist.putback (auxstring);
}
return NULL;
}
VisualScene * CSGeometryRegister :: GetVisualScene (const NetgenGeometry * geom) const
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.Ptr());
if (geometry)
{
vsgeom.SetGeometry (geometry);
return &vsgeom;
}
return NULL;
}
*/
class CSGeometryVisRegister : public GeometryRegister
{
public:
virtual NetgenGeometry * Load (string filename) const { return NULL; }
virtual VisualScene * GetVisualScene (const NetgenGeometry * geom) const;
};
VisualScene * CSGeometryVisRegister :: GetVisualScene (const NetgenGeometry * geom) const
{
const CSGeometry * geometry = dynamic_cast<const CSGeometry*> (geom);
if (geometry)
{
vsgeom.SetGeometry (const_cast<CSGeometry*>(geometry));
return &vsgeom;
}
return NULL;
}
}
using namespace netgen;
int Ng_CSG_Init (Tcl_Interp * interp)
{
geometryregister.Append (new CSGeometryVisRegister);
if (interp == NULL) return TCL_OK;
Tcl_CreateCommand (interp, "Ng_ParseGeometry", Ng_ParseGeometry,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
// geometry
Tcl_CreateCommand (interp, "Ng_CreatePrimitive", Ng_CreatePrimitive,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_SetPrimitiveData", Ng_SetPrimitiveData,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_GetPrimitiveData", Ng_GetPrimitiveData,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_GetPrimitiveList", Ng_GetPrimitiveList,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_GetSurfaceList", Ng_GetSurfaceList,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_SetSolidData", Ng_SetSolidData,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_GetSolidData", Ng_GetSolidData,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_GetSolidList", Ng_GetSolidList,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_TopLevel", Ng_TopLevel,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_GeometryOptions", Ng_GeometryOptions,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_SingularEdgeMS", Ng_SingularEdgeMS,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_SingularPointMS", Ng_SingularPointMS,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_SelectSurface", Ng_SelectSurface,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
return TCL_OK;
}

78
libsrc/csg/curve2d.cpp Normal file
View File

@ -0,0 +1,78 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <csg.hpp>
namespace netgen
{
CircleCurve2d :: CircleCurve2d (const Point<2> & acenter, double arad)
{
center = acenter;
rad = arad;
}
void CircleCurve2d :: Project (Point<2> & p) const
{
Vec<2> v = p - center;
v *= rad/v.Length();
p = center + v;
}
void CircleCurve2d :: NormalVector (const Point<2> & p, Vec<2> & n) const
{
n = p - center;
n /= n.Length();
}
QuadraticCurve2d :: QuadraticCurve2d ()
{
cxx = cyy = cxy = cx = cy = c = 0;
}
void QuadraticCurve2d :: Read (istream & ist)
{
ist >> cxx >> cyy >> cxy >> cx >> cy >> c;
}
void QuadraticCurve2d :: Project (Point<2> & p) const
{
double f, x, y, gradx, grady, grad2;
int its = 0;
x = p(0);
y = p(1);
do
{
f = cxx * x * x + cyy * y * y + cxy * x * y + cx * x + cy * y + c;
gradx = 2 * cxx * x + cxy * y + cx;
grady = 2 * cyy * y + cxy * x + cy;
grad2 = gradx * gradx + grady * grady;
x -= f * gradx / grad2;
y -= f * grady / grad2;
// (*mycout) << "x = " << x << " y = " << y << " f = " << f << endl;
its++;
}
while (fabs (f) > 1e-8 && its < 20);
if (its >= 20)
cerr << "QuadraticCurve2d::Project: many iterations, f = " << f << endl;
p(0) = x;
p(1) = y;
}
void QuadraticCurve2d :: NormalVector (const Point<2> & p, Vec<2> & n) const
{
n(0) = 2 * cxx * p(0) + cxy * p(1) + cx;
n(1) = 2 * cyy * p(1) + cxy * p(0) + cy;
n.Normalize();
}
}

67
libsrc/csg/curve2d.hpp Normal file
View File

@ -0,0 +1,67 @@
#ifndef FILE_CURVE2D
#define FILE_CURVE2D
/**************************************************************************/
/* File: curve2d.hh */
/* Author: Joachim Schoeberl */
/* Date: 24. Jul. 96 */
/**************************************************************************/
namespace netgen
{
/*
2D Curve repesentation
*/
///
class Curve2d : public Manifold
{
public:
///
virtual void Project (Point<2> & p) const = 0;
///
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const = 0;
};
///
class CircleCurve2d : public Curve2d
{
///
Point<2> center;
///
double rad;
public:
///
CircleCurve2d (const Point<2> & acenter, double arad);
///
virtual void Project (Point<2> & p) const;
///
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
};
///
class QuadraticCurve2d : public Curve2d
{
///
double cxx, cyy, cxy, cx, cy, c;
public:
///
QuadraticCurve2d ();
///
void Read (istream & ist);
///
virtual void Project (Point<2> & p) const;
///
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
};
}
#endif

1834
libsrc/csg/edgeflw.cpp Normal file

File diff suppressed because it is too large Load Diff

110
libsrc/csg/edgeflw.hpp Normal file
View File

@ -0,0 +1,110 @@
#ifndef FILE_EDGEFLW
#define FILE_EDGEFLW
/**************************************************************************/
/* File: edgeflw.hh */
/* Author: Joachim Schoeberl */
/* Date: 01. Okt. 95 */
/**************************************************************************/
namespace netgen
{
/*
Edge - following function and
Projection to edge of implicitly given edge
*/
/**
Calculates edges.
The edges of a solid geometry are computed. Special
points have to be given.
*/
extern void CalcEdges (const CSGeometry & geometry,
const Array<SpecialPoint> & specpoints,
double h, Mesh & mesh);
class EdgeCalculation
{
const CSGeometry & geometry;
Array<SpecialPoint> & specpoints;
Point3dTree * searchtree;
Point3dTree * meshpoint_tree;
int cntedge;
double ideps;
public:
EdgeCalculation (const CSGeometry & ageometry,
Array<SpecialPoint> & aspecpoints);
~EdgeCalculation();
void SetIdEps(const double epsin) {ideps = epsin;}
void Calc(double h, Mesh & mesh);
private:
void CalcEdges1 (double h, Mesh & mesh);
void FollowEdge (int pi1, int & ep, int & pos,
// const Array<SpecialPoint> & hsp,
const Array<int> & hsp,
double h, const Mesh & mesh,
Array<Point<3> > & edgepoints,
Array<double> & curvelength);
void AnalyzeEdge (int s1, int s2, int s1_rep, int s2_rep, int pos, int layer,
const Array<Point<3> > & edgepoints,
Array<Segment> & refedges,
Array<bool> & refedgesinv);
void StoreEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
const Array<Point<3> > & edgepoints,
const Array<double> & curvelength,
int layer,
Mesh & mesh);
void StoreShortEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
const Array<Point<3> > & edgepoints,
const Array<double> & curvelength,
int layer,
Mesh & mesh);
void CopyEdge (const Array<Segment> & refedges,
const Array<bool> & refedgesinv,
int copyfromedge,
const Point<3> & fromstart, const Point<3> & fromend,
const Point<3> & tostart, const Point<3> & toend,
int copyedgeidentification,
int layer,
Mesh & mesh);
void SplitEqualOneSegEdges (Mesh & mesh);
void FindClosedSurfaces (double h, Mesh & mesh);
public:
bool point_on_edge_problem;
};
}
#endif

View File

@ -0,0 +1,160 @@
#include <mystdlib.h>
#include <csg.hpp>
namespace netgen
{
ExplicitCurve2d :: ExplicitCurve2d ()
{
;
}
void ExplicitCurve2d :: Project (Point<2> & p) const
{
double t;
t = ProjectParam (p);
p = Eval (t);
}
double ExplicitCurve2d :: NumericalProjectParam (const Point<2> & p, double lb, double ub) const
{
double t(-1);
Vec<2> tan;
Vec<2> curv;
Point<2> cp;
double f, fl, fu;
int cnt;
tan = EvalPrime (lb);
cp = Eval (lb);
fl = tan * (cp - p);
if (fl > 0) // changed by wmf, originally fl >= 0
{
// cerr << "tan = " << tan << " cp - p = " << (cp - p) << endl;
// cerr << "ExplicitCurve2d::NumericalProject: lb wrong" << endl;
return 0;
}
tan = EvalPrime (ub);
cp = Eval (ub);
fu = tan * (cp - p);
if (fu < 0) // changed by wmf, originally fu <= 0
{
// cerr << "tan = " << tan << " cp - p = " << (cp - p) << endl;
// cerr << "ExplicitCurve2d::NumericalProject: ub wrong" << endl;
return 0;
}
cnt = 0;
while (ub - lb > 1e-12 && fu - fl > 1e-12)
{
cnt++;
if (cnt > 50)
{
(*testout) << "Num Proj, cnt = " << cnt << endl;
}
t = (lb * fu - ub * fl) / (fu - fl);
if (t > 0.9 * ub + 0.1 * lb) t = 0.9 * ub + 0.1 * lb;
if (t < 0.1 * ub + 0.9 * lb) t = 0.1 * ub + 0.9 * lb;
tan = EvalPrime (t);
cp = Eval (t);
f = tan * (cp - p);
if (f >= 0)
{
ub = t;
fu = f;
}
else
{
lb = t;
fl = f;
}
}
return t;
}
Vec<2> ExplicitCurve2d :: Normal (double t) const
{
Vec<2> tan = EvalPrime (t);
tan.Normalize();
return Vec<2> (tan(1), -tan(0));
}
void ExplicitCurve2d :: NormalVector (const Point<2> & p, Vec<2> & n) const
{
double t = ProjectParam (p);
n = Normal (t);
}
Point<2> ExplicitCurve2d :: CurvCircle (double t) const
{
Point<2> cp;
Vec<2> tan, n, curv;
double den;
cp = Eval (t);
tan = EvalPrime (t);
n = Normal (t);
curv = EvalPrimePrime (t);
den = n * curv;
if (fabs (den) < 1e-12)
return cp + 1e12 * n;
return cp + (tan.Length2() / den) * n;
}
double ExplicitCurve2d :: MaxCurvature () const
{
double t, tmin, tmax, dt;
double curv;
Vec<2> tan;
double maxcurv;
maxcurv = 0;
tmin = MinParam ();
tmax = MaxParam ();
dt = (tmax - tmin) / 1000;
for (t = tmin; t <= tmax+dt; t += dt)
if (SectionUsed (t))
{
tan = EvalPrime (t);
curv = fabs ( (Normal(t) * EvalPrimePrime(t)) / tan.Length2());
if (curv > maxcurv) maxcurv = curv;
}
return maxcurv;
}
double ExplicitCurve2d :: MaxCurvatureLoc (const Point<2> & p, double rad) const
{
double t, tmin, tmax, dt;
double curv;
Vec<2> tan;
double maxcurv;
maxcurv = 0;
tmin = MinParam ();
tmax = MaxParam ();
dt = (tmax - tmin) / 1000;
for (t = tmin; t <= tmax+dt; t += dt)
if (Dist (Eval(t), p) < rad)
{
tan = EvalPrime (t);
curv = fabs ( (Normal(t) * EvalPrimePrime(t)) / tan.Length2());
if (curv > maxcurv) maxcurv = curv;
}
return maxcurv;
}
}

View File

@ -0,0 +1,113 @@
#ifndef FILE_EXPLICITCURVE2D
#define FILE_EXPLICITCURVE2D
/**************************************************************************/
/* File: explicitcurve2d.hh */
/* Author: Joachim Schoeberl */
/* Date: 14. Oct. 96 */
/**************************************************************************/
namespace netgen
{
/*
Explicit 2D Curve repesentation
*/
///
class ExplicitCurve2d : public Curve2d
{
public:
///
ExplicitCurve2d ();
///
virtual void Project (Point<2> & p) const;
///
virtual double ProjectParam (const Point<2> & p) const = 0;
///
virtual double NumericalProjectParam (const Point<2> & p, double lb, double ub) const;
///
virtual double MinParam () const = 0;
///
virtual double MaxParam () const = 0;
///
virtual Point<2> Eval (double t) const = 0;
///
virtual Vec<2> EvalPrime (double t) const = 0;
///
virtual Vec<2> Normal (double t) const;
///
virtual void NormalVector (const Point<2> & p, Vec<2> & n) const;
///
virtual Vec<2> EvalPrimePrime (double t) const = 0;
///
virtual double MaxCurvature () const;
///
virtual double MaxCurvatureLoc (const Point<2> & p, double rad) const;
///
virtual Point<2> CurvCircle (double t) const;
///
virtual void Print (ostream & /* str */) const { };
///
virtual int SectionUsed (double /* t */) const { return 1; }
///
virtual void Reduce (const Point<2> & /* p */, double /* rad */) { };
///
virtual void UnReduce () { };
};
///
class BSplineCurve2d : public ExplicitCurve2d
{
///
Array<Point<2> > points;
///
Array<int> intervallused;
///
int redlevel;
public:
///
BSplineCurve2d ();
///
void AddPoint (const Point<2> & apoint);
bool Inside (const Point<2> & p, double & dist) const;
///
virtual double ProjectParam (const Point<2> & p) const;
///
virtual double MinParam () const { return 0; }
///
virtual double MaxParam () const { return points.Size(); }
///
virtual Point<2> Eval (double t) const;
///
virtual Vec<2> EvalPrime (double t) const;
///
virtual Vec<2> EvalPrimePrime (double t) const;
///
virtual void Print (ostream & str) const;
///
virtual int SectionUsed (double t) const;
///
virtual void Reduce (const Point<2> & p, double rad);
///
virtual void UnReduce ();
};
}
#endif

876
libsrc/csg/extrusion.cpp Normal file
View File

@ -0,0 +1,876 @@
#include <mystdlib.h>
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
Array<Point<3> > project1, project2;
void ExtrusionFace :: Init(void)
{
p0.SetSize(path->GetNSplines());
x_dir.SetSize(path->GetNSplines());
y_dir.SetSize(path->GetNSplines());
z_dir.SetSize(path->GetNSplines());
loc_z_dir.SetSize(path->GetNSplines());
spline3_path.SetSize(path->GetNSplines());
line_path.SetSize(path->GetNSplines());
for(int i=0; i<path->GetNSplines(); i++)
{
spline3_path[i] = dynamic_cast < const SplineSeg3<3>* >(&path->GetSpline(i));
line_path[i] = dynamic_cast < const LineSeg<3>* >(&path->GetSpline(i));
if(line_path[i])
{
y_dir[i] = line_path[i]->EndPI() - line_path[i]->StartPI();
y_dir[i].Normalize();
z_dir[i] = glob_z_direction;
Orthogonalize(y_dir[i],z_dir[i]);
x_dir[i] = Cross(y_dir[i],z_dir[i]);
loc_z_dir[i] = z_dir[i];
}
else
{
z_dir[i] = glob_z_direction;
loc_z_dir[i] = glob_z_direction;
}
}
profile->GetCoeff(profile_spline_coeff);
latest_point3d = -1.111e30;
}
ExtrusionFace :: ExtrusionFace(const SplineSeg<2> * profile_in,
const SplineGeometry<3> * path_in,
const Vec<3> & z_direction) :
profile(profile_in), path(path_in), glob_z_direction(z_direction)
{
deletable = false;
Init();
}
ExtrusionFace :: ExtrusionFace(const Array<double> & raw_data)
{
deletable = true;
int pos=0;
Array< Point<2> > p(3);
int ptype = int(raw_data[pos]); pos++;
for(int i=0; i<ptype; i++)
{
p[i](0) = raw_data[pos]; pos++;
p[i](1) = raw_data[pos]; pos++;
}
if(ptype == 2)
{
profile = new LineSeg<2>(GeomPoint<2>(p[0],1),
GeomPoint<2>(p[1],1));
}
else if(ptype == 3)
{
profile = new SplineSeg3<2>(GeomPoint<2>(p[0],1),
GeomPoint<2>(p[1],1),
GeomPoint<2>(p[2],1));
}
path = new SplineGeometry<3>;
pos = const_cast< SplineGeometry<3> *>(path)->Load(raw_data,pos);
for(int i = 0; i < 3; i++)
{
glob_z_direction(i) = raw_data[pos];
pos++;
}
Init();
}
ExtrusionFace :: ~ExtrusionFace()
{
if(deletable)
{
delete profile;
delete path;
}
}
int ExtrusionFace :: IsIdentic (const Surface & s2, int & inv, double eps) const
{
const ExtrusionFace * ext2 = dynamic_cast<const ExtrusionFace*>(&s2);
if(!ext2) return 0;
if(ext2 == this)
return 1;
return 0;
}
void ExtrusionFace :: Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const
{
v2 -= (v1*v2)*v1;
v2.Normalize();
}
void ExtrusionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d,
int & seg, double & t) const
{
if (Dist2 (point3d, latest_point3d) <
1e-25 * Dist2(path->GetSpline(0).StartPI(), path->GetSpline(0).EndPI()))
{
point2d = latest_point2d;
seg = latest_seg;
t = latest_t;
return;
}
latest_point3d = point3d;
double cutdist = -1;
Array<double> mindist(path->GetNSplines());
for(int i = 0; i < path->GetNSplines(); i++)
{
double auxcut = -1;
double auxmin = -1;
if(spline3_path[i])
{
Point<3> startp(path->GetSpline(i).StartPI());
Point<3> endp(path->GetSpline(i).EndPI());
Point<3> tanp(spline3_path[i]->TangentPoint());
// lower bound for dist
auxmin = sqrt (MinDistTP2 (startp, endp, tanp, point3d));
// upper bound for dist
auxcut = min2 (Dist (startp, point3d), Dist (endp, point3d));
}
else if(line_path[i])
{
auxmin = auxcut = sqrt (MinDistLP2 (path->GetSpline(i).StartPI(),
path->GetSpline(i).EndPI(),
point3d));
}
mindist[i] = auxmin;
if(i==0 || auxcut < cutdist)
cutdist = auxcut;
}
Point<2> testpoint2d;
Point<3> testpoint3d;
double minproj(-1);
bool minproj_set(false);
for(int i=0; i<path->GetNSplines(); i++)
{
if(mindist[i] > cutdist) continue;
double thist = CalcProj(point3d,testpoint2d,i);
testpoint3d = p0[i] + testpoint2d(0)*x_dir[i] + testpoint2d(1)*loc_z_dir[i];
double d = Dist2(point3d,testpoint3d);
if(!minproj_set || d < minproj)
{
minproj_set = true;
minproj = d;
point2d = testpoint2d;
t = thist;
seg = i;
latest_seg = i;
latest_t = t;
latest_point2d = point2d;
}
}
}
double ExtrusionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d,
int seg) const
{
double t = -1;
if(line_path[seg])
{
point2d(0) = (point3d-line_path[seg]->StartPI())*x_dir[seg];
point2d(1) = (point3d-line_path[seg]->StartPI())*z_dir[seg];
double l = Dist(line_path[seg]->StartPI(),
line_path[seg]->EndPI());
t = min2(max2((point3d - line_path[seg]->StartPI()) * y_dir[seg],0.),
l);
p0[seg] = line_path[seg]->StartPI() + t*y_dir[seg];
t *= 1./l;
}
else if(spline3_path[seg])
{
spline3_path[seg]->Project(point3d,p0[seg],t);
y_dir[seg] = spline3_path[seg]->GetTangent(t);
y_dir[seg].Normalize();
loc_z_dir[seg] = z_dir[seg];
Orthogonalize(y_dir[seg],loc_z_dir[seg]);
x_dir[seg] = Cross(y_dir[seg],loc_z_dir[seg]);
Vec<3> dir = point3d-p0[seg];
point2d(0) = x_dir[seg]*dir;
point2d(1) = loc_z_dir[seg]*dir;
}
return t;
}
double ExtrusionFace :: CalcFunctionValue (const Point<3> & point) const
{
Point<2> p;
double dummyd;
int dummyi;
CalcProj(point, p, dummyi, dummyd);
return
profile_spline_coeff(0)*p(0)*p(0) +
profile_spline_coeff(1)*p(1)*p(1) +
profile_spline_coeff(2)*p(0)*p(1) +
profile_spline_coeff(3)*p(0) +
profile_spline_coeff(4)*p(1) +
profile_spline_coeff(5);
}
void ExtrusionFace :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
{
Point<2> p2d;
double t_path;
int seg;
CalcProj (point, p2d, seg, t_path);
Point<3> phi;
Vec<3> phip, phipp, phi_minus_point;
path->GetSpline(seg).GetDerivatives(t_path, phi, phip, phipp);
phi_minus_point = phi-point;
Vec<3> grad_t = (1.0/(phipp*phi_minus_point + phip*phip)) * phip;
Vec<3> grad_xbar, grad_ybar;
Vec<3> hex, hey, hez, dex, dey, dez;
CalcLocalCoordinatesDeriv (seg, t_path, hex, hey, hez, dex, dey, dez);
grad_xbar = hex - (phi_minus_point*dex + hex*phip) * grad_t;
grad_ybar = hez - (phi_minus_point*dez + hez*phip) * grad_t;
double dFdxbar = 2.*profile_spline_coeff(0)*p2d(0) +
profile_spline_coeff(2)*p2d(1) + profile_spline_coeff(3);
double dFdybar = 2.*profile_spline_coeff(1)*p2d(1) +
profile_spline_coeff(2)*p2d(0) + profile_spline_coeff(4);
grad = dFdxbar * grad_xbar + dFdybar * grad_ybar;
}
void ExtrusionFace :: CalcHesse (const Point<3> & point, Mat<3> & hesse) const
{
const double eps = 1e-7*Dist(path->GetSpline(0).StartPI(),path->GetSpline(0).EndPI());
Point<3> auxpoint1(point),auxpoint2(point);
Vec<3> auxvec,auxgrad1,auxgrad2;
for(int i=0; i<3; i++)
{
auxpoint1(i) -= eps;
auxpoint2(i) += eps;
CalcGradient(auxpoint1,auxgrad1);
CalcGradient(auxpoint2,auxgrad2);
auxvec = (1./(2.*eps)) * (auxgrad2-auxgrad1);
for(int j=0; j<3; j++)
hesse(i,j) = auxvec(j);
auxpoint1(i) = point(i);
auxpoint2(i) = point(i);
}
/*
Vec<3> grad;
CalcGradient(point,grad);
Point<3> auxpoint(point);
Vec<3> auxvec,auxgrad;
for(int i=0; i<3; i++)
{
auxpoint(i) -= eps;
CalcGradient(auxpoint,auxgrad);
auxvec = (1./eps) * (grad-auxgrad);
for(int j=0; j<3; j++)
hesse(i,j) = auxvec(j);
auxpoint(i) = point(i);
}
*/
for(int i=0; i<3; i++)
for(int j=i+1; j<3; j++)
hesse(i,j) = hesse(j,i) = 0.5*(hesse(i,j)+hesse(j,i));
}
double ExtrusionFace :: HesseNorm () const
{
return fabs(profile_spline_coeff(0) + profile_spline_coeff(1)) +
sqrt(pow(profile_spline_coeff(0)+profile_spline_coeff(1),2)+4.*pow(profile_spline_coeff(2),2));
}
double ExtrusionFace :: MaxCurvature () const
{
double retval,actmax;
retval = profile->MaxCurvature();
for(int i=0; i<path->GetNSplines(); i++)
{
actmax = path->GetSpline(i).MaxCurvature();
if(actmax > retval)
retval = actmax;
}
return 2.*retval;
}
void ExtrusionFace :: Project (Point<3> & p) const
{
double dummyt;
int seg;
Point<2> p2d;
CalcProj(p,p2d,seg,dummyt);
profile->Project(p2d,p2d,profile_par);
p = p0[seg] + p2d(0)*x_dir[seg] + p2d(1)*loc_z_dir[seg];
Vec<2> tangent2d = profile->GetTangent(profile_par);
profile_tangent = tangent2d(0)*x_dir[seg] + tangent2d(1)*y_dir[seg];
}
Point<3> ExtrusionFace :: GetSurfacePoint () const
{
p0[0] = path->GetSpline(0).GetPoint(0.5);
if(!line_path[0])
{
y_dir[0] = path->GetSpline(0).GetTangent(0.5);
y_dir[0].Normalize();
loc_z_dir[0] = z_dir[0];
Orthogonalize(y_dir[0],loc_z_dir[0]);
x_dir[0] = Cross(y_dir[0],loc_z_dir[0]);
}
Point<2> locpoint = profile->GetPoint(0.5);
return p0[0] + locpoint(0)*x_dir[0] + locpoint(1)*loc_z_dir[0];
}
bool ExtrusionFace :: BoxIntersectsFace(const Box<3> & box) const
{
Point<3> center = box.Center();
Project(center);
//(*testout) << "box.Center() " << box.Center() << " projected " << center << " diam " << box.Diam()
// << " dist " << Dist(box.Center(),center) << endl;
return (Dist(box.Center(),center) < 0.5*box.Diam());
}
void ExtrusionFace :: LineIntersections ( const Point<3> & p,
const Vec<3> & v,
const double eps,
int & before,
int & after,
bool & intersecting ) const
{
Point<2> p2d;
Vec<2> v2d;
intersecting = false;
double segt;
int seg;
CalcProj(p,p2d,seg,segt);
if(seg == 0 && segt < 1e-20)
{
Vec<3> v1,v2;
v1 = path->GetSpline(0).GetTangent(0);
v2 = p-p0[seg];
if(v1*v2 < -eps)
return;
}
if(seg == path->GetNSplines()-1 && 1.-segt < 1e-20)
{
Vec<3> v1,v2;
v1 = path->GetSpline(seg).GetTangent(1);
v2 = p-p0[seg];
if(v1*v2 > eps)
return;
}
v2d(0) = v * x_dir[seg];
v2d(1) = v * loc_z_dir[seg];
Vec<2> n(v2d(1),-v2d(0));
Array < Point<2> > ips;
profile->LineIntersections(v2d(1),
-v2d(0),
-v2d(1)*p2d(0) + v2d(0)*p2d(1),
ips,eps);
int comp;
if(fabs(v2d(0)) >= fabs(v2d(1)))
comp = 0;
else
comp = 1;
//(*testout) << "p2d " << p2d;
for(int i=0; i<ips.Size(); i++)
{
//(*testout) << " ip " << ips[i];
double t = (ips[i](comp)-p2d(comp))/v2d(comp);
if(t < -eps)
before++;
else if(t > eps)
after++;
else
intersecting = true;
}
//(*testout) << endl;
}
void ExtrusionFace :: Print (ostream & str) const{}
INSOLID_TYPE ExtrusionFace :: VecInFace ( const Point<3> & p,
const Vec<3> & v,
const double eps ) const
{
Vec<3> normal1;
CalcGradient(p,normal1); normal1.Normalize();
double d1 = normal1*v;
if(d1 > eps)
return IS_OUTSIDE;
if(d1 < -eps)
return IS_INSIDE;
return DOES_INTERSECT;
/*
Point<2> p2d;
double t_path;
int seg;
CalcProj(p,p2d,seg,t_path);
double t;
profile.Project(p2d,p2d,t);
Vec<2> profile_tangent = profile.GetTangent(t);
double d;
Vec<3> normal1;
CalcGradient(p,normal1); normal1.Normalize();
double d1 = normal1*v;
Vec<2> v2d;
v2d(0) = v*x_dir[seg];
v2d(1) = v*loc_z_dir[seg];
Vec<2> normal(-profile_tangent(1),profile_tangent(0));
//d = normal*v2d;
d = d1;
if(d > eps)
return IS_OUTSIDE;
if(d < -eps)
return IS_INSIDE;
return DOES_INTERSECT;
*/
}
void ExtrusionFace :: GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & boundingbox,
double facets) const
{
int n = int(facets) + 1;
for(int k = 0; k < path -> GetNSplines(); k++)
{
for(int i = 0; i <= n; i++)
{
Point<3> origin = path -> GetSpline(k).GetPoint(double(i)/double(n));
if(!line_path[k])
{
y_dir[k] = path->GetSpline(k).GetTangent(double(i)/double(n));
y_dir[k].Normalize();
}
loc_z_dir[k] = z_dir[k];
Orthogonalize(y_dir[k],loc_z_dir[k]);
if(!line_path[k])
x_dir[k] = Cross(y_dir[k],loc_z_dir[k]);
for(int j = 0; j <= n; j++)
{
Point<2> locp = profile->GetPoint(double(j)/double(n));
tas.AddPoint(origin + locp(0)*x_dir[k] + locp(1)*loc_z_dir[k]);
}
}
}
for(int k = 0; k < path->GetNSplines(); k++)
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
{
int pi = k*(n+1)*(n+1) + (n+1)*i +j;
tas.AddTriangle( TATriangle (0, pi,pi+1,pi+n+1) );
tas.AddTriangle( TATriangle (0, pi+1,pi+n+1,pi+n+2) );
}
}
void ExtrusionFace :: GetRawData(Array<double> & data) const
{
data.DeleteAll();
profile->GetRawData(data);
path->GetRawData(data);
for(int i=0; i<3; i++)
data.Append(glob_z_direction[i]);
}
void ExtrusionFace ::
CalcLocalCoordinates (int seg, double t,
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez) const
{
ey = path->GetSpline(seg).GetTangent(t);
ey /= ey.Length();
ex = Cross (ey, glob_z_direction);
ex /= ex.Length();
ez = Cross (ex, ey);
}
void ExtrusionFace ::
CalcLocalCoordinatesDeriv (int seg, double t,
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez,
Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const
{
Point<3> point;
Vec<3> first, second;
path->GetSpline(seg).GetDerivatives (t, point, first, second);
ey = first;
ex = Cross (ey, glob_z_direction);
ez = Cross (ex, ey);
dey = second;
dex = Cross (dey, glob_z_direction);
dez = Cross (dex, ey) + Cross (ex, dey);
double lenx = ex.Length();
double leny = ey.Length();
double lenz = ez.Length();
ex /= lenx;
ey /= leny;
ez /= lenz;
dex /= lenx;
dex -= (dex * ex) * ex;
dey /= leny;
dey -= (dey * ey) * ey;
dez /= lenz;
dez -= (dez * ez) * ez;
}
Extrusion :: Extrusion(const SplineGeometry<3> & path_in,
const SplineGeometry<2> & profile_in,
const Vec<3> & z_dir) :
path(path_in), profile(profile_in), z_direction(z_dir)
{
surfaceactive.SetSize(0);
surfaceids.SetSize(0);
for(int j=0; j<profile.GetNSplines(); j++)
{
ExtrusionFace * face = new ExtrusionFace(&(profile.GetSpline(j)),
&path,
z_direction);
faces.Append(face);
surfaceactive.Append(true);
surfaceids.Append(0);
}
}
Extrusion :: ~Extrusion()
{
for(int i=0; i<faces.Size(); i++)
delete faces[i];
}
INSOLID_TYPE Extrusion :: BoxInSolid (const BoxSphere<3> & box) const
{
for(int i=0; i<faces.Size(); i++)
{
if(faces[i]->BoxIntersectsFace(box))
return DOES_INTERSECT;
}
return PointInSolid(box.Center(),0);
}
INSOLID_TYPE Extrusion :: PointInSolid (const Point<3> & p,
const double eps,
Array<int> * const facenums) const
{
Vec<3> random_vec(-0.4561,0.7382,0.4970247);
int before(0), after(0);
bool intersects(false);
bool does_intersect(false);
for(int i=0; i<faces.Size(); i++)
{
faces[i]->LineIntersections(p,random_vec,eps,before,after,intersects);
//(*testout) << "intersects " << intersects << " before " << before << " after " << after << endl;
if(intersects)
{
if(facenums)
{
facenums->Append(i);
does_intersect = true;
}
else
return DOES_INTERSECT;
}
}
if(does_intersect)
return DOES_INTERSECT;
if(before % 2 == 0)
return IS_OUTSIDE;
return IS_INSIDE;
}
INSOLID_TYPE Extrusion :: PointInSolid (const Point<3> & p,
double eps) const
{
return PointInSolid(p,eps,NULL);
}
INSOLID_TYPE Extrusion :: VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const
{
Array<int> facenums;
INSOLID_TYPE pInSolid = PointInSolid(p,eps,&facenums);
if(pInSolid != DOES_INTERSECT)
return pInSolid;
double d(0);
if(facenums.Size() == 1)
{
Vec<3> normal;
faces[facenums[0]]->CalcGradient(p,normal);
normal.Normalize();
d = normal*v;
latestfacenum = facenums[0];
}
else if (facenums.Size() == 2)
{
Vec<3> checkvec;
Point<3> dummy(p);
faces[facenums[0]]->Project(dummy);
if(fabs(faces[facenums[0]]->GetProfilePar()) < 0.1)
{
int aux = facenums[0];
facenums[0] = facenums[1]; facenums[1] = aux;
}
checkvec = faces[facenums[0]]->GetYDir();
Vec<3> n0, n1;
faces[facenums[0]]->CalcGradient(p,n0);
faces[facenums[1]]->CalcGradient(p,n1);
n0.Normalize();
n1.Normalize();
Vec<3> t = Cross(n0,n1);
if(checkvec*t < 0) t*= (-1.);
Vec<3> t0 = Cross(n0,t);
Vec<3> t1 = Cross(t,n1);
t0.Normalize();
t1.Normalize();
const double t0v = t0*v;
const double t1v = t1*v;
if(t0v > t1v)
{
latestfacenum = facenums[0];
d = n0*v;
}
else
{
latestfacenum = facenums[1];
d = n1*v;
}
if(fabs(t0v) < eps && fabs(t1v) < eps)
latestfacenum = -1;
}
else
{
cerr << "WHY ARE THERE " << facenums.Size() << " FACES?" << endl;
}
if(d > eps)
return IS_OUTSIDE;
if(d < -eps)
return IS_INSIDE;
return DOES_INTERSECT;
}
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
INSOLID_TYPE Extrusion :: VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
INSOLID_TYPE retval;
retval = VecInSolid(p,v1,eps);
// *testout << "extr, vecinsolid=" << int(retval) << endl;
if(retval != DOES_INTERSECT)
return retval;
if(latestfacenum >= 0)
return faces[latestfacenum]->VecInFace(p,v2,0);
else
return VecInSolid(p,v2,eps);
}
int Extrusion :: GetNSurfaces() const
{
return faces.Size();
}
Surface & Extrusion :: GetSurface (int i)
{
return *faces[i];
}
const Surface & Extrusion :: GetSurface (int i) const
{
return *faces[i];
}
void Extrusion :: Reduce (const BoxSphere<3> & box)
{
for(int i = 0; i < faces.Size(); i++)
surfaceactive[i] = faces[i]->BoxIntersectsFace(box);
}
void Extrusion :: UnReduce ()
{
for(int i = 0; i < faces.Size(); i++)
surfaceactive[i] = true;
}
}

155
libsrc/csg/extrusion.hpp Normal file
View File

@ -0,0 +1,155 @@
#ifndef _EXTRUSION_HPP
#define _EXTRUSION_HPP
namespace netgen
{
class Extrusion;
class ExtrusionFace : public Surface
{
private:
const SplineSeg<2> * profile;
const SplineGeometry<3> * path;
Vec<3> glob_z_direction;
bool deletable;
Array< const SplineSeg3<3> * > spline3_path;
Array< const LineSeg<3> * > line_path;
mutable Array < Vec<3> > x_dir, y_dir, z_dir, loc_z_dir;
mutable Array < Point<3> > p0;
mutable Vec<3> profile_tangent;
mutable double profile_par;
mutable Vector profile_spline_coeff;
mutable int latest_seg;
mutable double latest_t;
mutable Point<2> latest_point2d;
mutable Point<3> latest_point3d;
private:
void Orthogonalize(const Vec<3> & v1, Vec<3> & v2) const;
void Init(void);
public:
double CalcProj(const Point<3> & point3d, Point<2> & point2d,
int seg) const;
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
int & seg, double & t) const;
public:
ExtrusionFace(const SplineSeg<2> * profile_in,
const SplineGeometry<3> * path_in,
const Vec<3> & z_direction);
ExtrusionFace(const Array<double> & raw_data);
~ExtrusionFace();
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
virtual double HesseNorm () const;
virtual double MaxCurvature () const;
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
// double /* rad */) const;
virtual void Project (Point<3> & p) const;
virtual Point<3> GetSurfacePoint () const;
virtual void Print (ostream & str) const;
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & boundingbox,
double facets) const;
const SplineGeometry<3> & GetPath(void) const {return *path;}
const SplineSeg<2> & GetProfile(void) const {return *profile;}
bool BoxIntersectsFace(const Box<3> & box) const;
void LineIntersections ( const Point<3> & p,
const Vec<3> & v,
const double eps,
int & before,
int & after,
bool & intersecting ) const;
INSOLID_TYPE VecInFace ( const Point<3> & p,
const Vec<3> & v,
const double eps ) const;
const Vec<3> & GetYDir ( void ) const {return y_dir[latest_seg];}
const Vec<3> & GetProfileTangent (void) const {return profile_tangent;}
double GetProfilePar(void) const {return profile_par;}
void GetRawData(Array<double> & data) const;
void CalcLocalCoordinates (int seg, double t,
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez) const;
void CalcLocalCoordinatesDeriv (int seg, double t,
Vec<3> & ex, Vec<3> & ey, Vec<3> & ez,
Vec<3> & dex, Vec<3> & dey, Vec<3> & dez) const;
};
class Extrusion : public Primitive
{
private:
const SplineGeometry<3> & path;
const SplineGeometry<2> & profile;
const Vec<3> & z_direction;
Array<ExtrusionFace*> faces;
mutable int latestfacenum;
public:
Extrusion(const SplineGeometry<3> & path_in,
const SplineGeometry<2> & profile_in,
const Vec<3> & z_dir);
~Extrusion();
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const;
INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps,
Array<int> * const facenums) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const;
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual int GetNSurfaces() const;
virtual Surface & GetSurface (int i = 0);
virtual const Surface & GetSurface (int i = 0) const;
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();
};
}
#endif //_EXTRUSION_HPP

179
libsrc/csg/gencyl.cpp Normal file
View File

@ -0,0 +1,179 @@
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
GeneralizedCylinder :: GeneralizedCylinder (ExplicitCurve2d & acrosssection,
Point<3> ap, Vec<3> ae1, Vec<3> ae2)
: crosssection(acrosssection)
{
planep = ap;
planee1 = ae1;
planee2 = ae2;
planee3 = Cross (planee1, planee2);
(*testout) << "Vecs = " << planee1 << " " << planee2 << " " << planee3 << endl;
};
void GeneralizedCylinder :: Project (Point<3> & p) const
{
Point<2> p2d;
double z;
p2d = Point<2> (planee1 * (p - planep), planee2 * (p - planep));
z = planee3 * (p - planep);
crosssection.Project (p2d);
p = planep + p2d(0) * planee1 + p2d(1) * planee2 + z * planee3;
}
int GeneralizedCylinder ::BoxInSolid (const BoxSphere<3> & box) const
{
Point<3> p3d;
Point<2> p2d, projp;
double t;
Vec<2> tan, n;
p3d = box.Center();
p2d = Point<2> (planee1 * (p3d - planep), planee2 * (p3d - planep));
t = crosssection.ProjectParam (p2d);
projp = crosssection.Eval (t);
tan = crosssection.EvalPrime (t);
n(0) = tan(1);
n(1) = -tan(0);
if (Dist (p2d, projp) < box.Diam()/2)
return 2;
if (n * (p2d - projp) > 0)
{
return 0;
}
return 1;
}
double GeneralizedCylinder :: CalcFunctionValue (const Point<3> & point) const
{
Point<2> p2d, projp;
double t;
Vec<2> tan, n;
p2d = Point<2> (planee1 * (point - planep), planee2 * (point - planep));
t = crosssection.ProjectParam (p2d);
projp = crosssection.Eval (t);
tan = crosssection.EvalPrime (t);
n(0) = tan(1);
n(1) = -tan(0);
n /= n.Length();
return n * (p2d - projp);
}
void GeneralizedCylinder :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
{
Point<2> p2d, projp;
double t;
Vec<2> tan, n;
p2d = Point<2> (planee1 * (point - planep), planee2 * (point - planep));
t = crosssection.ProjectParam (p2d);
projp = crosssection.Eval (t);
tan = crosssection.EvalPrime (t);
n(0) = tan(1);
n(1) = -tan(0);
n /= n.Length();
grad = n(0) * planee1 + n(1) * planee2;
}
void GeneralizedCylinder :: CalcHesse (const Point<3> & point, Mat<3> & hesse) const
{
Point<2> p2d, projp;
double t, dist, val;
Point<2> curvp;
Vec<2> curvpp;
Mat<2> h2d;
Mat<3,2> vmat;
int i, j, k, l;
p2d = Point<2> (planee1 * (point - planep), planee2 * (point - planep));
t = crosssection.ProjectParam (p2d);
curvp = crosssection.CurvCircle (t);
curvpp = p2d-curvp;
dist = curvpp.Length();
curvpp /= dist;
h2d(0, 0) = (1 - curvpp(0) * curvpp(0) ) / dist;
h2d(0, 1) = h2d(1, 0) = (- curvpp(0) * curvpp(1) ) / dist;
h2d(1, 1) = (1 - curvpp(1) * curvpp(1) ) / dist;
vmat(0,0) = planee1(0);
vmat(1,0) = planee1(1);
vmat(2,0) = planee1(2);
vmat(0,1) = planee2(0);
vmat(1,1) = planee2(1);
vmat(2,1) = planee2(2);
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
{
val = 0;
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
val += vmat(i,k) * h2d(k,l) * vmat(j,l);
hesse(i,j) = val;
}
}
double GeneralizedCylinder :: HesseNorm () const
{
return crosssection.MaxCurvature();
}
double GeneralizedCylinder :: MaxCurvatureLoc (const Point<3> & c, double rad) const
{
Point<2> c2d = Point<2> (planee1 * (c - planep), planee2 * (c - planep));
return crosssection.MaxCurvatureLoc(c2d, rad);
}
Point<3> GeneralizedCylinder :: GetSurfacePoint () const
{
Point<2> p2d;
p2d = crosssection.Eval(0);
return planep + p2d(0) * planee1 + p2d(1) * planee2;
}
void GeneralizedCylinder :: Reduce (const BoxSphere<3> & box)
{
Point<2> c2d = Point<2> (planee1 * (box.Center() - planep),
planee2 * (box.Center() - planep));
crosssection.Reduce (c2d, box.Diam()/2);
}
void GeneralizedCylinder :: UnReduce ()
{
crosssection.UnReduce ();
}
void GeneralizedCylinder :: Print (ostream & str) const
{
str << "Generalized Cylinder" << endl;
crosssection.Print (str);
}
}

70
libsrc/csg/gencyl.hpp Normal file
View File

@ -0,0 +1,70 @@
#ifndef FILE_GENCYL
#define FILE_GENCYL
/**************************************************************************/
/* File: gencyl.hh */
/* Author: Joachim Schoeberl */
/* Date: 14. Oct. 96 */
/**************************************************************************/
namespace netgen
{
/*
Generalized Cylinder
*/
///
class GeneralizedCylinder : public Surface
{
///
ExplicitCurve2d & crosssection;
///
Point<3> planep;
///
Vec<3> planee1, planee2, planee3;
/// Vec<3> ex, ey, ez;
Vec2d e2x, e2y;
///
Point<3> cp;
public:
///
GeneralizedCylinder (ExplicitCurve2d & acrosssection,
Point<3> ap, Vec<3> ae1, Vec<3> ae2);
///
virtual void Project (Point<3> & p) const;
///
virtual int BoxInSolid (const BoxSphere<3> & box) const;
/// 0 .. no, 1 .. yes, 2 .. maybe
virtual double CalcFunctionValue (const Point<3> & point) const;
///
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
///
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
///
virtual double HesseNorm () const;
///
virtual double MaxCurvatureLoc (const Point<3> & c, double rad) const;
///
virtual Point<3> GetSurfacePoint () const;
///
virtual void Print (ostream & str) const;
///
virtual void Reduce (const BoxSphere<3> & box);
///
virtual void UnReduce ();
};
}
#endif

849
libsrc/csg/genmesh.cpp Normal file
View File

@ -0,0 +1,849 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <csg.hpp>
#include <meshing.hpp>
namespace netgen
{
Array<SpecialPoint> specpoints;
static Array<MeshPoint> spoints;
#define TCL_OK 0
#define TCL_ERROR 1
static void FindPoints (CSGeometry & geom, Mesh & mesh)
{
PrintMessage (1, "Start Findpoints");
const char * savetask = multithread.task;
multithread.task = "Find points";
for (int i = 0; i < geom.GetNUserPoints(); i++)
{
mesh.AddPoint(geom.GetUserPoint (i));
mesh.Points().Last().Singularity (geom.GetUserPointRefFactor(i));
mesh.AddLockedPoint (PointIndex (i+1));
}
SpecialPointCalculation spc;
spc.SetIdEps(geom.GetIdEps());
if (spoints.Size() == 0)
spc.CalcSpecialPoints (geom, spoints);
PrintMessage (2, "Analyze spec points");
spc.AnalyzeSpecialPoints (geom, spoints, specpoints);
PrintMessage (5, "done");
(*testout) << specpoints.Size() << " special points:" << endl;
for (int i = 0; i < specpoints.Size(); i++)
specpoints[i].Print (*testout);
/*
for (int i = 1; i <= geom.identifications.Size(); i++)
geom.identifications.Elem(i)->IdentifySpecialPoints (specpoints);
*/
multithread.task = savetask;
}
static void FindEdges (CSGeometry & geom, Mesh & mesh, const bool setmeshsize = false)
{
EdgeCalculation ec (geom, specpoints);
ec.SetIdEps(geom.GetIdEps());
ec.Calc (mparam.maxh, mesh);
for (int i = 0; i < geom.singedges.Size(); i++)
{
geom.singedges[i]->FindPointsOnEdge (mesh);
if(setmeshsize)
geom.singedges[i]->SetMeshSize(mesh,10.*geom.BoundingBox().Diam());
}
for (int i = 0; i < geom.singpoints.Size(); i++)
geom.singpoints[i]->FindPoints (mesh);
for (int i = 1; i <= mesh.GetNSeg(); i++)
{
//(*testout) << "segment " << mesh.LineSegment(i) << endl;
int ok = 0;
for (int k = 1; k <= mesh.GetNFD(); k++)
if (mesh.GetFaceDescriptor(k).SegmentFits (mesh.LineSegment(i)))
{
ok = k;
//(*testout) << "fits to " << k << endl;
}
if (!ok)
{
ok = mesh.AddFaceDescriptor (FaceDescriptor (mesh.LineSegment(i)));
//(*testout) << "did not find, now " << ok << endl;
}
//(*testout) << "change from " << mesh.LineSegment(i).si;
mesh.LineSegment(i).si = ok;
//(*testout) << " to " << mesh.LineSegment(i).si << endl;
}
if (geom.identifications.Size())
{
PrintMessage (3, "Find Identifications");
for (int i = 0; i < geom.identifications.Size(); i++)
{
geom.identifications[i]->IdentifyPoints (mesh);
//(*testout) << "identification " << i << " is "
// << *geom.identifications[i] << endl;
}
for (int i = 0; i < geom.identifications.Size(); i++)
geom.identifications[i]->IdentifyFaces (mesh);
}
// find intersecting segments
PrintMessage (3, "Check intersecting edges");
Point3d pmin, pmax;
mesh.GetBox (pmin, pmax);
Box3dTree segtree (pmin, pmax);
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{
if (mesh[si].seginfo)
{
Box<3> hbox;
hbox.Set (mesh[mesh[si][0]]);
hbox.Add (mesh[mesh[si][1]]);
segtree.Insert (hbox.PMin(), hbox.PMax(), si);
}
}
Array<int> loc;
if (!ec.point_on_edge_problem)
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{
if (!mesh[si].seginfo) continue;
Box<3> hbox;
hbox.Set (mesh[mesh[si][0]]);
hbox.Add (mesh[mesh[si][1]]);
hbox.Increase (1e-6);
segtree.GetIntersecting (hbox.PMin(), hbox.PMax(), loc);
// for (SegmentIndex sj = 0; sj < si; sj++)
for (int j = 0; j < loc.Size(); j++)
{
SegmentIndex sj = loc[j];
if (sj >= si) continue;
if (!mesh[si].seginfo || !mesh[sj].seginfo) continue;
if (mesh[mesh[si][0]].GetLayer() != mesh[mesh[sj][1]].GetLayer()) continue;
Point<3> pi1 = mesh[mesh[si][0]];
Point<3> pi2 = mesh[mesh[si][1]];
Point<3> pj1 = mesh[mesh[sj][0]];
Point<3> pj2 = mesh[mesh[sj][1]];
Vec<3> vi = pi2 - pi1;
Vec<3> vj = pj2 - pj1;
if (sqr (vi * vj) > (1.-1e-6) * Abs2 (vi) * Abs2 (vj)) continue;
// pi1 + vi t = pj1 + vj s
Mat<3,2> mat;
Vec<3> rhs;
Vec<2> sol;
for (int jj = 0; jj < 3; jj++)
{
mat(jj,0) = vi(jj);
mat(jj,1) = -vj(jj);
rhs(jj) = pj1(jj)-pi1(jj);
}
mat.Solve (rhs, sol);
//(*testout) << "mat " << mat << endl << "rhs " << rhs << endl << "sol " << sol << endl;
if (sol(0) > 1e-6 && sol(0) < 1-1e-6 &&
sol(1) > 1e-6 && sol(1) < 1-1e-6 &&
Abs (rhs - mat*sol) < 1e-6)
{
Point<3> ip = pi1 + sol(0) * vi;
//(*testout) << "ip " << ip << endl;
Point<3> pip = ip;
ProjectToEdge (geom.GetSurface (mesh[si].surfnr1),
geom.GetSurface (mesh[si].surfnr2), pip);
//(*testout) << "Dist (ip, pip_si) " << Dist (ip, pip) << endl;
if (Dist (ip, pip) > 1e-6*geom.MaxSize()) continue;
pip = ip;
ProjectToEdge (geom.GetSurface (mesh[sj].surfnr1),
geom.GetSurface (mesh[sj].surfnr2), pip);
//(*testout) << "Dist (ip, pip_sj) " << Dist (ip, pip) << endl;
if (Dist (ip, pip) > 1e-6*geom.MaxSize()) continue;
cout << "Intersection at " << ip << endl;
geom.AddUserPoint (ip);
spoints.Append (MeshPoint (ip, mesh[mesh[si][0]].GetLayer()));
mesh.AddPoint (ip);
(*testout) << "found intersection at " << ip << endl;
(*testout) << "sol = " << sol << endl;
(*testout) << "res = " << (rhs - mat*sol) << endl;
(*testout) << "segs = " << pi1 << " - " << pi2 << endl;
(*testout) << "and = " << pj1 << " - " << pj2 << endl << endl;
}
}
}
}
static void MeshSurface (CSGeometry & geom, Mesh & mesh)
{
const char * savetask = multithread.task;
multithread.task = "Surface meshing";
Array<Segment> segments;
int noldp = mesh.GetNP();
double starttime = GetTime();
// find master faces from identified
Array<int> masterface(mesh.GetNFD());
for (int i = 1; i <= mesh.GetNFD(); i++)
masterface.Elem(i) = i;
Array<INDEX_2> fpairs;
bool changed;
do
{
changed = 0;
for (int i = 0; i < geom.identifications.Size(); i++)
{
geom.identifications[i]->GetIdentifiedFaces (fpairs);
for (int j = 0; j < fpairs.Size(); j++)
{
if (masterface.Get(fpairs[j].I1()) <
masterface.Get(fpairs[j].I2()))
{
changed = 1;
masterface.Elem(fpairs[j].I2()) =
masterface.Elem(fpairs[j].I1());
}
if (masterface.Get(fpairs[j].I2()) <
masterface.Get(fpairs[j].I1()))
{
changed = 1;
masterface.Elem(fpairs[j].I1()) =
masterface.Elem(fpairs[j].I2());
}
}
}
}
while (changed);
int bccnt=0;
for (int k = 0; k < geom.GetNSurf(); k++)
bccnt = max2 (bccnt, geom.GetSurface(k)->GetBCProperty());
for (int k = 1; k <= mesh.GetNFD(); k++)
{
bool increased = false;
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
const Surface * surf = geom.GetSurface(fd.SurfNr());
if (fd.TLOSurface() &&
geom.GetTopLevelObject(fd.TLOSurface()-1) -> GetBCProp() > 0)
fd.SetBCProperty (geom.GetTopLevelObject(fd.TLOSurface()-1) -> GetBCProp());
else if (surf -> GetBCProperty() != -1)
fd.SetBCProperty (surf->GetBCProperty());
else
{
bccnt++;
fd.SetBCProperty (bccnt);
increased = true;
}
for (int l = 0; l < geom.bcmodifications.Size(); l++)
{
if (geom.GetSurfaceClassRepresentant (fd.SurfNr()) ==
geom.GetSurfaceClassRepresentant (geom.bcmodifications[l].si) &&
(fd.DomainIn() == geom.bcmodifications[l].tlonr+1 ||
fd.DomainOut() == geom.bcmodifications[l].tlonr+1))
{
if(geom.bcmodifications[l].bcname == NULL)
fd.SetBCProperty (geom.bcmodifications[l].bcnr);
else
{
if(!increased)
{
bccnt++;
fd.SetBCProperty (bccnt);
increased = true;
}
}
}
}
}
mesh.SetNBCNames( bccnt );
for (int k = 1; k <= mesh.GetNFD(); k++)
{
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
const Surface * surf = geom.GetSurface(fd.SurfNr());
if (fd.TLOSurface() )
{
int bcp = fd.BCProperty();
string nextbcname = geom.GetTopLevelObject(fd.TLOSurface()-1) -> GetBCName();
if ( nextbcname != "default" )
mesh.SetBCName ( bcp - 1 , nextbcname );
}
else // if (surf -> GetBCProperty() != -1)
{
int bcp = fd.BCProperty();
string nextbcname = surf->GetBCName();
if ( nextbcname != "default" )
mesh.SetBCName ( bcp - 1, nextbcname );
}
}
for (int k = 1; k <= mesh.GetNFD(); k++)
{
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
fd.SetBCName ( mesh.GetBCNamePtr ( fd.BCProperty() - 1 ) );
}
//!!
for (int k = 1; k <= mesh.GetNFD(); k++)
{
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
//const Surface * surf = geom.GetSurface(fd.SurfNr());
for (int l = 0; l < geom.bcmodifications.Size(); l++)
{
if (geom.GetSurfaceClassRepresentant (fd.SurfNr()) ==
geom.GetSurfaceClassRepresentant (geom.bcmodifications[l].si) &&
(fd.DomainIn() == geom.bcmodifications[l].tlonr+1 ||
fd.DomainOut() == geom.bcmodifications[l].tlonr+1) &&
geom.bcmodifications[l].bcname != NULL
)
{
int bcp = fd.BCProperty();
mesh.SetBCName ( bcp - 1, *(geom.bcmodifications[l].bcname) );
fd.SetBCName ( mesh.GetBCNamePtr ( bcp - 1) );
}
}
}
for(int k = 0; k<geom.bcmodifications.Size(); k++)
{
delete geom.bcmodifications[k].bcname;
geom.bcmodifications[k].bcname = NULL;
}
//!!
for (int j = 0; j < geom.singfaces.Size(); j++)
{
Array<int> surfs;
geom.GetIndependentSurfaceIndices (geom.singfaces[j]->GetSolid(),
geom.BoundingBox(), surfs);
for (int k = 1; k <= mesh.GetNFD(); k++)
{
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
for (int l = 0; l < surfs.Size(); l++)
if (surfs[l] == fd.SurfNr())
{
if (geom.singfaces[j]->GetDomainNr() == fd.DomainIn())
fd.SetDomainInSingular (1);
if (geom.singfaces[j]->GetDomainNr() == fd.DomainOut())
fd.SetDomainOutSingular (1);
}
}
}
// assemble edge hash-table
mesh.CalcSurfacesOfNode();
for (int k = 1; k <= mesh.GetNFD(); k++)
{
multithread.percent = 100.0 * k / (mesh.GetNFD()+1e-10);
if (masterface.Get(k) != k)
continue;
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
(*testout) << "Surface " << k << endl;
(*testout) << "Face Descriptor: " << fd << endl;
PrintMessage (1, "Surface ", k, " / ", mesh.GetNFD());
int oldnf = mesh.GetNSE();
const Surface * surf =
geom.GetSurface((mesh.GetFaceDescriptor(k).SurfNr()));
Meshing2Surfaces meshing(*surf, mparam, geom.BoundingBox());
meshing.SetStartTime (starttime);
double eps = 1e-8 * geom.MaxSize();
for (PointIndex pi = PointIndex::BASE; pi < noldp+PointIndex::BASE; pi++)
{
// if(surf->PointOnSurface(mesh[pi]))
meshing.AddPoint (mesh[pi], pi, NULL,
(surf->PointOnSurface(mesh[pi], eps) != 0));
}
segments.SetSize (0);
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
if (mesh[si].si == k)
{
segments.Append (mesh[si]);
(*testout) << "appending segment " << mesh[si] << endl;
//<< " from " << mesh[mesh[si][0]]
// << " to " <<mesh[mesh[si][1]]<< endl;
}
(*testout) << "num-segments " << segments.Size() << endl;
for (int i = 1; i <= geom.identifications.Size(); i++)
{
geom.identifications.Get(i)->
BuildSurfaceElements(segments, mesh, surf);
}
for (int si = 0; si < segments.Size(); si++)
{
PointGeomInfo gi;
gi.trignum = k;
meshing.AddBoundaryElement (segments[si][0] + 1 - PointIndex::BASE,
segments[si][1] + 1 - PointIndex::BASE,
gi, gi);
}
double maxh = mparam.maxh;
if (fd.DomainIn() != 0)
{
const Solid * s1 =
geom.GetTopLevelObject(fd.DomainIn()-1) -> GetSolid();
if (s1->GetMaxH() < maxh)
maxh = s1->GetMaxH();
maxh = min2(maxh, geom.GetTopLevelObject(fd.DomainIn()-1)->GetMaxH());
}
if (fd.DomainOut() != 0)
{
const Solid * s1 =
geom.GetTopLevelObject(fd.DomainOut()-1) -> GetSolid();
if (s1->GetMaxH() < maxh)
maxh = s1->GetMaxH();
maxh = min2(maxh, geom.GetTopLevelObject(fd.DomainOut()-1)->GetMaxH());
}
if (fd.TLOSurface() != 0)
{
double hi = geom.GetTopLevelObject(fd.TLOSurface()-1) -> GetMaxH();
if (hi < maxh) maxh = hi;
}
(*testout) << "domin = " << fd.DomainIn() << ", domout = " << fd.DomainOut()
<< ", tlo-surf = " << fd.TLOSurface()
<< " mpram.maxh = " << mparam.maxh << ", maxh = " << maxh << endl;
mparam.checkoverlap = 0;
MESHING2_RESULT res =
meshing.GenerateMesh (mesh, mparam, maxh, k);
if (res != MESHING2_OK)
{
PrintError ("Problem in Surface mesh generation");
throw NgException ("Problem in Surface mesh generation");
}
if (multithread.terminate) return;
for (SurfaceElementIndex sei = oldnf; sei < mesh.GetNSE(); sei++)
mesh[sei].SetIndex (k);
// mesh.CalcSurfacesOfNode();
if (segments.Size())
{
// surface was meshed, not copied
static int timer = NgProfiler::CreateTimer ("total surface mesh optimization");
NgProfiler::RegionTimer reg (timer);
PrintMessage (2, "Optimize Surface");
for (int i = 1; i <= mparam.optsteps2d; i++)
{
if (multithread.terminate) return;
{
MeshOptimize2dSurfaces meshopt(geom);
meshopt.SetFaceIndex (k);
meshopt.SetImproveEdges (0);
meshopt.SetMetricWeight (mparam.elsizeweight);
meshopt.SetWriteStatus (0);
meshopt.EdgeSwapping (mesh, (i > mparam.optsteps2d/2));
}
if (multithread.terminate) return;
{
// mesh.CalcSurfacesOfNode();
MeshOptimize2dSurfaces meshopt(geom);
meshopt.SetFaceIndex (k);
meshopt.SetImproveEdges (0);
meshopt.SetMetricWeight (mparam.elsizeweight);
meshopt.SetWriteStatus (0);
meshopt.ImproveMesh (mesh, mparam);
}
{
MeshOptimize2dSurfaces meshopt(geom);
meshopt.SetFaceIndex (k);
meshopt.SetImproveEdges (0);
meshopt.SetMetricWeight (mparam.elsizeweight);
meshopt.SetWriteStatus (0);
meshopt.CombineImprove (mesh);
// mesh.CalcSurfacesOfNode();
}
if (multithread.terminate) return;
{
MeshOptimize2dSurfaces meshopt(geom);
meshopt.SetFaceIndex (k);
meshopt.SetImproveEdges (0);
meshopt.SetMetricWeight (mparam.elsizeweight);
meshopt.SetWriteStatus (0);
meshopt.ImproveMesh (mesh, mparam);
}
}
}
PrintMessage (3, (mesh.GetNSE() - oldnf), " elements, ", mesh.GetNP(), " points");
extern void Render();
Render();
}
mesh.Compress();
do
{
changed = 0;
for (int k = 1; k <= mesh.GetNFD(); k++)
{
multithread.percent = 100.0 * k / (mesh.GetNFD()+1e-10);
if (masterface.Get(k) == k)
continue;
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
(*testout) << "Surface " << k << endl;
(*testout) << "Face Descriptor: " << fd << endl;
PrintMessage (2, "Surface ", k);
int oldnf = mesh.GetNSE();
const Surface * surf =
geom.GetSurface((mesh.GetFaceDescriptor(k).SurfNr()));
/*
if (surf -> GetBCProperty() != -1)
fd.SetBCProperty (surf->GetBCProperty());
else
{
bccnt++;
fd.SetBCProperty (bccnt);
}
*/
segments.SetSize (0);
for (int i = 1; i <= mesh.GetNSeg(); i++)
{
Segment * seg = &mesh.LineSegment(i);
if (seg->si == k)
segments.Append (*seg);
}
for (int i = 1; i <= geom.identifications.Size(); i++)
{
geom.identifications.Elem(i)->GetIdentifiedFaces (fpairs);
int found = 0;
for (int j = 1; j <= fpairs.Size(); j++)
if (fpairs.Get(j).I1() == k || fpairs.Get(j).I2() == k)
found = 1;
if (!found)
continue;
geom.identifications.Get(i)->
BuildSurfaceElements(segments, mesh, surf);
if (!segments.Size())
break;
}
if (multithread.terminate) return;
for (SurfaceElementIndex sei = oldnf; sei < mesh.GetNSE(); sei++)
mesh[sei].SetIndex (k);
if (!segments.Size())
{
masterface.Elem(k) = k;
changed = 1;
}
PrintMessage (3, (mesh.GetNSE() - oldnf), " elements, ", mesh.GetNP(), " points");
}
extern void Render();
Render();
}
while (changed);
mesh.SplitSeparatedFaces();
mesh.CalcSurfacesOfNode();
multithread.task = savetask;
}
int CSGGenerateMesh (CSGeometry & geom,
Mesh *& mesh, MeshingParameters & mparam,
int perfstepsstart, int perfstepsend)
{
if (mesh && mesh->GetNSE() &&
!geom.GetNSolids())
{
if (perfstepsstart < MESHCONST_MESHVOLUME)
perfstepsstart = MESHCONST_MESHVOLUME;
}
if (perfstepsstart <= MESHCONST_ANALYSE)
{
if (mesh)
mesh -> DeleteMesh();
else
mesh = new Mesh();
mesh->SetGlobalH (mparam.maxh);
mesh->SetMinimalH (mparam.minh);
Array<double> maxhdom(geom.GetNTopLevelObjects());
for (int i = 0; i < maxhdom.Size(); i++)
maxhdom[i] = geom.GetTopLevelObject(i)->GetMaxH();
mesh->SetMaxHDomain (maxhdom);
if (mparam.uselocalh)
{
double maxsize = geom.MaxSize();
mesh->SetLocalH (Point<3>(-maxsize, -maxsize, -maxsize),
Point<3>(maxsize, maxsize, maxsize),
mparam.grading);
mesh -> LoadLocalMeshSize (mparam.meshsizefilename);
}
spoints.SetSize(0);
FindPoints (geom, *mesh);
PrintMessage (5, "find points done");
#ifdef LOG_STREAM
(*logout) << "Special points found" << endl
<< "time = " << GetTime() << " sec" << endl
<< "points: " << mesh->GetNP() << endl << endl;
#endif
}
if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE)
return TCL_OK;
if (perfstepsstart <= MESHCONST_MESHEDGES)
{
FindEdges (geom, *mesh, true);
if (multithread.terminate) return TCL_OK;
#ifdef LOG_STREAM
(*logout) << "Edges meshed" << endl
<< "time = " << GetTime() << " sec" << endl
<< "points: " << mesh->GetNP() << endl;
#endif
if (multithread.terminate)
return TCL_OK;
if (mparam.uselocalh)
{
mesh->CalcLocalH(mparam.grading);
mesh->DeleteMesh();
FindPoints (geom, *mesh);
if (multithread.terminate) return TCL_OK;
FindEdges (geom, *mesh, true);
if (multithread.terminate) return TCL_OK;
mesh->DeleteMesh();
FindPoints (geom, *mesh);
if (multithread.terminate) return TCL_OK;
FindEdges (geom, *mesh);
if (multithread.terminate) return TCL_OK;
}
}
if (multithread.terminate || perfstepsend <= MESHCONST_MESHEDGES)
return TCL_OK;
if (perfstepsstart <= MESHCONST_MESHSURFACE)
{
MeshSurface (geom, *mesh);
if (multithread.terminate) return TCL_OK;
#ifdef LOG_STREAM
(*logout) << "Surfaces meshed" << endl
<< "time = " << GetTime() << " sec" << endl
<< "points: " << mesh->GetNP() << endl;
#endif
if (mparam.uselocalh && 0)
{
mesh->CalcLocalH(mparam.grading);
mesh->DeleteMesh();
FindPoints (geom, *mesh);
if (multithread.terminate) return TCL_OK;
FindEdges (geom, *mesh);
if (multithread.terminate) return TCL_OK;
MeshSurface (geom, *mesh);
if (multithread.terminate) return TCL_OK;
}
#ifdef LOG_STREAM
(*logout) << "Surfaces remeshed" << endl
<< "time = " << GetTime() << " sec" << endl
<< "points: " << mesh->GetNP() << endl;
#endif
#ifdef STAT_STREAM
(*statout) << mesh->GetNSeg() << " & "
<< mesh->GetNSE() << " & - &"
<< GetTime() << " & " << endl;
#endif
MeshQuality2d (*mesh);
mesh->CalcSurfacesOfNode();
}
if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE)
return TCL_OK;
if (perfstepsstart <= MESHCONST_MESHVOLUME)
{
multithread.task = "Volume meshing";
MESHING3_RESULT res =
MeshVolume (mparam, *mesh);
if (res != MESHING3_OK) return TCL_ERROR;
if (multithread.terminate) return TCL_OK;
RemoveIllegalElements (*mesh);
if (multithread.terminate) return TCL_OK;
MeshQuality3d (*mesh);
for (int i = 0; i < geom.GetNTopLevelObjects(); i++)
mesh->SetMaterial (i+1, geom.GetTopLevelObject(i)->GetMaterial().c_str());
#ifdef STAT_STREAM
(*statout) << GetTime() << " & ";
#endif
#ifdef LOG_STREAM
(*logout) << "Volume meshed" << endl
<< "time = " << GetTime() << " sec" << endl
<< "points: " << mesh->GetNP() << endl;
#endif
}
if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
return TCL_OK;
if (perfstepsstart <= MESHCONST_OPTVOLUME)
{
multithread.task = "Volume optimization";
OptimizeVolume (mparam, *mesh);
if (multithread.terminate) return TCL_OK;
#ifdef STAT_STREAM
(*statout) << GetTime() << " & "
<< mesh->GetNE() << " & "
<< mesh->GetNP() << " " << '\\' << '\\' << " \\" << "hline" << endl;
#endif
#ifdef LOG_STREAM
(*logout) << "Volume optimized" << endl
<< "time = " << GetTime() << " sec" << endl
<< "points: " << mesh->GetNP() << endl;
#endif
}
return TCL_OK;
}
}

16
libsrc/csg/geoml.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef FILE_GEOML
#define FILE_GEOML
/* *************************************************************************/
/* File: geoml.hh */
/* Author: Joachim Schoeberl */
/* Date: 21. Jun. 98 */
/* *************************************************************************/
#include <geom/geom.hh>
#include <geom/solid.hh>
#include <geom/algprim.hh>
#include <geom/adtree.hh>
#include <geom/csgeom.hh>
#endif

1662
libsrc/csg/identify.cpp Normal file

File diff suppressed because it is too large Load Diff

210
libsrc/csg/identify.hpp Normal file
View File

@ -0,0 +1,210 @@
#ifndef FILE_IDENTIFY
#define FILE_IDENTIFY
/**************************************************************************/
/* File: identify.hh */
/* Author: Joachim Schoeberl */
/* Date: 1. Aug. 99 */
/**************************************************************************/
namespace netgen
{
/**
Identify surfaces for periodic b.c. or
thin domains
*/
class SpecialPoint;
class Identification
{
protected:
const CSGeometry & geom;
// identified faces, index sorted
INDEX_2_HASHTABLE<int> identfaces;
int nr;
public:
DLL_HEADER Identification (int anr, const CSGeometry & ageom);
DLL_HEADER virtual ~Identification ();
DLL_HEADER virtual void Print (ostream & ost) const = 0;
DLL_HEADER virtual void GetData (ostream & ost) const = 0;
/// obsolete
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
/// can identify both special points (fixed direction)
/// (identified points, same tangent)
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const;
///
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
/// is it possible to identify sp1 with some other ?
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
/// are points (if connected) by a short edge (direction anyhow) ?
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
/// add entries in mesh identification tables
virtual void IdentifyPoints (class Mesh & mesh);
/// add entries to identified faces (based on segment infos)
virtual void IdentifyFaces (class Mesh & mesh);
/// get point on other surface, add entry in mesh identifications
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
/// copy surfaces, or fill rectangles
virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
/// insert volume elements in thin layers
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
class Mesh & mesh);
/// get list of identified faces
virtual void GetIdentifiedFaces (Array<INDEX_2> & idfaces) const;
friend ostream & operator<< (ostream & ost, Identification & ident);
};
class PeriodicIdentification : public Identification
{
const Surface * s1;
const Surface * s2;
public:
PeriodicIdentification (int anr,
const CSGeometry & ageom,
const Surface * as1,
const Surface * as2);
virtual ~PeriodicIdentification ();
virtual void Print (ostream & ost) const;
virtual void GetData (ostream & ost) const;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const;
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
virtual void IdentifyPoints (class Mesh & mesh);
virtual void IdentifyFaces (class Mesh & mesh);
virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
};
///
class TopLevelObject;
class CloseSurfaceIdentification : public Identification
{
const Surface * s1;
const Surface * s2;
const TopLevelObject * domain;
///
int dom_nr;
/// number of refinement levels (in Z-refinement)
int ref_levels;
/// number of refinement levels for layer next to s1 (in Z-refinement)
int ref_levels_s1;
/// number of refinement levels for layer next to s2 (in Z-refinement)
int ref_levels_s2;
///
double eps_n;
Array<double> slices;
/// used only for domain-local identification:
Array<int> domain_surfaces;
///
bool dom_surf_valid;
///
Vec<3> direction;
///
bool usedirection;
public:
CloseSurfaceIdentification (int anr,
const CSGeometry & ageom,
const Surface * as1,
const Surface * as2,
const TopLevelObject * adomain,
const Flags & flags);
virtual ~CloseSurfaceIdentification ();
virtual void Print (ostream & ost) const;
virtual void GetData (ostream & ost) const;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const;
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
const Array<double> & GetSlices () const { return slices; }
virtual void IdentifyPoints (class Mesh & mesh);
virtual void IdentifyFaces (class Mesh & mesh);
virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
void BuildSurfaceElements2 (Array<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
virtual void BuildVolumeElements (Array<class Element2d> & surfels,
class Mesh & mesh);
int RefLevels () const { return ref_levels; }
int RefLevels1 () const { return ref_levels_s1; }
int RefLevels2 () const { return ref_levels_s2; }
bool IsSkewIdentification(void) const {return usedirection;}
const Vec<3> & GetDirection(void) const {return direction;}
const Surface & GetSurface1(void) const
{ return *s1;}
const Surface & GetSurface2(void) const
{ return *s2;}
};
class CloseEdgesIdentification : public Identification
{
const Surface * facet;
const Surface * s1;
const Surface * s2;
public:
CloseEdgesIdentification (int anr,
const CSGeometry & ageom,
const Surface * afacet,
const Surface * as1,
const Surface * as2);
virtual ~CloseEdgesIdentification ();
virtual void Print (ostream & ost) const;
virtual void GetData (ostream & ost) const;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const;
virtual void IdentifyPoints (class Mesh & mesh);
virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh,
const Surface * surf);
};
}
#endif

14
libsrc/csg/manifold.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <csg.hpp>
namespace netgen
{
Manifold :: Manifold ()
{
;
}
Manifold :: ~Manifold ()
{
;
}
}

29
libsrc/csg/manifold.hpp Normal file
View File

@ -0,0 +1,29 @@
#ifndef FILE_MANIFOLD
#define FILE_MANIFOLD
/**************************************************************************/
/* File: manifold.hh */
/* Author: Joachim Schoeberl */
/* Date: 7. Aug. 96 */
/**************************************************************************/
namespace netgen
{
/**
Basis class for manifolds in 2d and 3d
*/
class Manifold
{
public:
///
Manifold ();
///
virtual ~Manifold ();
};
}
#endif

211
libsrc/csg/meshsurf.cpp Normal file
View File

@ -0,0 +1,211 @@
#include <mystdlib.h>
#include <csg.hpp>
#include <meshing.hpp>
namespace netgen
{
/*
Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurface)
: surface(asurface)
{
;
}
*/
Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurf,
const MeshingParameters & mp,
const Box<3> & abb)
: Meshing2(mp, abb), surface(asurf)
{
;
}
void Meshing2Surfaces :: DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2)
{
((Surface&)surface).DefineTangentialPlane (p1, p2);
}
void Meshing2Surfaces :: TransformToPlain (const Point3d & locpoint,
const MultiPointGeomInfo & geominfo,
Point2d & planepoint,
double h, int & zone)
{
Point<2> hp;
surface.ToPlane (locpoint, hp, h, zone);
planepoint.X() = hp(0);
planepoint.Y() = hp(1);
}
int Meshing2Surfaces :: TransformFromPlain (Point2d & planepoint,
Point3d & locpoint,
PointGeomInfo & gi,
double h)
{
Point<3> hp;
Point<2> hp2 (planepoint.X(), planepoint.Y());
surface.FromPlane (hp2, hp, h);
locpoint = hp;
gi.trignum = 1;
return 0;
}
double Meshing2Surfaces :: CalcLocalH (const Point3d & p, double gh) const
{
return surface.LocH (p, 3, 1, gh);
/*
double loch = mesh.lochfunc->GetH(p);
if (gh < loch) loch = gh;
return loch;
*/
}
MeshOptimize2dSurfaces :: MeshOptimize2dSurfaces (const CSGeometry & ageometry)
: MeshOptimize2d(), geometry(ageometry)
{
;
}
void MeshOptimize2dSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
{
Point<3> hp = p;
geometry.GetSurface(surfind)->Project (hp);
p = hp;
}
void MeshOptimize2dSurfaces :: ProjectPoint2 (INDEX surfind, INDEX surfind2,
Point<3> & p) const
{
Point<3> hp = p;
ProjectToEdge ( geometry.GetSurface(surfind),
geometry.GetSurface(surfind2), hp);
p = hp;
}
void MeshOptimize2dSurfaces ::
GetNormalVector(INDEX surfind, const Point<3> & p, Vec<3> & n) const
{
Vec<3> hn = n;
geometry.GetSurface(surfind)->CalcGradient (p, hn);
hn.Normalize();
n = hn;
/*
if (geometry.GetSurface(surfind)->Inverse())
n *= -1;
*/
}
RefinementSurfaces :: RefinementSurfaces (const CSGeometry & ageometry)
: Refinement(), geometry(ageometry)
{
if(geometry.GetNSurf() == 0)
*testout << endl
<< "WARNING: Intializing 2D refinement with 0-surface geometry" << endl
<< "==========================================================" << endl
<< endl << endl;
}
RefinementSurfaces :: ~RefinementSurfaces ()
{
;
}
void RefinementSurfaces ::
PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
int surfi,
const PointGeomInfo & gi1,
const PointGeomInfo & gi2,
Point<3> & newp, PointGeomInfo & newgi) const
{
Point<3> hnewp;
hnewp = p1+secpoint*(p2-p1);
if (surfi != -1)
{
geometry.GetSurface (surfi) -> Project (hnewp);
newgi.trignum = 1;
}
newp = hnewp;
}
void RefinementSurfaces ::
PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
int surfi1, int surfi2,
const EdgePointGeomInfo & ap1,
const EdgePointGeomInfo & ap2,
Point<3> & newp, EdgePointGeomInfo & newgi) const
{
Point<3> hnewp = p1+secpoint*(p2-p1);
//(*testout) << "hnewp " << hnewp << " s1 " << surfi1 << " s2 " << surfi2 << endl;
if (surfi1 != -1 && surfi2 != -1 && surfi1 != surfi2)
{
netgen::ProjectToEdge (geometry.GetSurface(surfi1),
geometry.GetSurface(surfi2),
hnewp);
// (*testout) << "Pointbetween, newp = " << hnewp << endl
// << ", err = " << sqrt (sqr (hnewp(0))+ sqr(hnewp(1)) + sqr (hnewp(2))) - 1 << endl;
newgi.edgenr = 1;
//(*testout) << "hnewp (a1) " << hnewp << endl;
}
else if (surfi1 != -1)
{
geometry.GetSurface (surfi1) -> Project (hnewp);
//(*testout) << "hnewp (a2) " << hnewp << endl;
}
newp = hnewp;
};
Vec<3> RefinementSurfaces :: GetTangent (const Point<3> & p, int surfi1, int surfi2,
const EdgePointGeomInfo & ap1) const
{
Vec<3> n1 = geometry.GetSurface (surfi1)->GetNormalVector (p);
Vec<3> n2 = geometry.GetSurface (surfi2)->GetNormalVector (p);
Vec<3> tau = Cross (n1, n2).Normalize();
return tau;
}
Vec<3> RefinementSurfaces :: GetNormal (const Point<3> & p, int surfi1,
const PointGeomInfo & gi) const
{
return geometry.GetSurface (surfi1)->GetNormalVector (p);
}
void RefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
{
if (surfi != -1)
geometry.GetSurface (surfi) -> Project (p);
};
void RefinementSurfaces :: ProjectToEdge (Point<3> & p, int surfi1, int surfi2, const EdgePointGeomInfo & egi) const
{
netgen::ProjectToEdge (geometry.GetSurface(surfi1),
geometry.GetSurface(surfi2),
p);
}
}

97
libsrc/csg/meshsurf.hpp Normal file
View File

@ -0,0 +1,97 @@
#ifndef FILE_MESHSURF
#define FILE_MESHSURF
namespace netgen
{
///
class Meshing2Surfaces : public Meshing2
{
///
const Surface & surface;
public:
///
// Meshing2Surfaces (const Surface & asurf);
///
Meshing2Surfaces (const Surface & asurf, const MeshingParameters & mp,
const Box<3> & aboundingbox);
protected:
///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2);
///
virtual void TransformToPlain (const Point3d & locpoint,
const MultiPointGeomInfo & geominfo,
Point2d & plainpoint,
double h, int & zone);
///
virtual int TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
PointGeomInfo & gi,
double h);
///
virtual double CalcLocalH (const Point3d & p, double gh) const;
};
///
class MeshOptimize2dSurfaces : public MeshOptimize2d
{
///
const CSGeometry & geometry;
public:
///
MeshOptimize2dSurfaces (const CSGeometry & ageometry);
///
virtual void ProjectPoint (INDEX surfind, Point<3> & p) const;
///
virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const;
///
virtual void GetNormalVector(INDEX surfind, const Point<3> & p, Vec<3> & n) const;
};
class RefinementSurfaces : public Refinement
{
const CSGeometry & geometry;
public:
RefinementSurfaces (const CSGeometry & ageometry);
virtual ~RefinementSurfaces ();
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
int surfi,
const PointGeomInfo & gi1,
const PointGeomInfo & gi2,
Point<3> & newp, PointGeomInfo & newgi) const;
virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
int surfi1, int surfi2,
const EdgePointGeomInfo & ap1,
const EdgePointGeomInfo & ap2,
Point<3> & newp, EdgePointGeomInfo & newgi) const;
virtual Vec<3> GetTangent (const Point<3> & p, int surfi1, int surfi2,
const EdgePointGeomInfo & ap1) const;
virtual Vec<3> GetNormal (const Point<3> & p, int surfi1,
const PointGeomInfo & gi) const;
virtual void ProjectToSurface (Point<3> & p, int surfi) const;
virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2, const EdgePointGeomInfo & egi) const;
};
}
#endif

738
libsrc/csg/polyhedra.cpp Normal file
View File

@ -0,0 +1,738 @@
#include <mystdlib.h>
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
Polyhedra::Face::Face (int pi1, int pi2, int pi3,
const Array<Point<3> > & points,
int ainputnr)
{
inputnr = ainputnr;
pnums[0] = pi1;
pnums[1] = pi2;
pnums[2] = pi3;
bbox.Set (points[pi1]);
bbox.Add (points[pi2]);
bbox.Add (points[pi3]);
v1 = points[pi2] - points[pi1];
v2 = points[pi3] - points[pi1];
n = Cross (v1, v2);
nn = n;
nn.Normalize();
// PseudoInverse (v1, v2, w1, w2);
Mat<2,3> mat;
Mat<3,2> inv;
for (int i = 0; i < 3; i++)
{
mat(0,i) = v1(i);
mat(1,i) = v2(i);
}
CalcInverse (mat, inv);
for (int i = 0; i < 3; i++)
{
w1(i) = inv(i,0);
w2(i) = inv(i,1);
}
}
Polyhedra :: Polyhedra ()
{
surfaceactive.SetSize(0);
surfaceids.SetSize(0);
eps_base1 = 1e-8;
}
Polyhedra :: ~Polyhedra ()
{
;
}
Primitive * Polyhedra :: CreateDefault ()
{
return new Polyhedra();
}
INSOLID_TYPE Polyhedra :: BoxInSolid (const BoxSphere<3> & box) const
{
/*
for (i = 1; i <= faces.Size(); i++)
if (FaceBoxIntersection (i, box))
return DOES_INTERSECT;
*/
for (int i = 0; i < faces.Size(); i++)
{
if (!faces[i].bbox.Intersect (box))
continue;
//(*testout) << "face " << i << endl;
const Point<3> & p1 = points[faces[i].pnums[0]];
const Point<3> & p2 = points[faces[i].pnums[1]];
const Point<3> & p3 = points[faces[i].pnums[2]];
if (fabs (faces[i].nn * (p1 - box.Center())) > box.Diam()/2)
continue;
//(*testout) << "still in loop" << endl;
double dist2 = MinDistTP2 (p1, p2, p3, box.Center());
//(*testout) << "p1 " << p1 << " p2 " << p2 << " p3 " << p3 << endl
// << " box.Center " << box.Center() << " box.Diam() " << box.Diam() << endl
// << " dist2 " << dist2 << " sqr(box.Diam()/2) " << sqr(box.Diam()/2) << endl;
if (dist2 < sqr (box.Diam()/2))
{
//(*testout) << "DOES_INTERSECT" << endl;
return DOES_INTERSECT;
}
};
return PointInSolid (box.Center(), 1e-3 * box.Diam());
}
INSOLID_TYPE Polyhedra :: PointInSolid (const Point<3> & p,
double eps) const
{
//(*testout) << "PointInSolid p " << p << " eps " << eps << endl;
//(*testout) << "bbox " << poly_bbox << endl;
if((p(0) > poly_bbox.PMax()(0) + eps) || (p(0) < poly_bbox.PMin()(0) - eps) ||
(p(1) > poly_bbox.PMax()(1) + eps) || (p(1) < poly_bbox.PMin()(1) - eps) ||
(p(2) > poly_bbox.PMax()(2) + eps) || (p(2) < poly_bbox.PMin()(2) - eps))
{
//(*testout) << "returning IS_OUTSIDE" << endl;
return IS_OUTSIDE;
}
Vec<3> n, v1, v2;
// random (?) numbers:
n(0) = -0.424621;
n(1) = 0.15432;
n(2) = 0.89212238;
int cnt = 0;
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
Vec<3> v0 = p - p1;
double lam3 = faces[i].nn * v0;
if(fabs(lam3) < eps)
{
double lam1 = (faces[i].w1 * v0);
double lam2 = (faces[i].w2 * v0);
if (lam1 >= -eps_base1 && lam2 >= -eps_base1 && lam1+lam2 <= 1+eps_base1)
{
//(*testout) << "returning DOES_INTERSECT" << endl;
return DOES_INTERSECT;
}
}
else
{
lam3 = -(faces[i].n * v0) / (faces[i].n * n);
if (lam3 < 0) continue;
Vec<3> rs = v0 + lam3 * n;
double lam1 = (faces[i].w1 * rs);
double lam2 = (faces[i].w2 * rs);
if (lam1 >= 0 && lam2 >= 0 && lam1+lam2 <= 1)
cnt++;
}
}
//(*testout) << " cnt = " << cnt%2 << endl;
return (cnt % 2) ? IS_INSIDE : IS_OUTSIDE;
}
void Polyhedra :: GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const
{
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
Vec<3> v0 = p - p1;
double lam3 = -(faces[i].nn * v0); // n->nn
if (fabs (lam3) > eps) continue;
double lam1 = (faces[i].w1 * v0);
double lam2 = (faces[i].w2 * v0);
if (lam1 >= -eps_base1 && lam2 >= -eps_base1 && lam1+lam2 <= 1+eps_base1)
if (!surfind.Contains (GetSurfaceId(i)))
surfind.Append (GetSurfaceId(i));
}
}
INSOLID_TYPE Polyhedra :: VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const
{
Array<int> point_on_faces;
INSOLID_TYPE res(DOES_INTERSECT);
Vec<3> vn = v;
vn.Normalize();
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
Vec<3> v0 = p - p1;
double lam3 = -(faces[i].nn * v0); // n->nn
if (fabs (lam3) > eps) continue;
//(*testout) << "lam3 <= eps" << endl;
double lam1 = (faces[i].w1 * v0);
double lam2 = (faces[i].w2 * v0);
if (lam1 >= -eps_base1 && lam2 >= -eps_base1 && lam1+lam2 <= 1+eps_base1)
{
point_on_faces.Append(i);
double scal = vn * faces[i].nn; // n->nn
res = DOES_INTERSECT;
if (scal > eps_base1) res = IS_OUTSIDE;
if (scal < -eps_base1) res = IS_INSIDE;
}
}
//(*testout) << "point_on_faces.Size() " << point_on_faces.Size()
// << " res " << res << endl;
if (point_on_faces.Size() == 0)
return PointInSolid (p, 0);
if (point_on_faces.Size() == 1)
return res;
double mindist(0);
bool first = true;
for(int i=0; i<point_on_faces.Size(); i++)
{
for(int j=0; j<3; j++)
{
double dist = Dist(p,points[faces[point_on_faces[i]].pnums[j]]);
if(dist > eps && (first || dist < mindist))
{
mindist = dist;
first = false;
}
}
}
Point<3> p2 = p + (1e-2*mindist) * vn;
res = PointInSolid (p2, eps);
// (*testout) << "mindist " << mindist << " res " << res << endl;
return res;
}
/*
INSOLID_TYPE Polyhedra :: VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
INSOLID_TYPE res;
res = VecInSolid(p,v1,eps);
if(res != DOES_INTERSECT)
return res;
int point_on_n_faces = 0;
Vec<3> v1n = v1;
v1n.Normalize();
Vec<3> v2n = v2;
v2n.Normalize();
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
Vec<3> v0 = p - p1;
double lam3 = -(faces[i].n * v0);
if (fabs (lam3) > eps) continue;
double lam1 = (faces[i].w1 * v0);
double lam2 = (faces[i].w2 * v0);
if (lam1 >= -eps && lam2 >= -eps && lam1+lam2 <= 1+eps)
{
double scal1 = v1n * faces[i].n;
if (fabs (scal1) > eps) continue;
point_on_n_faces++;
double scal2 = v2n * faces[i].n;
res = DOES_INTERSECT;
if (scal2 > eps) res = IS_OUTSIDE;
if (scal2 < -eps) res = IS_INSIDE;
}
}
if (point_on_n_faces == 1)
return res;
cerr << "primitive::vecinsolid2 makes nonsense for polyhedra" << endl;
return Primitive :: VecInSolid2 (p, v1, v2, eps);
}
*/
INSOLID_TYPE Polyhedra :: VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
//(*testout) << "VecInSolid2 eps " << eps << endl;
INSOLID_TYPE res = VecInSolid(p,v1,eps);
//(*testout) << "VecInSolid = " <<res <<endl;
if(res != DOES_INTERSECT)
return res;
int point_on_n_faces = 0;
Vec<3> v1n = v1;
v1n.Normalize();
Vec<3> v2n = v2 - (v2 * v1n) * v1n;
v2n.Normalize();
double cosv2, cosv2max = -99;
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
Vec<3> v0 = p - p1;
if (fabs (faces[i].nn * v0) > eps) continue; // n->nn
if (fabs (v1n * faces[i].nn) > eps_base1) continue; // n->nn
double lam1 = (faces[i].w1 * v0);
double lam2 = (faces[i].w2 * v0);
if (lam1 >= -eps_base1 && lam2 >= -eps_base1 && lam1+lam2 <= 1+eps_base1)
{
// v1 is in face
Point<3> fc = Center (points[faces[i].pnums[0]],
points[faces[i].pnums[1]],
points[faces[i].pnums[2]]);
Vec<3> vpfc = fc - p;
cosv2 = (v2n * vpfc) / vpfc.Length();
if (cosv2 > cosv2max)
{
cosv2max = cosv2;
point_on_n_faces++;
double scal2 = v2n * faces[i].nn; // n->nn
res = DOES_INTERSECT;
if (scal2 > eps_base1) res = IS_OUTSIDE;
if (scal2 < -eps_base1) res = IS_INSIDE;
}
}
}
if (point_on_n_faces >= 1)
return res;
(*testout) << "primitive::vecinsolid2 makes nonsense for polyhedra" << endl;
cerr << "primitive::vecinsolid2 makes nonsense for polyhedra" << endl;
return Primitive :: VecInSolid2 (p, v1, v2, eps);
}
void Polyhedra :: GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const
{
Vec<3> v1n = v1;
v1n.Normalize();
Vec<3> v2n = v2; // - (v2 * v1n) * v1n;
v2n.Normalize();
for (int i = 0; i < faces.Size(); i++)
{
const Point<3> & p1 = points[faces[i].pnums[0]];
Vec<3> v0 = p - p1;
if (fabs (v0 * faces[i].nn) > eps) continue; // n->nn
if (fabs (v1n * faces[i].nn) > eps_base1) continue; // n->nn
if (fabs (v2n * faces[i].nn) > eps_base1) continue; // n->nn
double lam01 = (faces[i].w1 * v0);
double lam02 = (faces[i].w2 * v0);
double lam03 = 1-lam01-lam02;
double lam11 = (faces[i].w1 * v1);
double lam12 = (faces[i].w2 * v1);
double lam13 = -lam11-lam12;
double lam21 = (faces[i].w1 * v2);
double lam22 = (faces[i].w2 * v2);
double lam23 = -lam21-lam22;
bool ok1 = lam01 > eps_base1 ||
(lam01 > -eps_base1 && lam11 > eps_base1) ||
(lam01 > -eps_base1 && lam11 > -eps_base1 && lam21 > eps_base1);
bool ok2 = lam02 > eps_base1 ||
(lam02 > -eps_base1 && lam12 > eps_base1) ||
(lam02 > -eps_base1 && lam12 > -eps_base1 && lam22 > eps_base1);
bool ok3 = lam03 > eps_base1 ||
(lam03 > -eps_base1 && lam13 > eps_base1) ||
(lam03 > -eps_base1 && lam13 > -eps_base1 && lam23 > eps_base1);
if (ok1 && ok2 && ok3)
{
if (!surfind.Contains (GetSurfaceId(faces[i].planenr)))
surfind.Append (GetSurfaceId(faces[i].planenr));
}
}
}
void Polyhedra :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const
{
classname = "Polyhedra";
coeffs.SetSize(0);
coeffs.Append (points.Size());
coeffs.Append (faces.Size());
coeffs.Append (planes.Size());
/*
int i, j;
for (i = 1; i <= planes.Size(); i++)
{
planes.Elem(i)->Print (*testout);
}
for (i = 1; i <= faces.Size(); i++)
{
(*testout) << "face " << i << " has plane " << faces.Get(i).planenr << endl;
for (j = 1; j <= 3; j++)
(*testout) << points.Get(faces.Get(i).pnums[j-1]);
(*testout) << endl;
}
*/
}
void Polyhedra :: SetPrimitiveData (Array<double> & /* coeffs */)
{
;
}
void Polyhedra :: Reduce (const BoxSphere<3> & box)
{
for (int i = 0; i < planes.Size(); i++)
surfaceactive[i] = 0;
for (int i = 0; i < faces.Size(); i++)
if (FaceBoxIntersection (i, box))
surfaceactive[faces[i].planenr] = 1;
}
void Polyhedra :: UnReduce ()
{
for (int i = 0; i < planes.Size(); i++)
surfaceactive[i] = 1;
}
int Polyhedra :: AddPoint (const Point<3> & p)
{
if(points.Size() == 0)
poly_bbox.Set(p);
else
poly_bbox.Add(p);
return points.Append (p);
}
int Polyhedra :: AddFace (int pi1, int pi2, int pi3, int inputnum)
{
(*testout) << "polyhedra, add face " << pi1 << ", " << pi2 << ", " << pi3 << endl;
if(pi1 == pi2 || pi2 == pi3 || pi3 == pi1)
{
ostringstream msg;
msg << "Illegal point numbers for polyhedron face: " << pi1+1 << ", " << pi2+1 << ", " << pi3+1;
throw NgException(msg.str());
}
faces.Append (Face (pi1, pi2, pi3, points, inputnum));
Point<3> p1 = points[pi1];
Point<3> p2 = points[pi2];
Point<3> p3 = points[pi3];
Vec<3> v1 = p2 - p1;
Vec<3> v2 = p3 - p1;
Vec<3> n = Cross (v1, v2);
n.Normalize();
Plane pl (p1, n);
// int inverse;
// int identicto = -1;
// for (int i = 0; i < planes.Size(); i++)
// if (pl.IsIdentic (*planes[i], inverse, 1e-9*max3(v1.Length(),v2.Length(),Dist(p2,p3))))
// {
// if (!inverse)
// identicto = i;
// }
// // cout << "is identic = " << identicto << endl;
// identicto = -1; // changed April 10, JS
// if (identicto != -1)
// faces.Last().planenr = identicto;
// else
{
planes.Append (new Plane (p1, n));
surfaceactive.Append (1);
surfaceids.Append (0);
faces.Last().planenr = planes.Size()-1;
}
// (*testout) << "is plane nr " << faces.Last().planenr << endl;
return faces.Size();
}
int Polyhedra :: FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const
{
/*
(*testout) << "check face box intersection, fnr = " << fnr << endl;
(*testout) << "box = " << box << endl;
(*testout) << "face-box = " << faces[fnr].bbox << endl;
*/
if (!faces[fnr].bbox.Intersect (box))
return 0;
const Point<3> & p1 = points[faces[fnr].pnums[0]];
const Point<3> & p2 = points[faces[fnr].pnums[1]];
const Point<3> & p3 = points[faces[fnr].pnums[2]];
double dist2 = MinDistTP2 (p1, p2, p3, box.Center());
/*
(*testout) << "p1 = " << p1 << endl;
(*testout) << "p2 = " << p2 << endl;
(*testout) << "p3 = " << p3 << endl;
(*testout) << "box.Center() = " << box.Center() << endl;
(*testout) << "center = " << box.Center() << endl;
(*testout) << "dist2 = " << dist2 << endl;
(*testout) << "diam = " << box.Diam() << endl;
*/
if (dist2 < sqr (box.Diam()/2))
{
// (*testout) << "intersect" << endl;
return 1;
}
return 0;
}
void Polyhedra :: GetPolySurfs(Array < Array<int> * > & polysurfs)
{
int maxnum = -1;
for(int i = 0; i<faces.Size(); i++)
{
if(faces[i].inputnr > maxnum)
maxnum = faces[i].inputnr;
}
polysurfs.SetSize(maxnum+1);
for(int i=0; i<polysurfs.Size(); i++)
polysurfs[i] = new Array<int>;
for(int i = 0; i<faces.Size(); i++)
polysurfs[faces[i].inputnr]->Append(faces[i].planenr);
}
void Polyhedra::CalcSpecialPoints (Array<Point<3> > & pts) const
{
for (int i = 0; i < points.Size(); i++)
pts.Append (points[i]);
}
void Polyhedra :: AnalyzeSpecialPoint (const Point<3> & /* pt */,
Array<Point<3> > & /* specpts */) const
{
;
}
Vec<3> Polyhedra :: SpecialPointTangentialVector (const Point<3> & p, int s1, int s2) const
{
const double eps = 1e-10*poly_bbox.Diam();
for (int fi1 = 0; fi1 < faces.Size(); fi1++)
for (int fi2 = 0; fi2 < faces.Size(); fi2++)
{
int si1 = faces[fi1].planenr;
int si2 = faces[fi2].planenr;
if (surfaceids[si1] != s1 || surfaceids[si2] != s2) continue;
//(*testout) << "check pair fi1/fi2 " << fi1 << "/" << fi2 << endl;
Vec<3> n1 = GetSurface(si1) . GetNormalVector (p);
Vec<3> n2 = GetSurface(si2) . GetNormalVector (p);
Vec<3> t = Cross (n1, n2);
//(*testout) << "t = " << t << endl;
/*
int samepts = 0;
for (int j = 0; j < 3; j++)
for (int k = 0; k < 3; k++)
if (Dist(points[faces[fi1].pnums[j]],
points[faces[fi2].pnums[k]]) < eps)
samepts++;
if (samepts < 2) continue;
*/
bool shareedge = false;
for(int j = 0; !shareedge && j < 3; j++)
{
Vec<3> v1 = points[faces[fi1].pnums[(j+1)%3]] - points[faces[fi1].pnums[j]];
double smax = v1.Length();
v1 *= 1./smax;
int pospos;
if(fabs(v1(0)) > 0.5)
pospos = 0;
else if(fabs(v1(1)) > 0.5)
pospos = 1;
else
pospos = 2;
double sp = (p(pospos) - points[faces[fi1].pnums[j]](pospos)) / v1(pospos);
if(sp < -eps || sp > smax+eps)
continue;
for (int k = 0; !shareedge && k < 3; k ++)
{
Vec<3> v2 = points[faces[fi2].pnums[(k+1)%3]] - points[faces[fi2].pnums[k]];
v2.Normalize();
if(v2 * v1 > 0)
v2 -= v1;
else
v2 += v1;
//(*testout) << "v2.Length2() " << v2.Length2() << endl;
if(v2.Length2() > 1e-18)
continue;
double sa,sb;
sa = (points[faces[fi2].pnums[k]](pospos) - points[faces[fi1].pnums[j]](pospos)) / v1(pospos);
sb = (points[faces[fi2].pnums[(k+1)%3]](pospos) - points[faces[fi1].pnums[j]](pospos)) / v1(pospos);
if(Dist(points[faces[fi1].pnums[j]] + sa*v1, points[faces[fi2].pnums[k]]) > eps)
continue;
if(sa > sb)
{
double aux = sa; sa = sb; sb = aux;
}
//testout->precision(20);
//(*testout) << "sa " << sa << " sb " << sb << " smax " << smax << " sp " << sp << " v1 " << v1 << endl;
//testout->precision(8);
shareedge = (sa < -eps && sb > eps) ||
(sa < smax-eps && sb > smax+eps) ||
(sa > -eps && sb < smax+eps);
if(!shareedge)
continue;
sa = max2(sa,0.);
sb = min2(sb,smax);
if(sp < sa+eps)
shareedge = (t * v1 > 0);
else if (sp > sb-eps)
shareedge = (t * v1 < 0);
}
}
if (!shareedge) continue;
t.Normalize();
return t;
}
return Vec<3> (0,0,0);
}
}

104
libsrc/csg/polyhedra.hpp Normal file
View File

@ -0,0 +1,104 @@
#ifndef FILE_POLYHEDRA
#define FILE_POLYHEDRA
/**************************************************************************/
/* File: polyhedra.hh */
/* Author: Joachim Schoeberl */
/* Date: 19. Mar. 2000 */
/**************************************************************************/
namespace netgen
{
/*
Polyhedral primitive
*/
class Polyhedra : public Primitive
{
class Face {
public:
int pnums[3];
int planenr;
int inputnr;
Box<3> bbox;
// Point<3> center;
Vec<3> v1, v2; // edges
Vec<3> w1, w2; // pseudo-inverse
Vec<3> n; // normal to face
Vec<3> nn; // normed normal
Face () { ; }
Face (int pi1, int pi2, int pi3,
const Array<Point<3> > & points,
int ainputnr);
};
Array<Point<3> > points;
Array<Face> faces;
Array<Plane*> planes;
Box<3> poly_bbox;
double eps_base1;
public:
Polyhedra ();
virtual ~Polyhedra ();
static Primitive * CreateDefault ();
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const;
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const;
virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const;
virtual void CalcSpecialPoints (Array<Point<3> > & pts) const;
virtual void AnalyzeSpecialPoint (const Point<3> & pt,
Array<Point<3> > & specpts) const;
virtual Vec<3> SpecialPointTangentialVector (const Point<3> & p, int s1, int s2) const;
virtual int GetNSurfaces() const
{ return planes.Size(); }
virtual Surface & GetSurface (int i)
{ return *planes[i]; }
virtual const Surface & GetSurface (int i) const
{ return *planes[i]; }
virtual void GetPrimitiveData (const char *& classname, Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();
int AddPoint (const Point<3> & p);
int AddFace (int pi1, int pi2, int pi3, int inputnum);
void GetPolySurfs(Array < Array<int> * > & polysurfs);
protected:
int FaceBoxIntersection (int fnr, const BoxSphere<3> & box) const;
// void CalcData();
};
}
#endif

900
libsrc/csg/revolution.cpp Normal file
View File

@ -0,0 +1,900 @@
#include <mystdlib.h>
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
void RevolutionFace :: Init(void)
{
const LineSeg<2> * line = dynamic_cast<const LineSeg<2>*>(spline);
const SplineSeg3<2> * spline3 = dynamic_cast<const SplineSeg3<2>*>(spline);
if(line)
{
checklines_start.Append(new Point<2>(line->StartPI()));
checklines_vec.Append(new Vec<2>(line->EndPI() - line->StartPI()));
(*checklines_vec.Last()) *= 1./pow(checklines_vec.Last()->Length(),2); //!!
}
else if (spline3)
{
checklines_start.Append(new Point<2>(spline3->EndPI()));
checklines_start.Append(new Point<2>(spline3->TangentPoint()));
checklines_start.Append(new Point<2>(spline3->StartPI()));
checklines_vec.Append(new Vec<2>(spline3->StartPI() - spline3->EndPI()));
(*checklines_vec.Last()) *= 1./pow(checklines_vec.Last()->Length(),2); //!!
checklines_vec.Append(new Vec<2>(spline3->EndPI() - spline3->TangentPoint()));
(*checklines_vec.Last()) *= 1./pow(checklines_vec.Last()->Length(),2); //!!
checklines_vec.Append(new Vec<2>(spline3->TangentPoint() - spline3->StartPI()));
(*checklines_vec.Last()) *= 1./pow(checklines_vec.Last()->Length(),2); //!!
}
for(int i=0; i<checklines_vec.Size(); i++)
{
checklines_normal.Append(new Vec<2>);
(*checklines_normal.Last())(0) = - (*checklines_vec[i])(1);
(*checklines_normal.Last())(1) = (*checklines_vec[i])(0);
checklines_normal.Last()->Normalize();
}
}
RevolutionFace :: RevolutionFace(const SplineSeg<2> & spline_in,
const Point<3> & p,
const Vec<3> & vec,
bool first,
bool last,
const int id_in) :
isfirst(first), islast(last), spline(&spline_in), p0(p), v_axis(vec), id(id_in)
{
deletable = false;
Init();
}
RevolutionFace :: RevolutionFace(const Array<double> & raw_data)
{
deletable = true;
int pos = 0;
Array< Point<2> > p(3);
int stype = int(raw_data[pos]); pos++;
for(int i=0; i<stype; i++)
{
p[i](0) = raw_data[pos]; pos++;
p[i](1) = raw_data[pos]; pos++;
}
if(stype == 2)
{
spline = new LineSeg<2>(GeomPoint<2>(p[0],1),
GeomPoint<2>(p[1],1));
//(*testout) << "appending LineSeg<2> " << p[0]
// << " to " << p[1] << endl;
}
else if(stype == 3)
{
spline = new SplineSeg3<2>(GeomPoint<2>(p[0],1),
GeomPoint<2>(p[1],1),
GeomPoint<2>(p[2],1));
//(*testout) << "appending SplineSeg<3> "
// << p[0] << " -- " << p[1] << " -- " << p[2] << endl;
}
for(int i=0; i<3; i++)
{
p0(i) = raw_data[pos];
pos++;
}
for(int i=0; i<3; i++)
{
v_axis(i) = raw_data[pos];
pos++;
}
isfirst = (raw_data[pos] > 0.9);
pos++;
islast = (raw_data[pos] < 0.1);
pos++;
}
RevolutionFace :: ~RevolutionFace()
{
for(int i=0; i<checklines_start.Size(); i++)
{
delete checklines_start[i];
delete checklines_vec[i];
delete checklines_normal[i];
}
if(deletable)
delete spline;
}
void RevolutionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d,
const Vec<3> & vector3d, Vec<2> & vector2d) const
{
Vec<3> pmp0 = point3d-p0;
CalcProj0(pmp0,point2d);
Vec<3> y=pmp0-point2d(0)*v_axis; y.Normalize();
vector2d(0) = vector3d*v_axis;
vector2d(1) = vector3d*y;
}
void RevolutionFace :: CalcProj(const Point<3> & point3d, Point<2> & point2d) const
{
Vec<3> pmp0 = point3d-p0;
CalcProj0(pmp0,point2d);
}
void RevolutionFace :: CalcProj0(const Vec<3> & point3d_minus_p0, Point<2> & point2d) const
{
point2d(0) = point3d_minus_p0 * v_axis;
point2d(1) = sqrt( point3d_minus_p0 * point3d_minus_p0 - point2d(0)*point2d(0) );
}
int RevolutionFace ::IsIdentic (const Surface & s2, int & inv, double eps) const
{
const RevolutionFace * rev2 = dynamic_cast<const RevolutionFace*>(&s2);
if(!rev2) return 0;
if(rev2 == this)
return 1;
return 0;
}
double RevolutionFace :: CalcFunctionValue (const Point<3> & point) const
{
if(spline_coefficient.Size() == 0)
spline->GetCoeff(spline_coefficient);
Point<2> p;
CalcProj(point,p);
return spline_coefficient(0)*p(0)*p(0) + spline_coefficient(1)*p(1)*p(1)
+ spline_coefficient(2)*p(0)*p(1) + spline_coefficient(3)*p(0)
+ spline_coefficient(4)*p(1) + spline_coefficient(5);
}
void RevolutionFace :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
{
if(spline_coefficient.Size() == 0)
spline->GetCoeff(spline_coefficient);
Vec<3> point_minus_p0 = point-p0;
Point<2> p;
CalcProj0(point_minus_p0,p);
const double dFdxbar = 2.*spline_coefficient(0)*p(0) + spline_coefficient(2)*p(1) + spline_coefficient(3);
if(fabs(p(1)) > 1e-10)
{
const double dFdybar = 2.*spline_coefficient(1)*p(1) + spline_coefficient(2)*p(0) + spline_coefficient(4);
grad(0) = dFdxbar*v_axis(0) + dFdybar * ( point_minus_p0(0)-v_axis(0)*p(0) )/p(1);
grad(1) = dFdxbar*v_axis(1) + dFdybar * ( point_minus_p0(1)-v_axis(1)*p(0) )/p(1);
grad(2) = dFdxbar*v_axis(2) + dFdybar * ( point_minus_p0(2)-v_axis(2)*p(0) )/p(1);
//(*testout) << "grad1("<<point<<") = " << grad << endl;
}
else
{
grad(0) = dFdxbar*v_axis(0);
grad(1) = dFdxbar*v_axis(1);
grad(2) = dFdxbar*v_axis(2);
//(*testout) << "grad2("<<point<<") = " << grad << endl;
}
}
void RevolutionFace :: CalcHesse (const Point<3> & point, Mat<3> & hesse) const
{
if(spline_coefficient.Size() == 0)
spline->GetCoeff(spline_coefficient);
Vec<3> point_minus_p0 = point-p0;
Point<2> p;
CalcProj0(point_minus_p0,p);
if(fabs(p(1)) > 1e-10)
{
const double dFdybar = 2.*spline_coefficient(1)*p(1) + spline_coefficient(2)*p(0) + spline_coefficient(4);
const double aux = -pow(p(1),-3);
const double aux0 = point_minus_p0(0) - v_axis(0)*p(0);
const double aux1 = point_minus_p0(1) - v_axis(1)*p(0);
const double aux2 = point_minus_p0(2) - v_axis(2)*p(0);
const double dybardx = aux0/p(1);
const double dybardy = aux1/p(1);
const double dybardz = aux2/p(1);
const double dybardxx = aux*aux0*aux0 + (1.-v_axis(0)*v_axis(0))/p(1);
const double dybardyy = aux*aux1*aux1 + (1.-v_axis(1)*v_axis(1))/p(1);
const double dybardzz = aux*aux2*aux2 + (1.-v_axis(2)*v_axis(2))/p(1);
const double dybardxy = aux*aux0*aux1 - v_axis(0)*v_axis(1)/p(1);
const double dybardxz = aux*aux0*aux2 - v_axis(0)*v_axis(2)/p(1);
const double dybardyz = aux*aux1*aux2 - v_axis(1)*v_axis(2)/p(1);
hesse(0,0) = 2.*spline_coefficient(0)*v_axis(0)*v_axis(0) + 2.*spline_coefficient(2)*v_axis(0)*dybardx + 2.*spline_coefficient(1)*dybardx*dybardx
+ dFdybar*dybardxx;
hesse(1,1) = 2.*spline_coefficient(0)*v_axis(1)*v_axis(1) + 2.*spline_coefficient(2)*v_axis(1)*dybardy + 2.*spline_coefficient(1)*dybardy*dybardy
+ dFdybar*dybardyy;
hesse(2,2) = 2.*spline_coefficient(0)*v_axis(2)*v_axis(2) + 2.*spline_coefficient(2)*v_axis(2)*dybardz + 2.*spline_coefficient(1)*dybardz*dybardz
+ dFdybar*dybardzz;
hesse(0,1) = hesse(1,0) = 2.*spline_coefficient(0)*v_axis(0)*v_axis(1) + spline_coefficient(2)*v_axis(0)*dybardy + spline_coefficient(2)*dybardx*v_axis(1)
+ 2.*spline_coefficient(2)*dybardx*dybardy + dFdybar*dybardxy;
hesse(0,2) = hesse(2,0) = 2.*spline_coefficient(0)*v_axis(0)*v_axis(2) + spline_coefficient(2)*v_axis(0)*dybardz + spline_coefficient(2)*dybardx*v_axis(2)
+ 2.*spline_coefficient(2)*dybardx*dybardz + dFdybar*dybardxz;
hesse(1,2) = hesse(2,1) = 2.*spline_coefficient(0)*v_axis(1)*v_axis(2) + spline_coefficient(2)*v_axis(1)*dybardz + spline_coefficient(2)*dybardy*v_axis(2)
+ 2.*spline_coefficient(2)*dybardy*dybardz + dFdybar*dybardyz;
//(*testout) << "hesse1: " << hesse <<endl;
}
else if (fabs(spline_coefficient(2)) + fabs(spline_coefficient(4)) < 1.e-9 &&
fabs(spline_coefficient(0)) > 1e-10)
{
double aux = spline_coefficient(0)-spline_coefficient(1);
hesse(0,0) = aux*v_axis(0)*v_axis(0) + spline_coefficient(1);
hesse(0,0) = aux*v_axis(1)*v_axis(1) + spline_coefficient(1);
hesse(0,0) = aux*v_axis(2)*v_axis(2) + spline_coefficient(1);
hesse(0,1) = hesse(1,0) = aux*v_axis(0)*v_axis(1);
hesse(0,2) = hesse(2,0) = aux*v_axis(0)*v_axis(2);
hesse(1,2) = hesse(2,1) = aux*v_axis(1)*v_axis(2);
//(*testout) << "hesse2: " << hesse <<endl;
}
else if (fabs(spline_coefficient(1)) + fabs(spline_coefficient(3)) + fabs(spline_coefficient(4)) + fabs(spline_coefficient(5)) < 1.e-9) // line
{
hesse = 0;
//(*testout) << "hesse3: " << hesse <<endl;
}
else
{
(*testout) << "hesse4: " << hesse <<endl;
}
}
double RevolutionFace ::HesseNorm () const
{
if (fabs(spline_coefficient(1)) + fabs(spline_coefficient(3)) + fabs(spline_coefficient(4)) + fabs(spline_coefficient(5)) < 1.e-9) // line
return 0;
if (fabs(spline_coefficient(2)) + fabs(spline_coefficient(4)) < 1.e-9 &&
fabs(spline_coefficient(0)) > 1e-10)
return 2.*max2(fabs(spline_coefficient(0)),fabs(spline_coefficient(1)));
double alpha = fabs(spline_coefficient(2)*(spline->StartPI()(0)-spline->EndPI()(0))) /
max2(fabs(spline->StartPI()(1)),fabs(spline->EndPI()(1)));
return max2(2.*fabs(spline_coefficient(0))+sqrt(2.)*fabs(spline_coefficient(2)),
2.*fabs(spline_coefficient(1))+spline_coefficient(2)+1.5*alpha);
}
double RevolutionFace :: MaxCurvature() const
{
double retval = spline->MaxCurvature();
Array < Point<2> > checkpoints;
const SplineSeg3<2> * ss3 = dynamic_cast<const SplineSeg3<2> *>(spline);
const LineSeg<2> * ls = dynamic_cast<const LineSeg<2> *>(spline);
if(ss3)
{
checkpoints.Append(ss3->StartPI());
checkpoints.Append(ss3->TangentPoint());
checkpoints.Append(ss3->TangentPoint());
checkpoints.Append(ss3->EndPI());
}
else if(ls)
{
checkpoints.Append(ls->StartPI());
checkpoints.Append(ls->EndPI());
}
for(int i=0; i<checkpoints.Size(); i+=2)
{
Vec<2> v = checkpoints[i+1]-checkpoints[i];
Vec<2> n(v(1),-v(0)); n.Normalize();
//if(ss3)
// (*testout) << "n " << n << endl;
if(fabs(n(1)) < 1e-15)
continue;
double t1 = -checkpoints[i](1)/n(1);
double t2 = -checkpoints[i+1](1)/n(1);
double c1 = (t1 > 0) ? (1./t1) : -1;
double c2 = (t2 > 0) ? (1./t2) : -1;
//if(ss3)
// (*testout) << "t1 " << t1 << " t2 " << t2 << " c1 " << c1 << " c2 " << c2 << endl;
if(c1 > retval)
retval = c1;
if(c2 > retval)
retval = c2;
}
//if(ss3)
// (*testout) << "curvature " << retval << endl;
return retval;
/*
// find smallest y value of spline:
Array<double> testt;
if(!isfirst)
testt.Append(0);
if(!islast)
testt.Append(1);
const SplineSegment3 * s3 = dynamic_cast<const SplineSegment3 *>(&spline);
if(s3)
{
double denom = (2.-sqrt(2.))*(s3->EndPI()(1) - s3->StartPI()(1));
if(fabs(denom) < 1e-20)
testt.Append(0.5);
else
{
double sD = sqrt(pow(s3->TangentPoint()(1) - s3->StartPI()(1),2)+
pow(s3->TangentPoint()(1) - s3->EndPI()(1),2));
testt.Append((s3->StartPI()(1)*(sqrt(2.)-1.) - sqrt(2.)*s3->TangentPoint()(1) + s3->EndPI()(1) + sD)/denom);
testt.Append((s3->StartPI()(1)*(sqrt(2.)-1.) - sqrt(2.)*s3->TangentPoint()(1) + s3->EndPI()(1) - sD)/denom);
}
}
double miny = fabs(spline.GetPoint(testt[0])(1));
for(int i=1; i<testt.Size(); i++)
{
double thisy = fabs(spline.GetPoint(testt[i])(1));
if(thisy < miny)
miny = thisy;
}
return max2(splinecurvature,1./miny);
*/
}
void RevolutionFace :: Project (Point<3> & p) const
{
Point<2> p2d;
CalcProj(p,p2d);
const Vec<3> y = (p-p0)-p2d(0)*v_axis;
const double yl = y.Length();
double dummy;
spline->Project(p2d,p2d,dummy);
p = p0 + p2d(0)*v_axis;
if(yl > 1e-20*Dist(spline->StartPI(),spline->EndPI()))
p+= (p2d(1)/yl)*y;
}
Point<3> RevolutionFace :: GetSurfacePoint () const
{
Vec<3> random_vec(0.760320,-0.241175,0.60311534);
Vec<3> n = Cross(v_axis,random_vec); n.Normalize();
Point<2> sp = spline->GetPoint(0.5);
Point<3> retval = p0 + sp(0)*v_axis + sp(1)*n;
return retval;
}
void RevolutionFace :: Print (ostream & str) const
{
if(spline_coefficient.Size() == 0)
spline->GetCoeff(spline_coefficient);
str << p0(0) << " " << p0(1) << " " << p0(2) << " "
<< v_axis(0) << " " << v_axis(1) << " " << v_axis(2) << " ";
for(int i=0; i<6; i++) str << spline_coefficient(i) << " ";
str << endl;
}
void RevolutionFace :: GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & boundingbox,
double facets) const
{
Vec<3> random_vec(0.760320,-0.241175,0.60311534);
Vec<3> v1 = Cross(v_axis,random_vec); v1.Normalize();
Vec<3> v2 = Cross(v1,v_axis); v2.Normalize();
int n = int(2.*facets) + 1;
for(int i=0; i<=n; i++)
{
Point<2> sp = spline->GetPoint(double(i)/double(n));
for(int j=0; j<=n; j++)
{
double phi = 2.*M_PI*double(j)/double(n);
Point<3> p = p0 + sp(0)*v_axis + sp(1)*cos(phi)*v1 + sp(1)*sin(phi)*v2;
tas.AddPoint(p);
}
}
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
{
int pi = (n+1)*i+j;
tas.AddTriangle( TATriangle (id, pi,pi+1,pi+n+1));
tas.AddTriangle( TATriangle (id, pi+1,pi+n+1,pi+n+2));
}
}
bool RevolutionFace :: BoxIntersectsFace(const Box<3> & box) const
{
Point<3> center = box.Center();
Project(center);
return (Dist(box.Center(),center) < 0.5*box.Diam());
}
/*
bool RevolutionFace :: BoxIntersectsFace (const BoxSphere<3> & box, bool & uncertain) const
{
Point<2> c,pmin,pmax;
CalcProj(box.Center(),c);
double aux = box.Diam()/sqrt(8.);
pmin(0) = c(0)-aux; pmin(1) = c(1)-aux;
pmax(0) = c(0)+aux; pmax(1) = c(1)+aux;
BoxSphere<2> box2d(pmin,pmax);
return BoxIntersectsFace(box2d, uncertain);
}
bool RevolutionFace :: BoxIntersectsFace (const BoxSphere<2> & box, bool & uncertain) const
{
const LineSegment * line = dynamic_cast<const LineSegment*>(&spline);
const SplineSegment3 * spline3 = dynamic_cast<const SplineSegment3*>(&spline);
bool always_right = true, always_left = true;
bool retval = false;
bool thisint;
bool intdirect = false;
bool inttangent = false;
uncertain = false;
if(line) inttangent = true;
for(int i=0; i<checklines_start.Size(); i++)
{
Vec<2> b = box.Center()- (*checklines_start[i]);
double d;
double checkdist = b * (*checklines_vec[i]);
double ncomp = b * (*checklines_normal[i]);
if(checkdist < 0)
d = b.Length();
else if (checkdist > 1)
{
if(spline3)
d = Dist(box.Center(),*checklines_start[(i+1)%3]);
else
d = Dist(box.Center(),(*checklines_start[i])
+ pow(checklines_vec[i]->Length(),2)*(*checklines_vec[i]));
}
else
d = fabs(ncomp);
thisint = (box.Diam() >= 2.*d);
retval = retval || thisint;
if(thisint)
{
if(i==0)
intdirect = true;
else
inttangent = true;
}
if(ncomp > 0) always_right = false;
else if(ncomp < 0) always_left = false;
}
if(retval && !(intdirect && inttangent))
uncertain = true;
if(!retval && spline3 && (always_right || always_left))
{
retval = true;
uncertain = true;
}
return retval;
}
*/
INSOLID_TYPE RevolutionFace :: PointInFace (const Point<3> & p, const double eps) const
{
Point<2> p2d;
CalcProj(p,p2d);
double val = spline_coefficient(0)*p2d(0)*p2d(0) + spline_coefficient(1)*p2d(1)*p2d(1) + spline_coefficient(2)*p2d(0)*p2d(1) +
spline_coefficient(3)*p2d(0) + spline_coefficient(4)*p2d(1) + spline_coefficient(5);
if(val > eps)
return IS_OUTSIDE;
if(val < -eps)
return IS_INSIDE;
return DOES_INTERSECT;
}
void RevolutionFace :: GetRawData(Array<double> & data) const
{
data.DeleteAll();
spline->GetRawData(data);
for(int i=0; i<3; i++)
data.Append(p0(i));
for(int i=0; i<3; i++)
data.Append(v_axis(i));
data.Append((isfirst) ? 1. : 0.);
data.Append((islast) ? 1. : 0.);
}
Revolution :: Revolution(const Point<3> & p0_in,
const Point<3> & p1_in,
const SplineGeometry<2> & spline_in) :
p0(p0_in), p1(p1_in), splinecurve(spline_in),
nsplines(spline_in.GetNSplines())
{
surfaceactive.SetSize(0);
surfaceids.SetSize(0);
v_axis = p1-p0;
v_axis.Normalize();
if(splinecurve.GetSpline(0).StartPI()(1) <= 0. &&
splinecurve.GetSpline(nsplines-1).EndPI()(1) <= 0.)
type = 2;
else if (Dist(splinecurve.GetSpline(0).StartPI(),
splinecurve.GetSpline(nsplines-1).EndPI()) < 1e-7)
type = 1;
else
cerr << "Surface of revolution cannot be constructed" << endl;
for(int i=0; i<splinecurve.GetNSplines(); i++)
{
RevolutionFace * face = new RevolutionFace(splinecurve.GetSpline(i),
p0,v_axis,
type==2 && i==0,
type==2 && i==splinecurve.GetNSplines()-1);
faces.Append(face);
surfaceactive.Append(1);
surfaceids.Append(0);
}
}
Revolution::~Revolution()
{
for(int i=0; i<faces.Size(); i++)
delete faces[i];
}
INSOLID_TYPE Revolution :: BoxInSolid (const BoxSphere<3> & box) const
{
for(int i=0; i<faces.Size(); i++)
if(faces[i]->BoxIntersectsFace(box))
return DOES_INTERSECT;
return PointInSolid(box.Center(),0);
/*
Point<2> c,pmin,pmax;
faces[0]->CalcProj(box.Center(),c);
double aux = box.Diam()/sqrt(8.);
pmin(0) = c(0)-aux; pmin(1) = c(1)-aux;
pmax(0) = c(0)+aux; pmax(1) = c(1)+aux;
BoxSphere<2> box2d(pmin,pmax);
bool intersection = false;
bool uncertain = true;
for(int i=0; !(intersection && !uncertain) && i<faces.Size(); i++)
{
bool thisintersects;
bool thisuncertain;
thisintersects = faces[i]->BoxIntersectsFace(box2d,thisuncertain);
intersection = intersection || thisintersects;
if(thisintersects && !thisuncertain)
uncertain = false;
}
if(intersection)
{
if(!uncertain)
return DOES_INTERSECT;
else
{
Array < Point<3> > pext(2);
Point<3> p;
pext[0] = box.PMin();
pext[1] = box.PMax();
INSOLID_TYPE position;
bool firsttime = true;
for(int i=0; i<2; i++)
for(int j=0; j<2; j++)
for(int k=0; k<2; k++)
{
p(0) = pext[i](0);
p(1) = pext[j](1);
p(2) = pext[k](2);
INSOLID_TYPE ppos = PointInSolid(p,0);
if(ppos == DOES_INTERSECT)
return DOES_INTERSECT;
if(firsttime)
{
firsttime = false;
position = ppos;
}
if(position != ppos)
return DOES_INTERSECT;
}
return position;
}
}
return PointInSolid(box.Center(),0);
*/
}
INSOLID_TYPE Revolution :: PointInSolid (const Point<3> & p,
double eps) const
{
Point<2> p2d;
faces[0]->CalcProj(p,p2d);
int intersections_before(0), intersections_after(0);
double randomx = 7.42357;
double randomy = 1.814756;
randomx *= 1./sqrt(randomx*randomx+randomy*randomy);
randomy *= 1./sqrt(randomx*randomx+randomy*randomy);
const double a = randomy;
const double b = -randomx;
const double c = -a*p2d(0)-b*p2d(1);
Array < Point<2> > points;
//(*testout) << "face intersections at: " << endl;
for(int i=0; i<faces.Size(); i++)
{
faces[i]->GetSpline().LineIntersections(a,b,c,points,eps);
for(int j=0; j<points.Size(); j++)
{
double t = (points[j](0)-p2d(0))/randomx;
//(*testout) << t << endl;
if ( t < -eps )
intersections_before++;
else if ( t > eps )
intersections_after++;
else
{
intersecting_face = i;
return DOES_INTERSECT;
}
}
}
if(intersections_before % 2 == 0)
return IS_OUTSIDE;
else
return IS_INSIDE;
}
INSOLID_TYPE Revolution :: VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const
{
INSOLID_TYPE pInSolid = PointInSolid(p,eps);
if(pInSolid != DOES_INTERSECT)
{
//(*testout) << "pInSolid" << endl;
return pInSolid;
}
Array<int> intersecting_faces;
for(int i=0; i<faces.Size(); i++)
if(faces[i]->PointInFace(p,eps) == DOES_INTERSECT)
intersecting_faces.Append(i);
Vec<3> hv;
if(intersecting_faces.Size() == 1)
{
faces[intersecting_faces[0]]->CalcGradient(p,hv);
double hv1;
hv1 = v * hv;
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
return DOES_INTERSECT;
}
else if(intersecting_faces.Size() == 2)
{
Point<2> p2d;
Vec<2> v2d;
faces[intersecting_faces[0]]->CalcProj(p,p2d,v,v2d);
if(Dist(faces[intersecting_faces[0]]->GetSpline().StartPI(),p2d) <
Dist(faces[intersecting_faces[0]]->GetSpline().EndPI(),p2d))
{
int aux = intersecting_faces[0];
intersecting_faces[0] = intersecting_faces[1];
intersecting_faces[1] = aux;
}
const SplineSeg3<2> * splinesegment3 =
dynamic_cast<const SplineSeg3<2> *>(&faces[intersecting_faces[0]]->GetSpline());
const LineSeg<2> * linesegment =
dynamic_cast<const LineSeg<2> *>(&faces[intersecting_faces[0]]->GetSpline());
Vec<2> t1,t2;
if(linesegment)
t1 = linesegment->StartPI() - linesegment->EndPI();
else if(splinesegment3)
t1 = splinesegment3->TangentPoint() - splinesegment3->EndPI();
linesegment =
dynamic_cast<const LineSeg<2> *>(&faces[intersecting_faces[1]]->GetSpline());
splinesegment3 =
dynamic_cast<const SplineSeg3<2> *>(&faces[intersecting_faces[1]]->GetSpline());
if(linesegment)
t2 = linesegment->EndPI() - linesegment->StartPI();
else if(splinesegment3)
t2 = splinesegment3->TangentPoint() - splinesegment3->StartPI();
t1.Normalize();
t2.Normalize();
double d1 = v2d*t1;
double d2 = v2d*t2;
Vec<2> n;
if(d1 > d2)
{
n(0) = t1(1);
n(1) = -t1(0);
}
else
{
n(0) = -t2(1);
n(1) = t2(0);
}
double d = v2d*n;
if(d > eps)
return IS_OUTSIDE;
else if (d < -eps)
return IS_INSIDE;
else
return DOES_INTERSECT;
}
else
{
cerr << "Jo gibt's denn des?" << endl;
}
return DOES_INTERSECT;
}
INSOLID_TYPE Revolution :: VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
INSOLID_TYPE ret1 = VecInSolid(p,v1,eps);
if(ret1 != DOES_INTERSECT)
return ret1;
return VecInSolid(p,v1+0.01*v2,eps);
}
int Revolution :: GetNSurfaces() const
{
return faces.Size();
}
Surface & Revolution :: GetSurface (int i)
{
return *faces[i];
}
const Surface & Revolution :: GetSurface (int i) const
{
return *faces[i];
}
void Revolution :: Reduce (const BoxSphere<3> & box)
{
//bool dummy;
for(int i=0; i<faces.Size(); i++)
surfaceactive[i] = (faces[i]->BoxIntersectsFace(box));
//surfaceactive[i] = (faces[i]->BoxIntersectsFace(box,dummy));
}
void Revolution :: UnReduce ()
{
for(int i=0; i<faces.Size(); i++)
surfaceactive[i] = true;
}
}

153
libsrc/csg/revolution.hpp Normal file
View File

@ -0,0 +1,153 @@
#ifndef _REVOLUTION_HPP
#define _REVOLUTION_HPP
namespace netgen
{
class Revolution;
class RevolutionFace : public Surface
{
private:
bool isfirst, islast;
const SplineSeg<2> * spline;
bool deletable;
Point<3> p0;
Vec<3> v_axis;
int id;
mutable Vector spline_coefficient;
Array < Vec<2>* > checklines_vec;
Array < Point<2>* > checklines_start;
Array < Vec<2>* > checklines_normal;
private:
void Init (void);
public:
void CalcProj(const Point<3> & point3d, Point<2> & point2d) const;
void CalcProj(const Point<3> & point3d, Point<2> & point2d,
const Vec<3> & vector3d, Vec<2> & vector2d) const;
void CalcProj0(const Vec<3> & point3d_minus_p0, Point<2> & point2d) const;
public:
RevolutionFace(const SplineSeg<2> & spline_in,
const Point<3> & p,
const Vec<3> & vec,
bool first = false,
bool last = false,
const int id_in = 0);
RevolutionFace(const Array<double> & raw_data);
~RevolutionFace();
virtual int IsIdentic (const Surface & s2, int & inv, double eps) const;
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
virtual double HesseNorm () const;
virtual double MaxCurvature () const;
//virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
// double /* rad */) const;
virtual void Project (Point<3> & p) const;
virtual Point<3> GetSurfacePoint () const;
virtual void Print (ostream & str) const;
virtual void GetTriangleApproximation (TriangleApproximation & tas,
const Box<3> & boundingbox,
double facets) const;
bool BoxIntersectsFace (const Box<3> & box) const;
/*
bool BoxIntersectsFace (const BoxSphere<2> & box, bool & uncertain) const;
bool BoxIntersectsFace (const BoxSphere<3> & box, bool & uncertain) const;
*/
const SplineSeg<2> & GetSpline(void) const {return *spline;}
INSOLID_TYPE PointInFace (const Point<3> & p, const double eps) const;
void GetRawData(Array<double> & data) const;
};
/*
Primitive of revolution
*/
class Revolution : public Primitive
{
private:
Point<3> p0,p1;
Vec<3> v_axis;
const SplineGeometry<2> & splinecurve;
const int nsplines;
// 1 ... torus-like
// 2 ... sphere-like
int type;
Array<RevolutionFace*> faces;
mutable int intersecting_face;
public:
Revolution(const Point<3> & p0_in,
const Point<3> & p1_in,
const SplineGeometry<2> & spline_in);
~Revolution();
/*
Check, whether box intersects solid defined by surface.
return values:
0 .. box outside solid \\
1 .. box in solid \\
2 .. can't decide (allowed, iff box is close to solid)
*/
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const;
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const;
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual int GetNSurfaces() const;
virtual Surface & GetSurface (int i = 0);
virtual const Surface & GetSurface (int i = 0) const;
virtual void Reduce (const BoxSphere<3> & box);
virtual void UnReduce ();
};
}
#endif

217
libsrc/csg/singularref.cpp Normal file
View File

@ -0,0 +1,217 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <csg.hpp>
#include <meshing.hpp>
namespace netgen
{
SingularEdge :: SingularEdge (double abeta, int adomnr,
const CSGeometry & ageom,
const Solid * asol1,
const Solid * asol2, double sf,
const double maxh_at_initialization)
: domnr(adomnr), geom(ageom)
{
beta = abeta;
maxhinit = maxh_at_initialization;
if (beta > 1)
{
beta = 1;
cout << "Warning: beta set to 1" << endl;
}
if (beta <= 1e-3)
{
beta = 1e-3;
cout << "Warning: beta set to minimal value 0.001" << endl;
}
sol1 = asol1;
sol2 = asol2;
factor = sf;
}
void SingularEdge :: FindPointsOnEdge (class Mesh & mesh)
{
(*testout) << "find points on edge" << endl;
points.SetSize(0);
segms.SetSize(0);
Array<int> si1, si2;
sol1->GetSurfaceIndices (si1);
sol2->GetSurfaceIndices (si2);
for (int i = 0; i < si1.Size(); i++)
si1[i] = geom.GetSurfaceClassRepresentant(si1[i]);
for (int i = 0; i < si2.Size(); i++)
si2[i] = geom.GetSurfaceClassRepresentant(si2[i]);
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++)
{
INDEX_2 i2 (mesh[si][0], mesh[si][1]);
/*
bool onedge = 1;
for (j = 1; j <= 2; j++)
{
const Point<3> p = mesh[ PointIndex (i2.I(j)) ];
if (sol1->IsIn (p, 1e-3) && sol2->IsIn(p, 1e-3) &&
!sol1->IsStrictIn (p, 1e-3) && !sol2->IsStrictIn(p, 1e-3))
{
;
}
else
onedge = 0;
}
*/
if (domnr != -1 && domnr != mesh[si].domin && domnr != mesh[si].domout)
continue;
/*
bool onedge = 1;
for (int j = 0; j < 2; j++)
{
int surfi = (j == 0) ? mesh[si].surfnr1 : mesh[si].surfnr2;
surfi = geom.GetSurfaceClassRepresentant(surfi);
if (!si1.Contains(surfi) && !si2.Contains(surfi))
onedge = 0;
}
*/
int surfi1 = geom.GetSurfaceClassRepresentant(mesh[si].surfnr1);
int surfi2 = geom.GetSurfaceClassRepresentant(mesh[si].surfnr2);
if ( (si1.Contains(surfi1) && si2.Contains(surfi2)) ||
(si1.Contains(surfi2) && si2.Contains(surfi1)) )
// if (onedge)
{
segms.Append (i2);
// PrintMessage (5, "sing segment ", i2.I1(), " - ", i2.I2());
points.Append (mesh[ PointIndex (i2.I1())]);
points.Append (mesh[ PointIndex (i2.I2())]);
mesh[si].singedge_left = factor;
mesh[si].singedge_right = factor;
}
}
/*
(*testout) << "Singular edge points:" << endl;
for (int i = 0; i < points.Size(); i++)
(*testout) << points[i] << endl;
*/
}
void SingularEdge :: SetMeshSize (class Mesh & mesh, double globalh)
{
double hloc = pow (globalh, 1/beta);
if(maxhinit > 0 && maxhinit < hloc)
{
hloc = maxhinit;
if(points.Size() > 1)
{
for (int i = 0; i < points.Size()-1; i++)
mesh.RestrictLocalHLine(points[i],points[i+1],hloc);
}
else
{
for (int i = 0; i < points.Size(); i++)
mesh.RestrictLocalH (points[i], hloc);
}
}
else
{
for (int i = 0; i < points.Size(); i++)
mesh.RestrictLocalH (points[i], hloc);
}
}
SingularPoint :: SingularPoint (double abeta,
const Solid * asol1,
const Solid * asol2,
const Solid * asol3, double sf)
{
beta = abeta;
sol1 = asol1;
sol2 = asol2;
sol3 = asol3;
factor = sf;
}
void SingularPoint :: FindPoints (class Mesh & mesh)
{
points.SetSize(0);
Array<int> surfk, surf;
for (PointIndex pi = PointIndex::BASE;
pi < mesh.GetNP()+PointIndex::BASE; pi++)
{
if (mesh[pi].Type() != FIXEDPOINT) continue;
const Point<3> p = mesh[pi];
(*testout) << "check singular point" << p << endl;
if (sol1->IsIn (p) && sol2->IsIn(p) && sol3->IsIn(p) &&
!sol1->IsStrictIn (p) && !sol2->IsStrictIn(p) && !sol3->IsStrictIn(p))
{
surf.SetSize (0);
for (int k = 1; k <= 3; k++)
{
const Solid * solk(NULL);
Solid *tansol;
switch (k)
{
case 1: solk = sol1; break;
case 2: solk = sol2; break;
case 3: solk = sol3; break;
}
solk -> TangentialSolid (p, tansol, surfk, 1e-3);
(*testout) << "Tansol = " << *tansol << endl;
if (!tansol) continue;
ReducePrimitiveIterator rpi(Box<3> (p-Vec<3> (1e-3,1e-3,1e-3),
p+Vec<3> (1e-3,1e-3,1e-3)));
UnReducePrimitiveIterator urpi;
tansol -> IterateSolid (rpi);
tansol->GetSurfaceIndices (surfk);
tansol -> IterateSolid (urpi);
(*testout) << "surfinds = " << surfk << endl;
for (int i = 0; i < surfk.Size(); i++)
if (!surf.Contains (surfk[i]))
surf.Append (surfk[i]);
delete tansol;
}
if (surf.Size() < 3) continue;
points.Append (p);
PrintMessage (5, "Point (", p(0), ", ", p(1), ", ", p(2), ") is singular");
mesh[pi].Singularity(factor);
}
}
}
void SingularPoint :: SetMeshSize (class Mesh & mesh, double globalh)
{
double hloc = pow (globalh, 1/beta);
for (int i = 1; i <= points.Size(); i++)
mesh.RestrictLocalH (points.Get(i), hloc);
}
}

View File

@ -0,0 +1,84 @@
#ifndef FILE_SINGULARREF
#define FILE_SINGULARREF
/**************************************************************************/
/* File: singularref.hh */
/* Author: Joachim Schoeberl */
/* Date: 25. Sep. 99 */
/**************************************************************************/
namespace netgen
{
/**
Control for local refinement
*/
/**
Singular Face.
Causes a bounday layer mesh refinement.
All elements in subdomain domnr will get a boundary layer
on faces sharing the solid sol
*/
class SingularFace
{
public:
int domnr;
const Solid *sol;
double factor;
// Array<Point<3> > points;
// Array<INDEX_2> segms;
public:
SingularFace (int adomnr, const Solid * asol, double sf)
: domnr(adomnr), sol(asol), factor(sf) { ; }
const Solid * GetSolid() const { return sol; }
int GetDomainNr () const { return domnr; }
};
///
class SingularEdge
{
public:
double beta;
int domnr;
const CSGeometry& geom;
const Solid *sol1, *sol2;
Array<Point<3> > points;
Array<INDEX_2> segms;
double factor;
double maxhinit;
public:
SingularEdge (double abeta, int adomnr,
const CSGeometry & ageom,
const Solid * asol1, const Solid * asol2, double sf,
const double maxh_at_initialization = -1);
void FindPointsOnEdge (class Mesh & mesh);
void SetMeshSize (class Mesh & mesh, double globalh);
};
///
class SingularPoint
{
public:
double beta;
const Solid *sol1, *sol2, *sol3;
Array<Point<3> > points;
double factor;
public:
SingularPoint (double abeta, const Solid * asol1, const Solid * asol2,
const Solid * asol3, double sf);
void FindPoints (class Mesh & mesh);
void SetMeshSize (class Mesh & mesh, double globalh);
};
}
#endif

1732
libsrc/csg/solid.cpp Normal file

File diff suppressed because it is too large Load Diff

246
libsrc/csg/solid.hpp Normal file
View File

@ -0,0 +1,246 @@
#ifndef FILE_SOLID
#define FILE_SOLID
/**************************************************************************/
/* File: solid.hh */
/* Author: Joachim Schoeberl */
/* Date: 1. Dez. 95 */
/**************************************************************************/
namespace netgen
{
/*
Constructive Solid Model (csg)
*/
class Solid;
class SolidIterator
{
public:
SolidIterator () { ; }
virtual ~SolidIterator () { ; }
virtual void Do (Solid * sol) = 0;
};
class Solid
{
public:
typedef enum optyp1 { TERM, TERM_REF, SECTION, UNION, SUB, ROOT /*, DUMMY */ } optyp;
private:
char * name;
Primitive * prim;
Solid * s1, * s2;
optyp op;
bool visited;
double maxh;
// static int cntnames;
public:
Solid (Primitive * aprim);
Solid (optyp aop, Solid * as1, Solid * as2 = NULL);
~Solid ();
const char * Name () const { return name; }
void SetName (const char * aname);
Solid * Copy (class CSGeometry & geom) const;
void Transform (Transformation<3> & trans);
void IterateSolid (SolidIterator & it, bool only_once = 0);
void Boundaries (const Point<3> & p, Array<int> & bounds) const;
int NumPrimitives () const;
void GetSurfaceIndices (Array<int> & surfind) const;
void GetSurfaceIndices (IndexSet & iset) const;
void GetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
void GetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, Array<int> & surfids, double eps) const;
Primitive * GetPrimitive ()
{ return (op == TERM || op == TERM_REF) ? prim : NULL; }
const Primitive * GetPrimitive () const
{ return (op == TERM || op == TERM_REF) ? prim : NULL; }
Solid * S1() { return s1; }
Solid * S2() { return s2; }
// geometric tests
bool IsIn (const Point<3> & p, double eps = 1e-6) const;
bool IsStrictIn (const Point<3> & p, double eps = 1e-6) const;
bool VectorIn (const Point<3> & p, const Vec<3> & v, double eps = 1e-6) const;
bool VectorStrictIn (const Point<3> & p, const Vec<3> & v, double eps = 1e-6) const;
bool VectorIn2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
double eps) const;
bool VectorIn2Rec (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
double eps) const;
/// compute localization in point p
void TangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids, double eps) const;
/// compute localization in point p tangential to vector t
void TangentialSolid2 (const Point<3> & p, const Vec<3> & t,
Solid *& tansol, Array<int> & surfids, double eps) const;
/** compute localization in point p, with second order approximation to edge
p + s t + s*s/2 t2 **/
void TangentialSolid3 (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
Solid *& tansol, Array<int> & surfids, double eps) const;
/** tangential solid, which follows the edge
p + s t + s*s/2 t2
with second order, and the neighbouring face
p + s t + s*s/2 t2 + r m
with first order
**/
void TangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
const Vec<3> & m,
Solid *& tansol, Array<int> & surfids, double eps) const;
void CalcOnePrimitiveSpecialPoints (const Box<3> & box, Array<Point<3> > & pts) const;
///
int Edge (const Point<3> & p, const Vec<3> & v, double eps) const;
///
int OnFace (const Point<3> & p, const Vec<3> & v, double eps) const;
///
void Print (ostream & str) const;
///
void CalcSurfaceInverse ();
///
Solid * GetReducedSolid (const BoxSphere<3> & box) const;
void SetMaxH (double amaxh)
{ maxh = amaxh; }
double GetMaxH () const
{ return maxh; }
void GetSolidData (ostream & ost, int first = 1) const;
static Solid * CreateSolid (istream & ist, const SYMBOLTABLE<Solid*> & solids);
static BlockAllocator ball;
void * operator new(size_t /* s */)
{
return ball.Alloc();
}
void operator delete (void * p)
{
ball.Free (p);
}
protected:
///
void RecBoundaries (const Point<3> & p, Array<int> & bounds,
int & in, int & strin) const;
///
void RecTangentialSolid (const Point<3> & p, Solid *& tansol, Array<int> & surfids,
int & in, int & strin, double eps) const;
void RecTangentialSolid2 (const Point<3> & p, const Vec<3> & vec,
Solid *& tansol, Array<int> & surfids,
int & in, int & strin, double eps) const;
///
void RecTangentialSolid3 (const Point<3> & p, const Vec<3> & vec,const Vec<3> & vec2,
Solid *& tansol, Array<int> & surfids,
int & in, int & strin, double eps) const;
///
void RecTangentialEdgeSolid (const Point<3> & p, const Vec<3> & t, const Vec<3> & t2,
const Vec<3> & m,
Solid *& tansol, Array<int> & surfids,
int & in, int & strin, double eps) const;
///
void RecEdge (const Point<3> & p, const Vec<3> & v,
int & in, int & strin, int & faces, double eps) const;
///
void CalcSurfaceInverseRec (int inv);
///
Solid * RecGetReducedSolid (const BoxSphere<3> & box, INSOLID_TYPE & in) const;
///
void RecGetSurfaceIndices (Array<int> & surfind) const;
void RecGetTangentialSurfaceIndices (const Point<3> & p, Array<int> & surfids, double eps) const;
void RecGetTangentialSurfaceIndices2 (const Point<3> & p, const Vec<3> & v, Array<int> & surfids, double eps) const;
void RecGetTangentialSurfaceIndices3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
Array<int> & surfids, double eps) const;
void RecGetTangentialEdgeSurfaceIndices (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2, const Vec<3> & m,
Array<int> & surfids, double eps) const;
void RecGetSurfaceIndices (IndexSet & iset) const;
void RecCalcOnePrimitiveSpecialPoints (Array<Point<3> > & pts) const;
friend class SolidIterator;
friend class ClearVisitedIt;
friend class RemoveDummyIterator;
friend class CSGeometry;
};
inline ostream & operator<< (ostream & ost, const Solid & sol)
{
sol.Print (ost);
return ost;
}
class ReducePrimitiveIterator : public SolidIterator
{
const BoxSphere<3> & box;
public:
ReducePrimitiveIterator (const BoxSphere<3> & abox)
: SolidIterator(), box(abox) { ; }
virtual ~ReducePrimitiveIterator () { ; }
virtual void Do (Solid * sol)
{
if (sol -> GetPrimitive())
sol -> GetPrimitive() -> Reduce (box);
}
};
class UnReducePrimitiveIterator : public SolidIterator
{
public:
UnReducePrimitiveIterator () { ; }
virtual ~UnReducePrimitiveIterator () { ; }
virtual void Do (Solid * sol)
{
if (sol -> GetPrimitive())
sol -> GetPrimitive() -> UnReduce ();
}
};
}
#endif

2099
libsrc/csg/specpoin.cpp Normal file

File diff suppressed because it is too large Load Diff

191
libsrc/csg/specpoin.hpp Normal file
View File

@ -0,0 +1,191 @@
#ifndef FILE_SPECPOIN
#define FILE_SPECPOIN
/**************************************************************************/
/* File: specpoin.hpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Okt. 95 */
/**************************************************************************/
namespace netgen
{
extern DLL_HEADER MeshingParameters mparam;
/*
Special Point Calculation
*/
class Surface;
class Solid;
/// Special point.
class SpecialPoint
{
public:
/// coordinates
Point<3> p;
/// tangential to edge
Vec<3> v;
///
int layer;
/// point must be used in mesh
bool unconditional;
/// surfaces defining edge
int s1, s2;
/// if s1 and s2 are only representatives, then these are the original indices
int s1_orig, s2_orig;
int nr;
///
SpecialPoint () : p(0,0,0), v(0,0,0), layer(0), unconditional(0), s1(0), s2(0), s1_orig(0), s2_orig(0)
{ ; }
///
SpecialPoint (const SpecialPoint & sp2);
///
SpecialPoint & operator= (const SpecialPoint & sp2);
///
void Print (ostream & str) const;
int GetLayer() const { return layer; }
///
bool HasSurfaces (int as1, int as2) const
{
return ( (s1 == as1 && s2 == as2) || (s1 == as2 && s2 == as1) );
}
};
inline ostream & operator<< (ostream & ost, const SpecialPoint & sp)
{
sp.Print (ost);
return ost;
}
///
class SpecialPointCalculation
{
private:
///
const CSGeometry * geometry;
///
Array<MeshPoint> * points;
///
Array<long int> boxesinlevel;
///
double size;
///
double relydegtest; // maximal dimension of bisection intervall for
/// test of degeneration parameters
double cpeps1, epeps1, epeps2, epspointdist2;
double ideps;
public:
///
SpecialPointCalculation ();
///
void SetIdEps(const double epsin) {ideps = epsin;}
///
void CalcSpecialPoints (const CSGeometry & ageometry,
Array<MeshPoint> & points);
///
void AnalyzeSpecialPoints (const CSGeometry & geometry,
Array<MeshPoint> & points,
Array<SpecialPoint> & specpoints);
protected:
///
void CalcSpecialPointsRec (const Solid * sol, int layer,
const BoxSphere<3> & box,
int level,
bool calccp, bool calcep);
///
bool CrossPointNewtonConvergence (const Surface * f1, const Surface * f2,
const Surface * f3, const BoxSphere<3> & box);
///
bool CrossPointDegenerated (const Surface * f1, const Surface * f2,
const Surface * f3, const BoxSphere<3> & box) const;
///
void CrossPointNewton (const Surface * f1, const Surface * f2,
const Surface * f3, Point<3> & p);
bool EdgeNewtonConvergence (const Surface * f1, const Surface * f2,
const Point<3> & p);
///
bool EdgeDegenerated (const Surface * f1, const Surface * f2,
const BoxSphere<3> & box) const;
///
void EdgeNewton (const Surface * f1, const Surface * f2,
Point<3> & p);
///
bool IsEdgeExtremalPoint (const Surface * f1, const Surface * f2,
const Point<3> & p, Point<3> & pp, double rad);
/*
///
bool ExtremalPointPossible (const Surface * f1, const Surface * f2,
int dir, const BoxSphere<3> & box);
///
bool ExtremalPointDegenerated (const Surface * f1, const Surface * f2,
int dir, const BoxSphere<3> & box);
///
bool ExtremalPointNewtonConvergence (const Surface * f1, const Surface * f2,
int dir, const BoxSphere<3> & box);
*/
///
void ExtremalPointNewton (const Surface * f1, const Surface * f2,
int dir, Point<3> & p);
///
bool AddPoint (const Point<3> & p, int layer);
void ComputeExtremalPoints (const Plane * plane,
const QuadraticSurface * quadric,
Array<Point<3> > & pts);
void ComputeExtremalPoints (const Sphere * sphere1,
const Sphere * sphere2,
Array<Point<3> > & pts);
void ComputeCrossPoints (const Plane * plane1,
const Plane * plane2,
const Plane * plane3,
Array<Point<3> > & pts);
void ComputeCrossPoints (const Plane * plane1,
const Plane * plane2,
const QuadraticSurface * quadratic,
Array<Point<3> > & pts);
void ComputeCrossPoints (const Sphere * sphere1,
const Sphere * sphere2,
const Sphere * sphere3,
Array<Point<3> > & pts);
};
}
#endif

355
libsrc/csg/spline3d.cpp Normal file
View File

@ -0,0 +1,355 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
splinesegment3d :: splinesegment3d (const Point<3> & ap1, const Point<3> & ap2,
const Point<3> & ap3)
{
p1 = ap1;
p2 = ap2;
p3 = ap3;
}
/*
todo
Tip von Joerg Stiller:
setzt Du in
void splinesegment3d :: Evaluate
Zeilen 54 und 56
b2 = 2 * t * (1-t);
b2 /= sqrt(2);
Das heisst, Du wichtest das zweite Bersteinpolynom mit
w2 = 1 / sqrt(2);
Das ist aber nur fuer 45-Grad-Segmente korrekt. Fuer den
allgemeinen Fall funktioniert
w2 = ( e(p3 - p1), e(p2 - p1) ); // also cos(winkel(p3-p1, p2-p1))
bzw. schoen symmetrisch
w2 = ( e(p3 - p1), e(p2 - p1) )/2 + ( e(p1 - p3), e(p2 - p3) )/2;
Das ist natuerlich kein C++ Code sondern symbolisch, wobei
e(p3 - p1) ist der von p1 zu p3 zeigende Einheitsvektor und
(a, b) steht fuer das Skalarprodukt zweier Vektoren etc.
Eine vergleichbare Information steht auch irgendwo im Hoscheck & Lasser.
Ich habe das Buch aber eben nicht zur Hand.
*/
void splinesegment3d :: Evaluate (double t, Point<3> & p) const
{
double x, y, z, w;
double b1, b2, b3;
b1 = (1-t)*(1-t);
b2 = 2 * t * (1-t);
b3 = t * t;
b2 /= sqrt(double(2));
x = p1(0) * b1 + p2(0) * b2 + p3(0) * b3;
y = p1(1) * b1 + p2(1) * b2 + p3(1) * b3;
z = p1(2) * b1 + p2(2) * b2 + p3(2) * b3;
w = b1 + b2 + b3;
p(0) = x / w;
p(1) = y / w;
p(2) = z / w;
}
void splinesegment3d :: EvaluateTangent (double t, Vec<3> & tang) const
{
double x, y, z, w, xprime, yprime, zprime, wprime;
double b1, b2, b3, b1prime, b2prime, b3prime;
b1 = (1-t)*(1-t);
b2 = 2 * t * (1-t);
b3 = t * t;
b2 /= sqrt(double(2));
b1prime = 2 * t - 2;
b2prime = - 4 * t + 2;
b3prime = 2 * t;
b2prime /= sqrt(double(2));
x = p1(0) * b1 + p2(0) * b2 + p3(0) * b3;
y = p1(1) * b1 + p2(1) * b2 + p3(1) * b3;
z = p1(2) * b1 + p2(2) * b2 + p3(2) * b3;
w = b1 + b2 + b3;
xprime = p1(0) * b1prime + p2(0) * b2prime + p3(0) * b3prime;
yprime = p1(1) * b1prime + p2(1) * b2prime + p3(1) * b3prime;
zprime = p1(2) * b1prime + p2(2) * b2prime + p3(2) * b3prime;
wprime = b1prime + b2prime + b3prime;
tang(0) = (w * xprime - x * wprime) / (w * w);
tang(1) = (w * yprime - y * wprime) / (w * w);
tang(2) = (w * zprime - z * wprime) / (w * w);
}
void spline3d :: AddSegment (const Point<3> & ap1, const Point<3> & ap2,
const Point<3> & ap3)
{
segments.Append (new splinesegment3d (ap1, ap2, ap3));
}
void spline3d :: Evaluate (double t, Point<3> & p) const
{
int nr;
double loct;
static int cnt = 0;
cnt++;
if (cnt % 10000 == 0) (*mycout) << "Evaluate calls: " << cnt << endl;
while (t < 0) t += GetNumSegments();
while (t >= GetNumSegments()) t -= GetNumSegments();
nr = 1 + int (t);
loct = t - nr + 1;
segments.Get(nr)->Evaluate (loct, p);
}
void spline3d :: EvaluateTangent (double t, Vec<3> & tang) const
{
int nr;
double loct;
while (t < 0) t += GetNumSegments();
while (t >= GetNumSegments()) t -= GetNumSegments();
nr = 1 + int (t);
loct = t - nr + 1;
segments.Get(nr)->EvaluateTangent (loct, tang);
}
double spline3d :: ProjectToSpline (Point<3> & p) const
{
double t, tl, tu, dt, dist, mindist, optt(0);
Point<3> hp;
Vec<3> tanx, px;
dt = 0.01;
mindist = 0;
for (t = 0; t <= GetNumSegments() + dt/2; t += dt)
{
Evaluate (t, hp);
dist = Dist (hp, p);
if (t == 0 || dist < mindist)
{
optt = t;
mindist = dist;
}
}
tu = optt + dt;
tl = optt - dt;
while (tu - tl > 1e-2)
{
optt = 0.5 * (tu + tl);
Evaluate (optt, hp);
EvaluateTangent (optt, tanx);
if (tanx * (hp - p) > 0)
tu = optt;
else
tl = optt;
}
optt = 0.5 * (tu + tl);
optt = ProjectToSpline (p, optt);
return optt;
}
double spline3d :: ProjectToSpline (Point<3> & p, double optt) const
{
double tl, tu, dt, val, dval, valu, vall;
Point<3> hp;
Vec<3> tanx, px;
int its = 0;
int cnt = 1000;
do
{
dt = 1e-8;
tl = optt - dt;
tu = optt + dt;
EvaluateTangent (optt, tanx);
Evaluate (optt, hp);
px = hp - p;
val = px * tanx;
EvaluateTangent (tl, tanx);
Evaluate (tl, hp);
px = hp - p;
vall = px * tanx;
EvaluateTangent (tu, tanx);
Evaluate (tu, hp);
px = hp - p;
valu = px * tanx;
dval = (valu - vall) / (2 * dt);
if (its % 100 == 99)
(*testout) << "optt = " << optt
<< " val = " << val
<< " dval = " << dval << endl;
optt -= val / dval;
its++;
if (fabs(val) < 1e-8 && cnt > 5) cnt = 5;
cnt--;
}
while (cnt > 0);
Evaluate (optt, p);
return optt;
}
splinetube :: splinetube (const spline3d & amiddlecurve, double ar)
: Surface(), middlecurve (amiddlecurve), r(ar)
{
(*mycout) << "Splinetube Allocated, r = " << r << endl;
}
void splinetube :: DefineTangentialPlane (const Point<3> & ap1,
const Point<3> & ap2)
{
double t;
double phi, z;
p1 = ap1;
p2 = ap2;
cp = p1;
t = middlecurve.ProjectToSpline (cp);
ex = p1 - cp;
middlecurve.EvaluateTangent (t, ez);
ex.Normalize();
ez.Normalize();
ey = Cross (ez, ex);
phi = r * atan2 (ey * (p2-cp), ex * (p2-cp));
z = ez * (p2 - cp);
e2x(0) = phi;
e2x(1) = z;
e2x.Normalize();
e2y(1) = e2x(0);
e2y(0) = -e2x(1);
// (*testout) << "Defineplane: " << endl
// << "p1 = " << p1 << " p2 = " << p2 << endl
// << "pc = " << cp << endl
// << "ex = " << ex << " ey = " << ey << " ez = " << ez << endl
// << "phi = " << phi << " z = " << z << endl
// << "e2x = " << e2x << " e2y = " << e2y << endl;
}
void splinetube :: ToPlane (const Point<3> & p3d, Point<2> & pplain, double h,
int & zone) const
{
Vec<2> v;
v(0) = r * atan2 (ey * (p3d-cp), ex * (p3d-cp));
v(1) = ez * (p3d - cp);
zone = 0;
if (v(0) > r * 2) zone = 1;
if (v(0) < r * 2) zone = 2;
pplain(0) = (v * e2x) / h;
pplain(1) = (v * e2y) / h;
}
void splinetube :: FromPlane (const Point<2> & pplain, Point<3> & p3d, double h) const
{
Vec<2> v;
v(0) = pplain(0) * h * e2x(0) + pplain(1) * h * e2y(0);
v(1) = pplain(0) * h * e2x(1) + pplain(1) * h * e2y(1);
p3d = p1 + v(0) * ey + v(1) * ez;
Project (p3d);
}
void splinetube :: Project (Point<3> & p3d) const
{
Point<3> hp;
hp = p3d;
middlecurve.ProjectToSpline (hp);
p3d = hp + (r / Dist(p3d, hp)) * (p3d - hp);
}
double splinetube :: CalcFunctionValue (const Point<3> & point) const
{
Point<3> hcp;
double rad;
hcp = point;
middlecurve.ProjectToSpline (hcp);
rad = Dist (hcp, point);
return 0.5 * (rad * rad / r - r);
}
void splinetube :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
{
Point<3> hcp;
hcp = point;
middlecurve.ProjectToSpline (hcp);
grad = point - hcp;
grad /= r;
}
Point<3> splinetube :: GetSurfacePoint () const
{
Point<3> p;
Vec<3> t, n;
middlecurve.Evaluate (0, p);
middlecurve.EvaluateTangent (0, t);
n = t.GetNormal ();
n *= r;
(*mycout) << "p = " << p << " t = " << t << " n = " << n << endl;
return p + n;
}
void splinetube :: Print (ostream & str) const
{
int i;
str << "SplineTube, "
<< middlecurve.GetNumSegments () << " segments, r = " << r << endl;
for (i = 1; i <= middlecurve.GetNumSegments(); i++)
str << middlecurve.P1(i) << " - "
<< middlecurve.P2(i) << " - "
<< middlecurve.P3(i) << endl;
}
int splinetube :: BoxInSolid (const BoxSphere<3> & box) const
// 0 .. no, 1 .. yes, 2 .. maybe
{
Point<3> pc = box.Center();
middlecurve.ProjectToSpline (pc);
double d = Dist (pc, box.Center());
if (d < r - box.Diam()/2) return 1;
if (d > r + box.Diam()/2) return 0;
return 2;
}
}

99
libsrc/csg/spline3d.hpp Normal file
View File

@ -0,0 +1,99 @@
namespace netgen
{
///
class splinesegment3d
{
///
Point<3> p1, p2, p3;
public:
///
splinesegment3d (const Point<3> & ap1, const Point<3> & ap2,
const Point<3> & ap3);
///
void Evaluate (double t, Point<3> & p) const;
///
void EvaluateTangent (double t, Vec<3> & tang) const;
///
const Point<3> & P1() const { return p1; }
///
const Point<3> & P2() const { return p2; }
///
const Point<3> & P3() const { return p3; }
};
///
class spline3d
{
///
Array<splinesegment3d *> segments;
public:
///
spline3d () { };
///
void AddSegment (const Point<3> & ap1, const Point<3> & ap2, const Point<3> & ap3);
///
int GetNumSegments () const { return segments.Size(); }
///
double ProjectToSpline (Point<3> & p) const;
///
double ProjectToSpline (Point<3> & p, double t) const;
///
void Evaluate (double t, Point<3> & p) const;
///
void EvaluateTangent (double t, Vec<3> & tang) const;
///
const Point<3> & P1(int i) const { return segments.Get(i)->P1(); }
///
const Point<3> & P2(int i) const { return segments.Get(i)->P2(); }
///
const Point<3> & P3(int i) const { return segments.Get(i)->P3(); }
};
///
class splinetube : public Surface
{
///
const spline3d & middlecurve;
///
double r;
/// Vec<3> ex, ey, ez;
Vec<2> e2x, e2y;
///
Point<3> cp;
public:
///
splinetube (const spline3d & amiddlecurve, double ar);
///
virtual void DefineTangentialPlane (const Point<3> & ap1, const Point<3> & ap2);
///
virtual void ToPlane (const Point<3> & p, Point<2> & pplain, double h, int & zone) const;
///
virtual void FromPlane (const Point<2> & pplain, Point<3> & p, double h) const;
///
virtual void Project (Point<3> & p) const;
// virtual int RootInBox (const box3d & box) const { return 0; }
/// 0 .. no, 1 .. yes, 2 .. maybe
virtual int BoxInSolid (const BoxSphere<3> & box) const;
/// 0 .. no, 1 .. yes, 2 .. maybe
virtual double CalcFunctionValue (const Point<3> & point) const;
///
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
///
virtual double HesseNorm () const { return 0.5 / r; }
///
virtual Point<3> GetSurfacePoint () const;
///
virtual void Print (ostream & str) const;
};
}

568
libsrc/csg/surface.cpp Normal file
View File

@ -0,0 +1,568 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <csg.hpp>
#include <linalg.hpp>
#include <meshing.hpp>
namespace netgen
{
Surface :: Surface ()
{
maxh = 1e10;
name = new char[7];
strcpy (name, "noname");
bcprop = -1;
bcname = "default";
}
Surface :: ~Surface()
{
delete [] name;
}
void Surface :: SetName (const char * aname)
{
delete [] name;
name = new char[strlen (aname)+1];
strcpy (name, aname);
}
int Surface :: PointOnSurface (const Point<3> & p,
double eps) const
{
double val = CalcFunctionValue (p);
return fabs (val) < eps;
}
void Surface :: CalcHesse (const Point<3> & point, Mat<3> & hesse) const
{
double dx = 1e-5;
Point<3> hp1, hp2;
Vec<3> g1, g2;
for (int i = 0; i < 3; i++)
{
hp1 = point;
hp2 = point;
hp1(i) += dx;
hp2(i) -= dx;
CalcGradient (hp1, g1);
CalcGradient (hp2, g2);
for (int j = 0; j < 3; j++)
hesse(i, j) = (g1(j) - g2(j)) / (2 * dx);
}
}
/*
void Surface :: GetNormalVector (const Point<3> & p, Vec<3> & n) const
{
CalcGradient (p, n);
n.Normalize();
}
*/
Vec<3> Surface :: GetNormalVector (const Point<3> & p) const
{
Vec<3> n;
CalcGradient (p, n);
n.Normalize();
return n;
}
void Surface :: DefineTangentialPlane (const Point<3> & ap1,
const Point<3> & ap2)
{
p1 = ap1;
p2 = ap2;
ez = GetNormalVector (p1);
ex = p2 - p1;
ex -= (ex * ez) * ez;
ex.Normalize();
ey = Cross (ez, ex);
}
void Surface :: ToPlane (const Point<3> & p3d, Point<2> & pplane,
double h, int & zone) const
{
Vec<3> p1p, n;
n = GetNormalVector (p3d);
if (n * ez < 0)
{
zone = -1;
pplane(0) = 1e8;
pplane(1) = 1e9;
return;
}
p1p = p3d - p1;
pplane(0) = (p1p * ex) / h;
pplane(1) = (p1p * ey) / h;
zone = 0;
}
void Surface :: FromPlane (const Point<2> & pplane,
Point<3> & p3d, double h) const
{
p3d = p1
+ (h * pplane(0)) * ex
+ (h * pplane(1)) * ey;
Project (p3d);
}
void Surface :: Project (Point<3> & p) const
{
Vec<3> n;
double val;
for (int i = 1; i <= 10; i++)
{
val = CalcFunctionValue (p);
if (fabs (val) < 1e-12) return;
CalcGradient (p, n);
p -= (val / Abs2 (n)) * n;
}
}
void Surface :: SkewProject (Point<3> & p, const Vec<3> & direction) const
{
Point<3> startp(p);
double t_old(0),t_new(1);
Vec<3> grad;
for(int i=0; fabs(t_old-t_new) > 1e-20 && i<15; i++)
{
t_old = t_new;
CalcGradient(p,grad);
t_new = t_old - CalcFunctionValue(p)/(grad*direction);
p = startp + t_new*direction;
}
}
double Surface :: MaxCurvature () const
{
return 0.5 * HesseNorm ();
}
double Surface ::
MaxCurvatureLoc (const Point<3> & /* c */ , double /* rad */) const
{
return MaxCurvature ();
}
double Surface :: LocH (const Point<3> & p, double x,
double c, double hmax) const
// finds h <= hmax, s.t. h * \kappa_x*h < c
{
/*
double h, hmin, kappa;
hmin = 0;
while (hmin < 0.9 * hmax)
{
h = 0.5 * (hmin + hmax);
kappa = 2 * MaxCurvatureLoc (p, x * h);
if (kappa * h >= c)
hmax = h;
else
hmin = h;
}
return h;
*/
double hret;
double kappa = MaxCurvatureLoc (p, x*hmax);
kappa *= c * mparam.curvaturesafety;
if (hmax * kappa < 1)
hret = hmax;
else
hret = 1 / kappa;
if (maxh < hret)
hret = maxh;
return hret;
}
Primitive :: Primitive ()
{
surfaceids.SetSize (1);
surfaceactive.SetSize (1);
surfaceactive[0] = 1;
}
Primitive :: ~Primitive()
{
;
}
int Primitive :: GetSurfaceId (int i) const
{
return surfaceids[i];
}
void Primitive :: SetSurfaceId (int i, int id)
{
surfaceids[i] = id;
}
void Primitive :: GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const
{
classname = "undef";
coeffs.SetSize (0);
}
void Primitive :: SetPrimitiveData (Array<double> & coeffs)
{
;
}
Primitive * Primitive :: CreatePrimitive (const char * classname)
{
if (strcmp (classname, "sphere") == 0)
return Sphere::CreateDefault();
if (strcmp (classname, "plane") == 0)
return Plane::CreateDefault();
if (strcmp (classname, "cylinder") == 0)
return Cylinder::CreateDefault();
if (strcmp (classname, "cone") == 0)
return Cone::CreateDefault();
if (strcmp (classname, "brick") == 0)
return Brick::CreateDefault();
stringstream ost;
ost << "Primitve::CreatePrimitive not implemented for " << classname << endl;
throw NgException (ost.str());
}
Primitive * Primitive :: Copy () const
{
stringstream ost;
ost << "Primitve::Copy not implemented for " << typeid(*this).name() << endl;
throw NgException (ost.str());
}
void Primitive :: Transform (Transformation<3> & trans)
{
stringstream ost;
ost << "Primitve::Transform not implemented for " << typeid(*this).name() << endl;
throw NgException (ost.str());
}
void Primitive :: GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const
{
for (int j = 0; j < GetNSurfaces(); j++)
if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps)
if (!surfind.Contains (GetSurfaceId(j)))
surfind.Append (GetSurfaceId(j));
}
void Primitive ::
GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
Array<int> & surfind, double eps) const
{
cout << "get tangvecsurfind not implemented" << endl;
surfind.SetSize (0);
}
void Primitive ::
GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const
{
for (int j = 0; j < GetNSurfaces(); j++)
{
if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps)
{
Vec<3> grad;
GetSurface(j).CalcGradient (p, grad);
if (sqr (grad * v1) < 1e-6 * v1.Length2() * grad.Length2() &&
sqr (grad * v2) < 1e-6 * v2.Length2() * grad.Length2() ) // new, 18032006 JS
{
if (!surfind.Contains (GetSurfaceId(j)))
surfind.Append (GetSurfaceId(j));
}
}
}
}
INSOLID_TYPE Primitive ::
VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
//(*testout) << "Primitive::VecInSolid2" << endl;
Point<3> hp = p + 1e-3 * v1 + 1e-5 * v2;
INSOLID_TYPE res = PointInSolid (hp, eps);
// (*testout) << "vectorin2, type = " << typeid(*this).name() << ", res = " << res << endl;
return res;
}
INSOLID_TYPE Primitive ::
VecInSolid3 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
//(*testout) << "Primitive::VecInSolid3" << endl;
return VecInSolid (p, v1, eps);
}
INSOLID_TYPE Primitive ::
VecInSolid4 (const Point<3> & p,
const Vec<3> & v,
const Vec<3> & v2,
const Vec<3> & m,
double eps) const
{
return VecInSolid2 (p, v, m, eps);
}
OneSurfacePrimitive :: OneSurfacePrimitive()
{
;
}
OneSurfacePrimitive :: ~OneSurfacePrimitive()
{
;
}
INSOLID_TYPE OneSurfacePrimitive ::
PointInSolid (const Point<3> & p,
double eps) const
{
double hv1 = (GetSurface(0).CalcFunctionValue(p));
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
return DOES_INTERSECT;
}
INSOLID_TYPE OneSurfacePrimitive ::
VecInSolid (const Point<3> & p, const Vec<3> & v,
double eps) const
{
double hv1 = (GetSurface(0).CalcFunctionValue(p));
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
Vec<3> hv;
GetSurface(0).CalcGradient (p, hv);
hv1 = v * hv;
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
return DOES_INTERSECT;
}
INSOLID_TYPE OneSurfacePrimitive ::
VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const
{
double hv1 = (GetSurface(0).CalcFunctionValue(p));
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
Vec<3> hv;
GetSurface(0).CalcGradient (p, hv);
hv1 = v1 * hv;
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
double hv2 = v2 * hv;
if (hv2 <= 0)
return IS_INSIDE;
else
return IS_OUTSIDE;
}
INSOLID_TYPE OneSurfacePrimitive ::
VecInSolid3 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
double eps) const
{
//(*testout) << "OneSurfacePrimitive::VecInSolid3" << endl;
double hv1 = (GetSurface(0).CalcFunctionValue(p));
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
Vec<3> grad;
GetSurface(0).CalcGradient (p, grad);
hv1 = v * grad;
if (hv1 <= -eps) return IS_INSIDE;
if (hv1 >= eps) return IS_OUTSIDE;
Mat<3> hesse;
GetSurface(0).CalcHesse (p, hesse);
double hv2 = v2 * grad + v * (hesse * v);
if (hv2 <= -eps) return IS_INSIDE;
if (hv2 >= eps) return IS_OUTSIDE;
return DOES_INTERSECT;
}
INSOLID_TYPE OneSurfacePrimitive ::
VecInSolid4 (const Point<3> & p, const Vec<3> & v, const Vec<3> & v2,
const Vec<3> & m,
double eps) const
{
double hv1 = (GetSurface(0).CalcFunctionValue(p));
if (hv1 <= -eps)
return IS_INSIDE;
if (hv1 >= eps)
return IS_OUTSIDE;
Vec<3> grad;
GetSurface(0).CalcGradient (p, grad);
hv1 = v * grad;
if (hv1 <= -eps) return IS_INSIDE;
if (hv1 >= eps) return IS_OUTSIDE;
Mat<3> hesse;
GetSurface(0).CalcHesse (p, hesse);
double hv2 = v2 * grad + v * (hesse * v);
if (hv2 <= -eps) return IS_INSIDE;
if (hv2 >= eps) return IS_OUTSIDE;
double hv3 = m * grad;
if (hv3 <= -eps) return IS_INSIDE;
if (hv3 >= eps) return IS_OUTSIDE;
return DOES_INTERSECT;
}
int OneSurfacePrimitive :: GetNSurfaces() const
{
return 1;
}
Surface & OneSurfacePrimitive :: GetSurface (int i)
{
return *this;
}
const Surface & OneSurfacePrimitive :: GetSurface (int i) const
{
return *this;
}
void ProjectToEdge (const Surface * f1, const Surface * f2, Point<3> & hp)
{
Vec<2> rs, lam;
Vec<3> a1, a2;
Mat<2> a;
int i = 10;
while (i > 0)
{
i--;
rs(0) = f1 -> CalcFunctionValue (hp);
rs(1) = f2 -> CalcFunctionValue (hp);
f1->CalcGradient (hp, a1);
f2->CalcGradient (hp, a2);
double alpha = fabs(a1*a2)/sqrt(a1.Length2()*a2.Length2());
if(fabs(1.-alpha) < 1e-6)
{
if(fabs(rs(0)) >= fabs(rs(1)))
f1 -> Project(hp);
else
f2 -> Project(hp);
}
else
{
a(0,0) = a1 * a1;
a(0,1) = a(1,0) = a1 * a2;
a(1,1) = a2 * a2;
a.Solve (rs, lam);
hp -= lam(0) * a1 + lam(1) * a2;
}
if (Abs2 (rs) < 1e-24 && i > 1) i = 1;
}
}
}

374
libsrc/csg/surface.hpp Normal file
View File

@ -0,0 +1,374 @@
#ifndef FILE_SURFACE
#define FILE_SURFACE
/**************************************************************************/
/* File: surface.hh */
/* Author: Joachim Schoeberl */
/* Date: 1. Dez. 95 */
/**************************************************************************/
namespace netgen
{
class TriangleApproximation;
/**
Basis class for implicit surface geometry.
This class is used for generation of surface meshes
in NETGEN
*/
class Surface
{
protected:
/// invert normal vector
bool inverse;
/// maximal h in surface
double maxh;
/// name of surface
char * name;
/// boundary condition nr
int bcprop;
/// boundary condition label
string bcname;
public:
Surface ();
/** @name Tangential plane.
The tangential plane is used for surface mesh generation.
*/
virtual ~Surface();
protected:
/** @name Points in the surface defining tangential plane.
Tangential plane is taken in p1, the local x-axis
is directed to p2.
*/
//@{
///
Point<3> p1;
///
Point<3> p2;
//@}
/** @name Base-vectos for local coordinate system. */
//@{
/// in plane, directed p1->p2
Vec<3> ex;
/// in plane
Vec<3> ey;
/// outer normal direction
Vec<3> ez;
//@}
public:
void SetName (const char * aname);
const char * Name () const { return name; }
//@{
/**
Defines tangential plane in ap1.
The local x-coordinate axis points to the direction of ap2 */
virtual void DefineTangentialPlane (const Point<3> & ap1,
const Point<3> & ap2);
/// Transforms 3d point p3d to local coordinates pplane
virtual void ToPlane (const Point<3> & p3d, Point<2> & pplane,
double h, int & zone) const;
/// Transforms point pplane in local coordinates to 3d point
virtual void FromPlane (const Point<2> & pplane,
Point<3> & p3d, double h) const;
//@}
/// Project point p onto surface (closest point)
virtual void Project (Point<3> & p) const;
/// Project along direction
virtual void SkewProject(Point<3> & p, const Vec<3> & direction) const;
/// Is current surface identic to surface 2 ?
virtual int IsIdentic (const Surface & /* s2 */, int & /* inv */,
double /* eps */) const
{ return 0; }
///
virtual int PointOnSurface (const Point<3> & p,
double eps = 1e-6) const;
/** @name Implicit function.
Calculate function value and derivatives.
*/
//@{
/// Calculate implicit function value in point point
virtual double CalcFunctionValue (const Point<3> & point) const = 0;
/**
Calc gradient of implicit function.
gradient should be O(1) at surface
*/
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const = 0;
/**
Calculate second derivatives of implicit function.
*/
virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const;
/**
Returns outer normal vector.
*/
// virtual void GetNormalVector (const Point<3> & p, Vec<3> & n) const;
virtual Vec<3> GetNormalVector (const Point<3> & p) const;
/**
Upper bound for spectral norm of Hesse-matrix
*/
virtual double HesseNorm () const = 0;
/**
Upper bound for spectral norm of Hesse-matrix in the
rad - environment of point c.
*/
virtual double HesseNormLoc (const Point<3> & /* c */,
double /* rad */) const
{ return HesseNorm (); }
//@}
///
virtual double MaxCurvature () const;
///
virtual double MaxCurvatureLoc (const Point<3> & /* c */ ,
double /* rad */) const;
/** Returns any point in the surface.
Needed to start surface mesh generation e.g. on sphere */
virtual Point<3> GetSurfacePoint () const = 0;
///
bool Inverse () const { return inverse; }
///
void SetInverse (bool ainverse) { inverse = ainverse; }
///
virtual void Print (ostream & str) const = 0;
///
virtual void Reduce (const BoxSphere<3> & /* box */) { };
///
virtual void UnReduce () { };
/// set max h in surface
void SetMaxH (double amaxh) { maxh = amaxh; }
///
double GetMaxH () const { return maxh; }
///
int GetBCProperty () const { return bcprop; }
///
void SetBCProperty (int abc) { bcprop = abc; }
/** Determine local mesh-size.
Find
\[ h \leq hmax, \]
such that
\[ h \times \kappa (x) \leq c \qquad \mbox{in} B(x, h), \]
where kappa(x) is the curvature in x. */
virtual double LocH (const Point<3> & p, double x,
double c, double hmax) const;
/**
Gets Approximation by triangles,
where qual is about the number of triangles per radius
*/
virtual void GetTriangleApproximation (TriangleApproximation & /* tas */,
const Box<3> & /* boundingbox */,
double /* facets */ ) const { };
string GetBCName() const { return bcname; }
void SetBCName( string abc ) { bcname = abc; }
};
inline ostream & operator<< (ostream & ost, const Surface & surf)
{
surf.Print(ost);
return ost;
}
typedef enum { IS_OUTSIDE = 0, IS_INSIDE = 1, DOES_INTERSECT = 2}
INSOLID_TYPE;
class DummySurface : public Surface
{
virtual double CalcFunctionValue (const Point<3> & /* point */) const
{ return 0; }
virtual void CalcGradient (const Point<3> & /* point */, Vec<3> & grad) const
{ grad = Vec<3> (0,0,0); }
virtual Point<3> GetSurfacePoint () const
{ return Point<3> (0,0,0); }
virtual double HesseNorm () const
{ return 0; }
virtual void Project (Point<3> & /* p */) const
{ ; }
virtual void Print (ostream & ost) const
{ ost << "dummy surface"; }
};
class Primitive
{
public:
Primitive ();
virtual ~Primitive();
/*
Check, whether box intersects solid defined by surface.
return values:
0 .. box outside solid \\
1 .. box in solid \\
2 .. can't decide (allowed, iff box is close to solid)
*/
virtual INSOLID_TYPE BoxInSolid (const BoxSphere<3> & box) const = 0;
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const = 0;
virtual void GetTangentialSurfaceIndices (const Point<3> & p,
Array<int> & surfind, double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const = 0;
// checks if lim s->0 lim t->0 p + t(v1 + s v2) in solid
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
// checks if p + s v1 + s*s/2 v2 is inside
virtual INSOLID_TYPE VecInSolid3 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
// like VecInSolid2, but second order approximation
virtual INSOLID_TYPE VecInSolid4 (const Point<3> & p,
const Vec<3> & v,
const Vec<3> & v2,
const Vec<3> & m,
double eps) const;
virtual void GetTangentialVecSurfaceIndices (const Point<3> & p, const Vec<3> & v,
Array<int> & surfind, double eps) const;
virtual void GetTangentialVecSurfaceIndices2 (const Point<3> & p, const Vec<3> & v1, const Vec<3> & v2,
Array<int> & surfind, double eps) const;
virtual void CalcSpecialPoints (Array<Point<3> > & /* pts */) const { ; }
virtual void AnalyzeSpecialPoint (const Point<3> & /* pt */,
Array<Point<3> > & /* specpts */) const { ; }
virtual Vec<3> SpecialPointTangentialVector (const Point<3> & /* p */,
int /* s1 */, int /* s2 */) const
{ return Vec<3> (0,0,0); }
virtual int GetNSurfaces() const = 0;
virtual Surface & GetSurface (int i = 0) = 0;
virtual const Surface & GetSurface (int i = 0) const = 0;
Array<int> surfaceids;
Array<int> surfaceactive;
int GetSurfaceId (int i = 0) const;
void SetSurfaceId (int i, int id);
int SurfaceActive (int i) const { return surfaceactive[i]; }
virtual int SurfaceInverted (int /* i */ = 0) const { return 0; }
virtual void GetPrimitiveData (const char *& classname,
Array<double> & coeffs) const;
virtual void SetPrimitiveData (Array<double> & coeffs);
static Primitive * CreatePrimitive (const char * classname);
virtual void Reduce (const BoxSphere<3> & /* box */) { };
virtual void UnReduce () { };
virtual Primitive * Copy () const;
virtual void Transform (Transformation<3> & trans);
};
class OneSurfacePrimitive : public Surface, public Primitive
{
public:
OneSurfacePrimitive();
~OneSurfacePrimitive();
virtual INSOLID_TYPE PointInSolid (const Point<3> & p,
double eps) const;
virtual INSOLID_TYPE VecInSolid (const Point<3> & p,
const Vec<3> & v,
double eps) const;
virtual INSOLID_TYPE VecInSolid2 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual INSOLID_TYPE VecInSolid3 (const Point<3> & p,
const Vec<3> & v1,
const Vec<3> & v2,
double eps) const;
virtual INSOLID_TYPE VecInSolid4 (const Point<3> & p,
const Vec<3> & v,
const Vec<3> & v2,
const Vec<3> & m,
double eps) const;
virtual int GetNSurfaces() const;
virtual Surface & GetSurface (int i = 0);
virtual const Surface & GetSurface (int i = 0) const;
};
/**
Projects point to edge.
The point hp is projected to the edge descibed by f1 and f2.
It is assumed that the edge is non-degenerated, and the
(generalized) Newton method converges.
*/
extern void ProjectToEdge (const Surface * f1,
const Surface * f2,
Point<3> & hp);
}
#endif

59
libsrc/csg/triapprox.cpp Normal file
View File

@ -0,0 +1,59 @@
#include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
TriangleApproximation :: TriangleApproximation ()
{
;
}
int TriangleApproximation ::
AddTriangle (const TATriangle & tri, bool invert)
{
trigs.Append (tri);
if (invert)
{
trigs.Last()[1] = tri[2];
trigs.Last()[2] = tri[1];
}
return trigs.Size()-1;
}
void TriangleApproximation :: RemoveUnusedPoints ()
{
BitArray used(GetNP());
Array<int> map (GetNP());
int i, j;
int cnt = 0;
used.Clear();
for (i = 0; i < GetNT(); i++)
for (j = 0; j < 3; j++)
used.Set (GetTriangle (i)[j]);
for (i = 0; i < GetNP(); i++)
if (used.Test(i))
map[i] = cnt++;
for (i = 0; i < GetNT(); i++)
for (j = 0; j < 3; j++)
trigs[i][j] = map[trigs[i][j]];
for (i = 0; i < GetNP(); i++)
if (used.Test(i))
{
points[map[i]] = points[i];
normals[map[i]] = normals[i];
}
points.SetSize (cnt);
normals.SetSize (cnt);
}
}

63
libsrc/csg/triapprox.hpp Normal file
View File

@ -0,0 +1,63 @@
#ifndef FILE_TRIAPPROX
#define FILE_TRIAPPROX
/**************************************************************************/
/* File: triapprox.hh */
/* Author: Joachim Schoeberl */
/* Date: 2. Mar. 98 */
/**************************************************************************/
namespace netgen
{
/**
Triangulated approxiamtion to true surface
*/
class TATriangle
{
int pi[3];
int surfind;
public:
TATriangle () { ; }
TATriangle (int si, int pi1, int pi2, int pi3)
{ surfind = si; pi[0] = pi1; pi[1] = pi2; pi[2] = pi3; }
int SurfaceIndex() const { return surfind; }
int & SurfaceIndex() { return surfind; }
int & operator[] (int i) { return pi[i]; }
const int & operator[] (int i) const { return pi[i]; }
};
class TriangleApproximation
{
Array<Point<3> > points;
Array<Vec<3> > normals;
Array<TATriangle> trigs;
public:
TriangleApproximation();
int GetNP () const { return points.Size(); }
int GetNT () const { return trigs.Size(); }
int AddPoint (const Point<3> & p) { points.Append (p); return points.Size()-1; }
int AddNormal (const Vec<3> & n) { normals.Append (n); return normals.Size()-1; }
int AddTriangle (const TATriangle & tri, bool invert = 0);
const Point<3> & GetPoint (int i) const { return points[i]; }
const TATriangle & GetTriangle (int i) const { return trigs[i]; }
const Vec<3> & GetNormal (int i) const { return normals[i]; }
void RemoveUnusedPoints ();
friend class CSGeometry;
};
}
#endif

495
libsrc/csg/vscsg.cpp Normal file
View File

@ -0,0 +1,495 @@
#include <mystdlib.h>
#include "incvis.hpp"
#include <myadt.hpp>
#include <meshing.hpp>
#include <csg.hpp>
#include <stlgeom.hpp>
#include <visual.hpp>
#include "vscsg.hpp"
namespace netgen
{
/* *********************** Draw Geometry **************** */
extern AutoPtr<Mesh> mesh;
extern Array<SpecialPoint> specpoints;
extern Array<Box<3> > boxes;
extern Array<Point<3> > project1, project2;
// extern AutoPtr<CSGeometry> geometry;
VisualSceneGeometry :: VisualSceneGeometry ()
: VisualScene()
{
selsurf = 0;
}
VisualSceneGeometry :: ~VisualSceneGeometry ()
{
;
}
void VisualSceneGeometry :: SelectSurface (int aselsurf)
{
selsurf = aselsurf;
DrawScene();
}
void VisualSceneGeometry :: DrawScene ()
{
if (changeval != geometry->GetChangeVal())
BuildScene();
changeval = geometry->GetChangeVal();
glClearColor(backcolor, backcolor, backcolor, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
SetLight();
glPushMatrix();
glMultMatrixf (transformationmat);
SetClippingPlane ();
glShadeModel (GL_SMOOTH);
glDisable (GL_COLOR_MATERIAL);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/*
float mat_spec_col[] = { 1, 1, 1, 1 };
glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, mat_spec_col);
*/
double shine = vispar.shininess;
double transp = vispar.transp;
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, shine);
glLogicOp (GL_COPY);
glEnable (GL_NORMALIZE);
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
const TopLevelObject * tlo = geometry -> GetTopLevelObject (i);
if (tlo->GetVisible() && !tlo->GetTransparent())
{
float mat_col[] = { tlo->GetRed(), tlo->GetGreen(), tlo->GetBlue(), 1 };
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col);
glCallList (trilists[i]);
}
}
glPolygonOffset (1, 1);
glEnable (GL_POLYGON_OFFSET_FILL);
glLogicOp (GL_NOOP);
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
const TopLevelObject * tlo = geometry -> GetTopLevelObject (i);
if (tlo->GetVisible() && tlo->GetTransparent())
{
float mat_col[] = { tlo->GetRed(), tlo->GetGreen(), tlo->GetBlue(), transp };
glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat_col);
glCallList (trilists[i]);
}
}
glDisable (GL_POLYGON_OFFSET_FILL);
glPopMatrix();
glDisable(GL_CLIP_PLANE0);
DrawCoordinateCross ();
DrawNetgenLogo ();
glFinish();
}
void VisualSceneGeometry :: BuildScene (int zoomall)
{
Box<3> box;
int hasp = 0;
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
const TriangleApproximation & ta =
*geometry->GetTriApprox(i);
if (!&ta) continue;
for (int j = 0; j < ta.GetNP(); j++)
{
if (hasp)
box.Add (ta.GetPoint(j));
else
{
hasp = 1;
box.Set (ta.GetPoint(j));
}
}
}
if (hasp)
{
center = box.Center();
rad = box.Diam() / 2;
}
else
{
center = Point3d(0,0,0);
rad = 1;
}
CalcTransformationMatrices();
for (int i = 0; i < trilists.Size(); i++)
glDeleteLists (trilists[i], 1);
trilists.SetSize(0);
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
{
trilists.Append (glGenLists (1));
glNewList (trilists.Last(), GL_COMPILE);
glEnable (GL_NORMALIZE);
const TriangleApproximation & ta =
*geometry->GetTriApprox(i);
if (&ta)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, &ta.GetPoint(0)(0));
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_DOUBLE, 0, &ta.GetNormal(0)(0));
for (int j = 0; j < ta.GetNT(); j++)
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, & (ta.GetTriangle(j)[0]));
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
/*
for (int j = 0; j < ta.GetNT(); j++)
{
glBegin (GL_TRIANGLES);
for (int k = 0; k < 3; k++)
{
int pi = ta.GetTriangle(j)[k];
glNormal3dv (ta.GetNormal(pi));
glVertex3dv (ta.GetPoint(pi));
}
glEnd ();
}
*/
}
glEndList ();
}
}
VisualSceneSpecPoints :: VisualSceneSpecPoints ()
: VisualScene()
{
;
}
VisualSceneSpecPoints :: ~VisualSceneSpecPoints ()
{
;
}
void VisualSceneSpecPoints :: DrawScene ()
{
if (!mesh)
{
VisualScene::DrawScene();
return;
}
if (changeval != specpoints.Size())
BuildScene();
changeval = specpoints.Size();
glClearColor(backcolor, backcolor, backcolor, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable (GL_COLOR_MATERIAL);
glColor3f (1.0f, 1.0f, 1.0f);
glLineWidth (1.0f);
glPushMatrix();
glMultMatrixf (transformationmat);
// glEnable (GL_COLOR);
// glDisable (GL_COLOR_MATERIAL);
if (vispar.drawedtangents)
{
glColor3d (1, 0, 0);
glBegin (GL_LINES);
for (int i = 1; i <= specpoints.Size(); i++)
{
const Point3d p1 = specpoints.Get(i).p;
const Point3d p2 = specpoints.Get(i).p + len * specpoints.Get(i).v;
glVertex3d (p1.X(), p1.Y(), p1.Z());
glVertex3d (p2.X(), p2.Y(), p2.Z());
}
glEnd();
}
if (vispar.drawededges)
{
glColor3d (1, 0, 0);
glBegin (GL_LINES);
for (int i = 1; i <= mesh->GetNSeg(); i++)
{
const Segment & seg = mesh -> LineSegment (i);
glVertex3dv ( (*mesh)[seg[0]] );
glVertex3dv ( (*mesh)[seg[1]] );
// glVertex3dv ( &(*mesh)[seg[0]].X() );
// glVertex3dv ( &(*mesh)[seg[1]].X() );
}
glEnd();
}
glColor3d (1, 0, 0);
glBegin (GL_LINES);
int edges[12][2] =
{ { 0, 1 },
{ 2, 3 },
{ 4, 5 },
{ 6, 7 },
{ 0, 2 },
{ 1, 3 },
{ 4, 6 },
{ 5, 7 },
{ 0, 4 },
{ 1, 5 },
{ 2, 6 },
{ 3, 7 } };
for (int i = 0; i < boxes.Size(); i++)
{
for (int j = 0; j < 12; j++)
{
glVertex3dv ( boxes[i].GetPointNr(edges[j][0]) );
glVertex3dv ( boxes[i].GetPointNr(edges[j][1]) );
}
/*
glVertex3dv ( boxes[i].PMin() );
glVertex3dv ( boxes[i].PMax() );
*/
}
glEnd();
if (vispar.drawededgenrs)
{
glEnable (GL_COLOR_MATERIAL);
GLfloat textcol[3] = { 1 - backcolor,
1 - backcolor,
1 - backcolor };
glColor3fv (textcol);
glNormal3d (0, 0, 1);
glPushAttrib (GL_LIST_BIT);
// glListBase (fontbase);
char buf[20];
for (int i = 1; i <= mesh->GetNSeg(); i++)
{
const Segment & seg = mesh -> LineSegment (i);
const Point3d p1 = mesh -> Point (seg[0]);
const Point3d p2 = mesh -> Point (seg[1]);
const Point3d p = Center (p1, p2);
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", seg.edgenr);
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
MyOpenGLText (buf);
}
glPopAttrib ();
glDisable (GL_COLOR_MATERIAL);
}
if (vispar.drawedpoints)
{
glColor3d (0, 0, 1);
/*
glPointSize( 3.0 );
float range[2];
glGetFloatv(GL_POINT_SIZE_RANGE, &range[0]);
cout << "max ptsize = " << range[0] << "-" << range[1] << endl;
glBegin( GL_POINTS );
for (int i = 1; i <= mesh -> GetNP(); i++)
{
const Point3d & p = mesh -> Point(i);
if (i % 2)
glVertex3f( p.X(), p.Y(), p.Z());
}
glEnd();
*/
static GLubyte knoedel[] =
{
0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
};
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glDisable (GL_COLOR_MATERIAL);
glDisable (GL_LIGHTING);
glDisable (GL_CLIP_PLANE0);
for (int i = 1; i <= mesh -> GetNP(); i++)
{
const Point3d & p = mesh -> Point(i);
glRasterPos3d (p.X(), p.Y(), p.Z());
glBitmap (7, 7, 3, 3, 0, 0, &knoedel[0]);
}
}
if (vispar.drawedpointnrs)
{
glEnable (GL_COLOR_MATERIAL);
GLfloat textcol[3] = { 1 - backcolor,
1 - backcolor,
1 - backcolor };
glColor3fv (textcol);
glNormal3d (0, 0, 1);
glPushAttrib (GL_LIST_BIT);
// glListBase (fontbase);
char buf[20];
for (int i = 1; i <= mesh->GetNP(); i++)
{
const Point3d & p = mesh->Point(i);
glRasterPos3d (p.X(), p.Y(), p.Z());
sprintf (buf, "%d", i);
// glCallLists (GLsizei(strlen (buf)), GL_UNSIGNED_BYTE, buf);
MyOpenGLText (buf);
}
glPopAttrib ();
glDisable (GL_COLOR_MATERIAL);
}
glPopMatrix();
if (vispar.drawcoordinatecross)
DrawCoordinateCross ();
DrawNetgenLogo ();
glFinish();
}
void VisualSceneSpecPoints :: BuildScene (int zoomall)
{
if (!mesh)
{
VisualScene::BuildScene(zoomall);
return;
}
Box3d box;
if (mesh->GetNSeg())
{
box.SetPoint (mesh->Point (mesh->LineSegment(1)[0]));
for (int i = 1; i <= mesh->GetNSeg(); i++)
{
box.AddPoint (mesh->Point (mesh->LineSegment(i)[0]));
box.AddPoint (mesh->Point (mesh->LineSegment(i)[1]));
}
}
else if (specpoints.Size() >= 2)
{
box.SetPoint (specpoints.Get(1).p);
for (int i = 2; i <= specpoints.Size(); i++)
box.AddPoint (specpoints.Get(i).p);
}
else
{
box = Box3d (Point3d (0,0,0), Point3d (1,1,1));
}
if (zoomall == 2 && ((vispar.centerpoint >= 1 && vispar.centerpoint <= mesh->GetNP()) ||
vispar.use_center_coords))
{
if (vispar.use_center_coords)
{
center.X() = vispar.centerx; center.Y() = vispar.centery; center.Z() = vispar.centerz;
}
else
center = mesh->Point (vispar.centerpoint);
}
else
center = Center (box.PMin(), box.PMax());
rad = 0.5 * Dist (box.PMin(), box.PMax());
CalcTransformationMatrices();
}
}

34
libsrc/csg/vscsg.hpp Normal file
View File

@ -0,0 +1,34 @@
#ifndef FILE_VSCSG
#define FILE_VSCSG
/**************************************************************************/
/* File: vscsg.hpp */
/* Author: Joachim Schoeberl */
/* Date: 05. Jan. 2011 */
/**************************************************************************/
namespace netgen
{
class VisualSceneGeometry : public VisualScene
{
class CSGeometry * geometry;
Array<int> trilists;
int selsurf;
public:
VisualSceneGeometry ();
virtual ~VisualSceneGeometry ();
void SetGeometry (class CSGeometry * ageometry) { geometry = ageometry; }
virtual void SelectSurface (int aselsurf);
virtual void BuildScene (int zoomall = 0);
virtual void DrawScene ();
};
}
#endif

View File

@ -0,0 +1,15 @@
noinst_HEADERS = array.hpp myadt.hpp optmem.hpp sort.hpp table.hpp autodiff.hpp flags.hpp mystring.hpp spbita2d.hpp template.hpp autoptr.hpp hashtabl.hpp netgenout.hpp profiler.hpp stack.hpp bitarray.hpp seti.hpp symbolta.hpp dynamicmem.hpp parthreads.hpp mpi_interface.hpp gzstream.h
# moveablemem.hpp
include_HEADERS = ngexception.hpp
AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include
METASOURCES = AUTO
noinst_LTLIBRARIES = libgen.la
libgen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \
hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \
profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \
mpi_interface.cpp gzstream.cpp
# moveablemem.cpp

614
libsrc/general/Makefile.in Normal file
View File

@ -0,0 +1,614 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = libsrc/general
DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/tcl.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libgen_la_LIBADD =
am_libgen_la_OBJECTS = array.lo bitarray.lo dynamicmem.lo flags.lo \
hashtabl.lo mystring.lo ngexception.lo optmem.lo parthreads.lo \
profiler.lo seti.lo sort.lo spbita2d.lo symbolta.lo table.lo \
mpi_interface.lo gzstream.lo
libgen_la_OBJECTS = $(am_libgen_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libgen_la_SOURCES)
DIST_SOURCES = $(libgen_la_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLEANFILES = @CLEANFILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH = @CYGPATH@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FFMPEG_INCLUDES = @FFMPEG_INCLUDES@
FFMPEG_LIBS = @FFMPEG_LIBS@
FGREP = @FGREP@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JPEGLIB_INCLUDES = @JPEGLIB_INCLUDES@
JPEGLIB_LIBS = @JPEGLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBGLU = @LIBGLU@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPI_INCLUDES = @MPI_INCLUDES@
MPI_LIBS = @MPI_LIBS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OCCFLAGS = @OCCFLAGS@
OCCLIBS = @OCCLIBS@
OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CFLAGS = @PKG_CFLAGS@
PKG_HEADERS = @PKG_HEADERS@
PKG_INCLUDES = @PKG_INCLUDES@
PKG_LIBS = @PKG_LIBS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_DEFS = @TCL_DEFS@
TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
TCL_INCLUDES = @TCL_INCLUDES@
TCL_LD_FLAGS = @TCL_LD_FLAGS@
TCL_LIBS = @TCL_LIBS@
TCL_LIB_FILE = @TCL_LIB_FILE@
TCL_LIB_FLAG = @TCL_LIB_FLAG@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
TCL_SRC_DIR = @TCL_SRC_DIR@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_VERSION = @TCL_VERSION@
TK_BIN_DIR = @TK_BIN_DIR@
TK_INCLUDES = @TK_INCLUDES@
TK_LIBS = @TK_LIBS@
TK_LIB_FILE = @TK_LIB_FILE@
TK_LIB_FLAG = @TK_LIB_FLAG@
TK_LIB_SPEC = @TK_LIB_SPEC@
TK_SRC_DIR = @TK_SRC_DIR@
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
TK_VERSION = @TK_VERSION@
TK_XINCLUDES = @TK_XINCLUDES@
TOGLLIBDIR = @TOGLLIBDIR@
TOGL_WINDOWINGSYSTEM = @TOGL_WINDOWINGSYSTEM@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_HEADERS = array.hpp myadt.hpp optmem.hpp sort.hpp table.hpp autodiff.hpp flags.hpp mystring.hpp spbita2d.hpp template.hpp autoptr.hpp hashtabl.hpp netgenout.hpp profiler.hpp stack.hpp bitarray.hpp seti.hpp symbolta.hpp dynamicmem.hpp parthreads.hpp mpi_interface.hpp gzstream.h
# moveablemem.hpp
include_HEADERS = ngexception.hpp
AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include
METASOURCES = AUTO
noinst_LTLIBRARIES = libgen.la
libgen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \
hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \
profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \
mpi_interface.cpp gzstream.cpp
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libsrc/general/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign libsrc/general/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libgen.la: $(libgen_la_OBJECTS) $(libgen_la_DEPENDENCIES) $(EXTRA_libgen_la_DEPENDENCIES)
$(CXXLINK) $(libgen_la_OBJECTS) $(libgen_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitarray.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynamicmem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flags.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gzstream.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashtabl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpi_interface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mystring.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ngexception.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optmem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parthreads.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/profiler.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seti.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spbita2d.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbolta.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-includeHEADERS install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-includeHEADERS
# moveablemem.cpp
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

75
libsrc/general/array.cpp Normal file
View File

@ -0,0 +1,75 @@
#ifndef FILE_NGSTD_ArrayCPP
#define FILE_NGSTD_ArrayCPP
// necessary for SGI ????
/**************************************************************************/
/* File: array.cpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
/*
Abstract data type Array
*/
#include <mystdlib.h>
#include <myadt.hpp>
#include <assert.h>
namespace netgen
{
//using namespace netgen;
#ifdef NONE
void BASE_Array :: ReSize (int minsize, int elementsize)
{
cout << "resize, minsize = " << minsize << endl;
if (inc == -1)
throw Exception ("Try to resize fixed size array");
void * p;
int nsize = (inc) ? allocsize + inc : 2 * allocsize;
if (nsize < minsize) nsize = minsize;
if (data)
{
p = new char [nsize * elementsize];
int mins = (nsize < actsize) ? nsize : actsize;
memcpy (p, data, mins * elementsize);
delete [] static_cast<char*> (data);
data = p;
}
else
{
data = new char[nsize * elementsize];
}
allocsize = nsize;
cout << "resize done" << endl;
}
void BASE_Array :: RangeCheck (int i) const
{
if (i < 0 || i >= actsize)
throw ArrayRangeException ();
}
void BASE_Array :: CheckNonEmpty () const
{
if (!actsize)
{
throw Exception ("Array should not be empty");
// cerr << "Array souldn't be empty";
}
}
#endif
}
#endif

698
libsrc/general/array.hpp Normal file
View File

@ -0,0 +1,698 @@
#ifndef FILE_Array
#define FILE_Array
/**************************************************************************/
/* File: array.hpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
namespace netgen
{
// template <class T, int B1, int B2> class IndirectArray;
template <class TA1, class TA2> class IndirectArray;
/**
A simple array container.
Array represented by size and data-pointer.
No memory allocation and deallocation, must be provided by user.
Helper functions for printing.
Optional range check by macro RANGE_CHECK
*/
template <typename T, int BASE = 0, typename TIND = int>
class FlatArray
{
protected:
/// the size
int size;
/// the data
T * data;
public:
typedef T TELEM;
/// provide size and memory
FlatArray (int asize, T * adata)
: size(asize), data(adata) { ; }
/// the size
int Size() const { return size; }
TIND Begin() const { return TIND(BASE); }
TIND End() const { return TIND(size+BASE); }
/// Access array. BASE-based
T & operator[] (TIND i) const
{
#ifdef DEBUG
if (i-BASE < 0 || i-BASE >= size)
cout << "array<" << typeid(T).name() << "> out of range, i = " << i << ", s = " << size << endl;
#endif
return data[i-BASE];
}
template <typename T2, int B2>
IndirectArray<FlatArray, FlatArray<T2,B2> > operator[] (const FlatArray<T2,B2> & ia) const
{
return IndirectArray<FlatArray, FlatArray<T2,B2> > (*this, ia);
}
/// Access array, one-based (old fashioned)
T & Elem (int i)
{
#ifdef DEBUG
if (i < 1 || i > size)
cout << "Array<" << typeid(T).name()
<< ">::Elem out of range, i = " << i
<< ", s = " << size << endl;
#endif
return ((T*)data)[i-1];
}
/// Access array, one-based (old fashioned)
const T & Get (int i) const
{
#ifdef DEBUG
if (i < 1 || i > size)
cout << "Array<" << typeid(T).name() << ">::Get out of range, i = " << i
<< ", s = " << size << endl;
#endif
return ((const T*)data)[i-1];
}
/// Access array, one-based (old fashioned)
void Set (int i, const T & el)
{
#ifdef DEBUG
if (i < 1 || i > size)
cout << "Array<" << typeid(T).name() << ">::Set out of range, i = " << i
<< ", s = " << size << endl;
#endif
((T*)data)[i-1] = el;
}
/// access first element
T & First () const
{
return data[0];
}
/// access last element. check by macro CHECK_RANGE
T & Last () const
{
return data[size-1];
}
/// Fill array with value val
FlatArray & operator= (const T & val)
{
for (int i = 0; i < size; i++)
data[i] = val;
return *this;
}
/// takes range starting from position start of end-start elements
const FlatArray<T> Range (TIND start, TIND end)
{
return FlatArray<T> (end-start, data+start);
}
/// first position of element elem, returns -1 if element not contained in array
TIND Pos(const T & elem) const
{
TIND pos = -1;
for(TIND i=0; pos==-1 && i < this->size; i++)
if(elem == data[i]) pos = i;
return pos;
}
/// does the array contain element elem ?
bool Contains(const T & elem) const
{
return ( Pos(elem) >= 0 );
}
};
// print array
template <typename T, int BASE, typename TIND>
inline ostream & operator<< (ostream & s, const FlatArray<T,BASE,TIND> & a)
{
for (TIND i = a.Begin(); i < a.End(); i++)
s << i << ": " << a[i] << endl;
return s;
}
/**
Dynamic array container.
Array<T> is an automatically increasing array container.
The allocated memory doubles on overflow.
Either the container takes care of memory allocation and deallocation,
or the user provides one block of data.
*/
template <class T, int BASE = 0, typename TIND = int>
class Array : public FlatArray<T, BASE, TIND>
{
protected:
using FlatArray<T,BASE,TIND>::size;
using FlatArray<T,BASE,TIND>::data;
/// physical size of array
int allocsize;
/// memory is responsibility of container
bool ownmem;
public:
/// Generate array of logical and physical size asize
explicit Array()
: FlatArray<T, BASE, TIND> (0, NULL)
{
allocsize = 0;
ownmem = 1;
}
explicit Array(int asize)
: FlatArray<T, BASE, TIND> (asize, new T[asize])
{
allocsize = asize;
ownmem = 1;
}
/// Generate array in user data
Array(TIND asize, T* adata)
: FlatArray<T, BASE, TIND> (asize, adata)
{
allocsize = asize;
ownmem = 0;
}
/// array copy
explicit Array (const Array<T,BASE,TIND> & a2)
: FlatArray<T, BASE, TIND> (a2.Size(), a2.Size() ? new T[a2.Size()] : 0)
{
allocsize = size;
ownmem = 1;
for (TIND i = BASE; i < size+BASE; i++)
(*this)[i] = a2[i];
}
/// if responsible, deletes memory
~Array()
{
if (ownmem)
delete [] data;
}
/// Change logical size. If necessary, do reallocation. Keeps contents.
void SetSize(int nsize)
{
if (nsize > allocsize)
ReSize (nsize);
size = nsize;
}
/// Change physical size. Keeps logical size. Keeps contents.
void SetAllocSize (int nallocsize)
{
if (nallocsize > allocsize)
ReSize (nallocsize);
}
/// Add element at end of array. reallocation if necessary.
int Append (const T & el)
{
if (size == allocsize)
ReSize (size+1);
data[size] = el;
size++;
return size;
}
template <typename T2, int B2>
void Append (FlatArray<T2, B2> a2)
{
if (size+a2.Size() > allocsize)
ReSize (size+a2.Size());
for (int i = 0; i < a2.Size(); i++)
data[size+i] = a2[i+B2];
size += a2.Size();
}
/// Delete element i (0-based). Move last element to position i.
void Delete (TIND i)
{
#ifdef CHECK_Array_RANGE
RangeCheck (i+1);
#endif
data[i] = data[size-1];
size--;
// DeleteElement (i+1);
}
/// Delete element i (1-based). Move last element to position i.
void DeleteElement (TIND i)
{
#ifdef CHECK_Array_RANGE
RangeCheck (i);
#endif
data[i-1] = data[size-1];
size--;
}
/// Delete last element.
void DeleteLast ()
{
size--;
}
/// Deallocate memory
void DeleteAll ()
{
if (ownmem)
delete [] data;
data = 0;
size = allocsize = 0;
}
/// Fill array with val
Array & operator= (const T & val)
{
FlatArray<T, BASE, TIND>::operator= (val);
return *this;
}
/// array copy
Array & operator= (const Array & a2)
{
SetSize (a2.Size());
for (TIND i (BASE); i < size+BASE; i++)
(*this)[i] = a2[i];
return *this;
}
/// array copy
Array & operator= (const FlatArray<T> & a2)
{
SetSize (a2.Size());
for (TIND i = BASE; i < size+BASE; i++)
(*this)[i] = a2[i];
return *this;
}
private:
/// resize array, at least to size minsize. copy contents
void ReSize (int minsize)
{
int nsize = 2 * allocsize;
if (nsize < minsize) nsize = minsize;
if (data)
{
T * p = new T[nsize];
int mins = (nsize < size) ? nsize : size;
memcpy (p, data, mins * sizeof(T));
if (ownmem)
delete [] data;
ownmem = 1;
data = p;
}
else
{
data = new T[nsize];
ownmem = 1;
}
allocsize = nsize;
}
};
template <class T, int S>
class ArrayMem : public Array<T>
{
using Array<T>::size;
using Array<T>::data;
using Array<T>::ownmem;
// T mem[S]; // Intel C++ calls dummy constructor
// char mem[S*sizeof(T)];
double mem[(S*sizeof(T)+7) / 8];
public:
/// Generate array of logical and physical size asize
explicit ArrayMem(int asize = 0)
: Array<T> (S, static_cast<T*> (static_cast<void*>(&mem[0])))
{
size = asize;
if (asize > S)
{
data = new T[asize];
ownmem = 1;
}
// SetSize (asize);
}
ArrayMem & operator= (const T & val)
{
Array<T>::operator= (val);
return *this;
}
/// array copy
ArrayMem & operator= (const FlatArray<T> & a2)
{
this->SetSize (a2.Size());
for (int i = 0; i < size; i++)
(*this)[i] = a2[i];
return *this;
}
};
/*
template <class T, int B1, int B2>
class IndirectArray
{
const FlatArray<T, B1> & array;
const FlatArray<int, B2> & ia;
public:
IndirectArray (const FlatArray<T,B1> & aa, const FlatArray<int, B2> & aia)
: array(aa), ia(aia) { ; }
int Size() const { return ia.Size(); }
const T & operator[] (int i) const { return array[ia[i]]; }
};
*/
template <class TA1, class TA2>
class IndirectArray
{
const TA1 & array;
const TA2 & ia;
public:
IndirectArray (const TA1 & aa, const TA2 & aia)
: array(aa), ia(aia) { ; }
int Size() const { return ia.Size(); }
int Begin() const { return ia.Begin(); }
int End() const { return ia.End(); }
const typename TA1::TELEM & operator[] (int i) const { return array[ia[i]]; }
};
template <typename T1, typename T2>
inline ostream & operator<< (ostream & s, const IndirectArray<T1,T2> & ia)
{
for (int i = ia.Begin(); i < ia.End(); i++)
s << i << ": " << ia[i] << endl;
return s;
}
/*
///
template <class T, int BASE = 0>
class MoveableArray
{
int size;
int allocsize;
DynamicMem<T> data;
public:
MoveableArray()
{
size = allocsize = 0;
data.SetName ("MoveableArray");
}
MoveableArray(int asize)
: size(asize), allocsize(asize), data(asize)
{ ; }
~MoveableArray () { ; }
int Size() const { return size; }
void SetSize(int nsize)
{
if (nsize > allocsize)
{
data.ReAlloc (nsize);
allocsize = nsize;
}
size = nsize;
}
void SetAllocSize (int nallocsize)
{
data.ReAlloc (nallocsize);
allocsize = nallocsize;
}
///
T & operator[] (int i)
{ return ((T*)data)[i-BASE]; }
///
const T & operator[] (int i) const
{ return ((const T*)data)[i-BASE]; }
///
T & Elem (int i)
{ return ((T*)data)[i-1]; }
///
const T & Get (int i) const
{ return ((const T*)data)[i-1]; }
///
void Set (int i, const T & el)
{ ((T*)data)[i-1] = el; }
///
T & Last ()
{ return ((T*)data)[size-1]; }
///
const T & Last () const
{ return ((const T*)data)[size-1]; }
///
int Append (const T & el)
{
if (size == allocsize)
{
SetAllocSize (2*allocsize+1);
}
((T*)data)[size] = el;
size++;
return size;
}
///
void Delete (int i)
{
DeleteElement (i+1);
}
///
void DeleteElement (int i)
{
((T*)data)[i-1] = ((T*)data)[size-1];
size--;
}
///
void DeleteLast ()
{ size--; }
///
void DeleteAll ()
{
size = allocsize = 0;
data.Free();
}
///
void PrintMemInfo (ostream & ost) const
{
ost << Size() << " elements of size " << sizeof(T) << " = "
<< Size() * sizeof(T) << endl;
}
MoveableArray & operator= (const T & el)
{
for (int i = 0; i < size; i++)
((T*)data)[i] = el;
return *this;
}
MoveableArray & Copy (const MoveableArray & a2)
{
SetSize (a2.Size());
for (int i = 0; i < this->size; i++)
data[i] = a2.data[i];
return *this;
}
/// array copy
MoveableArray & operator= (const MoveableArray & a2)
{
return Copy(a2);
}
void SetName (const char * aname)
{
data.SetName(aname);
}
private:
///
//MoveableArray & operator= (MoveableArray &); //???
///
//MoveableArray (const MoveableArray &); //???
};
template <class T>
inline ostream & operator<< (ostream & ost, MoveableArray<T> & a)
{
for (int i = 0; i < a.Size(); i++)
ost << i << ": " << a[i] << endl;
return ost;
}
*/
/// bubble sort array
template <class T>
inline void BubbleSort (const FlatArray<T> & data)
{
for (int i = 0; i < data.Size(); i++)
for (int j = i+1; j < data.Size(); j++)
if (data[i] > data[j])
{
T hv = data[i];
data[i] = data[j];
data[j] = hv;
}
}
/// bubble sort array
template <class T, class S>
inline void BubbleSort (FlatArray<T> & data, FlatArray<S> & slave)
{
for (int i = 0; i < data.Size(); i++)
for (int j = i+1; j < data.Size(); j++)
if (data[i] > data[j])
{
T hv = data[i];
data[i] = data[j];
data[j] = hv;
S hvs = slave[i];
slave[i] = slave[j];
slave[j] = hvs;
}
}
template <class T, class S>
void QuickSortRec (FlatArray<T> & data,
FlatArray<S> & slave,
int left, int right)
{
int i = left;
int j = right;
T midval = data[(left+right)/2];
do
{
while (data[i] < midval) i++;
while (midval < data[j]) j--;
if (i <= j)
{
Swap (data[i], data[j]);
Swap (slave[i], slave[j]);
i++; j--;
}
}
while (i <= j);
if (left < j) QuickSortRec (data, slave, left, j);
if (i < right) QuickSortRec (data, slave, i, right);
}
template <class T, class S>
void QuickSort (FlatArray<T> & data, FlatArray<S> & slave)
{
QuickSortRec (data, slave, 0, data.Size()-1);
}
template <class T>
void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2,
Array<T> & out)
{
out.SetSize(0);
for(int i=0; i<in1.Size(); i++)
if(in2.Contains(in1[i]))
out.Append(in1[i]);
}
template <class T>
void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2, const FlatArray<T> & in3,
Array<T> & out)
{
out.SetSize(0);
for(int i=0; i<in1.Size(); i++)
if(in2.Contains(in1[i]) && in3.Contains(in1[i]))
out.Append(in1[i]);
}
}
#endif

351
libsrc/general/autodiff.hpp Normal file
View File

@ -0,0 +1,351 @@
#ifndef FILE_AUTODIFF
#define FILE_AUTODIFF
/**************************************************************************/
/* File: autodiff.hpp */
/* Author: Joachim Schoeberl */
/* Date: 24. Oct. 02 */
/**************************************************************************/
// Automatic differentiation datatype
/**
Datatype for automatic differentiation.
Contains function value and D derivatives. Algebraic
operations are overloaded by using product-rule etc. etc.
**/
template <int D, typename SCAL = double>
class AutoDiff
{
SCAL val;
SCAL dval[D];
public:
typedef AutoDiff<D,SCAL> TELEM;
typedef SCAL TSCAL;
/// elements are undefined
AutoDiff () throw() { };
// { val = 0; for (int i = 0; i < D; i++) dval[i] = 0; } // !
/// copy constructor
AutoDiff (const AutoDiff & ad2) throw()
{
val = ad2.val;
for (int i = 0; i < D; i++)
dval[i] = ad2.dval[i];
}
/// initial object with constant value
AutoDiff (SCAL aval) throw()
{
val = aval;
for (int i = 0; i < D; i++)
dval[i] = 0;
}
/// init object with (val, e_diffindex)
AutoDiff (SCAL aval, int diffindex) throw()
{
val = aval;
for (int i = 0; i < D; i++)
dval[i] = 0;
dval[diffindex] = 1;
}
/// assign constant value
AutoDiff & operator= (SCAL aval) throw()
{
val = aval;
for (int i = 0; i < D; i++)
dval[i] = 0;
return *this;
}
/// returns value
SCAL Value() const throw() { return val; }
/// returns partial derivative
SCAL DValue (int i) const throw() { return dval[i]; }
/// access value
SCAL & Value() throw() { return val; }
/// accesses partial derivative
SCAL & DValue (int i) throw() { return dval[i]; }
///
AutoDiff<D,SCAL> & operator+= (const AutoDiff<D,SCAL> & y) throw()
{
val += y.val;
for (int i = 0; i < D; i++)
dval[i] += y.dval[i];
return *this;
}
///
AutoDiff<D,SCAL> & operator-= (const AutoDiff<D,SCAL> & y) throw()
{
val -= y.val;
for (int i = 0; i < D; i++)
dval[i] -= y.dval[i];
return *this;
}
///
AutoDiff<D,SCAL> & operator*= (const AutoDiff<D,SCAL> & y) throw()
{
for (int i = 0; i < D; i++)
{
// dval[i] *= y.val;
// dval[i] += val * y.dval[i];
dval[i] = dval[i] * y.val + val * y.dval[i];
}
val *= y.val;
return *this;
}
///
AutoDiff<D,SCAL> & operator*= (const SCAL & y) throw()
{
val *= y;
for (int i = 0; i < D; i++)
dval[i] *= y;
return *this;
}
///
AutoDiff<D,SCAL> & operator/= (const SCAL & y) throw()
{
SCAL iy = 1.0 / y;
val *= iy;
for (int i = 0; i < D; i++)
dval[i] *= iy;
return *this;
}
///
bool operator== (SCAL val2) throw()
{
return val == val2;
}
///
bool operator!= (SCAL val2) throw()
{
return val != val2;
}
///
bool operator< (SCAL val2) throw()
{
return val < val2;
}
///
bool operator> (SCAL val2) throw()
{
return val > val2;
}
};
//@{ AutoDiff helper functions.
/// prints AutoDiff
template<int D, typename SCAL>
inline ostream & operator<< (ostream & ost, const AutoDiff<D,SCAL> & x)
{
ost << x.Value() << ", D = ";
for (int i = 0; i < D; i++)
ost << x.DValue(i) << " ";
return ost;
}
/// AutoDiff plus AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator+ (const AutoDiff<D,SCAL> & x, const AutoDiff<D,SCAL> & y) throw()
{
AutoDiff<D,SCAL> res;
res.Value () = x.Value()+y.Value();
// AutoDiff<D,SCAL> res(x.Value()+y.Value());
for (int i = 0; i < D; i++)
res.DValue(i) = x.DValue(i) + y.DValue(i);
return res;
}
/// AutoDiff minus AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator- (const AutoDiff<D,SCAL> & x, const AutoDiff<D,SCAL> & y) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x.Value()-y.Value();
// AutoDiff<D,SCAL> res (x.Value()-y.Value());
for (int i = 0; i < D; i++)
res.DValue(i) = x.DValue(i) - y.DValue(i);
return res;
}
/// double plus AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator+ (double x, const AutoDiff<D,SCAL> & y) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x+y.Value();
for (int i = 0; i < D; i++)
res.DValue(i) = y.DValue(i);
return res;
}
/// AutoDiff plus double
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator+ (const AutoDiff<D,SCAL> & y, double x) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x+y.Value();
for (int i = 0; i < D; i++)
res.DValue(i) = y.DValue(i);
return res;
}
/// minus AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator- (const AutoDiff<D,SCAL> & x) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = -x.Value();
for (int i = 0; i < D; i++)
res.DValue(i) = -x.DValue(i);
return res;
}
/// AutoDiff minus double
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator- (const AutoDiff<D,SCAL> & x, double y) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x.Value()-y;
for (int i = 0; i < D; i++)
res.DValue(i) = x.DValue(i);
return res;
}
///
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator- (double x, const AutoDiff<D,SCAL> & y) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x-y.Value();
for (int i = 0; i < D; i++)
res.DValue(i) = -y.DValue(i);
return res;
}
/// double times AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator* (double x, const AutoDiff<D,SCAL> & y) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x*y.Value();
for (int i = 0; i < D; i++)
res.DValue(i) = x*y.DValue(i);
return res;
}
/// AutoDiff times double
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator* (const AutoDiff<D,SCAL> & y, double x) throw()
{
AutoDiff<D,SCAL> res;
res.Value() = x*y.Value();
for (int i = 0; i < D; i++)
res.DValue(i) = x*y.DValue(i);
return res;
}
/// AutoDiff times AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator* (const AutoDiff<D,SCAL> & x, const AutoDiff<D,SCAL> & y) throw()
{
AutoDiff<D,SCAL> res;
SCAL hx = x.Value();
SCAL hy = y.Value();
res.Value() = hx*hy;
for (int i = 0; i < D; i++)
res.DValue(i) = hx*y.DValue(i) + hy*x.DValue(i);
return res;
}
/// AutoDiff times AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> sqr (const AutoDiff<D,SCAL> & x) throw()
{
AutoDiff<D,SCAL> res;
SCAL hx = x.Value();
res.Value() = hx*hx;
hx *= 2;
for (int i = 0; i < D; i++)
res.DValue(i) = hx*x.DValue(i);
return res;
}
/// Inverse of AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> Inv (const AutoDiff<D,SCAL> & x)
{
AutoDiff<D,SCAL> res(1.0 / x.Value());
for (int i = 0; i < D; i++)
res.DValue(i) = -x.DValue(i) / (x.Value() * x.Value());
return res;
}
/// AutoDiff div AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator/ (const AutoDiff<D,SCAL> & x, const AutoDiff<D,SCAL> & y)
{
return x * Inv (y);
}
/// AutoDiff div double
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator/ (const AutoDiff<D,SCAL> & x, double y)
{
return (1/y) * x;
}
/// double div AutoDiff
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> operator/ (double x, const AutoDiff<D,SCAL> & y)
{
return x * Inv(y);
}
template<int D, typename SCAL>
inline AutoDiff<D,SCAL> fabs (const AutoDiff<D,SCAL> & x)
{
double abs = fabs (x.Value());
AutoDiff<D,SCAL> res( abs );
if (abs != 0.0)
for (int i = 0; i < D; i++)
res.DValue(i) = x.DValue(i) / abs;
else
for (int i = 0; i < D; i++)
res.DValue(i) = 0.0;
return res;
}
//@}
#endif

View File

@ -0,0 +1,36 @@
#ifndef FILE_AUTOPTR
#define FILE_AUTOPTR
/**************************************************************************/
/* File: autoptr.hpp */
/* Author: STL, Joachim Schoeberl */
/* Date: 29. Dec. 02 */
/**************************************************************************/
namespace netgen
{
template <typename T>
class AutoPtr
{
private:
T * ptr;
public:
typedef T* pT;
explicit AutoPtr (T * p = 0) { ptr = p; }
~AutoPtr () { delete ptr; }
T & operator*() const { return *ptr; }
T* operator->() const { return ptr; }
T *& Ptr() { return ptr; }
T * Ptr() const { return ptr; }
void Reset(T * p = 0) { if (p != ptr) { delete ptr; ptr = p; } }
operator bool () { return ptr != 0; }
private:
AutoPtr (AutoPtr &) { ; }
AutoPtr & operator= (AutoPtr &) { ; }
};
}
#endif

132
libsrc/general/bitarray.cpp Normal file
View File

@ -0,0 +1,132 @@
/**************************************************************************/
/* File: bitarray.cc */
/* Autho: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
/*
data type BitArray
*/
#include <mystdlib.h>
#include <myadt.hpp>
namespace netgen
{
//using namespace netgen;
BitArray :: BitArray ()
{
size = 0;
data = NULL;
}
BitArray :: BitArray (int asize)
{
size = 0;
data = NULL;
SetSize (asize);
}
BitArray :: ~BitArray ()
{
delete [] data;
}
void BitArray :: SetSize (int asize)
{
if (size == asize) return;
delete [] data;
size = asize;
data = new unsigned char [Addr (size)+1];
}
void BitArray :: Set ()
{
if (!size) return;
for (int i = 0; i <= Addr (size); i++)
data[i] = UCHAR_MAX;
}
void BitArray :: Clear ()
{
if (!size) return;
for (int i = 0; i <= Addr (size); i++)
data[i] = 0;
}
void BitArray :: Invert ()
{
if (!size) return;
for (int i = 0; i <= Addr (size); i++)
data[i] ^= 255;
}
void BitArray :: And (const BitArray & ba2)
{
if (!size) return;
for (int i = 0; i <= Addr (size); i++)
data[i] &= ba2.data[i];
}
void BitArray :: Or (const BitArray & ba2)
{
if (!size) return;
for (int i = 0; i <= Addr (size); i++)
data[i] |= ba2.data[i];
}
template <int BASE>
void BitArrayChar<BASE> :: Set ()
{
data = 1;
}
template <int BASE>
void BitArrayChar<BASE> :: Clear ()
{
data = 0;
}
template <int BASE>
void BitArrayChar<BASE> :: Invert ()
{
for (int i = BASE; i < data.Size()+BASE; i++)
data[i] = 1 - data[i];
}
template <int BASE>
void BitArrayChar<BASE> :: And (const BitArrayChar & ba2)
{
for (int i = BASE; i < data.Size()+BASE; i++)
data[i] &= ba2.data[i];
}
template <int BASE>
void BitArrayChar<BASE> :: Or (const BitArrayChar & ba2)
{
for (int i = BASE; i < data.Size()+BASE; i++)
data[i] |= ba2.data[i];
}
template class BitArrayChar<0>;
template class BitArrayChar<1>;
}

227
libsrc/general/bitarray.hpp Normal file
View File

@ -0,0 +1,227 @@
#ifndef FILE_BitArray
#define FILE_BitArray
/**************************************************************************/
/* File: bitarray.hpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
#include <limits.h>
namespace netgen
{
/**
data type BitArray
BitArray is a compressed array of Boolean information. By Set and Clear
the whole array or one bit can be set or reset, respectively.
Test returns the state of the accoring bit.
No range checking is done.
index ranges from 0 to size-1
*/
class BitArray
{
INDEX size;
unsigned char * data;
public:
BitArray ();
///
BitArray (INDEX asize);
///
~BitArray ();
///
void SetSize (INDEX asize);
///
INDEX Size () const
{
return size;
}
///
void Set ();
///
void Set (INDEX i)
{
data[Addr(i)] |= Mask(i);
}
void Clear ();
void Clear (INDEX i)
{
data[Addr(i)] &= ~Mask(i);
}
bool Test (INDEX i) const
{
return (data[i / CHAR_BIT] & (char(1) << (i % CHAR_BIT) ) ) ? true : false;
}
///
void Invert ();
///
void And (const BitArray & ba2);
///
void Or (const BitArray & ba2);
private:
///
inline unsigned char Mask (INDEX i) const
{
return char(1) << (i % CHAR_BIT);
}
///
inline INDEX Addr (INDEX i) const
{
return (i / CHAR_BIT);
}
///
BitArray & operator= (BitArray &);
///
BitArray (const BitArray &);
};
// print bitarray
inline ostream & operator<< (ostream & s, const BitArray & a)
{
for (int i = 1; i <= a.Size(); i++)
{
s << int (a.Test(i));
if (i % 40 == 0) s << "\n";
}
if (a.Size() % 40 != 0) s << "\n";
return s;
}
/*
inline
INDEX BitArray :: Size () const
{
return size;
}
inline
unsigned char BitArray :: Mask (INDEX i) const
{
return char(1) << (i % CHAR_BIT);
}
inline
INDEX BitArray :: Addr (INDEX i) const
{
return (i / CHAR_BIT);
}
inline
void BitArray :: Set (INDEX i)
{
data[Addr(i)] |= Mask(i);
}
inline
void BitArray :: Clear (INDEX i)
{
data[Addr(i)] &= ~Mask(i);
}
inline
int BitArray :: Test (INDEX i) const
{
return (data[i / CHAR_BIT] & (char(1) << (i % CHAR_BIT) ) ) ? 1 : 0;
}
*/
/**
data type BitArrayChar
BitArray is an array of Boolean information. By Set and Clear
the whole array or one bit can be set or reset, respectively.
Test returns the state of the accoring bit.
No range checking is done.
*/
template <int BASE = 1>
class BitArrayChar
{
///
Array<char,BASE> data;
public:
///
BitArrayChar ()
{ ; }
///
BitArrayChar (int asize)
: data(asize)
{ ; }
///
~BitArrayChar ()
{ ; }
///
void SetSize (int asize)
{ data.SetSize(asize); }
///
inline int Size () const
{ return data.Size(); }
///
void Set ();
///
inline void Set (int i)
{ data[i] = 1; }
///
void Clear ();
///
inline void Clear (int i)
{ data[i] = 0; }
///
inline int Test (int i) const
{ return data[i]; }
///
void Invert ();
///
void And (const BitArrayChar & ba2);
///
void Or (const BitArrayChar & ba2);
private:
/// copy bitarray is not supported
BitArrayChar & operator= (BitArrayChar &) { return *this; }
/// copy bitarray is not supported
BitArrayChar (const BitArrayChar &) { ; }
};
template <int BASE>
inline ostream & operator<< (ostream & s, const BitArrayChar<BASE> & a)
{
for (int i = BASE; i < a.Size()+BASE; i++)
{
s << a.Test(i);
if ( (i-BASE) % 40 == 39) s << "\n";
}
if (a.Size() % 40 != 0) s << "\n";
return s;
}
}
#endif

View File

@ -0,0 +1,202 @@
#include <myadt.hpp>
using namespace std;
namespace netgen
{
BaseDynamicMem * BaseDynamicMem::first = 0;
BaseDynamicMem * BaseDynamicMem::last = 0;
BaseDynamicMem :: BaseDynamicMem ()
{
prev = last;
next = 0;
if (last) last->next = this;
last = this;
if (!first) first = this;
size = 0;
ptr = 0;
name = 0;
}
BaseDynamicMem :: ~BaseDynamicMem ()
{
Free();
if (next) next->prev = prev;
else last = prev;
if (prev) prev->next = next;
else first = next;
delete [] name;
}
void BaseDynamicMem :: SetName (const char * aname)
{
delete [] name;
name = NULL;
if (aname)
{
name = new char[strlen(aname)+1];
strcpy (name, aname);
}
}
void BaseDynamicMem :: Alloc (size_t s)
{
size = s;
ptr = new char[s];
if (!ptr)
{
cerr << "BaseynamicMem, cannot allocate " << s << " bytes" << endl;
Print ();
throw ("BaseDynamicMem::Alloc: out of memory");
}
// ptr = (char*)malloc (s);
// ptr = (char*) _mm_malloc (s,16);
}
void BaseDynamicMem :: ReAlloc (size_t s)
{
if (size == s) return;
char * old = ptr;
ptr = new char[s];
if (!ptr)
{
cerr << "BaseynamicMem, cannot Reallocate " << s << " bytes" << endl;
Print ();
throw ("BaseDynamicMem::Alloc: out of memory");
}
// ptr = (char*)malloc(s);
// ptr = (char*) _mm_malloc (s,16);
memmove (ptr, old, (s < size) ? s : size);
delete [] old;
// free (old);
// _mm_free (old);
size = s;
}
void BaseDynamicMem :: Free ()
{
delete [] ptr;
// free (ptr);
// _mm_free (ptr);
ptr = 0;
}
void BaseDynamicMem :: Swap (BaseDynamicMem & m2)
{
size_t hi;
char * cp;
hi = size; size = m2.size; m2.size = hi;
cp = ptr; ptr = m2.ptr; m2.ptr = cp;
cp = name; name = m2.name; m2.name = cp;
}
void BaseDynamicMem :: Print ()
{
cout << "****************** Dynamic Mem Report ****************" << endl;
BaseDynamicMem * p = first;
size_t mem = 0;
int cnt = 0;
while (p)
{
mem += p->size;
cnt++;
cout << setw(10) << p->size << " Bytes";
cout << ", addr = " << (void*)p->ptr;
if (p->name)
cout << " in block " << p->name;
cout << endl;
p = p->next;
}
if (mem > 100000000)
cout << "memory in dynamic memory: " << mem/1048576 << " MB" << endl;
else if (mem > 100000)
cout << "memory in dynamic memory: " << mem/1024 << " kB" << endl;
else
cout << "memory in dynamic memory: " << mem << " Bytes" << endl;
cout << "number of blocks: " << cnt << endl;
// cout << "******************************************************" << endl;
}
#ifdef __INTEL_COMPILER
#pragma warning(push)
#pragma warning(disable:1684)
#endif
void BaseDynamicMem :: GetUsed (int nr, char * ch)
{
BaseDynamicMem * p = first;
for (int i = 0; i < nr; i++)
ch[i] = '0';
while (p)
{
long unsigned hptr = (long unsigned) (p->ptr);
// uintptr_t hptr = reinterpret_cast<uintptr_t>(p->ptr); //??
hptr /= (1024*1024);
hptr /= (4096/nr);
size_t blocks = p->size / (1024*1024);
blocks /= (4096/nr);
// cout << "ptr = " << (void*)(p->ptr) << ", size = " << p->size << ", hptr = " << hptr << " blocks = " << blocks << endl;
for (size_t i = 0; i <= blocks; i++)
ch[hptr+i] = '1';
p = p->next;
}
{
/*
BaseMoveableMem * pm = BaseMoveableMem::first;
while (pm)
{
long unsigned hptr = (long unsigned) pm->ptr;
// uintptr_t hptr = reinterpret_cast<uintptr_t>(pm->ptr);
hptr /= (1024*1024);
hptr /= (4096/nr);
size_t blocks = pm->size / (1024*1024);
blocks /= (4096/nr);
// cout << "moveable, ptr = " << (void*)(pm->ptr) << ", size = " << pm->size << ", hptr = " << hptr << " blocks = " << blocks << endl;
for (size_t i = 0; i <= blocks; i++)
ch[hptr+i] = '1';
pm = pm->next;
}
*/
}
}
#ifdef __INTEL_COMPILER
#pragma warning(pop)
#endif
}

View File

@ -0,0 +1,100 @@
#ifndef FILE_DYNAMICMEM
#define FILE_DYNAMICMEM
/**************************************************************************/
/* File: dynamicmem.hpp */
/* Author: Joachim Schoeberl */
/* Date: 12. Feb. 2003 */
/**************************************************************************/
namespace netgen
{
class BaseDynamicMem
{
private:
static BaseDynamicMem *first, *last;
BaseDynamicMem *prev, *next;
size_t size;
char * ptr;
char * name;
protected:
BaseDynamicMem ();
~BaseDynamicMem ();
void Alloc (size_t s);
void ReAlloc (size_t s);
void Free ();
// char * Ptr() { return ptr; }
char * Ptr() const { return ptr; }
void Swap (BaseDynamicMem & m2);
public:
void SetName (const char * aname);
static void Print ();
static void GetUsed (int nr, char * ch);
};
template <typename T>
class DynamicMem : public BaseDynamicMem
{
public:
DynamicMem ()
: BaseDynamicMem ()
{
;
}
DynamicMem (size_t s)
: BaseDynamicMem ()
{
Alloc (s);
}
void Alloc (size_t s)
{
BaseDynamicMem::Alloc (sizeof(T) * s);
}
void ReAlloc (size_t s)
{
BaseDynamicMem::ReAlloc (sizeof(T) * s);
}
void Free ()
{
BaseDynamicMem::Free ();
}
/*
const T * Ptr() const
{
return reinterpret_cast<const T*> (BaseDynamicMem::Ptr());
}
*/
const T * Ptr()
{
return reinterpret_cast<T*> (BaseDynamicMem::Ptr());
}
/*
operator const T* () const
{
return reinterpret_cast<const T*> (BaseDynamicMem::Ptr());
}
*/
operator T* () const
{
return reinterpret_cast<T*> (BaseDynamicMem::Ptr());
}
void Swap (DynamicMem<T> & m2)
{
BaseDynamicMem::Swap (m2);
}
protected:
DynamicMem (const DynamicMem & m);
DynamicMem & operator= (const DynamicMem & m);
};
}
#endif

330
libsrc/general/flags.cpp Normal file
View File

@ -0,0 +1,330 @@
/**************************************************************************/
/* File: flags.cc */
/* Author: Joachim Schoeberl */
/* Date: 10. Oct. 96 */
/**************************************************************************/
/*
Datatype Flags
*/
#include <mystdlib.h>
#include <myadt.hpp>
namespace netgen
{
//using namespace netgen;
Flags :: Flags ()
{
;
}
Flags :: ~Flags ()
{
DeleteFlags ();
}
void Flags :: DeleteFlags ()
{
for (int i = 0; i < strflags.Size(); i++)
delete [] strflags[i];
for (int i = 0; i < numlistflags.Size(); i++)
delete numlistflags[i];
strflags.DeleteAll();
numflags.DeleteAll();
defflags.DeleteAll();
strlistflags.DeleteAll();
numlistflags.DeleteAll();
}
void Flags :: SetFlag (const char * name, const char * val)
{
char * hval = new char[strlen (val) + 1];
strcpy (hval, val);
strflags.Set (name, hval);
}
void Flags :: SetFlag (const char * name, double val)
{
numflags.Set (name, val);
}
void Flags :: SetFlag (const char * name)
{
defflags.Set (name, 1);
}
void Flags :: SetFlag (const char * name, const Array<char*> & val)
{
Array<char*> * strarray = new Array<char*>;
for (int i = 1; i <= val.Size(); i++)
{
strarray->Append (new char[strlen(val.Get(i))+1]);
strcpy (strarray->Last(), val.Get(i));
}
strlistflags.Set (name, strarray);
}
void Flags :: SetFlag (const char * name, const Array<double> & val)
{
Array<double> * numarray = new Array<double>;
for (int i = 1; i <= val.Size(); i++)
numarray->Append (val.Get(i));
numlistflags.Set (name, numarray);
}
const char *
Flags :: GetStringFlag (const char * name, const char * def) const
{
if (strflags.Used (name))
return strflags.Get(name);
else
return def;
}
double Flags :: GetNumFlag (const char * name, double def) const
{
if (numflags.Used (name))
return numflags.Get(name);
else
return def;
}
const double * Flags :: GetNumFlagPtr (const char * name) const
{
if (numflags.Used (name))
return & ((SYMBOLTABLE<double>&)numflags).Elem(name);
else
return NULL;
}
double * Flags :: GetNumFlagPtr (const char * name)
{
if (numflags.Used (name))
return & ((SYMBOLTABLE<double>&)numflags).Elem(name);
else
return NULL;
}
bool Flags :: GetDefineFlag (const char * name) const
{
return defflags.Used (name);
}
const Array<char*> &
Flags :: GetStringListFlag (const char * name) const
{
if (strlistflags.Used (name))
return *strlistflags.Get(name);
else
{
static Array<char*> dummy_array(0);
return dummy_array;
}
}
const Array<double> &
Flags ::GetNumListFlag (const char * name) const
{
if (numlistflags.Used (name))
return *numlistflags.Get(name);
else
{
static Array<double> dummy_array(0);
return dummy_array;
}
}
bool Flags :: StringFlagDefined (const char * name) const
{
return strflags.Used (name);
}
bool Flags :: NumFlagDefined (const char * name) const
{
return numflags.Used (name);
}
bool Flags :: StringListFlagDefined (const char * name) const
{
return strlistflags.Used (name);
}
bool Flags :: NumListFlagDefined (const char * name) const
{
return numlistflags.Used (name);
}
void Flags :: SaveFlags (const char * filename) const
{
int i;
ofstream outfile (filename);
for (i = 1; i <= strflags.Size(); i++)
outfile << strflags.GetName(i) << " = " << strflags.Get(i) << endl;
for (i = 1; i <= numflags.Size(); i++)
outfile << numflags.GetName(i) << " = " << numflags.Get(i) << endl;
for (i = 1; i <= defflags.Size(); i++)
outfile << defflags.GetName(i) << endl;
}
void Flags :: PrintFlags (ostream & ost) const
{
int i;
for (i = 1; i <= strflags.Size(); i++)
ost << strflags.GetName(i) << " = " << strflags.Get(i) << endl;
for (i = 1; i <= numflags.Size(); i++)
ost << numflags.GetName(i) << " = " << numflags.Get(i) << endl;
for (i = 1; i <= defflags.Size(); i++)
ost << defflags.GetName(i) << endl;
}
void Flags :: LoadFlags (const char * filename)
{
char name[100], str[100];
char ch;
double val;
ifstream infile(filename);
// (*logout) << "Load flags from " << filename << endl << endl;
while (infile.good())
{
infile >> name;
if (strlen (name) == 0) break;
if (name[0] == '/' && name[1] == '/')
{
// (*logout) << "comment: ";
ch = 0;
while (ch != '\n' && infile.good())
{
ch = infile.get();
// (*logout) << ch;
}
continue;
}
// (*logout) << name;
ch = 0;
infile >> ch;
if (ch != '=')
{
// (*logout) << endl;
infile.putback (ch);
SetFlag (name);
}
else
{
infile >> val;
if (!infile.good())
{
infile.clear();
infile >> str;
SetFlag (name, str);
// (*logout) << " = " << str << endl;
}
else
{
SetFlag (name, val);
// (*logout) << " = " << val << endl;
}
}
}
// (*logout) << endl;
}
void Flags :: SetCommandLineFlag (const char * st)
{
// cout << "clflag = " << st << endl;
istringstream inst( (char *)st);
// istrstream defined with char * (not const char * ?????)
char name[100];
double val;
if (st[0] != '-')
{
cerr << "flag must start with '-'" << endl;
return;
}
const char * pos = strchr (st, '=');
if (!pos)
{
// (cout) << "Add def flag: " << st+1 << endl;
SetFlag (st+1);
}
else
{
// cout << "pos = " << pos << endl;
strncpy (name, st+1, (pos-st)-1);
name[pos-st-1] = 0;
// cout << "name = " << name << endl;
pos++;
char * endptr = NULL;
val = strtod (pos, &endptr);
// cout << "val = " << val << endl;
if (endptr == pos)
{
// (cout) << "Add String Flag: " << name << " = " << pos << endl;
SetFlag (name, pos);
}
else
{
// (cout) << "Add Num Flag: " << name << " = " << val << endl;
SetFlag (name, val);
}
}
/*
inst >> name;
(*mycout) << "name = " << name << endl;
ch = 0;
inst >> ch;
if (ch != '=')
{
SetFlag (name);
}
else
{
inst >> val;
if (!inst.good())
{
inst.clear();
inst >> str;
SetFlag (name, str);
(*mycout) << "str = " << str << endl;
}
else
{
SetFlag (name, val);
(*mycout) << "val = " << val << endl;
}
}
*/
}
}

88
libsrc/general/flags.hpp Normal file
View File

@ -0,0 +1,88 @@
#ifndef FILE_FLAGS
#define FILE_FLAGS
/**************************************************************************/
/* File: flags.hh */
/* Author: Joachim Schoeberl */
/* Date: 10. Oct. 96 */
/**************************************************************************/
namespace netgen
{
/**
Flag - Table.
A flag table maintains string variables, numerical
variables and boolean flags.
*/
class Flags
{
///
SYMBOLTABLE<char *> strflags;
///
SYMBOLTABLE<double> numflags;
///
SYMBOLTABLE<int> defflags;
///
SYMBOLTABLE<Array<char*>*> strlistflags;
///
SYMBOLTABLE<Array<double>*> numlistflags;
public:
///
DLL_HEADER Flags ();
///
DLL_HEADER ~Flags ();
/// Deletes all flags
DLL_HEADER void DeleteFlags ();
/// Sets string flag, overwrite if exists
DLL_HEADER void SetFlag (const char * name, const char * val);
/// Sets numerical flag, overwrite if exists
DLL_HEADER void SetFlag (const char * name, double val);
/// Sets boolean flag
DLL_HEADER void SetFlag (const char * name);
/// Sets string arary falg
DLL_HEADER void SetFlag (const char * name, const Array<char*> & val);
/// Sets double array flag
DLL_HEADER void SetFlag (const char * name, const Array<double> & val);
/// Save flags to file
DLL_HEADER void SaveFlags (const char * filename) const;
/// write flags to stream
DLL_HEADER void PrintFlags (ostream & ost) const;
/// Load flags from file
DLL_HEADER void LoadFlags (const char * filename);
/// set flag of form -name=hello -val=0.5 -defined
DLL_HEADER void SetCommandLineFlag (const char * st);
/// Returns string flag, default value if not exists
DLL_HEADER const char * GetStringFlag (const char * name, const char * def) const;
/// Returns numerical flag, default value if not exists
DLL_HEADER double GetNumFlag (const char * name, double def) const;
/// Returns address of numerical flag, null if not exists
DLL_HEADER const double * GetNumFlagPtr (const char * name) const;
/// Returns address of numerical flag, null if not exists
DLL_HEADER double * GetNumFlagPtr (const char * name);
/// Returns boolean flag
DLL_HEADER bool GetDefineFlag (const char * name) const;
/// Returns string list flag, empty array if not exist
DLL_HEADER const Array<char*> & GetStringListFlag (const char * name) const;
/// Returns num list flag, empty array if not exist
DLL_HEADER const Array<double> & GetNumListFlag (const char * name) const;
/// Test, if string flag is defined
DLL_HEADER bool StringFlagDefined (const char * name) const;
/// Test, if num flag is defined
DLL_HEADER bool NumFlagDefined (const char * name) const;
/// Test, if string list flag is defined
DLL_HEADER bool StringListFlagDefined (const char * name) const;
/// Test, if num list flag is defined
DLL_HEADER bool NumListFlagDefined (const char * name) const;
};
}
#endif

165
libsrc/general/gzstream.cpp Normal file
View File

@ -0,0 +1,165 @@
// ============================================================================
// gzstream, C++ iostream classes wrapping the zlib compression library.
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ============================================================================
//
// File : gzstream.C
// Revision : $Revision: 1.7 $
// Revision_date : $Date: 2003/01/08 14:41:27 $
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
//
// Standard streambuf implementation following Nicolai Josuttis, "The
// Standard C++ Library".
// ============================================================================
#include "gzstream.h"
#include <iostream>
#include <string.h> // for memcpy
#ifdef GZSTREAM_NAMESPACE
namespace GZSTREAM_NAMESPACE {
#endif
// ----------------------------------------------------------------------------
// Internal classes to implement gzstream. See header file for user classes.
// ----------------------------------------------------------------------------
// --------------------------------------
// class gzstreambuf:
// --------------------------------------
gzstreambuf* gzstreambuf::open( const char* name, int open_mode) {
if ( is_open())
return (gzstreambuf*)0;
mode = open_mode;
// no append nor read/write mode
if ((mode & std::ios::ate) || (mode & std::ios::app)
|| ((mode & std::ios::in) && (mode & std::ios::out)))
return (gzstreambuf*)0;
char fmode[10];
char* fmodeptr = fmode;
if ( mode & std::ios::in)
*fmodeptr++ = 'r';
else if ( mode & std::ios::out)
*fmodeptr++ = 'w';
*fmodeptr++ = 'b';
*fmodeptr = '\0';
file = gzopen( name, fmode);
if (file == 0)
return (gzstreambuf*)0;
opened = 1;
return this;
}
gzstreambuf * gzstreambuf::close() {
if ( is_open()) {
sync();
opened = 0;
if ( gzclose( file) == Z_OK)
return this;
}
return (gzstreambuf*)0;
}
int gzstreambuf::underflow() { // used for input buffer only
if ( gptr() && ( gptr() < egptr()))
return * reinterpret_cast<unsigned char *>( gptr());
if ( ! (mode & std::ios::in) || ! opened)
return EOF;
// Josuttis' implementation of inbuf
int n_putback = gptr() - eback();
if ( n_putback > 4)
n_putback = 4;
memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback);
int num = gzread( file, buffer+4, bufferSize-4);
if (num <= 0) // ERROR or EOF
return EOF;
// reset buffer pointers
setg( buffer + (4 - n_putback), // beginning of putback area
buffer + 4, // read position
buffer + 4 + num); // end of buffer
// return next character
return * reinterpret_cast<unsigned char *>( gptr());
}
int gzstreambuf::flush_buffer() {
// Separate the writing of the buffer from overflow() and
// sync() operation.
int w = pptr() - pbase();
if ( gzwrite( file, pbase(), w) != w)
return EOF;
pbump( -w);
return w;
}
int gzstreambuf::overflow( int c) { // used for output buffer only
if ( ! ( mode & std::ios::out) || ! opened)
return EOF;
if (c != EOF) {
*pptr() = c;
pbump(1);
}
if ( flush_buffer() == EOF)
return EOF;
return c;
}
int gzstreambuf::sync() {
// Changed to use flush_buffer() instead of overflow( EOF)
// which caused improper behavior with std::endl and flush(),
// bug reported by Vincent Ricard.
if ( pptr() && pptr() > pbase()) {
if ( flush_buffer() == EOF)
return -1;
}
return 0;
}
// --------------------------------------
// class gzstreambase:
// --------------------------------------
gzstreambase::gzstreambase( const char* name, int mode) {
init( &buf);
open( name, mode);
}
gzstreambase::~gzstreambase() {
buf.close();
}
void gzstreambase::open( const char* name, int open_mode) {
if ( ! buf.open( name, open_mode))
clear( rdstate() | std::ios::badbit);
}
void gzstreambase::close() {
if ( buf.is_open())
if ( ! buf.close())
clear( rdstate() | std::ios::badbit);
}
#ifdef GZSTREAM_NAMESPACE
} // namespace GZSTREAM_NAMESPACE
#endif
// ============================================================================
// EOF //

121
libsrc/general/gzstream.h Normal file
View File

@ -0,0 +1,121 @@
// ============================================================================
// gzstream, C++ iostream classes wrapping the zlib compression library.
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ============================================================================
//
// File : gzstream.h
// Revision : $Revision: 1.5 $
// Revision_date : $Date: 2002/04/26 23:30:15 $
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
//
// Standard streambuf implementation following Nicolai Josuttis, "The
// Standard C++ Library".
// ============================================================================
#ifndef GZSTREAM_H
#define GZSTREAM_H 1
// standard C++ with new header file names and std:: namespace
#include <iostream>
#include <fstream>
#include <zlib.h>
#ifdef GZSTREAM_NAMESPACE
namespace GZSTREAM_NAMESPACE {
#endif
// ----------------------------------------------------------------------------
// Internal classes to implement gzstream. See below for user classes.
// ----------------------------------------------------------------------------
class gzstreambuf : public std::streambuf {
private:
static const int bufferSize = 47+256; // size of data buff
// totals 512 bytes under g++ for igzstream at the end.
gzFile file; // file handle for compressed file
char buffer[bufferSize]; // data buffer
char opened; // open/close state of stream
int mode; // I/O mode
int flush_buffer();
public:
gzstreambuf() : opened(0) {
setp( buffer, buffer + (bufferSize-1));
setg( buffer + 4, // beginning of putback area
buffer + 4, // read position
buffer + 4); // end position
// ASSERT: both input & output capabilities will not be used together
}
int is_open() { return opened; }
gzstreambuf* open( const char* name, int open_mode);
gzstreambuf* close();
~gzstreambuf() { close(); }
virtual int overflow( int c = EOF);
virtual int underflow();
virtual int sync();
};
class gzstreambase : virtual public std::ios {
protected:
gzstreambuf buf;
public:
gzstreambase() { init(&buf); }
gzstreambase( const char* name, int open_mode);
~gzstreambase();
void open( const char* name, int open_mode);
void close();
gzstreambuf* rdbuf() { return &buf; }
};
// ----------------------------------------------------------------------------
// User classes. Use igzstream and ogzstream analogously to ifstream and
// ofstream respectively. They read and write files based on the gz*
// function interface of the zlib. Files are compatible with gzip compression.
// ----------------------------------------------------------------------------
class igzstream : public gzstreambase, public std::istream {
public:
igzstream() : std::istream( &buf) {}
igzstream( const char* name, int open_mode = std::ios::in)
: gzstreambase( name, open_mode), std::istream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const char* name, int open_mode = std::ios::in) {
gzstreambase::open( name, open_mode);
}
};
class ogzstream : public gzstreambase, public std::ostream {
public:
ogzstream() : std::ostream( &buf) {}
ogzstream( const char* name, int mode = std::ios::out)
: gzstreambase( name, mode), std::ostream( &buf) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
void open( const char* name, int open_mode = std::ios::out) {
gzstreambase::open( name, open_mode);
}
};
#ifdef GZSTREAM_NAMESPACE
} // namespace GZSTREAM_NAMESPACE
#endif
#endif // GZSTREAM_H
// ============================================================================
// EOF //

326
libsrc/general/hashtabl.cpp Normal file
View File

@ -0,0 +1,326 @@
/**************************************************************************/
/* File: hashtabl.cpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
/*
Abstract data type HASHTABLE
*/
#include <algorithm>
#include <mystdlib.h>
#include <myadt.hpp>
namespace netgen
{
//using namespace netgen;
void INDEX_4 :: Sort ()
{
if (i[0] > i[1]) Swap (i[0], i[1]);
if (i[2] > i[3]) Swap (i[2], i[3]);
if (i[0] > i[2]) Swap (i[0], i[2]);
if (i[1] > i[3]) Swap (i[1], i[3]);
if (i[1] > i[2]) Swap (i[1], i[2]);
}
void INDEX_4Q :: Sort ()
{
if (min2 (i[1], i[2]) < min2 (i[0], i[3]))
{ Swap (i[0], i[1]); Swap (i[2], i[3]);}
if (i[3] < i[0])
{ Swap (i[0], i[3]); Swap (i[1], i[2]);}
if (i[3] < i[1])
{ Swap (i[1], i[3]); }
}
ostream & operator<<(ostream & s, const INDEX_2 & i2)
{
return s << i2.I1() << ", " << i2.I2();
}
ostream & operator<<(ostream & s, const INDEX_3 & i3)
{
return s << i3.I1() << ", " << i3.I2() << ", " << i3.I3();
}
ostream & operator<<(ostream & s, const INDEX_4 & i4)
{
return s << i4.I1() << ", " << i4.I2() << ", " << i4.I3() << ", " << i4.I4();
}
ostream & operator<<(ostream & s, const INDEX_4Q & i4)
{
return s << i4.I1() << ", " << i4.I2() << ", " << i4.I3() << ", " << i4.I4();
}
int BASE_INDEX_HASHTABLE :: Position (int bnr, const INDEX & ind) const
{
for (int i = 1; i <= hash.EntrySize (bnr); i++)
if (hash.Get(bnr, i) == ind)
return i;
return 0;
}
/*
int BASE_INDEX_2_HASHTABLE :: Position (int bnr, const INDEX_2 & ind) const
{
int i;
for (i = 1; i <= hash.EntrySize (bnr); i++)
if (hash.Get(bnr, i) == ind)
return i;
return 0;
}
*/
void BASE_INDEX_2_HASHTABLE :: PrintStat (ostream & ost) const
{
int n = hash.Size();
int i;
int sumn = 0, sumnn = 0;
for (i = 1; i <= n; i++)
{
sumn += hash.EntrySize(i);
sumnn += sqr (hash.EntrySize(i));
}
ost << "Hashtable: " << endl
<< "size : " << n << endl
<< "elements per row : " << (double(sumn) / double(n)) << endl
<< "av. acces time : "
<< (sumn ? (double (sumnn) / double(sumn)) : 0) << endl;
}
/*
int BASE_INDEX_3_HASHTABLE :: Position (int bnr, const INDEX_3 & ind) const
{
int i;
const INDEX_3 * pi = &hash.Get(bnr, 1);
int n = hash.EntrySize(bnr);
for (i = 1; i <= n; ++i, ++pi)
{
if (*pi == ind)
return i;
}
return 0;
}
*/
BASE_INDEX_CLOSED_HASHTABLE ::
BASE_INDEX_CLOSED_HASHTABLE (int size)
: hash(size)
{
// hash.SetName ("index-hashtable, hash");
invalid = -1;
for (int i = 1; i <= size; i++)
hash.Elem(i) = invalid;
}
void BASE_INDEX_CLOSED_HASHTABLE ::
BaseSetSize (int size)
{
hash.SetSize(size);
for (int i = 1; i <= size; i++)
hash.Elem(i) = invalid;
}
int BASE_INDEX_CLOSED_HASHTABLE ::
Position2 (const INDEX & ind) const
{
int i = HashValue(ind);
while (1)
{
i++;
if (i > hash.Size()) i = 1;
if (hash.Get(i) == ind) return i;
if (hash.Get(i) == invalid) return 0;
}
}
int BASE_INDEX_CLOSED_HASHTABLE ::
PositionCreate2 (const INDEX & ind, int & apos)
{
int i = HashValue(ind);
int startpos = i;
while (1)
{
i++;
if (i > hash.Size()) i = 1;
if (hash.Get(i) == ind)
{
apos = i;
return 0;
}
if (hash.Get(i) == invalid)
{
hash.Elem(i) = ind;
apos = i;
return 1;
}
if (i == startpos)
throw NgException ("Try to set new element in full closed hashtable");
}
}
int BASE_INDEX_CLOSED_HASHTABLE :: UsedElements () const
{
int n = hash.Size();
int cnt = 0;
for (int i = 1; i <= n; i++)
if (hash.Get(i) != invalid)
cnt++;
return cnt;
}
BASE_INDEX_2_CLOSED_HASHTABLE ::
BASE_INDEX_2_CLOSED_HASHTABLE (int size)
: hash(size)
{
// hash.SetName ("i2-hashtable, hash");
invalid = -1;
for (int i = 1; i <= size; i++)
hash.Elem(i).I1() = invalid;
}
void BASE_INDEX_2_CLOSED_HASHTABLE ::
BaseSetSize (int size)
{
hash.SetSize(size);
for (int i = 1; i <= size; i++)
hash.Elem(i).I1() = invalid;
}
int BASE_INDEX_2_CLOSED_HASHTABLE ::
Position2 (const INDEX_2 & ind) const
{
int i = HashValue(ind);
while (1)
{
i++;
if (i > hash.Size()) i = 1;
if (hash.Get(i) == ind) return i;
if (hash.Get(i).I1() == invalid) return 0;
}
}
int BASE_INDEX_2_CLOSED_HASHTABLE ::
PositionCreate2 (const INDEX_2 & ind, int & apos)
{
int i = HashValue(ind);
int startpos = i;
while (1)
{
i++;
if (i > hash.Size()) i = 1;
if (hash.Get(i) == ind)
{
apos = i;
return 0;
}
if (hash.Get(i).I1() == invalid)
{
hash.Elem(i) = ind;
apos = i;
return 1;
}
if (i == startpos)
throw NgException ("Try to set new element in full closed hashtable");
}
}
int BASE_INDEX_2_CLOSED_HASHTABLE :: UsedElements () const
{
int n = hash.Size();
int cnt = 0;
for (int i = 1; i <= n; i++)
if (hash.Get(i).I1() != invalid)
cnt++;
return cnt;
}
void BASE_INDEX_3_CLOSED_HASHTABLE ::
BaseSetSize (int size)
{
hash.SetSize(size);
for (int i = 0; i < size; i++)
hash[i].I1() = invalid;
}
bool BASE_INDEX_3_CLOSED_HASHTABLE ::
PositionCreate2 (const INDEX_3 & ind, int & apos)
{
int i = HashValue(ind);
int startpos = i;
while (1)
{
/*
i++;
if (i >= hash.Size()) i = 0;
*/
i = (i+1) % hash.Size();
if (hash[i] == ind)
{
apos = i;
return false;
}
if (hash[i].I1() == invalid)
{
hash[i] = ind;
apos = i;
return true;
}
if (i == startpos)
throw NgException ("Try to set new element in full closed hashtable");
}
}
}

1369
libsrc/general/hashtabl.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
/**************************************************************************/
/* File: mpi_interface.cpp */
/* Author: Joachim Schoeberl */
/* Date: 04. Apr. 97 */
/**************************************************************************/
#include <mystdlib.h>
#include <myadt.hpp>
namespace netgen
{
#ifdef PARALLEL
void MyMPI_SendCmd (const char * cmd)
{
char buf[100];
strcpy (buf, cmd);
// MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD);
for (int dest = 1; dest < ntasks; dest++)
MPI_Bsend( &buf, 100, MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD);
}
string MyMPI_RecvCmd ()
{
char buf[100];
// MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD);
// VT_OFF();
MPI_Status status;
int flag;
do
{
MPI_Iprobe (0, MPI_TAG_CMD, MPI_COMM_WORLD, &flag, &status);
if (!flag)
{
VT_TRACER ("sleep");
usleep (1000);
}
}
while (!flag);
// VT_ON();
MPI_Recv( &buf, 100, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status);
return string(buf);
}
#endif
}

View File

@ -0,0 +1,359 @@
#ifndef FILE_PARALLEL
#define FILE_PARALLEL
#ifdef VTRACE
#include "vt_user.h"
#else
#define VT_USER_START(n)
#define VT_USER_END(n)
#define VT_TRACER(n)
#endif
namespace netgen
{
extern DLL_HEADER int id, ntasks;
#ifdef PARALLEL
enum { MPI_TAG_CMD = 110 };
enum { MPI_TAG_MESH = 210 };
enum { MPI_TAG_VIS = 310 };
extern MPI_Comm mesh_comm;
template <class T>
MPI_Datatype MyGetMPIType ( )
{ cerr << "ERROR in GetMPIType() -- no type found" << endl;return 0; }
template <>
inline MPI_Datatype MyGetMPIType<int> ( )
{ return MPI_INT; }
template <>
inline MPI_Datatype MyGetMPIType<double> ( )
{ return MPI_DOUBLE; }
template <int S> class Vec;
template <>
inline MPI_Datatype MyGetMPIType<Vec<3> > ()
{
static MPI_Datatype MPI_T = 0;
if (!MPI_T)
{
MPI_Type_contiguous ( 3, MPI_DOUBLE, &MPI_T);
MPI_Type_commit ( &MPI_T );
}
return MPI_T;
};
inline void MyMPI_Send (int i, int dest, int tag)
{
int hi = i;
MPI_Send( &hi, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
}
inline void MyMPI_Recv (int & i, int src, int tag)
{
MPI_Status status;
MPI_Recv( &i, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
}
inline void MyMPI_Send (const string & s, int dest, int tag)
{
MPI_Send( const_cast<char*> (s.c_str()), s.length(), MPI_CHAR, dest, tag, MPI_COMM_WORLD);
}
inline void MyMPI_Recv (string & s, int src, int tag)
{
MPI_Status status;
int len;
MPI_Probe (src, tag, MPI_COMM_WORLD, &status);
MPI_Get_count (&status, MPI_CHAR, &len);
s.assign (len, ' ');
MPI_Recv( &s[0], len, MPI_CHAR, src, tag, MPI_COMM_WORLD, &status);
}
template <class T, int BASE>
inline void MyMPI_Send (FlatArray<T, BASE> s, int dest, int tag)
{
MPI_Send( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD);
}
template <class T, int BASE>
inline void MyMPI_Recv ( FlatArray<T, BASE> s, int src, int tag)
{
MPI_Status status;
MPI_Recv( &s.First(), s.Size(), MyGetMPIType<T>(), src, tag, MPI_COMM_WORLD, &status);
}
template <class T, int BASE>
inline void MyMPI_Recv ( Array <T, BASE> & s, int src, int tag)
{
MPI_Status status;
int len;
MPI_Probe (src, tag, MPI_COMM_WORLD, &status);
MPI_Get_count (&status, MyGetMPIType<T>(), &len);
s.SetSize (len);
MPI_Recv( &s.First(), len, MyGetMPIType<T>(), src, tag, MPI_COMM_WORLD, &status);
}
template <class T, int BASE>
inline int MyMPI_Recv ( Array <T, BASE> & s, int tag)
{
MPI_Status status;
int len;
MPI_Probe (MPI_ANY_SOURCE, tag, MPI_COMM_WORLD, &status);
int src = status.MPI_SOURCE;
MPI_Get_count (&status, MyGetMPIType<T>(), &len);
s.SetSize (len);
MPI_Recv( &s.First(), len, MyGetMPIType<T>(), src, tag, MPI_COMM_WORLD, &status);
return src;
}
/*
template <class T, int BASE>
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
{
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
}
template <class T, int BASE>
inline void MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
{
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
}
*/
template <class T, int BASE>
inline MPI_Request MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm = MPI_COMM_WORLD)
{
MPI_Request request;
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
return request;
}
template <class T, int BASE>
inline MPI_Request MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm = MPI_COMM_WORLD)
{
MPI_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
return request;
}
/*
template <class T, int BASE>
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag)
{
MPI_Request request;
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &request);
MPI_Request_free (&request);
}
template <class T, int BASE>
inline void MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag)
{
MPI_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &request);
MPI_Request_free (&request);
}
*/
/*
send a table entry to each of the prcesses in the group ...
receive-table entries will be set
*/
/*
template <typename T>
inline void MyMPI_ExchangeTable (TABLE<T> & send_data,
TABLE<T> & recv_data, int tag,
MPI_Comm comm = MPI_COMM_WORLD)
{
int ntasks, rank;
MPI_Comm_size(comm, &ntasks);
MPI_Comm_rank(comm, &rank);
Array<MPI_Request> requests;
for (int dest = 0; dest < ntasks; dest++)
if (dest != rank)
requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm));
for (int i = 0; i < ntasks-1; i++)
{
MPI_Status status;
MPI_Probe (MPI_ANY_SOURCE, tag, comm, &status);
int size, src = status.MPI_SOURCE;
MPI_Get_count (&status, MPI_INT, &size);
recv_data.SetEntrySize (src, size, sizeof(T));
requests.Append (MyMPI_IRecv (recv_data[src], src, tag, comm));
}
MPI_Barrier (comm);
MPI_Waitall (requests.Size(), &requests[0], MPI_STATUS_IGNORE);
}
*/
template <typename T>
inline void MyMPI_ExchangeTable (TABLE<T> & send_data,
TABLE<T> & recv_data, int tag,
MPI_Comm comm = MPI_COMM_WORLD)
{
int ntasks, rank;
MPI_Comm_size(comm, &ntasks);
MPI_Comm_rank(comm, &rank);
Array<int> send_sizes(ntasks);
Array<int> recv_sizes(ntasks);
for (int i = 0; i < ntasks; i++)
send_sizes[i] = send_data[i].Size();
MPI_Alltoall (&send_sizes[0], 1, MPI_INT,
&recv_sizes[0], 1, MPI_INT, comm);
// in-place is buggy !
// MPI_Alltoall (MPI_IN_PLACE, 1, MPI_INT,
// &recv_sizes[0], 1, MPI_INT, comm);
for (int i = 0; i < ntasks; i++)
recv_data.SetEntrySize (i, recv_sizes[i], sizeof(T));
Array<MPI_Request> requests;
for (int dest = 0; dest < ntasks; dest++)
if (dest != rank && send_data[dest].Size())
requests.Append (MyMPI_ISend (send_data[dest], dest, tag, comm));
for (int dest = 0; dest < ntasks; dest++)
if (dest != rank && recv_data[dest].Size())
requests.Append (MyMPI_IRecv (recv_data[dest], dest, tag, comm));
// MPI_Barrier (comm);
MPI_Waitall (requests.Size(), &requests[0], MPI_STATUS_IGNORE);
}
extern void MyMPI_SendCmd (const char * cmd);
extern string MyMPI_RecvCmd ();
template <class T>
inline void MyMPI_Bcast (T & s, MPI_Comm comm = MPI_COMM_WORLD)
{
MPI_Bcast (&s, 1, MyGetMPIType<T>(), 0, comm);
}
template <class T>
inline void MyMPI_Bcast (Array<T, 0> & s, MPI_Comm comm = MPI_COMM_WORLD)
{
int size = s.Size();
MyMPI_Bcast (size, comm);
if (id != 0) s.SetSize (size);
MPI_Bcast (&s[0], size, MyGetMPIType<T>(), 0, comm);
}
template <class T>
inline void MyMPI_Bcast (Array<T, 0> & s, int root, MPI_Comm comm = MPI_COMM_WORLD)
{
int id;
MPI_Comm_rank(comm, &id);
int size = s.Size();
MPI_Bcast (&size, 1, MPI_INT, root, comm);
if (id != root) s.SetSize (size);
if ( !size ) return;
MPI_Bcast (&s[0], size, MyGetMPIType<T>(), root, comm);
}
template <class T, class T2>
inline void MyMPI_Allgather (const T & send, FlatArray<T2> recv, MPI_Comm comm)
{
MPI_Allgather( const_cast<T*> (&send), 1, MyGetMPIType<T>(), &recv[0], 1, MyGetMPIType<T2>(), comm);
}
template <class T, class T2>
inline void MyMPI_Alltoall (FlatArray<T> send, FlatArray<T2> recv, MPI_Comm comm)
{
MPI_Alltoall( &send[0], 1, MyGetMPIType<T>(), &recv[0], 1, MyGetMPIType<T2>(), comm);
}
// template <class T, class T2>
// inline void MyMPI_Alltoall_Block (FlatArray<T> send, FlatArray<T2> recv, int blocklen, MPI_Comm comm)
// {
// MPI_Alltoall( &send[0], blocklen, MyGetMPIType<T>(), &recv[0], blocklen, MyGetMPIType<T2>(), comm);
// }
/*
inline void MyMPI_Send ( int *& s, int len, int dest, int tag)
{
int hlen = len;
MPI_Send( &hlen, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
MPI_Send( s, len, MPI_INT, dest, tag, MPI_COMM_WORLD);
}
inline void MyMPI_Recv ( int *& s, int & len, int src, int tag)
{
MPI_Status status;
MPI_Recv( &len, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
if ( s )
delete [] s;
s = new int [len];
MPI_Recv( s, len, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
}
inline void MyMPI_Send ( double * s, int len, int dest, int tag)
{
MPI_Send( &len, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
MPI_Send( s, len, MPI_DOUBLE, dest, tag, MPI_COMM_WORLD);
}
inline void MyMPI_Recv ( double *& s, int & len, int src, int tag)
{
MPI_Status status;
MPI_Recv( &len, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
if ( s )
delete [] s;
s = new double [len];
MPI_Recv( s, len, MPI_DOUBLE, src, tag, MPI_COMM_WORLD, &status);
}
*/
#endif // PARALLEL
}
#endif

48
libsrc/general/myadt.hpp Normal file
View File

@ -0,0 +1,48 @@
#ifndef FILE_MYADT
#define FILE_MYADT
/**************************************************************************/
/* File: myadt.hpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
/*
include for all abstract data types
*/
#include "../include/mystdlib.h"
#include "../include/mydefs.hpp"
#include "ngexception.hpp"
#include "parthreads.hpp"
// #include "moveablemem.hpp"
#include "dynamicmem.hpp"
#include "template.hpp"
#include "array.hpp"
#include "table.hpp"
#include "hashtabl.hpp"
#include "symbolta.hpp"
#include "bitarray.hpp"
#include "flags.hpp"
#include "spbita2d.hpp"
#include "seti.hpp"
#include "optmem.hpp"
#include "autoptr.hpp"
#include "sort.hpp"
#include "stack.hpp"
#include "mystring.hpp"
#include "profiler.hpp"
#include "mpi_interface.hpp"
#include "netgenout.hpp"
#include "gzstream.h"
#endif

426
libsrc/general/mystring.cpp Normal file
View File

@ -0,0 +1,426 @@
//**************************************************************
//
// filename: mystring.cpp
//
// project: doctoral thesis
//
// autor: Dipl.-Ing. Gerstmayr Johannes
//
// generated: 20.12.98
// last change: 20.12.98
// description: implementation for strings
// remarks:
//
//**************************************************************
// string class
#include <mystdlib.h>
#include <myadt.hpp>
#include <linalg.hpp>
#include <gprim.hpp>
namespace netgen
{
void ReadEnclString(istream & in, string & str, const char encl)
{
char currchar;
str = "";
in.get(currchar);
while(in && (currchar == ' ' || currchar == '\t' || currchar == '\n') )
in.get(currchar);
if(currchar == encl)
{
in.get(currchar);
while(in && currchar != encl)
{
str += currchar;
in.get(currchar);
}
}
else
{
in.putback(currchar);
in >> str;
}
}
void DefaultStringErrHandler()
{
cerr << "Error : string operation out of range\n" << flush;
}
void (*MyStr::ErrHandler)() = DefaultStringErrHandler;
/*
MyStr::MyStr()
{
length = 0;
str = shortstr;
str[0] = 0;
}
*/
MyStr::MyStr(const char *s)
{
length = unsigned(strlen(s));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, s);
}
/*
MyStr::MyStr(char s)
{
length = 1;
str = shortstr;
str[0] = s;
str[1] = (char)0;
}
*/
MyStr::MyStr(const MyStr& s)
{
length = s.length;
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, s.str);
}
MyStr::MyStr(int i)
{
char buffer[32];
sprintf(buffer, "%d", i);
length = unsigned(strlen(buffer));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, buffer);
}
MyStr::MyStr(void * p)
{
char buffer[32];
sprintf(buffer, "%p", p);
length = unsigned(strlen(buffer));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, buffer);
}
MyStr::MyStr(long l)
{
char buffer[32];
sprintf(buffer, "%ld", l);
length = unsigned(strlen(buffer));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, buffer);
}
MyStr::MyStr(double d)
{
char buffer[32];
//if (fabs(d) < 1E-100) {d = 0;}
sprintf(buffer, "%g", d);
length = unsigned(strlen(buffer));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, buffer);
}
MyStr::MyStr(const Point3d& p)
{
char buffer[80];
//if (fabs(d) < 1E-100) {d = 0;}
sprintf(buffer, "[%g, %g, %g]", p.X(), p.Y(), p.Z());
length = unsigned(strlen(buffer));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, buffer);
}
MyStr::MyStr(const Vec3d& p)
{
char buffer[80];
//if (fabs(d) < 1E-100) {d = 0;}
sprintf(buffer, "[%g, %g, %g]", p.X(), p.Y(), p.Z());
length = unsigned(strlen(buffer));
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, buffer);
}
MyStr::MyStr(unsigned n, int)
{
length = n;
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
str[n] = 0;
}
MyStr::MyStr(const string & st)
{
length = unsigned(st.length());
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy (str, st.c_str());
}
MyStr MyStr::Left(unsigned r)
{
if(r > length)
{
MyStr::ErrHandler();
MyStr s;
return s;
}
else
{
MyStr tmp(r, 0);
strncpy(tmp.str, str, r);
return tmp;
}
}
MyStr MyStr::Right(unsigned l)
{
if(l > length)
{
MyStr::ErrHandler();
MyStr s;
return s;
}
else
{
MyStr tmp(l, 0);
strncpy(tmp.str, str + length - l, l);
return tmp;
}
}
MyStr& MyStr::InsertAt(unsigned pos, const MyStr& s)
{
if(pos > length)
{
MyStr::ErrHandler();
return *this;
}
int newLength = length + s.length;
char *tmp = new char[newLength + 1];
strncpy(tmp, str, pos);
strcpy(tmp + pos, s.str);
strcpy(tmp + pos + s.length, str + pos);
if (length > SHORTLEN) delete [] str;
length = newLength;
if (length > SHORTLEN)
str = tmp;
else
{
strcpy (shortstr, tmp);
delete [] tmp;
str = shortstr;
}
return *this;
}
MyStr &MyStr::WriteAt(unsigned pos, const MyStr& s)
{
if(pos > length)
{
MyStr::ErrHandler();
return *this;
}
unsigned n = length - pos;
if(s.length < n)
n = s.length;
strncpy(str + pos, s.str, n);
return *this;
}
void MyStr::ConvertTextToExcel()
{
/*
for (int i = 0; i < Length(); i++)
{
if ((*this)[i]==',') {(*this)[i] = ';';}
else if ((*this)[i]=='.') {(*this)[i] = ',';}
}
*/
}
void MyStr::ConvertExcelToText()
{
/*
for (int i = 0; i < Length(); i++)
{
if ((*this)[i]==',') {(*this)[i] = '.';}
else if ((*this)[i]==';') {(*this)[i] = ',';}
}
*/
}
MyStr& MyStr::operator = (const MyStr& s)
{
if (length > SHORTLEN) delete [] str;
length = s.length;
if (length > SHORTLEN)
str = new char[length + 1];
else
str = shortstr;
strcpy(str, s.str);
return *this;
}
MyStr operator + (const MyStr& s1, const MyStr& s2)
{
MyStr tmp(s1.length + s2.length, 0);
if (s1.length != 0) strcpy(tmp.str, s1.str);
if (s2.length != 0) strcpy(tmp.str + s1.length, s2.str);
return tmp;
}
void MyStr::operator += (const MyStr& s)
{
if (length+s.length <= SHORTLEN)
{
if (s.length != 0) strcpy(shortstr + length, s.str);
}
else
{
char *tmp = new char[length + s.length + 1];
if (length != 0) strcpy(tmp, str);
if (s.length != 0) strcpy(tmp + length, s.str);
if (length > SHORTLEN) delete [] str;
length += s.length;
str = tmp;
}
}
char& MyStr::operator [] (unsigned n)
{
static char dummy;
if(n < length)
return str[n];
else
{
MyStr::ErrHandler();
return dummy;
}
}
char MyStr::operator [] (unsigned n) const
{
static char dummy;
if(n < length)
return str[n];
else
{
MyStr::ErrHandler();
return dummy;
}
}
MyStr MyStr::operator () (unsigned l, unsigned r)
{
if((l > r) || (r > length))
{
MyStr::ErrHandler();
MyStr s;
return s;
}
else
{
int n = r - l + 1;
MyStr tmp(n, 0);
strncpy(tmp.str, str + 1, n);
return tmp;
}
}
string MyStr::cpp_string(void) const
{
string aux(str,length);
return aux;
}
/*
istream& operator >> (istream& is, MyStr& s)
{
const int buflen = 1000;
char buffer[buflen+1];
int end = 0;
s = "";
MyStr str;
while (!end)
{
is.get(buffer, buflen);
str = MyStr(buffer);
s += str;
if (is.peek() == EOF) {end = 1;}
}
return is;
}
*/
/*
#ifdef __borland
::ifstream& operator >> (::ifstream& is, MyStr& s) // wb
{ // wb
const int buflen = 1000; // wb
char buffer[buflen+1]; // wb
// wb
int end = 0; // wb
s = ""; // wb
MyStr str; // wb
// wb
while (!end) // wb
{ // wb
is.get(buffer, buflen); // wb
str = MyStr(buffer); // wb
s += str; // wb
if (is.peek() == EOF) {end = 1;} // wb
} // wb
// wb
return is; // wb
}
#endif
*/
}

220
libsrc/general/mystring.hpp Normal file
View File

@ -0,0 +1,220 @@
//**************************************************************
//
// filename: mystring.h
//
// project: doctoral thesis, program smart
//
// autor: Dipl.-Ing. Gerstmayr Johannes
//
// generated: 20.12.98
// last change: 20.12.98
// description: base class for strings
// remarks: string with n characters has
// 0..n-1 characters and at pos n a 0
//
//**************************************************************
#ifndef MYSTRING__H
#define MYSTRING__H
namespace netgen
{
class Point3d;
class Vec3d;
// extract string str which is enclosed by the given character encl from a given string in
void ReadEnclString(istream & in, string & str, const char encl);
class MyStr;
DLL_HEADER MyStr operator + (const MyStr &, const MyStr &);
DLL_HEADER int operator == (const MyStr &, const MyStr &);
DLL_HEADER int operator < (const MyStr &, const MyStr &);
DLL_HEADER int operator <= (const MyStr &, const MyStr &);
DLL_HEADER int operator > (const MyStr &, const MyStr &);
DLL_HEADER int operator >= (const MyStr &, const MyStr &);
DLL_HEADER int operator != (const MyStr &, const MyStr &);
DLL_HEADER ostream& operator << (ostream &, const MyStr &);
DLL_HEADER istream& operator >> (istream &, MyStr &);
class DLL_HEADER MyStr
{
public:
MyStr();
MyStr(const char *);
MyStr(char);
MyStr(const MyStr &);
MyStr(int);
MyStr(void *);
MyStr(long);
MyStr(double);
MyStr(const Point3d& p);
MyStr(const Vec3d& p);
MyStr(const string & st);
~MyStr();
MyStr Left(unsigned);
MyStr Right(unsigned);
MyStr& InsertAt(unsigned, const MyStr &);
MyStr& WriteAt(unsigned, const MyStr &);
unsigned Length() const;
int Find(const char);
int Find(const char *);
int Find(const MyStr &);
MyStr& operator = (const MyStr &);
DLL_HEADER friend MyStr operator + (const MyStr &, const MyStr &);
void operator += (const MyStr &);
char* c_str();
string cpp_string(void) const;
//change every ',' -> ';', '.' -> ','
void ConvertTextToExcel();
//change every ','->'.', ';'->','
void ConvertExcelToText();
MyStr operator () (unsigned, unsigned);
operator int();
operator double();
operator long();
operator char *();
char& operator [] (unsigned int);
char operator [] (unsigned int) const;
DLL_HEADER friend int operator == (const MyStr &, const MyStr &);
DLL_HEADER friend int operator < (const MyStr &, const MyStr &);
DLL_HEADER friend int operator <= (const MyStr &, const MyStr &);
DLL_HEADER friend int operator > (const MyStr &, const MyStr &);
DLL_HEADER friend int operator >= (const MyStr &, const MyStr &);
DLL_HEADER friend int operator != (const MyStr &, const MyStr &);
DLL_HEADER friend ostream& operator << (ostream &, const MyStr &);
DLL_HEADER friend istream& operator >> (istream &, MyStr &);
static void SetToErrHandler(void (*)());
private:
MyStr(unsigned, int);
char *str;
unsigned length;
enum { SHORTLEN = 24 };
char shortstr[SHORTLEN+1];
static void(*ErrHandler)();
};
inline MyStr::MyStr()
{
length = 0;
str = shortstr;
str[0] = 0;
}
inline MyStr::MyStr(char s)
{
length = 1;
str = shortstr;
str[0] = s;
str[1] = (char)0;
}
inline MyStr::~MyStr()
{
if (length > SHORTLEN)
delete [] str;
}
inline unsigned MyStr::Length() const
{
return length;
}
inline int MyStr::Find(const char c)
{
char *pos = strchr(str, int(c));
return pos ? int(pos - str) : -1;
}
inline int MyStr::Find(const MyStr &s)
{
char *pos = strstr(str, s.str);
return pos ? int(pos - str) : -1;
}
inline int MyStr::Find(const char *s)
{
char *pos = strstr(str, s);
return pos ? int(pos - str) : -1;
}
inline MyStr::operator int()
{
return atoi(str);
}
inline MyStr::operator double()
{
return atof(str);
}
inline MyStr::operator long()
{
return atol(str);
}
inline MyStr::operator char *()
{
return str;
}
inline char* MyStr::c_str()
{
return str;
}
inline int operator == (const MyStr &s1, const MyStr& s2)
{
return strcmp(s1.str, s2.str) == 0;
}
inline int operator < (const MyStr &s1, const MyStr& s2)
{
return strcmp(s1.str, s2.str) < 0;
}
inline int operator <= (const MyStr &s1, const MyStr& s2)
{
return strcmp(s1.str, s2.str) <= 0;
}
inline int operator > (const MyStr &s1, const MyStr& s2)
{
return strcmp(s1.str, s2.str) > 0;
}
inline int operator >= (const MyStr &s1, const MyStr& s2)
{
return strcmp(s1.str, s2.str) >= 0;
}
inline int operator != (const MyStr &s1, const MyStr& s2)
{
return !(s1 == s2);
}
inline ostream& operator << (ostream& os, const MyStr& s)
{
return os << s.str;
}
inline void MyStr::SetToErrHandler(void (*Handler)())
{
ErrHandler = Handler;
};
}
#endif

View File

@ -0,0 +1,208 @@
#ifndef NETGEN_OUT_STREAM_HPP__
#define NETGEN_OUT_STREAM_HPP__
// #include <ostream>
// #include <mystdlib.h>
// #include <meshing.hpp>
namespace netgen
{
#ifdef PARALLEL
extern int id;
extern int ntasks;
#endif
DLL_HEADER extern int printmessage_importance;
DLL_HEADER extern int printdots;
class Imp
{
int importance;
public:
Imp () : importance(0) { ; }
Imp ( int aimportance ) : importance(aimportance) { ; }
int GetImp () const { return importance; }
};
class Proc
{
int proc;
public:
Proc () : proc(0) { ; }
Proc ( int aproc ) : proc(aproc) { ; }
int GetProc () const { return proc; }
};
class Procs
{
const netgen::FlatArray<int> procs;
public:
Procs ( const netgen::FlatArray<int> & aprocs ) : procs (aprocs) { ; }
const netgen::FlatArray<int> & GetProcs () const { return procs; }
};
class NetgenOutStream
{
ostream * out;
bool print;
bool printheader;
public:
NetgenOutStream() :
out(&std::cout),
print(1),
printheader(1)
{
;
}
NetgenOutStream(ostream * aout, Imp imp ) :
out(aout),
printheader(1)
{
if ( netgen::printmessage_importance >= imp.GetImp() )
print = true;
else
print = false;
}
NetgenOutStream(ostream * aout, Proc proc ) :
out(aout),
printheader(1)
{
#ifdef PARALLEL
if ( netgen::id == proc.GetProc() )
print = true;
else
print = false;
#else
if ( 0 == proc.GetProc() )
print = true;
else
print = false;
#endif
}
NetgenOutStream(ostream * aout, Procs & procs ) :
out(aout),
printheader(1)
{
#ifdef PARALLEL
if ( procs.GetProcs().Contains(netgen::id) )
print = true;
else
print = false;
#else
if ( procs.GetProcs().Contains(0) )
print = true;
else
print = false;
#endif
}
ostream & OStream ()
{
return *out;
}
template <typename T>
NetgenOutStream & operator<< (T & var)
{
if ( print )
{
#ifdef PARALLEL
if ( printheader )
{
*out << "proc " << netgen::id << ": ";
printheader = false;
}
#endif
*out << var;
}
return (*this);
}
NetgenOutStream& operator<< (ostream& ( *pf )(ostream&))
{
if ( print )
*out << (*pf) ;
return (*this);
}
NetgenOutStream& operator<< (ios& ( *pf )(ios&))
{
if ( print)
*out << (*pf) ;
printheader = 1;
return (*this);
}
NetgenOutStream& operator<< (ios_base& ( *pf )(ios_base&))
{
if (print )
*out << (*pf) ;
return (*this);
}
};
/*
NetgenOutStream operator<< ( ostream & ost, Imp imp );
NetgenOutStream operator<< ( ostream & ost, Proc proc );
NetgenOutStream operator<< ( ostream & ost, Procs & procs );
*/
inline NetgenOutStream operator<< ( ostream & ost, Imp imp )
{
return ( NetgenOutStream ( &ost, imp ) );
}
inline NetgenOutStream operator<< ( ostream & ost, Proc proc )
{
return ( NetgenOutStream ( &ost, proc ) );
}
inline NetgenOutStream operator<< ( ostream & ost, Procs & procs )
{
return ( NetgenOutStream ( &ost, procs ) );
}
// {
// return ( NetgenOutStream ( &ost, imp.GetImp() ) );
// }
// template <typename T>
// NetgenOutStream& operator<< (NetgenOutStream& out, T c )
// {
// out.OStream() << c << endl;
// return out;
// }
}
#endif

View File

@ -0,0 +1,33 @@
/**************************************************************************/
/* File: ngexception.cpp */
/* Author: Joachim Schoeberl */
/* Date: 16. Jan. 02 */
/**************************************************************************/
#include <myadt.hpp>
namespace netgen
{
//using namespace netgen;
NgException :: NgException (const string & s)
: what(s)
{
;
}
NgException :: ~NgException ()
{
;
}
/// append string to description
void NgException :: Append (const string & s)
{
what += s;
}
}

View File

@ -0,0 +1,33 @@
#ifndef FILE_NGEXCEPTION
#define FILE_NGEXCEPTION
/**************************************************************************/
/* File: ngexception.hpp */
/* Author: Joachim Schoeberl */
/* Date: 16. Jan. 2002 */
/**************************************************************************/
namespace netgen
{
/// Base class for all ng exceptions
class NgException
{
/// verbal description of exception
string what;
public:
///
DLL_HEADER NgException (const string & s);
///
DLL_HEADER virtual ~NgException ();
/// append string to description
DLL_HEADER void Append (const string & s);
// void Append (const char * s);
/// verbal description of exception
const string & What() const { return what; }
};
}
#endif

62
libsrc/general/optmem.cpp Normal file
View File

@ -0,0 +1,62 @@
/**************************************************************************/
/* File: optmem.cpp */
/* Author: Joachim Schoeberl */
/* Date: 04. Apr. 97 */
/**************************************************************************/
/*
Abstract data type Array
*/
#include <mystdlib.h>
#include <myadt.hpp>
namespace netgen
{
BlockAllocator :: BlockAllocator (unsigned asize, unsigned ablocks)
: bablocks (0)
{
if (asize < sizeof(void*))
asize = sizeof(void*);
size = asize;
blocks = ablocks;
freelist = NULL;
}
BlockAllocator :: ~BlockAllocator ()
{
for (int i = 0; i < bablocks.Size(); i++)
delete [] bablocks[i];
}
void * BlockAllocator :: Alloc ()
{
// return new char[size];
if (!freelist)
{
// cout << "freelist = " << freelist << endl;
// cout << "BlockAlloc: " << size*blocks << endl;
char * hcp = new char [size * blocks];
bablocks.Append (hcp);
bablocks.Last() = hcp;
for (unsigned i = 0; i < blocks-1; i++)
*(void**)&(hcp[i * size]) = &(hcp[ (i+1) * size]);
*(void**)&(hcp[(blocks-1)*size]) = NULL;
freelist = hcp;
}
void * p = freelist;
freelist = *(void**)freelist;
return p;
}
/*
void BlockAllocator :: Free (void * p)
{
*(void**)p = freelist;
freelist = p;
}
*/
}

62
libsrc/general/optmem.hpp Normal file
View File

@ -0,0 +1,62 @@
#ifndef FILE_OPTMEM
#define FILE_OPTMEM
/**************************************************************************/
/* File: optmem.hh */
/* Author: Joachim Schoeberl */
/* Date: 04. Apr. 97 */
/**************************************************************************/
namespace netgen
{
/**
Optimized Memory allocation classes
*/
class BlockAllocator
{
private:
///
unsigned size, blocks;
///
void * freelist;
///
Array<char*> bablocks;
public:
///
BlockAllocator (unsigned asize, unsigned ablocks = 100);
///
~BlockAllocator ();
///
void * Alloc ();
/*
{
if (!freelist)
Alloc2();
void * p = freelist;
// freelist = *(void**)freelist;
freelist = *static_cast<void**> (freelist);
return p;
}
*/
///
void Free (void * p)
{
*(void**)p = freelist;
freelist = p;
}
private:
// void Alloc2 ();
};
}
#endif

View File

@ -0,0 +1,40 @@
/**************************************************************************/
/* File: parthreads.cpp */
/* Author: Joachim Schoeberl */
/* Date: 01. Jun. 95 */
/**************************************************************************/
#include <mystdlib.h>
#include <myadt.hpp>
/*
namespace netgen
{
using namespace netgen;
#ifdef WIN32
NgLock :: NgLock (NgMutex & mut)
: sl(&mut.cs)
{
;
}
void NgLock :: Lock ()
{
sl.Lock();
}
void NgLock :: UnLock ()
{
sl.Unlock();
}
#else
#endif
}
*/

View File

@ -0,0 +1,192 @@
#ifndef FILE_PARTHREADS
#define FILE_PARTHREADS
/**************************************************************************/
/* File: parthreads.hh */
/* Author: Joachim Schoeberl */
/* Date: 22. Nov. 2000 */
/**************************************************************************/
/*
Parallel thread, Mutex,
*/
namespace netgen
{
#ifdef NO_PARALLEL_THREADS
class NgMutex { };
class NgLock
{
public:
NgLock (NgMutex & mut, bool lock = 0) { ; }
void Lock () { ; }
void UnLock () { ; }
};
#else
#ifdef _MSC_VER
#ifdef MSVC_EXPRESS
// #include <pthread.h>
class NgMutex
{
pthread_mutex_t mut;
public:
NgMutex ()
{
pthread_mutex_init (&mut, NULL);
}
friend class NgLock;
};
class NgLock
{
pthread_mutex_t & mut;
bool locked;
public:
NgLock (NgMutex & ngmut, bool lock = false)
: mut (ngmut.mut)
{
if (lock)
pthread_mutex_lock (&mut);
locked = lock;
};
~NgLock()
{
if (locked)
pthread_mutex_unlock (&mut);
}
void Lock ()
{
pthread_mutex_lock (&mut);
locked = true;
}
void UnLock ()
{
pthread_mutex_unlock (&mut);
locked = false;
}
/*
int TryLock ()
{
return pthread_mutex_trylock (&mut);
}
*/
};
#else // Using MS VC++ Standard / Enterprise / Professional edition...
class NgMutex
{
CCriticalSection cs;
public:
NgMutex ()
{ ; }
friend class NgLock;
};
class NgLock
{
CSingleLock sl;
bool locked;
public:
NgLock (NgMutex & mut, bool lock = 0)
: sl(&mut.cs)
{
if (lock) sl.Lock();
locked = lock;
}
~NgLock ()
{
if (locked) sl.Unlock();
}
void Lock ()
{
sl.Lock();
locked = 1;
}
void UnLock ()
{
sl.Unlock();
locked = 0;
}
};
#endif // MSVC_EXPRESS
#else
// #include <pthread.h>
class NgMutex
{
pthread_mutex_t mut;
public:
NgMutex ()
{
pthread_mutex_init (&mut, NULL);
}
friend class NgLock;
};
class NgLock
{
pthread_mutex_t & mut;
bool locked;
public:
NgLock (NgMutex & ngmut, bool lock = false)
: mut (ngmut.mut)
{
if (lock)
pthread_mutex_lock (&mut);
locked = lock;
};
~NgLock()
{
if (locked)
pthread_mutex_unlock (&mut);
}
void Lock ()
{
pthread_mutex_lock (&mut);
locked = true;
}
void UnLock ()
{
pthread_mutex_unlock (&mut);
locked = false;
}
/*
int TryLock ()
{
return pthread_mutex_trylock (&mut);
}
*/
};
#endif
#endif
}
#endif

127
libsrc/general/profiler.cpp Normal file
View File

@ -0,0 +1,127 @@
/**************************************************************************/
/* File: profiler.cpp */
/* Author: Joachim Schoeberl */
/* Date: 19. Apr. 2002 */
/**************************************************************************/
#include <myadt.hpp>
namespace netgen
{
//using namespace netgen;
long int NgProfiler::tottimes[SIZE];
long int NgProfiler::starttimes[SIZE];
long int NgProfiler::counts[SIZE];
string NgProfiler::names[SIZE];
int NgProfiler::usedcounter[SIZE];
NgProfiler :: NgProfiler()
{
for (int i = 0; i < SIZE; i++)
{
tottimes[i] = 0;
usedcounter[i] = 0;
}
total_timer = CreateTimer ("total CPU time");
StartTimer (total_timer);
}
NgProfiler :: ~NgProfiler()
{
#ifndef PARALLEL
StopTimer (total_timer);
#endif
//ofstream prof;
//prof.open("ng.prof");
// ofstream-constructor may be called after STL-stuff is destructed,
// which leads to an "order of destruction"-problem,
// thus we use the C-variant:
if (getenv ("NGPROFILE"))
{
char filename[100];
#ifdef PARALLEL
sprintf (filename, "netgen.prof.%d", id);
#else
sprintf (filename, "netgen.prof");
#endif
if (id == 0) printf ("write profile to file netgen.prof\n");
FILE *prof = fopen(filename,"w");
Print (prof);
fclose(prof);
}
}
// void NgProfiler :: Print (ostream & prof)
// {
// for (int i = 0; i < SIZE; i++)
// if (counts[i] != 0 || usedcounter[i] != 0)
// {
// prof.setf (ios::fixed, ios::floatfield);
// prof.setf (ios::showpoint);
// prof // << "job " << setw(3) << i
// << "calls " << setw(8) << counts[i]
// << ", time " << setprecision(2) << setw(6) << double(tottimes[i]) / CLOCKS_PER_SEC << " sec";
// if (usedcounter[i])
// prof << " " << names[i];
// else
// prof << " " << i;
// prof << endl;
// }
// }
void NgProfiler :: Print (FILE * prof)
{
for (int i = 0; i < SIZE; i++)
if (counts[i] != 0 || usedcounter[i] != 0)
{
//fprintf(prof,"job %3i calls %8i, time %6.2f sec",i,counts[i],double(tottimes[i]) / CLOCKS_PER_SEC);
fprintf(prof,"calls %8li, time %6.2f sec",counts[i],double(tottimes[i]) / CLOCKS_PER_SEC);
if(usedcounter[i])
fprintf(prof," %s",names[i].c_str());
else
fprintf(prof," %i",i);
fprintf(prof,"\n");
}
}
int NgProfiler :: CreateTimer (const string & name)
{
for (int i = SIZE-1; i > 0; i--)
if(names[i] == name)
return i;
for (int i = SIZE-1; i > 0; i--)
if (!usedcounter[i])
{
usedcounter[i] = 1;
names[i] = name;
return i;
}
return -1;
}
void NgProfiler :: ClearTimers ()
{
for (int i = 0; i < SIZE; i++)
{
tottimes[i] = 0;
counts[i] = 0;
}
}
NgProfiler prof;
}

View File

@ -0,0 +1,68 @@
#ifndef FILE_NG_PROFILER
#define FILE_NG_PROFILER
/**************************************************************************/
/* File: profiler.hpp */
/* Author: Joachim Schoeberl */
/* Date: 5. Jan. 2005 */
/**************************************************************************/
#ifdef VTRACE
#include "vt_user.h"
#else
#define VT_USER_START(n)
#define VT_USER_END(n)
#define VT_TRACER(n)
#endif
namespace netgen
{
class NgProfiler
{
enum { SIZE = 1000 };
static long int tottimes[SIZE];
static long int starttimes[SIZE];
static long int counts[SIZE];
static string names[SIZE];
static int usedcounter[SIZE];
int total_timer;
public:
NgProfiler();
~NgProfiler();
static int CreateTimer (const string & name);
static void StartTimer (int nr)
{
starttimes[nr] = clock(); counts[nr]++;
// VT_USER_START (const_cast<char*> (names[nr].c_str()));
VT_USER_START ( (char * const) (names[nr].c_str()));
}
static void StopTimer (int nr)
{
tottimes[nr] += clock()-starttimes[nr];
VT_USER_END (const_cast<char*> (names[nr].c_str()));
}
//static void Print (ostream & ost);
static void Print (FILE * prof);
static void ClearTimers ();
class RegionTimer
{
int nr;
public:
RegionTimer (int anr) : nr(anr)
{ StartTimer (nr); }
~RegionTimer () { StopTimer (nr); }
};
};
}
#endif

70
libsrc/general/seti.cpp Normal file
View File

@ -0,0 +1,70 @@
#include <mystdlib.h>
#include <myadt.hpp>
namespace netgen
{
//using namespace netgen;
IndexSet :: IndexSet (int maxind)
{
SetMaxIndex (maxind);
}
IndexSet :: ~IndexSet ()
{
Clear();
}
void IndexSet :: SetMaxIndex (int maxind)
{
if (maxind > flags.Size())
{
flags.SetSize (2 * maxind);
flags.Clear();
}
}
/*
int IndexSet :: IsIn (int ind) const
{
return flags.Test (ind);
}
*/
/*
void IndexSet :: Add (int ind)
{
if (ind > flags.Size())
{
cerr << "out of range" << endl;
exit (1);
}
if (!flags.Test(ind))
{
set.Append (ind);
flags.Set (ind);
}
}
*/
void IndexSet :: Del (int ind)
{
for (int i = 1; i <= set.Size(); i++)
if (set.Get(i) == ind)
{
set.DeleteElement (ind);
break;
}
flags.Clear (ind);
}
void IndexSet :: Clear ()
{
for (int i = 1; i <= set.Size(); i++)
flags.Clear (set.Get(i));
set.SetSize (0);
}
}

Some files were not shown because too many files have changed in this diff Show More