Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Trelis 17 #64

Merged
merged 9 commits into from
Oct 13, 2020
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
project(SvalinnCommandPlugin)

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.7)
bam241 marked this conversation as resolved.
Show resolved Hide resolved

# User must specify the version of Cubit being used
if (NOT CUBIT_VERSION)
message(FATAL_ERROR "CUBIT_VERSION not specified")
endif ()

# Build options
option(UPDATE_SUBMODULES "Automatically update git submodules" ON)
Expand Down Expand Up @@ -33,6 +38,9 @@ if (CMAKE_SYSTEM_NAME MATCHES Linux AND CMAKE_COMPILER_IS_GNUCXX)
endif ()

# Find Cubit/Trelis
if (NOT CUBIT_ROOT)
set(CUBIT_ROOT "/opt/Trelis-${CUBIT_VERSION}")
endif ()
list(APPEND CMAKE_PREFIX_PATH ${CUBIT_ROOT}/bin)
find_package(Cubit REQUIRED CONFIG)
include_directories(${CUBIT_INCLUDE_DIRS})
Expand Down Expand Up @@ -77,6 +85,9 @@ if (BUILD_IGEOM)
include_directories(iGeom)
add_library(iGeom SHARED ${IGEOM_SRC_FILES})
target_link_libraries(iGeom ${CUBIT_LIBS})
if (CUBIT_VERSION VERSION_GREATER_EQUAL 17.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment here noting that this really has to do with the SDK version as opposed to the version of Trelis/Cubit? As per @gonuke's comment #61 (comment) here, it still isn't clear what versions of Cubit (as opposed to Trelis versions) this will apply to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if statement was removed per my comment on iGeom.cpp

target_compile_definitions(iGeom PUBLIC -DCUBIT_17_PLUS)
endif ()
install(TARGETS iGeom LIBRARY DESTINATION lib)
list(APPEND PLUGIN_LINK_LIBS iGeom)
endif ()
Expand Down
112 changes: 73 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
Svalinn plugins and command extensions for Trelis
=================================================

**Beta:** This software is currently under early development. It has been
**Beta:** This software is currently under early development. It has been
demonstrated to work on a wide range of problems, but the build system is not
well developed.
finalized.

The plugin has been tested and is confirmed to work with Trelis versions 16.5
and 17.1. These build instructions assume that Trelis 17.1 is being used, but
other versions can be used by replacing instances of "17.1" with the version
being used.

Prerequisites
=============

In order to build the plugin, you must have access to Trelis-16.5 and the
Trelis-16.5 SDK. Additionally, the following system packages must be present on
In order to build the plugin, you must have access to Trelis and the Trelis SDK.
Additionally, the following system packages must be present on
your computer:

* EIGEN3
Expand All @@ -34,21 +39,32 @@ Trelis can be installed by obtaining the Trelis `.deb` package and installing it
with the package manager; i.e.

```
sudo dpkg -i Trelis-16.5.3-Lin64.deb
sudo dpkg -i Trelis-17.1.0-Lin64.deb
```

This installs Trelis to `/opt/Trelis-16.5`.
This installs Trelis to `/opt/Trelis-17.1`.

The Trelis SDK can be installed with these commands:
The Trelis 17 SDK can be installed with these commands:

```
cd /opt
sudo tar -xzvf /path/to/Trelis-SDK-17.1.0-Lin64.tar.gz
```

### Note for Trelis 16

The SDK for Trelis 16 should be unpacked from `/opt/Trelis-16.5` instead of
just `/opt`; i.e.

```
cd /opt/Trelis-16.5
sudo tar -xzvf /path/to/Trelis-SDK-16.5.3-Lin64.tar.gz
sudo tar -xzvf /path/to/Trelis-SDK-16.5.4-Lin64.tar.gz
```

There is currently a bug (or some other unknown issue) which requires a file in
the Trelis SDK to be modified. The following commands show how to make this
change.
There is also a bug (or some other unknown issue) in Trelis 16 which requires a
file in the Trelis SDK to be modified. The following commands show how to make
this change. This issue is not present in Trelis 17, so these commands do not
need to be run for Trelis 17.

```
cd /opt/Trelis-16.5/bin
Expand All @@ -72,8 +88,15 @@ remains empty when running Trelis as well.
Build MOAB
==========

MOAB must be built with HDF5 enabled. The following commands show how to build
the MOAB dependency using system HDF5.
MOAB must be built with HDF5 enabled. On Ubuntu 18.04, HDF5 is located in the
`/usr/lib/x86_64-linux-gnu/hdf5/serial` directory, but it may be located
somewhere else on other flavors or versions of Linux. MOAB should be built with
the Eigen matrix algebra library instead of LAPACK. The
`_GLIBCXX_USE_CXX11_ABI=0` flag is required for compatibility with Trelis.

The following commands show how to correctly build the MOAB dependency. If HDF5
is located somewhere other than `/usr/lib/x86_64-linux-gnu/hdf5/serial`, then
replace the directory with the correct one.

```
cd ${HOME}/plugin-build
Expand All @@ -83,32 +106,38 @@ git clone https://bitbucket.org/fathomteam/moab -b Version5.1.0
cd moab
autoreconf -fi
cd ../bld
../moab/configure --disable-blaslapack \
--enable-shared \
../moab/configure --enable-shared \
--enable-optimize \
--disable-debug \
--disable-blaslapack \
--with-eigen3=/usr/include/eigen3 \
--with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial \
--prefix=${HOME}/plugin-build/moab
--prefix=${HOME}/plugin-build/moab \
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
bam241 marked this conversation as resolved.
Show resolved Hide resolved
make -j`grep -c processor /proc/cpuinfo`
make install
```

Build DAGMC
===========

The following commands show how to build the DAGMC dependency. Only the features
that are needed are built using these commands.
The following commands show how to build the DAGMC dependency. The `uwuw` and
`make_watertight` features should be turned on, while other features should be
turned off. The `MOAB_DIR` variable should point to the location of the
previously-built MOAB library. The `_GLIBCXX_USE_CXX11_ABI=0` flag is once again
required.

The following commands show how to correctly build the DAGMC dependency.

```
cd ${HOME}/plugin-build
mkdir -pv DAGMC/bld
cd DAGMC
git clone https://github.com/svalinn/DAGMC -b develop
cd bld
cmake ../DAGMC -DMOAB_DIR=${HOME}/plugin-build/moab \
-DBUILD_UWUW=OFF \
cmake ../DAGMC -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
-DMOAB_DIR=${HOME}/plugin-build/moab \
-DBUILD_UWUW=ON \
-DBUILD_TALLY=OFF \
-DBUILD_BUILD_OBB=OFF \
-DBUILD_MAKE_WATERTIGHT=ON \
Expand All @@ -120,21 +149,21 @@ make -j`grep -c processor /proc/cpuinfo`
make install
```

This results in the DAGMC library being built against the previously-built MOAB
library.

Build the Plugin
================

The following commands show how to build the plugin itself. The `CUBIT_ROOT`
variable must point to the location of Trelis, while the `DAGMC_DIR` variable
must point to the location of DAGMC.
The following commands show how to build the plugin itself. The `CUBIT_VERSION`
variable, which specifies the version of Trelis, must be included. Only the
first two numbers in the version should be included; e.g. use "17.1" instead of
"17.1.0". This indicates to the build system that Trelis is located in
`/opt/Trelis-17.1` for Trelis 17.1. The `DAGMC_DIR` variable should point to the
location of the previously-built DAGMC library.

```
cd ${HOME}/plugin-build
mkdir -pv bld
cd bld
cmake ../Trelis-plugin -DCUBIT_ROOT=/opt/Trelis-16.5 \
cmake ../Trelis-plugin -CUBIT_VERSION=17.1 \
-DDAGMC_DIR=${HOME}/plugin-build/DAGMC \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${HOME}/plugin-build
Expand All @@ -160,8 +189,9 @@ git submodule update --init
Create the Tarball
==================

The following commands show how to create the tarall for the plugin. These
commands have only been tested on Ubuntu 18.04.
The following commands show how to create the tarall for the plugin. Once again,
the location of HDF5 might be different than what is presented here depending on
what flavor or version of Linux is being used.

```
# Set up the directory which will contain the libraries
Expand All @@ -170,39 +200,43 @@ mkdir -p pack/bin/plugins/svalinn
cd pack/bin/plugins/svalinn

# Copy all needed libraries into current directory
cp -pPv ${HOME}/plugin-build/lib/* .
cp -pPv /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100* .
cp -pPv ${HOME}/plugin-build/moab/lib/libMOAB.so* .
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libdagmc.so* .
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libmakeWatertight.so* .
cp -pPv /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100* .
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libpyne_dagmc.so* .
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libuwuw.so* .
cp -pPv ${HOME}/plugin-build/lib/* .
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-17.1/bin/plugins/svalinn libMOAB.so
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libdagmc.so
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libmakeWatertight.so
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libpyne_dagmc.so
patchelf --set-rpath /opt/Trelis-17.1/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 ..
tar --sort=name -czvf svalinn-plugin-17.1.tgz bin
mv -v svalinn-plugin-17.1.tgz ..
cd ..
rm -rf pack
```

The Svalinn plugin tarball should now be located at
`${HOME}/plugin-build/svalinn-plugin.tgz`.
`${HOME}/plugin-build/svalinn-plugin-17.1.tgz`.

Install the Plugin
==================

To install the plugin, simply run

```
cd /opt/Trelis-16.5
sudo tar -xzvf ${HOME}/plugin-build/svalinn-plugin.tgz
cd /opt/Trelis-17.1
sudo tar -xzvf ${HOME}/plugin-build/svalinn-plugin-17.1.tgz
```

Test the Plugin
Expand Down
9 changes: 8 additions & 1 deletion iGeom/iGeom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,8 +1454,15 @@ CGMTagManager::CGMTagManager()
// get the tag number for CATag
DLIList<int> tag_types;
int max_type = 0;
CubitAttribManager *cam = CGMApp::instance()->attrib_manager();

#ifdef CUBIT_17_PLUS
pshriwise marked this conversation as resolved.
Show resolved Hide resolved
CubitAttribManager cam = CGMApp::instance()->attrib_manager();
cam.get_registered_types(tag_types);
#else
CubitAttribManager* cam = CGMApp::instance()->attrib_manager();
cam->get_registered_types(tag_types);
#endif

for (int i = 0; i < tag_types.size(); i++) {
int this_type = tag_types.get_and_step();
max_type = (max_type < this_type ? this_type : max_type);
Expand Down