Skip to content

Commit 181f65c

Browse files
authored
Merge pull request #64 from ljacobson64/handle_trelis_17
Handle Trelis 17
2 parents fe8ab27 + 7a355d4 commit 181f65c

3 files changed

Lines changed: 79 additions & 37 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ if (CMAKE_SYSTEM_NAME MATCHES Linux AND CMAKE_COMPILER_IS_GNUCXX)
3333
endif ()
3434

3535
# Find Cubit/Trelis
36+
if (NOT CUBIT_ROOT)
37+
message(FATAL_ERROR "CUBIT_ROOT not specified")
38+
endif ()
3639
list(APPEND CMAKE_PREFIX_PATH ${CUBIT_ROOT}/bin)
3740
find_package(Cubit REQUIRED CONFIG)
3841
include_directories(${CUBIT_INCLUDE_DIRS})

README.md

Lines changed: 67 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
Svalinn plugins and command extensions for Trelis
22
=================================================
33

4-
**Beta:** This software is currently under early development. It has been
4+
**Beta:** This software is currently under early development. It has been
55
demonstrated to work on a wide range of problems, but the build system is not
6-
well developed.
6+
finalized.
7+
8+
The plugin has been tested and is confirmed to work with Trelis versions 16.5
9+
and 17.1. These build instructions assume that Trelis 17.1 is being used, but
10+
other versions can be used by replacing instances of "17.1" with the version
11+
being used.
712

813
Prerequisites
914
=============
1015

11-
In order to build the plugin, you must have access to Trelis-16.5 and the
12-
Trelis-16.5 SDK. Additionally, the following system packages must be present on
16+
In order to build the plugin, you must have access to Trelis and the Trelis SDK.
17+
Additionally, the following system packages must be present on
1318
your computer:
1419

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

3641
```
37-
sudo dpkg -i Trelis-16.5.3-Lin64.deb
42+
sudo dpkg -i Trelis-17.1.0-Lin64.deb
3843
```
3944

40-
This installs Trelis to `/opt/Trelis-16.5`.
45+
This installs Trelis to `/opt/Trelis-17.1`.
4146

42-
The Trelis SDK can be installed with these commands:
47+
The Trelis 17 SDK can be installed with these commands:
48+
49+
```
50+
cd /opt
51+
sudo tar -xzvf /path/to/Trelis-SDK-17.1.0-Lin64.tar.gz
52+
```
53+
54+
### Note for Trelis 16
55+
56+
The SDK for Trelis 16 should be unpacked from `/opt/Trelis-16.5` instead of
57+
just `/opt`; i.e.
4358

4459
```
4560
cd /opt/Trelis-16.5
46-
sudo tar -xzvf /path/to/Trelis-SDK-16.5.3-Lin64.tar.gz
61+
sudo tar -xzvf /path/to/Trelis-SDK-16.5.4-Lin64.tar.gz
4762
```
4863

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

5369
```
5470
cd /opt/Trelis-16.5/bin
@@ -72,8 +88,15 @@ remains empty when running Trelis as well.
7288
Build MOAB
7389
==========
7490

75-
MOAB must be built with HDF5 enabled. The following commands show how to build
76-
the MOAB dependency using system HDF5.
91+
MOAB must be built with HDF5 enabled. On Ubuntu 18.04, HDF5 is located in the
92+
`/usr/lib/x86_64-linux-gnu/hdf5/serial` directory, but it may be located
93+
somewhere else on other flavors or versions of Linux. MOAB should be built with
94+
the Eigen matrix algebra library instead of LAPACK. The
95+
`_GLIBCXX_USE_CXX11_ABI=0` flag is required for compatibility with Trelis.
96+
97+
The following commands show how to correctly build the MOAB dependency. If HDF5
98+
is located somewhere other than `/usr/lib/x86_64-linux-gnu/hdf5/serial`, then
99+
replace the directory with the correct one.
77100

78101
```
79102
cd ${HOME}/plugin-build
@@ -83,7 +106,7 @@ git clone https://bitbucket.org/fathomteam/moab -b Version5.1.0
83106
cd moab
84107
autoreconf -fi
85108
cd ../bld
86-
../moab/configure --disable-blaslapack \
109+
../moab/configure CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
87110
--enable-shared \
88111
--enable-optimize \
89112
--disable-debug \
@@ -98,17 +121,23 @@ make install
98121
Build DAGMC
99122
===========
100123

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

104132
```
105133
cd ${HOME}/plugin-build
106134
mkdir -pv DAGMC/bld
107135
cd DAGMC
108136
git clone https://github.com/svalinn/DAGMC -b develop
109137
cd bld
110-
cmake ../DAGMC -DMOAB_DIR=${HOME}/plugin-build/moab \
111-
-DBUILD_UWUW=OFF \
138+
cmake ../DAGMC -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 \
139+
-DMOAB_DIR=${HOME}/plugin-build/moab \
140+
-DBUILD_UWUW=ON \
112141
-DBUILD_TALLY=OFF \
113142
-DBUILD_BUILD_OBB=OFF \
114143
-DBUILD_MAKE_WATERTIGHT=ON \
@@ -120,21 +149,18 @@ make -j`grep -c processor /proc/cpuinfo`
120149
make install
121150
```
122151

123-
This results in the DAGMC library being built against the previously-built MOAB
124-
library.
125-
126152
Build the Plugin
127153
================
128154

129155
The following commands show how to build the plugin itself. The `CUBIT_ROOT`
130-
variable must point to the location of Trelis, while the `DAGMC_DIR` variable
131-
must point to the location of DAGMC.
156+
variable should point to the location of Trelis. The `DAGMC_DIR` variable should
157+
point to the location of the previously-built DAGMC library.
132158

133159
```
134160
cd ${HOME}/plugin-build
135161
mkdir -pv bld
136162
cd bld
137-
cmake ../Trelis-plugin -DCUBIT_ROOT=/opt/Trelis-16.5 \
163+
cmake ../Trelis-plugin -CUBIT_ROOT=/opt/Trelis-17.1 \
138164
-DDAGMC_DIR=${HOME}/plugin-build/DAGMC \
139165
-DCMAKE_BUILD_TYPE=Release \
140166
-DCMAKE_INSTALL_PREFIX=${HOME}/plugin-build
@@ -160,8 +186,9 @@ git submodule update --init
160186
Create the Tarball
161187
==================
162188

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

166193
```
167194
# Set up the directory which will contain the libraries
@@ -170,39 +197,43 @@ mkdir -p pack/bin/plugins/svalinn
170197
cd pack/bin/plugins/svalinn
171198
172199
# Copy all needed libraries into current directory
173-
cp -pPv ${HOME}/plugin-build/lib/* .
200+
cp -pPv /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100* .
174201
cp -pPv ${HOME}/plugin-build/moab/lib/libMOAB.so* .
175202
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libdagmc.so* .
176203
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libmakeWatertight.so* .
177-
cp -pPv /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.100* .
204+
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libpyne_dagmc.so* .
205+
cp -pPv ${HOME}/plugin-build/DAGMC/lib/libuwuw.so* .
206+
cp -pPv ${HOME}/plugin-build/lib/* .
178207
chmod 644 *
179208
180209
# Set the RPATH to be the current directory for the DAGMC libraries
181-
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libMOAB.so
182-
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libdagmc.so
183-
patchelf --set-rpath /opt/Trelis-16.5/bin/plugins/svalinn libmakeWatertight.so
210+
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libMOAB.so
211+
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libdagmc.so
212+
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libmakeWatertight.so
213+
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libpyne_dagmc.so
214+
patchelf --set-rpath /opt/Trelis-17.1/bin/plugins/svalinn libuwuw.so
184215
185216
# Create the Svalinn plugin tarball
186217
cd ..
187218
ln -sv svalinn/libsvalinn_plugin.so .
188219
cd ../..
189-
tar --sort=name -czvf svalinn-plugin.tgz bin
190-
mv -v svalinn-plugin.tgz ..
220+
tar --sort=name -czvf svalinn-plugin-17.1.tgz bin
221+
mv -v svalinn-plugin-17.1.tgz ..
191222
cd ..
192223
rm -rf pack
193224
```
194225

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

198229
Install the Plugin
199230
==================
200231

201232
To install the plugin, simply run
202233

203234
```
204-
cd /opt/Trelis-16.5
205-
sudo tar -xzvf ${HOME}/plugin-build/svalinn-plugin.tgz
235+
cd /opt/Trelis-17.1
236+
sudo tar -xzvf ${HOME}/plugin-build/svalinn-plugin-17.1.tgz
206237
```
207238

208239
Test the Plugin

iGeom/iGeom.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "CATag.hpp"
33
#include "CubitEntity.hpp"
44
#include "CubitInterface.hpp"
5+
#include "CubitVersion.h"
56
#include "GeometryQueryTool.hpp"
67
#include "Body.hpp"
78
#include "RefEntityFactory.hpp"
@@ -1454,8 +1455,15 @@ CGMTagManager::CGMTagManager()
14541455
// get the tag number for CATag
14551456
DLIList<int> tag_types;
14561457
int max_type = 0;
1457-
CubitAttribManager *cam = CGMApp::instance()->attrib_manager();
1458+
1459+
#if CUBIT_VERSION_MAJOR >= 17
1460+
CubitAttribManager cam = CGMApp::instance()->attrib_manager();
1461+
cam.get_registered_types(tag_types);
1462+
#else
1463+
CubitAttribManager* cam = CGMApp::instance()->attrib_manager();
14581464
cam->get_registered_types(tag_types);
1465+
#endif
1466+
14591467
for (int i = 0; i < tag_types.size(); i++) {
14601468
int this_type = tag_types.get_and_step();
14611469
max_type = (max_type < this_type ? this_type : max_type);

0 commit comments

Comments
 (0)