Skip to content
Draft
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions buid_plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/bash

sudo apt-get install autogen autoconf libtool libeigen3-dev libhdf5-dev patchelf gfortran

# Setup
CURRENT=$(pwd)
SCRIPTPATH=`dirname $(realpath $0)`

PLUGIN_DIR="plugin-build"

mkdir ${PLUGIN_DIR}
PLUGIN_ABS_PATH=${CURRENT}/${PLUGIN_DIR}

echo "Building the Trelis plugin in ${CURRENT}\\${PLUGIN_DIR}"

unset LD_LIBRARY_PATH

cd ${PLUGIN_ABS_PATH}
ln -s $SCRIPTPATH ./

mkdir -pv moab/bld
cd moab
git clone https://bitbucket.org/fathomteam/moab -b Version5.1.0
cd moab
autoreconf -fi
cd ../bld
../moab/configure CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
--disable-blaslapack \
--enable-shared \
--enable-optimize \
--disable-debug \
--disable-blaslapack \
--with-eigen3=/usr/include/eigen3 \
--with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial \
--prefix=${PLUGIN_ABS_PATH}/moab
make -j`grep -c processor /proc/cpuinfo`
make install

cd ${PLUGIN_ABS_PATH}
mkdir -pv DAGMC/bld
cd DAGMC
git clone https://github.com/svalinn/DAGMC -b develop
cd bld
cmake ../DAGMC -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
-DMOAB_DIR=${PLUGIN_ABS_PATH}/moab \
-DBUILD_UWUW=ON \
-DBUILD_TALLY=OFF \
-DBUILD_BUILD_OBB=OFF \
-DBUILD_MAKE_WATERTIGHT=ON \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PLUGIN_ABS_PATH}/DAGMC
make -j`grep -c processor /proc/cpuinfo`
make install


cd ${PLUGIN_ABS_PATH}/Trelis-plugin
git submodule update --init

cd ${PLUGIN_ABS_PATH}
mkdir -pv bld
cd bld
cmake ../Trelis-plugin -DCUBIT_ROOT=/opt/Trelis-17.1 \
-DDAGMC_DIR=${PLUGIN_ABS_PATH}/DAGMC \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PLUGIN_ABS_PATH}
make -j`grep -c processor /proc/cpuinfo`
make install


cd ${PLUGIN_ABS_PATH}
mkdir -p pack/bin/plugins/svalinn
cd pack/bin/plugins/svalinn

# Copy all needed libraries into current directory
cp -pPv ${PLUGIN_ABS_PATH}/lib/* .
cp -pPv ${PLUGIN_ABS_PATH}/moab/lib/libMOAB.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libdagmc.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libmakeWatertight.so* .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libpyne_dagmc.so .
cp -pPv ${PLUGIN_ABS_PATH}/DAGMC/lib/libuwuw.so .
cp -pPv /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100* .
chmod 644 *

# Set the RPATH to be the current directory for the DAGMC libraries
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libMOAB.so
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libdagmc.so
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libmakeWatertight.so
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libpyne_dagmc.so
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libuwuw.so

# Create the Svalinn plugin tarball
cd ..
ln -sv svalinn/libsvalinn_plugin.so .
cd ../..
tar --sort=name -czvf svalinn-plugin.tgz bin
mv -v svalinn-plugin.tgz ..
cd ..
rm -rf pack bld DAGMC lib moab
rm Trelis-plugin
41 changes: 40 additions & 1 deletion export_dagmc_cmd/DAGMCExportCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "moab/Interface.hpp"
#include "moab/GeomTopoTool.hpp"

// DAGMC includes
#include "uwuw_preprocessor.hpp"

#define CHK_MB_ERR_RET(A,B) if (moab::MB_SUCCESS != (B)) { \
message << (A) << (B) << std::endl; \
CubitInterface::get_cubit_message_handler()->print_message(message.str().c_str()); \
Expand All @@ -46,6 +49,9 @@ DAGMCExportCommand::DAGMCExportCommand() :
verbose_warnings = false;
fatal_on_curves = false;

pyne_mat_lib = "";
hdf5_path = "/materials";

CubitMessageHandler *console = CubitInterface::get_cubit_message_handler();
if (console) {
std::ostringstream load_message;
Expand All @@ -70,6 +76,8 @@ std::vector<std::string> DAGMCExportCommand::get_syntax()
"[length_tolerance <value:label='length_tolerance',help='<length tolerance>'>] "
"[normal_tolerance <value:label='normal_tolerance',help='<normal tolerance>'>] "
"[make_watertight]"
"[pyne_mat_lib <string:label='pyne_mat_lib',help='<pyne_mat_lib>'>]"
"[hdf5_path <string:label='hdf5_path',help='<hdf5_path>'>]"
"[verbose] [fatal_on_curves]";

std::vector<std::string> syntax_list;
Expand Down Expand Up @@ -159,6 +167,24 @@ bool DAGMCExportCommand::execute(CubitCommandData &data)
rval = teardown();
CHK_MB_ERR_RET("Error tearing down export command.",rval);

// if a PyNE material library is provided then try to process the mats
if(pyne_mat_lib != "") {
bool fatal_errors = false;

uwuw_preprocessor* uwuw_preproc = new uwuw_preprocessor(pyne_mat_lib, filename, filename, hdf5_path, verbose_warnings, fatal_errors);
// process the materials
uwuw_preproc->process_materials();

// process the tallies
uwuw_preproc->process_tallies();

// write the material data
uwuw_preproc->write_uwuw_materials();

// write the tally data
uwuw_preproc->write_uwuw_tallies();
}

return result;
}

Expand Down Expand Up @@ -191,7 +217,20 @@ moab::ErrorCode DAGMCExportCommand::parse_options(CubitCommandData &data, moab::
verbose_warnings = data.find_keyword("verbose");
fatal_on_curves = data.find_keyword("fatal_on_curves");
make_watertight = data.find_keyword("make_watertight");


// read parsed command for normal tolerance
data.get_string("pyne_mat_lib", pyne_mat_lib);
if (pyne_mat_lib != "") {
message << "Looking for the PyNE material Lib in " << pyne_mat_lib << std::endl;
data.get_string("hdf5_path",hdf5_path);
message << "hdf5 path set to " << hdf5_path << std::endl;
}
else {
message
<< "No Material Library set, material assignments will not be processed"
<< std::endl;
}

if (verbose_warnings && fatal_on_curves)
message << "This export will fail if curves fail to facet" << std::endl;

Expand Down
5 changes: 4 additions & 1 deletion export_dagmc_cmd/DAGMCExportCommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ class DAGMCExportCommand: public CubitCommand
bool verbose_warnings;
bool fatal_on_curves;
bool make_watertight;

std::string pyne_mat_lib;
std::string hdf5_path;


int failed_curve_count;
std::vector<int> failed_curves;

Expand Down