Skip to content

Commit f99b98a

Browse files
authored
Merge pull request #50 from MASTmultiphysics/nastran_io
NastranIO support for reading Nastran meshes/subdomains/boundaries.
2 parents 5b61795 + 6930531 commit f99b98a

34 files changed

+21785
-52
lines changed

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ build
66
# Files generated by CMake.
77
src/base/mast_config.h
88

9-
# Files generated by Python example/documentation preprocessor.
10-
doc/example_1.dox
11-
doc/example_2.dox
12-
doc/example_3.dox
13-
149
# CLion IDE files.
1510
.idea/
1611
cmake-build*/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "doc/assets"]
2+
path = doc/assets
3+
url = https://github.com/MASTmultiphysics/mast-assets.git

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ install:
4040

4141
script:
4242
- ci/build_mast.sh
43-
-
4443

4544
deploy:
4645
provider: script

CMakeLists.txt

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PREAMBLE
2-
cmake_minimum_required(VERSION 3.2)
2+
cmake_minimum_required(VERSION 3.13)
33
project(MAST
44
VERSION 0.3
55
LANGUAGES C CXX)
@@ -14,24 +14,25 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1414
include(GNUInstallDirs)
1515

1616
# Build options with defaults.
17-
option(ENABLE_GCMMA "Build with GCMMA interface" OFF)
18-
option(ENABLE_DOT "Build with DOT interface" OFF)
19-
option(ENABLE_SNOPT "Build with SNOPT interface" OFF)
20-
option(ENABLE_NLOPT "Build with NLOPT interface" OFF)
21-
option(ENABLE_CYTHON "Build with CYTHON interface" OFF)
22-
option(BUILD_DOC "Build documentation" OFF)
23-
24-
# Required dependency paths.
17+
option(ENABLE_GCMMA "Build with GCMMA interface" OFF)
18+
option(ENABLE_DOT "Build with DOT interface" OFF)
19+
option(ENABLE_SNOPT "Build with SNOPT interface" OFF)
20+
option(ENABLE_NLOPT "Build with NLOPT interface" OFF)
21+
option(ENABLE_NASTRANIO "Build with support for reading Nastran meshes" OFF)
22+
option(ENABLE_CYTHON "Build with support for Cython development" OFF)
23+
option(BUILD_DOC "Build documentation" OFF)
24+
25+
# Dependency paths (optional) - these paths help CMake find dependencies.
2526
set(MAST_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
2627
set(libMesh_DIR "libMesh_DIR" CACHE PATH "Directory containing libMesh include/ and lib/")
2728
set(PETSc_DIR "PETSc_DIR" CACHE PATH "Directory containing PETSc include/ and lib/")
2829
set(PETSc_ARCH "PETSc_ARCH" CACHE STRING "Configuration/build of PETSc that should be used.")
2930
set(SLEPc_DIR "SLEPc_DIR" CACHE PATH "Directory containing SLEPc include/ and lib/")
3031
set(SLEPc_ARCH "SLEPc_ARCH" CACHE STRING "Configuration/build of SLEPc that should be used.")
3132
set(EIGEN3_ROOT "Eigen_DIR" CACHE PATH "Directory containing eigen header files")
32-
set(DOT_DIR "DOT_DIR" CACHE PATH "Directory containing DOT lib/")
33-
set(SNOPT_DIR "SNOpt_DIR" CACHE PATH "Directory containing SNOPT lib/")
34-
set(NLOPT_DIR "NLOpt_DIR" CACHE PATH "Directory containing NLOpt include/ and lib/")
33+
set(DOT_DIR "DOT_DIR" CACHE PATH "Directory containing DOT lib/")
34+
set(SNOPT_DIR "SNOpt_DIR" CACHE PATH "Directory containing SNOPT lib/")
35+
set(NLOPT_DIR "NLOpt_DIR" CACHE PATH "Directory containing NLOpt include/ and lib/")
3536

3637
# EXTERNALLY PROVIDED CONTENT
3738
# None. Use this if we pull something in during the build in the future.
@@ -83,12 +84,36 @@ else()
8384
set (MAST_ENABLE_NLOPT 0)
8485
endif()
8586

87+
if (ENABLE_NASTRANIO)
88+
find_package(Python3 REQUIRED)
89+
90+
# Make sure Python has pyNastran.
91+
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import pyNastran"
92+
RESULT_VARIABLE PYNASTRAN_ERROR)
93+
if(PYNASTRAN_ERROR)
94+
message(FATAL_ERROR "Error finding pyNastran package for Python3_EXECUTABLE!")
95+
else()
96+
message(STATUS " pyNastran package found")
97+
endif()
98+
99+
# Make sure Python has NumPy.
100+
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import numpy"
101+
RESULT_VARIABLE NUMPY_ERROR)
102+
if(NUMPY_ERROR)
103+
message(FATAL_ERROR "Error finding pyNastran package for Python3_EXECUTABLE!")
104+
else()
105+
message(STATUS " Numpy package found")
106+
endif()
107+
endif()
108+
109+
# THIRD PARTY/CONTRIB
110+
# - This directory contains files developed by third parties and are included in the
111+
# MAST source for convenience.
112+
add_subdirectory(contrib)
113+
86114
# MAIN TARGETS
87115
add_subdirectory(src)
88116

89-
# EXAMPLES
90-
add_subdirectory(examples)
91-
92117
# DOCUMENTATION
93118
if(BUILD_DOC)
94119
add_subdirectory(doc)
@@ -98,3 +123,6 @@ endif()
98123
enable_testing()
99124
add_subdirectory(tests)
100125

126+
# EXAMPLES
127+
add_subdirectory(examples)
128+

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,14 @@ This code was developed under funding from the Air Force Research Laboratory.
77
MAST was cleared for public release on 08 Nov 2016 with case number 88ABW-2016-5689.
88

99
Documentation for the code is available at [https://mastmultiphysics.github.io](https://mastmultiphysics.github.io).
10+
11+
## Submodules
12+
To keep the size of this main MAST repository smaller, a git submodule is used
13+
to store larger media/assets such as images and animations used for the documentation
14+
in a separate repo (doc/assets). To build the documentation locally, you must update
15+
the submodule. To do this, simply run the following commands from inside the root
16+
level of this main repository:
17+
```
18+
git submodule init
19+
git submodule update
20+
```

ci/build_dependencies.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
if [ "${TRAVIS_OS_NAME}" = linux ]; then # Ubuntu Linux
44

55
if [ "${TRAVIS_DIST}" = xenial ]; then # Ubuntu 16.04 Xenial Xerus
6+
cd ${HOME} || exit
7+
8+
# Python 3.6 apt repository (since its not neatly included in Ubuntu 16.04)
9+
sudo add-apt-repository -y ppa:deadsnakes/ppa
10+
11+
# Regular libMesh/MAST dependencies.
612
sudo apt-get -qq update
713
sudo apt-get -qq install -y gfortran wget m4
814
sudo apt-get -qq install -y openmpi-bin libopenmpi-dev
@@ -12,6 +18,19 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then # Ubuntu Linux
1218
sudo apt-get -qq install -y libeigen3-dev
1319
sudo apt-get -qq install -y doxygen graphviz rsync
1420
sudo apt-get -qq install -y texlive-latex-base dvi2ps ghostscript
21+
sudo apt-get -qq install -y python3.6 python3.6-dev libpython3.6
22+
23+
# Get pip working with external Python 3.6.
24+
wget https://bootstrap.pypa.io/get-pip.py || exit
25+
sudo python3.6 get-pip.py || exit
26+
27+
sudo python3.6 -m pip install numpy scipy docopt colorama pandas h5py matplotlib cpylog pyNastran
28+
sudo python3.6 -m pip install Cython --install-option="--no-cython-compile"
29+
30+
# Update to later CMake release.
31+
wget https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-x86_64.sh || exit
32+
sudo mkdir /opt/cmake || exit
33+
sudo sh cmake-3.15.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license || exit
1534

1635
# elif [ "${TRAVIS_DIST}" = bionic ]; then # Ubuntu 18.04 Bionic Beaver
1736
# sudo apt-get -qq update

ci/build_mast.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then # Ubuntu Linux
1818
# First let us build/install a Release (optimized) version of MAST (-DCMAKE_BUILD_TYPE=Release).
1919
echo "TEST RELEASE/OPTIMIZED BUILD..."
2020
cd build_rel || exit
21-
cmake .. \
21+
/opt/cmake/bin/cmake .. \
2222
-DCMAKE_BUILD_TYPE=Release \
2323
-DCMAKE_INSTALL_PREFIX="${MAST_INSTALL_DIR}" \
2424
-DCMAKE_C_COMPILER=mpicc \
@@ -28,14 +28,19 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then # Ubuntu Linux
2828
-DPETSc_DIR=/usr/lib/petscdir/3.6.2/x86_64-linux-gnu-real \
2929
-DSLEPc_DIR=/usr/lib/slepcdir/3.6.1/x86_64-linux-gnu-real \
3030
-DEIGEN3_ROOT=/usr/include/eigen3 \
31+
-DPython3_DIR=/usr \
3132
-DBOOST_ROOT=/usr \
3233
-DBUILD_DOC=ON \
3334
-DENABLE_DOT=OFF \
3435
-DENABLE_GCMMA=OFF \
35-
-DENABLE_SNOPT=OFF || exit
36+
-DENABLE_SNOPT=OFF \
37+
-DENABLE_NASTRANIO=ON \
38+
-DENABLE_CYTHON=ON || exit
3639

3740
if [ ${CI_BUILD_DOCS} ]; then
3841
make doc_doxygen || exit
42+
cd ${TRAVIS_BUILD_DIR} || exit
43+
ci/prepare_docs.sh || exit
3944
else
4045
make -j 2 || exit
4146
make install || exit
@@ -51,7 +56,7 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then # Ubuntu Linux
5156
else
5257

5358
cd ../build_dbg || exit
54-
cmake .. \
59+
/opt/cmake/bin/cmake .. \
5560
-DCMAKE_BUILD_TYPE=Debug \
5661
-DCMAKE_INSTALL_PREFIX="${MAST_INSTALL_DIR}" \
5762
-DCMAKE_C_COMPILER=mpicc \
@@ -61,11 +66,14 @@ if [ "${TRAVIS_OS_NAME}" = linux ]; then # Ubuntu Linux
6166
-DPETSc_DIR=/usr/lib/petscdir/3.6.2/x86_64-linux-gnu-real \
6267
-DSLEPc_DIR=/usr/lib/slepcdir/3.6.1/x86_64-linux-gnu-real \
6368
-DEIGEN3_ROOT=/usr/include/eigen3 \
69+
-DPython3_DIR=/usr \
6470
-DBOOST_ROOT=/usr \
6571
-DBUILD_DOC=ON \
6672
-DENABLE_DOT=OFF \
6773
-DENABLE_GCMMA=OFF \
68-
-DENABLE_SNOPT=OFF || exit
74+
-DENABLE_SNOPT=OFF\
75+
-DENABLE_NASTRANIO=ON \
76+
-DENABLE_CYTHON=ON || exit
6977

7078
if [ ${CI_BUILD_DOCS} ]; then
7179
echo "No CI documentation for a Debug build."
@@ -115,12 +123,16 @@ elif [ "${TRAVIS_OS_NAME}" = osx ]; then # macOS 10.14, XCode 10.2
115123
-DEIGEN3_ROOT=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/eigen-3.3.7-bd2r4aqrkox7dpebj2r3gqvgpqzwuh7x \
116124
-DLAPACK_LIBRARIES=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/openblas-0.3.7-xqeap7iegoomce3es67cd7exlnq3neue/lib/libopenblas.dylib \
117125
-DBLAS_LIBRARIES=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/openblas-0.3.7-xqeap7iegoomce3es67cd7exlnq3neue/lib/libopenblas.dylib \
126+
-DPython3_DIR=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/python-3.7.4-hh7odiqwzpw2nnfdcfzjxvb3ggyzwvfk \
118127
-DENABLE_GCMMA=OFF \
119128
-DENABLE_DOT=OFF \
120129
-DENABLE_SNOPT=OFF \
121130
-DENABLE_NLOPT=OFF \
122131
-DENABLE_CYTHON=OFF \
123-
-DBUILD_DOC=OFF || exit
132+
-DBUILD_DOC=OFF \
133+
-DENABLE_NASTRANIO=ON \
134+
-DENABLE_CYTHON=ON || exit
135+
124136
make -j 2 || exit
125137
make install || exit
126138

@@ -141,12 +153,16 @@ elif [ "${TRAVIS_OS_NAME}" = osx ]; then # macOS 10.14, XCode 10.2
141153
-DEIGEN3_ROOT=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/eigen-3.3.7-bd2r4aqrkox7dpebj2r3gqvgpqzwuh7x \
142154
-DLAPACK_LIBRARIES=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/openblas-0.3.7-xqeap7iegoomce3es67cd7exlnq3neue/lib/libopenblas.dylib \
143155
-DBLAS_LIBRARIES=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/openblas-0.3.7-xqeap7iegoomce3es67cd7exlnq3neue/lib/libopenblas.dylib \
156+
-DPython3_DIR=/Users/travis/Code/spack-mstc/spack/opt/spack/darwin-mojave-x86_64/clang-10.0.1-apple/python-3.7.4-hh7odiqwzpw2nnfdcfzjxvb3ggyzwvfk \
144157
-DENABLE_GCMMA=OFF \
145158
-DENABLE_DOT=OFF \
146159
-DENABLE_SNOPT=OFF \
147160
-DENABLE_NLOPT=OFF \
148161
-DENABLE_CYTHON=OFF \
149-
-DBUILD_DOC=OFF || exit
162+
-DBUILD_DOC=OFF \
163+
-DENABLE_NASTRANIO=ON \
164+
-DENABLE_CYTHON=ON || exit
165+
150166
make -j 2 || exit
151167

152168
else

ci/deploy_docs.sh

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
#!/usr/bin/env bash
22

3-
# Deploy Doxygen generated HTML documentation to Github for hosting.
3+
# Deploy organized HTML documentation to Github for hosting.
44
#
5-
# This script deploys Doxygen generated HTML documentation to the MAST Github repository for hosting. It is meant
6-
# to be called during the Travis-CI 'deploy' stage and requires the GH_TOKEN environment variable be set in
7-
# the Travis-CI job from an account that can push to https://github.com/MASTmultiphysics/MASTmultiphysics.github.io
5+
# This script deploys organized HTML documentation produced by `prepare_docs.sh` to a repository in the MAST Team
6+
# GitHub repository for hosting. It is meant to be called during the Travis-CI `deploy` stage and requires the
7+
# GH_TOKEN environment variable be set in the Travis-CI job from an account that can push
8+
# to https://github.com/MASTmultiphysics/MASTmultiphysics.github.io
89
#
9-
# Contents of this script were inspired in part by https://gist.github.com/willprice/e07efd73fb7f13f917ea.
10-
11-
# Setup git user for website commit information.
12-
git config --global user.email "[email protected]"
13-
git config --global user.name "Travis CI"
14-
15-
# Organize website content. First delete all current contents (except .git directory) and then copy generated
16-
# HTML and other desired files.
17-
mkdir ${TRAVIS_BUILD_DIR}/website
18-
cd ${TRAVIS_BUILD_DIR}/website
19-
rsync -r ${TRAVIS_BUILD_DIR}/build_rel/doc/doxygen/html/ .
20-
cp ${TRAVIS_BUILD_DIR}/doc/README.md .
21-
22-
# Initialize empty git repository. Add all files. Commit.
23-
git init
24-
git add .
25-
git commit --quiet --message "Travis build ${TRAVIS_BUILD_NUMBER}, mast-multiphysics commit ${TRAVIS_COMMIT}"
10+
# Contents of this script (and `prepare_docs.sh`) were inspired in part
11+
# by https://gist.github.com/willprice/e07efd73fb7f13f917ea.
2612

2713
# Set git remote URL. Force push to GitHub website repository.
2814
# Update git remote URL to include ${GH_TOKEN} key. Push files back to GitHub website repository.
29-
git remote add origin https://${GH_TOKEN}@github.com/MASTmultiphysics/MASTmultiphysics.github.io.git
30-
git push --force origin master
15+
git remote add origin https://${GH_TOKEN}@github.com/MASTmultiphysics/MASTmultiphysics.github.io.git || exit
16+
git push --force origin master || exit
3117

ci/prepare_docs.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Prepare/organized Doxygen generated HTML documentation to Github for hosting by `deploy_docs.sh`.
4+
#
5+
# This script organizes the Doxygen generated HTML documentation and commits it to local .git repository.
6+
# Doxygen generated HTML documentation to the MAST Github repository for hosting. This script should be called
7+
# during the Travis-CI 'script' phase after documentation is built so that if an error occurs we can catch it
8+
# on a non-master build (the 'deploy' stage only runs for commits on the `master` branch). We currently call it
9+
# inside of `ci/build_mast.sh` on the worker that satisfies ${CI_BUILD_DOCS}=true.
10+
#
11+
# Contents of this script (and `deploy_docs.sh`) were inspired in part by
12+
# https://gist.github.com/willprice/e07efd73fb7f13f917ea.
13+
14+
# Setup git user for website commit information.
15+
git config --global user.email "[email protected]" || exit
16+
git config --global user.name "Travis CI" || exit
17+
18+
# Organize website content. First delete all current contents (except .git directory) and then copy generated
19+
# HTML and other desired files.
20+
mkdir ${TRAVIS_BUILD_DIR}/website || exit
21+
cd ${TRAVIS_BUILD_DIR}/website || exit
22+
rsync -r ${TRAVIS_BUILD_DIR}/build_rel/doc/doxygen/html/ . || exit
23+
24+
# Initialize empty git repository. Add all files. Commit.
25+
git init || exit
26+
git add . || exit
27+
git commit --quiet --message "Travis build ${TRAVIS_BUILD_NUMBER}, mast-multiphysics commit ${TRAVIS_COMMIT}" || exit

cmake/FindCython.cmake

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Find the Cython compiler.
2+
#
3+
# This code sets the following variables:
4+
#
5+
# Cython_FOUND - Cython is available on the system.
6+
# Cython_EXECUTABLE - Path to the Cython executable.
7+
#
8+
# Note this file is a modified version of that provided by Kitware online.
9+
# --- see original Kitware copyright statement at bottom of file.
10+
11+
# Use the Cython executable that lives next to the Python executable if it
12+
# exists. If not, we will use whatever we can find on the system paths.
13+
if(Python3_FOUND)
14+
get_filename_component(_PYTHON_PATH ${Python3_EXECUTABLE} PATH)
15+
find_program(Cython_EXECUTABLE
16+
NAMES
17+
cython
18+
cython.bat
19+
cython3
20+
HINTS ${_PYTHON_PATH})
21+
else()
22+
find_program(Cython_EXECUTABLE
23+
NAMES
24+
cython
25+
cython.bat
26+
cython3)
27+
endif()
28+
29+
# Set standard CMake variables and output status.
30+
include(FindPackageHandleStandardArgs)
31+
find_package_handle_standard_args(Cython
32+
REQUIRED_VARS
33+
Cython_EXECUTABLE)
34+
35+
# Advance cache variables.
36+
mark_as_advanced(Cython_EXECUTABLE)
37+
38+
39+
40+
41+
42+
# Original Kitware copywrite statement. Modifications to code included
43+
# formatting changes to utilize MAST-Interface version of FindPython.cmake.
44+
#=============================================================================
45+
# Copyright 2011 Kitware, Inc.
46+
#
47+
# Licensed under the Apache License, Version 2.0 (the "License");
48+
# you may not use this file except in compliance with the License.
49+
# You may obtain a copy of the License at
50+
#
51+
# http://www.apache.org/licenses/LICENSE-2.0
52+
#
53+
# Unless required by applicable law or agreed to in writing, software
54+
# distributed under the License is distributed on an "AS IS" BASIS,
55+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
56+
# See the License for the specific language governing permissions and
57+
# limitations under the License.
58+
#=============================================================================

0 commit comments

Comments
 (0)