[MOAB-dev] r1803 - in MOAB/trunk: . tools tools/mcnpmit
bckiedro at mcs.anl.gov
bckiedro at mcs.anl.gov
Sat May 10 13:11:34 CDT 2008
Author: bckiedro
Date: 2008-05-10 13:11:32 -0500 (Sat, 10 May 2008)
New Revision: 1803
Added:
MOAB/trunk/tools/mcnpmit/
MOAB/trunk/tools/mcnpmit/Makefile.am
MOAB/trunk/tools/mcnpmit/Makefile.in
MOAB/trunk/tools/mcnpmit/README
MOAB/trunk/tools/mcnpmit/main.cpp
MOAB/trunk/tools/mcnpmit/mcnpmit.cpp
MOAB/trunk/tools/mcnpmit/mcnpmit.hpp
Modified:
MOAB/trunk/configure.in
MOAB/trunk/tools/Makefile.am
MOAB/trunk/tools/README.tools
Log:
BCK 05/10/2008
Added the MCNP Mesh Interpolation Tool called mcnpmit to
the list of MOAB tools.
Modified: MOAB/trunk/configure.in
===================================================================
--- MOAB/trunk/configure.in 2008-05-09 20:04:58 UTC (rev 1802)
+++ MOAB/trunk/configure.in 2008-05-10 18:11:32 UTC (rev 1803)
@@ -236,6 +236,7 @@
MB_OPTIONAL_TOOL([mbsize], [yes])
MB_OPTIONAL_TOOL([mbskin], [yes])
MB_OPTIONAL_TOOL([mbtagprop], [yes])
+MB_OPTIONAL_TOOL([mcnpmit], [yes])
MB_OPTIONAL_TOOL([spheredecomp], [yes])
MB_OPTIONAL_TOOL([mbsurfplot], [yes])
MB_OPTIONAL_TOOL([mbzoltan], [no] )
@@ -814,6 +815,7 @@
tools/mbchaco/Makefile
tools/mbzoltan/Config.moab
tools/mbzoltan/Makefile
+ tools/mcnpmit/Makefile
tools/qvdual/Makefile
tools/size/Makefile
tools/skin/Makefile
Modified: MOAB/trunk/tools/Makefile.am
===================================================================
--- MOAB/trunk/tools/Makefile.am 2008-05-09 20:04:58 UTC (rev 1802)
+++ MOAB/trunk/tools/Makefile.am 2008-05-10 18:11:32 UTC (rev 1803)
@@ -61,6 +61,12 @@
mbsurfplot_DIR=
endif
+if ENABLE_mcnpmit
+ mcnpmit_DIR = mcnpmit
+else
+ mcnpmit_DIR =
+endif
+
if ENABLE_dagmc
dagmc_DIR = dagmc
else
@@ -79,6 +85,7 @@
$(mbchaco_DIR) \
$(mbzoltan_DIR) \
$(mbperf_DIR) \
+ $(mcnpmit_DIR) \
$(qvdual_DIR) \
$(size_DIR) \
$(skin_DIR) \
Modified: MOAB/trunk/tools/README.tools
===================================================================
--- MOAB/trunk/tools/README.tools 2008-05-09 20:04:58 UTC (rev 1802)
+++ MOAB/trunk/tools/README.tools 2008-05-10 18:11:32 UTC (rev 1803)
@@ -11,6 +11,7 @@
mbperf: performance tests for MOAB, unstructured and structured
mbzoltan: static and dynamic partitioner / load balancer, based on
Sandia Zoltan library
+mcnpmit: tool to interpolate .unv meshes on MCNP meshtal files
qvdual: mesh visualization tool, based on Qt and Vtk; can visualize
hex mesh dual, among other things
size: reads mesh and prints size by geometric owner or block/boundary
Added: MOAB/trunk/tools/mcnpmit/Makefile.am
===================================================================
--- MOAB/trunk/tools/mcnpmit/Makefile.am (rev 0)
+++ MOAB/trunk/tools/mcnpmit/Makefile.am 2008-05-10 18:11:32 UTC (rev 1803)
@@ -0,0 +1,7 @@
+AUTOMAKE_OPTIONS = foreign
+DEFS = $(DEFINES)
+INCLUDES += -I$(top_srcdir) -I$(top_builddir)
+bin_PROGRAMS = mcnpmit
+mcnpmit_SOURCES = mcnpmit.cpp main.cpp
+LDADD = $(top_builddir)/libMOAB.la
+mcnpmit_DEPENDENCIES = $(top_builddir)/libMOAB.la
Added: MOAB/trunk/tools/mcnpmit/Makefile.in
===================================================================
--- MOAB/trunk/tools/mcnpmit/Makefile.in (rev 0)
+++ MOAB/trunk/tools/mcnpmit/Makefile.in 2008-05-10 18:11:32 UTC (rev 1803)
@@ -0,0 +1,544 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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@
+target_triplet = @target@
+bin_PROGRAMS = mcnpmit$(EXEEXT)
+subdir = tools/mcnpmit
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/compiler.m4 \
+ $(top_srcdir)/m4/cplusplus.m4 $(top_srcdir)/m4/hdf5.m4 \
+ $(top_srcdir)/m4/netcdf.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h $(top_builddir)/MBVersion.h \
+ $(top_builddir)/MBEntityHandle.h $(top_builddir)/MBCN_FCDefs.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_mcnpmit_OBJECTS = mcnpmit.$(OBJEXT) main.$(OBJEXT)
+mcnpmit_OBJECTS = $(am_mcnpmit_OBJECTS)
+mcnpmit_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir) -I$(top_builddir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(mcnpmit_SOURCES)
+DIST_SOURCES = $(mcnpmit_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AM_LDFLAGS = @AM_LDFLAGS@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BABEL_DIR = @BABEL_DIR@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CGM_CONFIG_OPTIONS = @CGM_CONFIG_OPTIONS@
+CGM_DIR = @CGM_DIR@
+CHACO_INCLUDES = @CHACO_INCLUDES@
+CHACO_LIBS = @CHACO_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DAGMC_CONFIG_OPTIONS = @DAGMC_CONFIG_OPTIONS@
+DEFINES = @DEFINES@
+DEFS = $(DEFINES)
+DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
+DOXYGEN = @DOXYGEN@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_DOXYGEN_FALSE = @ENABLE_DOXYGEN_FALSE@
+ENABLE_DOXYGEN_TRUE = @ENABLE_DOXYGEN_TRUE@
+ENABLE_dagmc_FALSE = @ENABLE_dagmc_FALSE@
+ENABLE_dagmc_TRUE = @ENABLE_dagmc_TRUE@
+ENABLE_hexmodops_FALSE = @ENABLE_hexmodops_FALSE@
+ENABLE_hexmodops_TRUE = @ENABLE_hexmodops_TRUE@
+ENABLE_imesh_FALSE = @ENABLE_imesh_FALSE@
+ENABLE_imesh_TRUE = @ENABLE_imesh_TRUE@
+ENABLE_mbchaco_FALSE = @ENABLE_mbchaco_FALSE@
+ENABLE_mbchaco_TRUE = @ENABLE_mbchaco_TRUE@
+ENABLE_mbconvert_FALSE = @ENABLE_mbconvert_FALSE@
+ENABLE_mbconvert_TRUE = @ENABLE_mbconvert_TRUE@
+ENABLE_mbperf_FALSE = @ENABLE_mbperf_FALSE@
+ENABLE_mbperf_TRUE = @ENABLE_mbperf_TRUE@
+ENABLE_mbsize_FALSE = @ENABLE_mbsize_FALSE@
+ENABLE_mbsize_TRUE = @ENABLE_mbsize_TRUE@
+ENABLE_mbskin_FALSE = @ENABLE_mbskin_FALSE@
+ENABLE_mbskin_TRUE = @ENABLE_mbskin_TRUE@
+ENABLE_mbsurfplot_FALSE = @ENABLE_mbsurfplot_FALSE@
+ENABLE_mbsurfplot_TRUE = @ENABLE_mbsurfplot_TRUE@
+ENABLE_mbtagprop_FALSE = @ENABLE_mbtagprop_FALSE@
+ENABLE_mbtagprop_TRUE = @ENABLE_mbtagprop_TRUE@
+ENABLE_mbzoltan_FALSE = @ENABLE_mbzoltan_FALSE@
+ENABLE_mbzoltan_TRUE = @ENABLE_mbzoltan_TRUE@
+ENABLE_mcnpmit_FALSE = @ENABLE_mcnpmit_FALSE@
+ENABLE_mcnpmit_TRUE = @ENABLE_mcnpmit_TRUE@
+ENABLE_qvdual_FALSE = @ENABLE_qvdual_FALSE@
+ENABLE_qvdual_TRUE = @ENABLE_qvdual_TRUE@
+ENABLE_spheredecomp_FALSE = @ENABLE_spheredecomp_FALSE@
+ENABLE_spheredecomp_TRUE = @ENABLE_spheredecomp_TRUE@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FCLIBS = @FCLIBS@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+HAVE_CGM_FALSE = @HAVE_CGM_FALSE@
+HAVE_CGM_TRUE = @HAVE_CGM_TRUE@
+HAVE_ZCAT_FALSE = @HAVE_ZCAT_FALSE@
+HAVE_ZCAT_TRUE = @HAVE_ZCAT_TRUE@
+HDF5_FILE_FALSE = @HDF5_FILE_FALSE@
+HDF5_FILE_TRUE = @HDF5_FILE_TRUE@
+HDF5_LIBS = @HDF5_LIBS@
+INCLUDES = @INCLUDES@ -I$(top_srcdir) -I$(top_builddir)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MOAB_CXX_LDFLAGS = @MOAB_CXX_LDFLAGS@
+MOAB_CXX_LIBS = @MOAB_CXX_LIBS@
+MOC = @MOC@
+NETCDF_FILE_FALSE = @NETCDF_FILE_FALSE@
+NETCDF_FILE_TRUE = @NETCDF_FILE_TRUE@
+NETCDF_LIBS = @NETCDF_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PARALLEL_FALSE = @PARALLEL_FALSE@
+PARALLEL_HDF5_FALSE = @PARALLEL_HDF5_FALSE@
+PARALLEL_HDF5_TRUE = @PARALLEL_HDF5_TRUE@
+PARALLEL_TRUE = @PARALLEL_TRUE@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+QTDIR = @QTDIR@
+QVDUAL_INCLUDES = @QVDUAL_INCLUDES@
+QVDUAL_LIBS = @QVDUAL_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+UIC = @UIC@
+USE_BABEL = @USE_BABEL@
+USE_BABEL_FALSE = @USE_BABEL_FALSE@
+USE_BABEL_TRUE = @USE_BABEL_TRUE@
+USE_MPI_FALSE = @USE_MPI_FALSE@
+USE_MPI_TRUE = @USE_MPI_TRUE@
+VERSION = @VERSION@
+VTK_LIB_DIR = @VTK_LIB_DIR@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZCAT = @ZCAT@
+ZOLTAN_ARCH = @ZOLTAN_ARCH@
+ZOLTAN_DIR = @ZOLTAN_DIR@
+ZOLTAN_INCLUDES = @ZOLTAN_INCLUDES@
+ZOLTAN_LIBS = @ZOLTAN_LIBS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+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@
+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@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+AUTOMAKE_OPTIONS = foreign
+mcnpmit_SOURCES = mcnpmit.cpp main.cpp
+LDADD = $(top_builddir)/libMOAB.la
+mcnpmit_DEPENDENCIES = $(top_builddir)/libMOAB.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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/mcnpmit/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tools/mcnpmit/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
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+mcnpmit$(EXEEXT): $(mcnpmit_OBJECTS) $(mcnpmit_DEPENDENCIES)
+ @rm -f mcnpmit$(EXEEXT)
+ $(CXXLINK) $(mcnpmit_LDFLAGS) $(mcnpmit_OBJECTS) $(mcnpmit_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mcnpmit.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+ at am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && 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)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; 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:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+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-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic 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-binPROGRAMS install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ 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-binPROGRAMS uninstall-info-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:
Added: MOAB/trunk/tools/mcnpmit/README
===================================================================
--- MOAB/trunk/tools/mcnpmit/README (rev 0)
+++ MOAB/trunk/tools/mcnpmit/README 2008-05-10 18:11:32 UTC (rev 1803)
@@ -0,0 +1,34 @@
+
+mcnpmit (MCNP Mesh Interpolation Tool)
+
+Takes a modified MCNP meshtal file (source) and a provided set
+of points or a IDEAS .unv mesh (target) and interpolates the
+tally values of the source mesh onto the target mesh, output in
+a list of points and if a .unv file is read, a cooresponding .h5m
+or .vtk file.
+
+Syntax
+
+./mcnpmit <source_mesh> <target_mesh> <output_file>
+
+source_mesh: is one of two options:
+
+(1) A modified MCNP meshtal file. The format is as follows:
+
+Title card
+Single entry stating coordinate system: "Box" or "Cylindrical"
+"Rotation Matrix:"
+4x4 rotation matrix (one row on each line)
+The rest of the standard file...
+
+(2) A .h5m file which is generated after running the program. It
+will be called <source_mesh>.h5m
+
+target_mesh: is one of two options:
+
+(1) A list of vertex points in .qsv format
+
+(2) A .unv mesh file. Note that if this is used, a .vtk file
+called <target_mesh>.vtk is generated with the interpolated data.
+
+output_file: the name of the output file.
Added: MOAB/trunk/tools/mcnpmit/main.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/main.cpp (rev 0)
+++ MOAB/trunk/tools/mcnpmit/main.cpp 2008-05-10 18:11:32 UTC (rev 1803)
@@ -0,0 +1,394 @@
+#include <iostream>
+#include <fstream>
+#include <math.h>
+#include <time.h>
+#include "assert.h"
+
+#include "mcnpmit.hpp"
+
+#include "MBCartVect.hpp"
+#include "MBCore.hpp"
+#include "MBTagConventions.hpp"
+#include "MBAdaptiveKDTree.hpp"
+#include "MBGeomUtil.hpp"
+
+#define MBI mb_instance()
+
+McnpData* mc_instance();
+MBInterface* mb_instance();
+MCNPError read_files(int, char**);
+MCNPError next_double(std::string, double&, int&);
+MCNPError next_int(std::string, int&, int&);
+
+MCNPError result;
+MBTag coord_tag, rotation_tag, cfd_heating_tag;
+
+std::string h5m_filename;
+std::string CAD_filename;
+std::string output_filename;
+
+bool skip_build = false;
+bool read_unv = false;
+
+clock_t start_time, load_time, build_time, interp_time;
+
+int main(int argc, char **argv) {
+
+ start_time = clock();
+
+ // Read in file names from command line
+ result = read_files(argc, argv);
+ if (result == MCNP_FAILURE) return 1;
+
+ result = MCNP->initialize_tags();
+
+ // Parse the MCNP input file
+ if (!skip_build) {
+ result = MCNP -> read_mcnpfile(skip_build);
+ if (result == MCNP_FAILURE) {
+ std::cout << "Failure reading MCNP file!" << std::endl;
+ return 1;
+ }
+ }
+
+ load_time = clock() - start_time;
+
+ // Make the KD-Tree
+ MBErrorCode MBresult;
+ MBAdaptiveKDTree kdtree(MBI);
+ MBEntityHandle root;
+ MBAdaptiveKDTree::Settings settings;
+ settings.candidatePlaneSet = MBAdaptiveKDTree::SUBDIVISION;
+
+ MBI->tag_create("CoordTag", sizeof(int), MB_TAG_DENSE, coord_tag, 0);
+ MBI->tag_create("RotationTag", 16*sizeof(double), MB_TAG_DENSE, rotation_tag, 0);
+
+ if (skip_build) {
+ MBresult = MBI->load_mesh(h5m_filename.c_str());
+
+ if (MB_SUCCESS == MBresult) {
+ std::cout << std::endl << "Read in mesh from h5m file." << std::endl << std::endl;
+ std::cout << "Querying mesh file..." << std::endl;
+ }
+ else {
+ std::cout << "Failure reading h5m file!" << std::endl;
+ return 1;
+ }
+
+ MBRange tmprange;
+ kdtree.find_all_trees( tmprange );
+ root = tmprange[0];
+
+ }
+ else {
+ std::cout << "Building KD-Tree..." << std::endl;
+ MBresult = kdtree.build_tree( MCNP -> elem_handles, root, &settings);
+ if (MBresult == MB_SUCCESS) {
+
+ MBI->tag_set_data(coord_tag, &root, 1, &(MCNP->coord_system));
+ MBI->tag_set_data(rotation_tag, &root, 1, &(MCNP->rotation_matrix));
+
+ std::cout << "KD-Tree has been built successfully!" << std::endl << std::endl;
+ MBresult = MBI->write_mesh( (MCNP->MCNP_filename + ".h5m").c_str() );
+
+ std::cout << "Querying mesh file..." << std::endl;
+ }
+ else {
+ std::cout << "Error building KD-Tree!" << std::endl << std::endl;
+ return 1;
+ }
+ }
+
+ int coord_sys;
+ double rmatrix[16];
+
+ MBresult = MBI->tag_get_data( coord_tag, &root, 1, &coord_sys);
+ MBresult = MBI->tag_get_data( rotation_tag, &root, 1, &rmatrix);
+
+ build_time = clock() - load_time;
+
+ // Read the CAD mesh data and query the tree
+ std::ifstream cadfile;
+ std::ofstream outfile;
+
+ outfile.open( output_filename.c_str() );
+
+ int num_pts;
+ int n;
+ long int nl = 0;
+ char* ctmp;
+ int elems_read = 0;
+ int p = 0;
+ std::string s;
+ char line[10000];
+
+ // Used only when reading a .unv file to get vertex info
+ double *cfd_coords;
+ MBRange::iterator cfd_iter;
+ MBEntityHandle meshset;
+
+ if (!read_unv) {
+ cadfile.open( CAD_filename.c_str() );
+ cadfile.getline(line, 10000);
+ cadfile.getline(line, 10000);
+ result = next_int(line, num_pts, p);
+ }
+ else {
+
+ MBresult = MBI->load_file( CAD_filename.c_str(), meshset );
+ assert( MB_SUCCESS == MBresult );
+
+ MBRange cfd_verts;
+ MBresult = MBI->get_entities_by_type( meshset, MBVERTEX, cfd_verts, true);
+ num_pts = cfd_verts.size();
+
+ cfd_coords = new double [ 3 * num_pts ];
+ MBresult = MBI->get_coords( cfd_verts , cfd_coords );
+
+ cfd_iter = cfd_verts.begin();
+ MBresult = MBI->tag_create("heating_tag", sizeof(double), MB_TAG_DENSE, cfd_heating_tag, 0);
+
+ std::cout << std::endl << "Read in mesh with query points." << std::endl << std::endl;
+
+ }
+
+
+ double testpt[3];
+ double transformed_pt[3];
+ double taldata;
+ MBCartVect testvc;
+
+ bool found = false;
+
+ MBAdaptiveKDTreeIter treeiter;
+ kdtree.get_tree_iterator( root, treeiter );
+
+ // MBRange verts;
+ std::vector<MBEntityHandle> verts;
+ MBRange range;
+ MBCartVect box_max, box_min;
+
+ MBCartVect hexverts[8];
+ MBCartVect tmp_cartvect;
+ std::vector<double> coords;
+
+// double davg = 0.0;
+// unsigned int nmax = 0, nmin = 1000000000 ;
+
+ for (unsigned int i = 0; i < (unsigned int) num_pts; i++) {
+
+ // Grab the coordinates to query
+ if (!read_unv) {
+ cadfile.getline(line, 10000);
+
+ nl = std::strtol(line, &ctmp, 10); n = (unsigned int) nl;
+ testpt[0] = std::strtod( ctmp+1, &ctmp );
+ testpt[1] = std::strtod( ctmp+1, &ctmp );
+ testpt[2] = std::strtod( ctmp+1, NULL );
+ }
+ else {
+ testpt[0] = cfd_coords[3*i ];
+ testpt[1] = cfd_coords[3*i+1];
+ testpt[2] = cfd_coords[3*i+2];
+ n = i+1;
+ }
+
+ result = MCNP->transform_point( testpt, transformed_pt, coord_sys, rmatrix );
+
+ testvc[0] = transformed_pt[0];
+ testvc[1] = transformed_pt[1];
+ testvc[2] = transformed_pt[2];
+
+ // std::cout << n << " " << testvc << std::endl;
+
+ // Find the leaf containing the point
+ MBresult = kdtree.leaf_containing_point( root, transformed_pt, treeiter);
+ assert(MBresult == MB_SUCCESS);
+
+ range.clear();
+ MBresult = MBI -> get_entities_by_type( treeiter.handle(), MBHEX, range );
+ assert(MBresult == MB_SUCCESS);
+
+ // davg += (double) range.size();
+ // if (range.size() > nmax) nmax = range.size();
+ // if (range.size() < nmin) nmin = range.size();
+
+ for (MBRange::iterator rit = range.begin(); rit != range.end(); rit++) {
+ verts.clear();
+ const MBEntityHandle *connect;
+ int num_connect;
+ MBresult = MBI -> get_connectivity( *rit, connect, num_connect, true);
+ assert(MBresult == MB_SUCCESS);
+
+ coords.resize(3*num_connect);
+ MBresult = MBI -> get_coords( connect, num_connect, &coords[0]);
+ assert(MBresult == MB_SUCCESS);
+
+ for (unsigned int j = 0; j < (unsigned int) num_connect; j++) {
+ hexverts[j][0] = coords[3*j];
+ hexverts[j][1] = coords[3*j+1];
+ hexverts[j][2] = coords[3*j+2];
+ }
+
+ if (MBGeomUtil::point_in_trilinear_hex(hexverts, testvc, 1.e-6)) {
+ MBresult = MBI -> tag_get_data( MCNP->tally_tag, &(*rit), 1, &taldata);
+ outfile << n << ","
+ << testpt[0] << ","
+ << testpt[1] << ","
+ << testpt[2] << ","
+ << taldata << std::endl;
+
+ if (read_unv) {
+ MBresult = MBI->tag_set_data(cfd_heating_tag, &(*cfd_iter), 1, &taldata);
+ cfd_iter++;
+ }
+
+ found = true;
+ elems_read++;
+
+ break;
+ }
+ }
+
+ if (!found) {
+ std::cout << n << " " << testvc << std::endl;
+ }
+ found = false;
+
+ }
+
+ cadfile.close();
+ outfile.close();
+
+ if (result == MCNP_SUCCESS) {
+ std::cout << "Success! " << elems_read << " elements interpolated." << std::endl << std::endl;
+ }
+ else {
+ std::cout << "Failure during query! " << elems_read << " elements interpolated." << std::endl << std::endl;
+ }
+
+ interp_time = clock() - build_time;
+
+ if (read_unv) {
+ std::string cfd_mesh_fname = CAD_filename;
+ cfd_mesh_fname.erase( CAD_filename.find(".unv"), CAD_filename.length());
+ // MBresult = MBI->write_mesh( (cfd_mesh_fname + ".h5m").c_str(), &meshset, 1);
+ MBresult = MBI->write_file( (cfd_mesh_fname + ".vtk").c_str(), "vtk", NULL, &meshset, 1, &cfd_heating_tag, 1);
+ }
+
+ std::cout << "Time to read in file: " << (double) load_time / CLOCKS_PER_SEC << std::endl;
+ std::cout << "Time to build kd-tree: " << (double) build_time / CLOCKS_PER_SEC << std::endl;
+ std::cout << "Time to interpolate data: " << (double) interp_time / CLOCKS_PER_SEC << std::endl;
+
+ return 0;
+
+}
+
+
+
+MCNPError read_files(int argc, char **argv) {
+
+ // Check to see if appropriate command lines specified
+ if (argc < 3) {
+ std::cout << "Source and Target mesh filenames NOT specified!";
+ std::cout << std::endl;
+ return MCNP_FAILURE;
+ }
+
+ // Set the MCNP or H5M filename
+ std::string str;
+ str = argv[1];
+
+ unsigned int itmp = str.find(".h5m");
+ if ((itmp > 0) && (itmp < str.length())) {
+ skip_build = true;
+ h5m_filename = str;
+ }
+ else {
+ result = MCNP -> set_filename(str);
+ }
+
+ // Set the CAD filename
+ str = argv[2];
+ CAD_filename = str;
+
+ itmp = str.find(".unv");
+ if ((itmp > 0) && (itmp < str.length()))
+ read_unv = true;
+
+ // Set the output filename
+ str = argv[3];
+ output_filename = str;
+
+
+ return result;
+}
+
+
+MCNPError next_double(std::string s, double &d, int &p) {
+
+ unsigned int slen = s.length();
+ unsigned int j;
+ std::string sn;
+
+ for (unsigned int i = p; i < slen; i++) {
+ if ( ( (s[i] >= 48) && (s[i] <= 57) ) || (s[i] == 45) ) {
+
+ j = s.find(",",i);
+ if (j > slen)
+ j = slen;
+
+ // Extract the number out of the string
+ char cn[j-i];
+ s.copy(cn,j-i,i);
+
+ d = std::atof(cn);
+ p = j+1;
+
+ return MCNP_SUCCESS;
+ }
+ }
+
+ return DONE;
+}
+
+
+MCNPError next_int(std::string s, int &k, int &p) {
+
+ unsigned int slen = s.length();
+ unsigned int j;
+ std::string sn;
+
+ for (unsigned int i = p; i < slen; i++) {
+ if ( ( (s[i] >= 48) && (s[i] <= 57) ) || (s[i] == 45) ) {
+
+ j = s.find(",",i);
+ if (j > slen)
+ j = slen;
+
+ // Extract the number out of the string
+ char cn[j-i];
+ s.copy(cn,j-i,i);
+
+ k = std::atoi(cn);
+ p = j+1;
+
+ return MCNP_SUCCESS;
+ }
+ }
+
+ return DONE;
+}
+
+
+McnpData* mc_instance()
+{
+ static McnpData inst;
+ return &inst;
+}
+
+MBInterface* mb_instance()
+{
+ static MBCore inst;
+ return &inst;
+}
Added: MOAB/trunk/tools/mcnpmit/mcnpmit.cpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/mcnpmit.cpp (rev 0)
+++ MOAB/trunk/tools/mcnpmit/mcnpmit.cpp 2008-05-10 18:11:32 UTC (rev 1803)
@@ -0,0 +1,440 @@
+#include <iostream>
+#include <fstream>
+#include "mcnpmit.hpp"
+#include "MBCartVect.hpp"
+#include "math.h"
+
+MBInterface* mb_instance();
+
+MCNPError next_number(std::string, double&, int&);
+int how_many_numbers(std::string);
+MCNPError read_numbers(std::string, int, std::vector<double>&);
+
+// Constructor
+McnpData::McnpData() {
+
+ // Default value for coordinate system
+ coord_system = 0;
+
+ // Default rotation matrix is identity matrix
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ if (i == j)
+ rotation_matrix[4*i + j] = 1;
+ else
+ rotation_matrix[4*i + j] = 0;
+ }
+ }
+
+}
+
+// Destructor
+McnpData::~McnpData() {
+
+ // Vertices and elements
+ MCNP_vertices.clear();
+
+}
+
+
+// Setting and retrieving coordinate sysem
+MCNPError McnpData::set_coord_system(int k) {
+ coord_system = k;
+ return MCNP_SUCCESS;
+}
+int McnpData::get_coord_system() {
+ return coord_system;
+}
+
+// Setting and retrieving roation matrix
+MCNPError McnpData::set_rotation_matrix(double r[16]) {
+ for (int i = 0; i < 16; i++) {
+ rotation_matrix[i] = r[i];
+ }
+ return MCNP_SUCCESS;
+}
+double* McnpData::get_rotation_matrix() {
+ return rotation_matrix;
+}
+
+
+// Set the filename
+MCNPError McnpData::set_filename(std::string fname) {
+ MCNP_filename = fname;
+ return MCNP_SUCCESS;
+}
+std::string McnpData::get_filename() {
+ return MCNP_filename;
+}
+
+
+// Reading the MCNP file
+MCNPError McnpData::read_mcnpfile(bool skip_mesh) {
+
+ MCNPError result;
+ MBErrorCode MBresult;
+ int nelems;
+ MBCartVect tvect;
+
+ std::vector<double> xvec[3];
+
+ // Open the file
+ std::ifstream mcnpfile;
+ mcnpfile.open( MCNP_filename.c_str() );
+ if (!mcnpfile) {
+ std::cout << "Unable to open MCNP data file." << std::endl;
+ return MCNP_FAILURE;
+ }
+ std::cout << std::endl;
+ std::cout << "Reading MCNP input file..." << std::endl;
+
+ // Prepare for file reading ...
+ char line[10000];
+ int mode = 0; // Set the file reading mode to read proper data
+ int nv[3];
+
+ // Read in the file ...
+ while (! mcnpfile.eof() ) {
+
+ mcnpfile.getline(line, 10000);
+ // std::cout << line << std::endl;
+
+ switch(mode) {
+ case 0: // First line is a title
+ mode++;
+ break;
+ case 1: // Coordinate system
+ mode++;
+ result = read_coord_system(line);
+ if (result == MCNP_FAILURE)
+ return MCNP_FAILURE;
+ break;
+ case 2: // Rotation matrix
+ mode++;
+ for (int i = 0; i < 4; i++) {
+ mcnpfile.getline(line, 10000);
+ result = read_rotation_matrix(line, i);
+ if (result == MCNP_FAILURE)
+ return MCNP_FAILURE;
+ }
+ if (skip_mesh) return MCNP_SUCCESS;
+ break;
+ case 3: // Read in vertices and build elements
+ mode++;
+
+ for (int i = 0; i < 3; i++) {
+ // How many points in the x[i]-direction
+ nv[i] = how_many_numbers(line);
+ if (nv[i] <= 0) return MCNP_FAILURE;
+
+ // Get space and read in these points
+ result = read_numbers(line , nv[i], xvec[i]);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+
+ // Update to the next line
+ mcnpfile.getline(line, 10000);
+ }
+
+ // Make the elements and vertices
+ nelems = (nv[0] - 1) * (nv[1] - 1) * (nv[2] - 1);
+ result = make_elements(xvec, nv);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+ break;
+ case 4: // Read in tally data, make, and tag elements
+ mode++;
+ MBEntityHandle elemhandle;
+
+ MBEntityHandle vstart, vijk;
+ MBEntityHandle connect[8];
+ // double d[3];
+
+ // vstart = MCNP_vertices.front();
+ vstart = *(vert_handles.begin());
+
+ for (int k=0; k < nv[2]-1; k++) {
+ for (int j=0; j < nv[1]-1; j++) {
+ for (int i=0; i < nv[0]-1; i++) {
+ vijk = vstart + (i + j*nv[0] + k*nv[0]*nv[1]);
+
+ //std::cout << vijk << std::endl;
+
+ connect[0] = vijk;
+ connect[1] = vijk + 1;
+ connect[2] = vijk + 1 + nv[0];
+ connect[3] = vijk + nv[0];
+ connect[4] = vijk + nv[0]*nv[1];
+ connect[5] = vijk + 1 + nv[0]*nv[1];
+ connect[6] = vijk + 1 + nv[0] + nv[0]*nv[1];
+ connect[7] = vijk + nv[0] + nv[0]*nv[1];
+
+ MBresult = MBI->create_element(MBHEX, connect, 8, elemhandle);
+ if (MBresult != MB_SUCCESS) return MCNP_FAILURE;
+ elem_handles.insert(elemhandle);
+
+ mcnpfile.getline(line, 10000);
+ result = extract_tally_data(line, elemhandle);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+
+ }
+ }
+ }
+
+/*
+ for (MBRange::iterator rit=vert_handles.begin(); rit != vert_handles.end(); rit++) {
+ std::cout << *rit << std::endl;
+ }
+
+
+ for (int i=0; i < nv[0]-1; i++) {
+ for (int j=0; j < nv[1]-1; j++) {
+ for (int k=0; k < nv[2]-1; k++) {
+ vijk = vstart + (i + j*nv[0] + k*nv[0]*nv[1]);
+ connect[0] = vijk;
+ connect[1] = vijk + 1;
+ connect[2] = vijk + 1 + nv[0];
+ connect[3] = vijk + nv[0];
+ connect[4] = vijk + nv[0]*nv[1];
+ connect[5] = vijk + 1 + nv[0]*nv[1];
+ connect[6] = vijk + 1 + nv[0] + nv[0]*nv[1];
+ connect[7] = vijk + nv[0] + nv[0]*nv[1];
+
+ MBresult = MBI->create_element(MBHEX, connect, 8, elemhandle);
+ if (MBresult != MB_SUCCESS) return MCNP_FAILURE;
+ elem_handles.insert(elemhandle);
+
+ mcnpfile.getline(line, 10000);
+ result = extract_tally_data(line, elemhandle);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+
+ }
+ }
+ }
+*/
+ break;
+ case 5: // Ckeck for weirdness at end of file
+ if (! mcnpfile.eof() ) return MCNP_FAILURE;
+ break;
+ }
+
+ }
+
+ std::cout << "SUCCESS! Read in " << elem_handles.size()
+ << " elements!" << std::endl << std::endl;
+ // MCNP_vertices.clear();
+ vert_handles.clear();
+ MCNP_elems.clear();
+ return MCNP_SUCCESS;
+
+}
+
+MCNPError McnpData::read_coord_system(std::string s) {
+
+ if ((s.find("Box") < 100) || (s.find("xyz") < 100))
+ coord_system = CARTESIAN;
+ else if (s.find("Cyl") < 100)
+ coord_system = CYLINDRICAL;
+ else if (s.find("Sph") < 100)
+ coord_system = SPHERICAL;
+ else
+ return MCNP_FAILURE;
+
+ return MCNP_SUCCESS;
+}
+
+MCNPError McnpData::read_rotation_matrix(std::string s, int i) {
+
+ int fpos = 0;
+ MCNPError result;
+
+ for (int j = 0; j < 4; j++) {
+ result = next_number(s, rotation_matrix[4*i+j], fpos);
+ if (result == MCNP_FAILURE)
+ return MCNP_FAILURE;
+ }
+
+ return MCNP_SUCCESS;
+}
+
+MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
+
+ // double v[3];
+ // MBEntityHandle dumhandle;
+ // MBEntityHandle vstart, vijk;
+ MBErrorCode MBresult;
+
+ unsigned int num_verts = n[0]*n[1]*n[2];
+ double *coords;
+ coords = new double [ 3 * num_verts ];
+
+/*
+ // Enter the vertices ...
+ for (int k=0; k < n[2]; k++) {
+ v[2] = x[2].at(k);
+ for (int j=0; j < n[1]; j++) {
+ v[1] = x[1].at(j);
+ for (int i=0; i < n[0]; i++) {
+ v[0] = x[0].at(i);
+ MBresult = MBI->create_vertex(v, dumhandle);
+ if (MBresult != MB_SUCCESS) return MCNP_FAILURE;
+ MCNP_vertices.push_back(dumhandle);
+
+ }
+ }
+ }
+*/
+
+ // Enter the vertices ...
+ for (int k=0; k < n[2]; k++) {
+ for (int j=0; j < n[1]; j++) {
+ for (int i=0; i < n[0]; i++) {
+ unsigned int ijk = 3*(k*n[0]*n[1] + j*n[0] + i);
+ coords[ ijk ] = x[0][i];
+ coords[ ijk+1 ] = x[1][j];
+ coords[ ijk+2 ] = x[2][k];
+
+ // std::cout << coords[ijk] << " " << coords[ijk+1] << " "
+ // << coords[ijk+2] << std::endl;
+
+ // MCNP_vertices.push_back(dumhandle);
+ }
+ }
+ }
+
+ MBresult = MBI->create_vertices(coords, num_verts, vert_handles);
+
+
+ delete coords;
+ return MCNP_SUCCESS;
+}
+
+MCNPError McnpData::initialize_tags() {
+
+ MBErrorCode rval;
+
+ rval = MBI->tag_create(TALLY_TAG, sizeof(double), MB_TAG_DENSE, tally_tag, 0);
+ rval = MBI->tag_create(ERROR_TAG, sizeof(double), MB_TAG_DENSE, relerr_tag, 0);
+
+ return MCNP_SUCCESS;
+
+}
+
+MCNPError McnpData::extract_tally_data(std::string s, MBEntityHandle handle) {
+
+ int fpos = 0;
+ double d = 0;
+
+ MCNPError result;
+ MBErrorCode MBresult;
+
+ // Discard first three lines
+ for (int i = 0; i < 3; i++) {
+ result = next_number(s, d, fpos);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+ }
+ // Need to read in tally entry and tag ...
+ result = next_number(s, d, fpos);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+ MBresult = MBI -> tag_set_data(tally_tag, &handle, 1, &d);
+ if (MBresult != MB_SUCCESS) return MCNP_FAILURE;
+
+ // Need to read in relative error entry and tag ...
+ result = next_number(s, d, fpos);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+ // MBresult = MBI -> tag_set_data(relerr_tag, &handle, 1, &d);
+ // if (MBresult != MB_SUCCESS) return MCNP_FAILURE;
+
+ return MCNP_SUCCESS;
+}
+
+MCNPError next_number(std::string s, double &d, int &p) {
+
+ unsigned int slen = s.length();
+ unsigned int j;
+ std::string sn;
+
+ for (unsigned int i = p; i < slen; i++) {
+ if ( ( (s[i] >= 48) && (s[i] <= 57) ) || (s[i] == 45) ) {
+
+ j = s.find(" ",i);
+
+ if (j > slen)
+ j = slen;
+
+ // Extract the number out of the string
+ char cn[j-i];
+ s.copy(cn,j-i,i);
+
+
+ d = std::atof(cn);
+ p = j+1;
+
+ return MCNP_SUCCESS;
+ }
+
+ }
+
+ return DONE;
+}
+
+int how_many_numbers(std::string s) {
+
+ int n = -1;
+ int fpos = 0;
+ double d = 0;
+ MCNPError result = MCNP_SUCCESS;
+
+ while (result != DONE) {
+ result = next_number(s, d, fpos);
+ n++;
+ }
+
+ return n;
+
+}
+
+MCNPError read_numbers(std::string s, int n, std::vector<double> &x) {
+
+ MCNPError result;
+ int fpos = 0;
+ double d;
+
+ for (int i = 0; i < n; i++) {
+ result = next_number(s, d, fpos);
+ if (result == MCNP_FAILURE) return MCNP_FAILURE;
+ x.push_back(d);
+ }
+
+ return MCNP_SUCCESS;
+}
+
+MCNPError McnpData::transform_point(double *p, double *r, int csys, double *rmat) {
+
+ double q[3];
+
+ // Apply the rotation matrix
+ for (unsigned int i=0; i < 3; i++) {
+ q[i] = p[0] * rmat[4*i ] + p[1] * rmat[4*i+1]
+ + p[2] * rmat[4*i+2] + rmat[4*i+3];
+ }
+
+ // Transform coordinate system
+ switch( csys ) {
+ case CARTESIAN :
+ r[0] = q[0]; r[1] = q[1]; r[2] = q[2];
+ break;
+ case CYLINDRICAL :
+ r[0] = sqrt( q[0]*q[0] + q[1]*q[1] );
+ r[1] = q[2];
+ r[2] = c2pi * ( atan2( q[1], q[0] ) );
+ break;
+ case SPHERICAL :
+ return MCNP_FAILURE;
+ break;
+ default :
+ return MCNP_FAILURE;
+ break;
+ }
+
+ return MCNP_SUCCESS;
+
+}
Added: MOAB/trunk/tools/mcnpmit/mcnpmit.hpp
===================================================================
--- MOAB/trunk/tools/mcnpmit/mcnpmit.hpp (rev 0)
+++ MOAB/trunk/tools/mcnpmit/mcnpmit.hpp 2008-05-10 18:11:32 UTC (rev 1803)
@@ -0,0 +1,68 @@
+#include "MBCore.hpp"
+#include <iostream>
+#define MCNP mc_instance()
+#define BOXMIN_TAG "BOXMIN_TAG"
+#define BOXMAX_TAG "BOXMAX_TAG"
+#define TALLY_TAG "TALLY_TAG"
+#define ERROR_TAG "ERROR_TAG"
+
+#define MBI mb_instance()
+
+enum MCNPError { MCNP_SUCCESS, MCNP_FAILURE, DONE };
+enum { NOSYS, CARTESIAN, CYLINDRICAL, SPHERICAL };
+
+class McnpData {
+
+ public:
+ // Constructor and Destructor
+ McnpData ();
+ ~McnpData ();
+
+ // Coordinate system and rotation matrix
+ int coord_system;
+ double rotation_matrix[16];
+
+ // Vertices and elements
+ std::vector<MBEntityHandle> MCNP_vertices;
+ std::vector<MBEntityHandle> MCNP_elems;
+ MBRange vert_handles;
+ MBRange elem_handles;
+
+ // Tally data
+ MBTag box_min_tag, box_max_tag;
+ MBTag tally_tag;
+ MBTag relerr_tag;
+
+ // MCNP Meshtal file name
+ std::string MCNP_filename;
+
+ // Setting and retrieving coordinate sysem
+ MCNPError set_coord_system(int);
+ int get_coord_system();
+
+ // Setting and retrieving roation matrix
+ MCNPError set_rotation_matrix(double[16]);
+ double* get_rotation_matrix();
+
+ // Set the filename
+ MCNPError set_filename(std::string);
+ std::string get_filename();
+
+ // MCNP reading routines
+ MCNPError read_mcnpfile(bool);
+ MCNPError read_coord_system(std::string);
+ MCNPError read_rotation_matrix(std::string, int);
+ MCNPError make_elements(std::vector<double> [3], int*);
+ MCNPError make_adjacencies(int*);
+ MCNPError initialize_tags();
+ MCNPError extract_tally_data(std::string, MBEntityHandle);
+
+ // Transformation routine
+ MCNPError transform_point(double*, double*, int, double*);
+
+ // Parameters
+ static const double pi = 3.141592653589793;
+ static const double c2pi = 0.1591549430918954;
+ static const double cpi = 0.3183098861837907;
+
+};
More information about the moab-dev
mailing list