Skip to content

Commit 55cb839

Browse files
authored
Merge pull request #84 from svalinn/linux_action
Cubit 2020.2 compatibility -- Linux action and scripts
2 parents fa010b7 + 2794682 commit 55cb839

13 files changed

Lines changed: 286 additions & 64 deletions

File tree

.github/workflows/linux.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Linux
2+
3+
on:
4+
# allows us to run workflows manually
5+
workflow_dispatch:
6+
pull_request:
7+
branches:
8+
- develop
9+
- master
10+
push:
11+
branches:
12+
- develop
13+
- master
14+
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
jobs:
19+
main:
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
include:
24+
- cubit: 17.1.0
25+
os: ubuntu-18.04
26+
URL: LINUX_CUBIT_17_1_0
27+
URL_SDK: LINUX_CUBIT_SDK_17_1_0
28+
29+
- cubit: 2020.2
30+
os: ubuntu-20.04
31+
URL: LINUX_CUBIT_2020_2
32+
URL_SDK: LINUX_CUBIT_SDK_2020_2
33+
34+
name: 'Trelis/Cubit Svalinn Plugin ${{ matrix.cubit }} Build for Linux'
35+
36+
37+
steps:
38+
- uses: actions/checkout@v2
39+
40+
- name: Environment Variables
41+
shell: bash -l {0}
42+
run: |
43+
echo "CURRENT=$(pwd)" >> $GITHUB_ENV
44+
echo "SCRIPTPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
45+
echo "PLUGIN_ABS_PATH=$GITHUB_WORKSPACE/.." >> $GITHUB_ENV
46+
echo "FOLDER_PKG=$GITHUB_WORKSPACE/../pkg" >> $GITHUB_ENV
47+
echo "SUDO=sudo " >> $GITHUB_ENV
48+
if [ "${{ matrix.cubit }}" = "17.1.0" ]; then
49+
echo "CUBIT_PATH=/opt/Trelis-17.1" >> $GITHUB_ENV
50+
echo "TRELIS_PKG=Trelis-17.1.0-Lin64.deb" >> $GITHUB_ENV
51+
echo "TRELIS_SDK_PKG=Trelis-SDK-17.1.0-Lin64.tar.gz" >> $GITHUB_ENV
52+
echo "CMAKE_ADDITIONAL_FLAGS=-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" >> $GITHUB_ENV
53+
echo "UBUNTU_VERSION=18" >> $GITHUB_ENV
54+
echo "HDF5_PATH=/usr/lib/x86_64-linux-gnu/hdf5/serial" >> $GITHUB_ENV
55+
else
56+
echo "TRELIS_PKG=Coreform-Cubit-2020.2-Ubuntu20.deb" >> $GITHUB_ENV
57+
echo "TRELIS_SDK_PKG=Coreform-Cubit-2020.2-Lin64-SDK.tar.gz" >> $GITHUB_ENV
58+
echo "CUBIT_PATH=/opt/Coreform-Cubit-2020.2" >> $GITHUB_ENV
59+
echo "UBUNTU_VERSION=20" >> $GITHUB_ENV
60+
echo "HDF5_PATH=/usr/local/HDF_Group/HDF5/1.12.0" >> $GITHUB_ENV
61+
fi
62+
echo "source $GITHUB_WORKSPACE/scripts/linux_share_build.sh" >> $HOME/.bash_profile
63+
64+
- name: Initial setup
65+
shell: bash -l {0}
66+
run: |
67+
install_prerequisites
68+
setup_var ${{ matrix.cubit }}
69+
echo "TRELIS_PATH=$TRELIS_PATH" >> $GITHUB_ENV
70+
echo "TRELIS_PKG=$TRELIS_PKG" >> $GITHUB_ENV
71+
echo "TRELIS_SDK_PKG=$TRELIS_SDK_PKG" >> $GITHUB_ENV
72+
echo "CMAKE_ADDITIONAL_FLAGS=$CMAKE_ADDITIONAL_FLAGS" >> $GITHUB_ENV
73+
74+
- name: Downloading packages
75+
shell: bash -l {0}
76+
env:
77+
CUBIT_DEB_URL: ${{ secrets[matrix.URL] }}
78+
CUBIT_SDK_URL: ${{ secrets[matrix.URL_SDK] }}
79+
run: |
80+
mkdir -p $FOLDER_PKG
81+
cd $FOLDER_PKG
82+
echo ${TRELIS_PKG}
83+
curl -L https://uwmadison.box.com/shared/static/${CUBIT_DEB_URL}.deb --output ${TRELIS_PKG}
84+
curl -L https://uwmadison.box.com/shared/static/${CUBIT_SDK_URL}.gz --output ${TRELIS_SDK_PKG}
85+
86+
87+
88+
89+
- name: Build HDF5
90+
shell: bash -l {0}
91+
run: |
92+
build_hdf5
93+
94+
- name: Build MOAB
95+
shell: bash -l {0}
96+
run: |
97+
build_moab
98+
99+
- name: build DAGMC
100+
shell: bash -l {0}
101+
run: |
102+
build_dagmc
103+
104+
- name: Trelis setup
105+
shell: bash -l {0}
106+
env:
107+
CUBIT_DEB_URL: ${{ secrets[matrix.URL] }}
108+
CUBIT_SDK_URL: ${{ secrets[matrix.URL_SDK] }}
109+
run: |
110+
setup_Trelis_sdk ${{ matrix.cubit }}
111+
112+
- name: build plugin
113+
shell: bash -l {0}
114+
run: |
115+
build_plugin
116+
117+
- name: prepare pkg
118+
shell: bash -l {0}
119+
run: |
120+
build_plugin_pkg ${{ matrix.cubit }}
121+
122+
- name: 'Upload package'
123+
uses: actions/upload-artifact@v2
124+
with:
125+
name: svalinn-plugin_linux_${{ matrix.cubit }}
126+
path: /home/runner/work/Trelis-plugin/pack/svalinn-plugin_linux_cubit_${{ matrix.cubit }}.tgz

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
bld
2+
build

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@ endif ()
2323
# Use C++11
2424
set(CMAKE_CXX_STANDARD 11)
2525

26-
# Adjust compiler setting for Linux using gcc version 5.0 and higher
27-
if (CMAKE_SYSTEM_NAME MATCHES Linux AND CMAKE_COMPILER_IS_GNUCXX)
28-
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0")
29-
if (NOT CMAKE_CXX_FLAGS MATCHES _GLIBCXX_USE_CXX11_ABI)
30-
set(CMAKE_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0 ${CMAKE_CXX_FLAGS}")
31-
endif ()
32-
endif ()
33-
endif ()
34-
3526
# Find Cubit/Trelis
3627
if (NOT CUBIT_ROOT)
3728
message(FATAL_ERROR "CUBIT_ROOT not specified")
@@ -80,6 +71,8 @@ if (BUILD_IGEOM)
8071
include_directories(iGeom)
8172
add_library(iGeom SHARED ${IGEOM_SRC_FILES})
8273
target_link_libraries(iGeom ${CUBIT_LIBS})
74+
target_include_directories(iGeom PUBLIC
75+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
8376
install(TARGETS iGeom LIBRARY DESTINATION lib)
8477
list(APPEND PLUGIN_LINK_LIBS iGeom)
8578
endif ()
@@ -129,5 +122,6 @@ message(STATUS "Building Svalinn plugin")
129122
message(STATUS "PLUGIN_SRC_FILES: ${PLUGIN_SRC_FILES}")
130123
message(STATUS "PLUGIN_LINK_LIBS: ${PLUGIN_LINK_LIBS}")
131124
add_library(svalinn_plugin MODULE ${PLUGIN_SRC_FILES})
125+
target_include_directories(svalinn_plugin PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
132126
target_link_libraries(svalinn_plugin ${PLUGIN_LINK_LIBS})
133127
install(TARGETS svalinn_plugin LIBRARY DESTINATION lib)

CubitVersionCompatibility.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef SVALINN_COMPATIBILITY_HPP
2+
#define SVALINN_COMPATIBILITY_HPP
3+
4+
#include "CubitVersion.h"
5+
6+
#if CUBIT_VERSION_MAJOR <= 17
7+
#define CUBIT_INTERFACE_HEADER "CubitInterface.hpp"
8+
#define MSG_HANDLER CubitInterface::get_cubit_message_handler()
9+
#else
10+
#define CUBIT_INTERFACE_HEADER "CubitCoreformInterface.hpp"
11+
#define MSG_HANDLER CubitMessage::get_message_handler()
12+
#endif
13+
14+
#endif // SVALINN_COMPATIBILITY_HPP

SvalinnPlugin.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#include "SvalinnPlugin.hpp"
2+
23
#include <sstream>
34

5+
#include "CubitVersionCompatibility.hpp"
6+
#include CUBIT_INTERFACE_HEADER
7+
48
#include "CubitMessageHandler.hpp"
5-
#include "CubitInterface.hpp"
69

710
//Not including this when you aren't building the DAGMC export means you don't need to have MakeWatertight.hpp
811
#ifdef BUILD_DAGMC_EXPORT
@@ -20,12 +23,12 @@
2023
SvalinnPlugin::SvalinnPlugin()
2124
{
2225

23-
CubitMessageHandler *console = CubitInterface::get_cubit_message_handler();
26+
CubitMessageHandler* console = MSG_HANDLER;
2427
if (console) {
2528
std::ostringstream load_message;
2629
load_message.str("");
2730
load_message << "Loaded Svalinn plugin." << std::endl;
28-
CubitInterface::get_cubit_message_handler()->print_error(load_message.str().c_str());
31+
console->print_error(load_message.str().c_str());
2932
}
3033

3134
}

export_dagmc_cmd/DAGMCExportCommand.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "DAGMCExportCommand.hpp"
2-
#include "CubitInterface.hpp"
2+
3+
#include "CubitVersionCompatibility.hpp"
4+
#include CUBIT_INTERFACE_HEADER
35

46
// CGM includes
57
#include "GeometryQueryTool.hpp"
@@ -27,7 +29,7 @@
2729

2830
#define CHK_MB_ERR_RET(A,B) if (moab::MB_SUCCESS != (B)) { \
2931
message << (A) << (B) << std::endl; \
30-
CubitInterface::get_cubit_message_handler()->print_message(message.str().c_str()); \
32+
MSG_HANDLER ->print_message(message.str().c_str()); \
3133
return false; \
3234
}
3335

@@ -46,12 +48,12 @@ DAGMCExportCommand::DAGMCExportCommand() :
4648
verbose_warnings = false;
4749
fatal_on_curves = false;
4850

49-
CubitMessageHandler *console = CubitInterface::get_cubit_message_handler();
51+
CubitMessageHandler* console = MSG_HANDLER;
5052
if (console) {
5153
std::ostringstream load_message;
5254
load_message.str("");
5355
load_message << "-- DAGMC export command available." << std::endl;
54-
CubitInterface::get_cubit_message_handler()->print_error(load_message.str().c_str());
56+
console->print_error(load_message.str().c_str());
5557
}
5658
}
5759

@@ -248,8 +250,8 @@ moab::ErrorCode DAGMCExportCommand::teardown()
248250
message << "----- All surfaces faceted correctly -----" << std::endl;
249251
}
250252
message << "***** End of Faceting Summary Information *****" << std::endl;
251-
252-
CubitInterface::get_cubit_message_handler()->print_message(message.str().c_str());
253+
254+
MSG_HANDLER->print_message(message.str().c_str());
253255
message.str("");
254256

255257

iGeom/iGeom.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#include "iGeom.h"
2+
3+
#include "CubitVersionCompatibility.hpp"
4+
#include CUBIT_INTERFACE_HEADER
5+
26
#include "CATag.hpp"
37
#include "CubitEntity.hpp"
4-
#include "CubitInterface.hpp"
58
#include "CubitVersion.h"
69
#include "GeometryQueryTool.hpp"
710
#include "Body.hpp"
@@ -150,7 +153,7 @@ void iGeom_createBrick(iGeom_Instance instance,
150153
error_message.str("");
151154
error_message << "Dimensions must be >= 0, or y & z must both be zero."
152155
<< std::endl;
153-
CubitInterface::get_cubit_message_handler()->print_error(error_message.str().c_str());
156+
MSG_HANDLER->print_error(error_message.str().c_str());
154157
}
155158
else {
156159

@@ -606,7 +609,7 @@ void iGeom_intersectEnts(iGeom_Instance instance,
606609
}
607610

608611
if (0 == new_body_list.size()) {
609-
CubitInterface::get_cubit_message_handler()->print_error("Intersect Failed");
612+
MSG_HANDLER->print_error("Intersect Failed");
610613
return;
611614
}
612615
else {

iGeom/tests/iGeom_test.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include "iGeom_test.hpp"
2-
#include "iGeom.h"
2+
33
#include <vector>
4-
#include "CubitInterface.hpp"
4+
5+
#include "CubitVersionCompatibility.hpp"
6+
#include CUBIT_INTERFACE_HEADER
7+
8+
#include "iGeom.h"
59

610
// CGM includes
711
#include "GeometryModifyTool.hpp"
@@ -14,12 +18,12 @@ iGeom_test::iGeom_test()
1418
radius = 2.0;
1519
radius2 = 1.0;
1620

17-
CubitMessageHandler *console = CubitInterface::get_cubit_message_handler();
21+
CubitMessageHandler* console = MSG_HANDLER;
1822
if (console) {
1923
std::ostringstream load_message;
2024
load_message.str("");
2125
load_message << "-- iGeom_test command available." << std::endl;
22-
CubitInterface::get_cubit_message_handler()->print_error(load_message.str().c_str());
26+
console->print_error(load_message.str().c_str());
2327
}
2428
}
2529

import_mcnp_cmd/MCNPImp.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "MCNPImp.hpp"
2-
#include "CubitInterface.hpp"
2+
3+
#include "CubitVersionCompatibility.hpp"
4+
#include CUBIT_INTERFACE_HEADER
5+
36
#include "CubitMessage.hpp"
47
#include "options.hpp"
58
#include "mcnp2cad.hpp"
@@ -25,13 +28,12 @@ MCNPImp::MCNPImp()
2528
Gopt.override_tolerance = false;
2629
Gopt.input_file = "";
2730

28-
29-
CubitMessageHandler *console = CubitInterface::get_cubit_message_handler();
31+
CubitMessageHandler* console = MSG_HANDLER;
3032
if (console) {
3133
std::ostringstream load_message;
3234
load_message.str("");
3335
load_message << "-- MCNP import command available." << std::endl;
34-
CubitInterface::get_cubit_message_handler()->print_error(load_message.str().c_str());
36+
console->print_error(load_message.str().c_str());
3537
}
3638

3739
}

scripts/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ Linux (tested on Ubuntu 18.04 and 20.04):
1616
- `build_plugin_pkg()`: build a tarball containing the plugin
1717

1818
- `build_plugin_linux.sh`: build the plugin on a linux computer (relies on apt-get to install required dependencies)
19-
- arguments: Trelis/Cubit version to build the plugin for (only supported yet `17.1.0`)
19+
- arguments:
20+
- 1 Trelis/Cubit version to build the plugin for (only supported yet `17.1.0`and Cubit `2020.2`)
21+
- 2 path to Trelis/Cubit package folder (containing Trelis install package and SDK)
22+
- 3 name of the Trelis deb package
23+
- 4 name of the Trelis sdk tarball
2024
- `build_plugin_docker_ubuntu.sh`: build the plugin in a docker container
2125
- arguments: Arguments have to be provided in order
2226
- 1 docker image (tested on `ubuntu:18.04` and `ubuntu:20.04`)
23-
- 2 local path to the folder containing the Trelis/Cubit install deb and SDK
24-
- 3 version of Cubit Trelis to build the plugin for (only tested with `17.1.0`)
27+
- 2 version of Cubit Trelis to build the plugin for (only tested with `17.1.0` and Cubit `2020.2`)
28+
- 3 local path to the folder containing the Trelis/Cubit install deb and SDK
29+
- 4 name of the Trelis deb package
30+
- 5 name of the Trelis sdk tarball

0 commit comments

Comments
 (0)