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

Add support for EGADS geometry system #330

Open
wants to merge 91 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
0232dae
Created barebones framework for EGADS model support. Need to look at …
tuckerbabcock Nov 13, 2019
9ffeda7
Added implementation of gmi_egads_load. Reqiuired adding methods to E…
tuckerbabcock Nov 13, 2019
4678b2d
re-implemented gmi_egads_load to use existing EGADS functions
tuckerbabcock Nov 14, 2019
dd0c9bd
more implementation of gmi functions.
tuckerbabcock Nov 14, 2019
a71b5c3
all methods have preliminary implementation. Now trying to link and c…
tuckerbabcock Nov 17, 2019
4698365
moved gmi_egads files to new gmi_egads directory
tuckerbabcock Nov 17, 2019
494b48c
Added cmake files for finding and compiling with EGADS. Currently the…
tuckerbabcock Nov 17, 2019
56de2bd
fix some typos causing compile erros
tuckerbabcock Nov 19, 2019
4d11165
gmi-egads builds without any erros now
tuckerbabcock Nov 19, 2019
749572f
gmi_egads compiles and links, though mesh verify fails.
tuckerbabcock Nov 20, 2019
542eb7f
testing fails with 3D and 2D meshes.For 2D at least it seems the AFLR…
tuckerbabcock Nov 23, 2019
13c02dc
added 2D ugrid support
tuckerbabcock Dec 13, 2019
25ffd58
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Dec 13, 2019
79a1869
read dummy face ID
tuckerbabcock Dec 13, 2019
432bea2
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Dec 13, 2019
f7f35a2
fix read amount for dummy face ID
tuckerbabcock Dec 13, 2019
e56f39d
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Dec 13, 2019
83bab38
changed to egads reader based on how memory was being managed. Needs …
tuckerbabcock Dec 16, 2019
c7f8a65
2D ugrid reader now reads a 2D ugrid mesh and can verify and write to…
tuckerbabcock Dec 16, 2019
c6cdfc6
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Dec 16, 2019
4619442
added algorithm include
tuckerbabcock Dec 16, 2019
e77a4ef
Merge branch 'ugrid1D-dev' into egads-dev
tuckerbabcock Dec 16, 2019
dbe89db
changed gmi_normal to use correct get topology
tuckerbabcock Dec 16, 2019
f474a5b
added print statements for debug
tuckerbabcock Dec 16, 2019
6e64cda
added function for vertex reparameterization on an edge
tuckerbabcock Dec 16, 2019
dc51601
added parameterization of vertices onto edges and faces in ugrid read…
tuckerbabcock Dec 18, 2019
761f5e5
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Dec 18, 2019
67b60e9
rewrote apf function loadMdsFromUgrid to read the header and figure o…
tuckerbabcock Jan 24, 2020
dc71643
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Jan 24, 2020
8964abe
cleaning up code prior to pull request
tuckerbabcock Jan 24, 2020
640d67b
removed static from gmi_egads_load
tuckerbabcock Jan 24, 2020
faf8e46
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Jan 24, 2020
24dab6d
curved 2D meshing works with EGADS with ugrid reading
tuckerbabcock Jan 25, 2020
2576981
removing old code
tuckerbabcock Jan 25, 2020
7437a90
removed print statements
tuckerbabcock Jan 25, 2020
2f07637
Merge branch 'ugrid2D-dev' into egads-dev
tuckerbabcock Jan 25, 2020
dd95ea8
added egads_ent struct that wraps ego, and attempts to support 3D mod…
tuckerbabcock Jan 26, 2020
c733e03
quick change to struct typedef so it will compile on scorec
tuckerbabcock Jan 26, 2020
eae7fd6
changing pointers and mallocs
tuckerbabcock Jan 27, 2020
572326e
Merge branch 'egads-dev' of github.com:tuckerbabcock/core into egads-dev
tuckerbabcock Jan 27, 2020
5e2ef43
more pointer/reference changes
tuckerbabcock Jan 27, 2020
383e168
changes from last night on scorec
tuckerbabcock Jan 27, 2020
843e549
merged changes
tuckerbabcock Jan 27, 2020
23de3fc
seem to have fixed strange malloc issue. Wasn't allocating room for t…
tuckerbabcock Jan 27, 2020
54d6a06
Added new method to initialize used in pumiAIM
tuckerbabcock Feb 5, 2020
114273a
changed FindEGADS file to make it work better.
tuckerbabcock Feb 5, 2020
a55157a
Merge branch 'egads-dev' of github.com:tuckerbabcock/core into egads-dev
tuckerbabcock Feb 5, 2020
420a015
re-wrote gmi_egads to use new global array of ents to handle allocati…
tuckerbabcock Feb 27, 2020
7bbb112
implemented getVertexUV
tuckerbabcock Feb 27, 2020
7571748
pumi verifies tetgen mesh with multiple regions
tuckerbabcock Feb 29, 2020
a4e7219
can read adjacency binary file from PUMI AIM
tuckerbabcock Mar 1, 2020
edef983
freeing adjacency table
tuckerbabcock Mar 1, 2020
b63e7e5
commenting out prints
tuckerbabcock Mar 18, 2020
cb96614
fix errors
tuckerbabcock Mar 18, 2020
e317b7e
temporarily making isParamPointInsideModel always return true to allo…
tuckerbabcock Mar 26, 2020
4664d05
cleaning up memory use more
tuckerbabcock Apr 24, 2020
f5b9220
merge upstream develop into egads-dev
tuckerbabcock Aug 10, 2020
38f65e1
merge updates
tuckerbabcock Aug 10, 2020
7c43f81
made everything not part of the interface static, moved non-public pa…
tuckerbabcock Sep 22, 2020
38b539f
fix compiler warnings related to fread on gcc 10
tuckerbabcock Oct 20, 2020
cf181ef
removing unneeded forward declaration of struct
tuckerbabcock Nov 5, 2020
c51a0fa
adding egads related things to the split executable, making egads_glo…
tuckerbabcock Nov 20, 2020
e14c8fe
Merge branch 'develop' into egads-dev
tuckerbabcock Feb 12, 2021
bdaf4ca
Merge branch 'egads-dev' of github.com:tuckerbabcock/core into egads-dev
tuckerbabcock Feb 12, 2021
7d5d26e
reverting example_config
tuckerbabcock Feb 12, 2021
f3c0892
address clang warning about firstFace being used uninitialized
tuckerbabcock Feb 12, 2021
1832ccc
attempting to add EGADS split tests
tuckerbabcock Feb 13, 2021
46f75a8
introduced new egads_model struct to store model specific things and …
tuckerbabcock Feb 15, 2021
9a47057
cleaning up old print statements
tuckerbabcock Feb 15, 2021
a7e41e3
document sup filename and free it
tuckerbabcock Feb 15, 2021
ad8ab1f
use private linkage and header file includes for EGADS headers and li…
tuckerbabcock Feb 16, 2021
bf4420b
revert changes from isParamPointInsideModel
tuckerbabcock Feb 16, 2021
31a02f5
remove iostream include from apfMesh.cc
tuckerbabcock Feb 16, 2021
2e505f6
using cmake's configure_file to define the locations of the egads and…
tuckerbabcock Mar 25, 2021
6bfd4c6
added function pointers and routines for opening/closing dylib
tuckerbabcock Mar 25, 2021
a4a41ef
function pointers loaded and switched to using them
tuckerbabcock Mar 25, 2021
2e1012d
switched to lazy symbol loading
tuckerbabcock Mar 25, 2021
0f8ea73
added error checking to make sure EGADS is loaded correctly
tuckerbabcock Mar 25, 2021
3ae5571
got rid of EG_isEquivalent since it does not work with EGADSlite
tuckerbabcock Mar 25, 2021
3fa7bc7
added egads stuff to verify executable
tuckerbabcock Mar 25, 2021
64e1dec
remove goto from getVertexUV
tuckerbabcock Mar 26, 2021
9aff5b6
make fail str buffers larger to address compile error on gcc 8.1.0
tuckerbabcock Mar 27, 2021
b6f2b42
switching to only using EGADSlite
tuckerbabcock Mar 29, 2021
4f58438
added back the option to build gmi_egads with EGADS or EGADSlite, opt…
tuckerbabcock Apr 2, 2021
f145720
change USE_EGADSLITE to PUMI_USE_EGADSLITE
tuckerbabcock Apr 2, 2021
f98fe6d
remove egadslite include accidentally commited
tuckerbabcock Apr 3, 2021
83e59a5
Merge branch 'master' into egads-dev
tuckerbabcock Feb 18, 2022
407ead5
Merge branch 'master' into egads-dev
tuckerbabcock Feb 18, 2022
afb21d5
update CMake support for finding EGADS, import it as a target now, an…
tuckerbabcock Jul 25, 2022
910b12a
Update gmi EGADS CMake setup to use target_compile_definitions for HA…
tuckerbabcock Aug 2, 2022
3f13376
enable testing EGADS with EGADSLITE enabled
tuckerbabcock Aug 2, 2022
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
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")

# Use <PackageName>_ROOT cmake or environment variables when finding packages
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()

# Gets C99 support
find_package(C99 REQUIRED)
set(CMAKE_C_FLAGS "${C99_C_FLAGS} ${CMAKE_C_FLAGS}")
Expand Down Expand Up @@ -92,6 +97,7 @@ set(Trilinos_PREFIX "" CACHE STRING "Trilinos installation directory")
option(SKIP_SIMMETRIX_VERSION_CHECK "enable at your own risk; it may result in undefined behavior" OFF)
option(ENABLE_SIMMETRIX "Build with Simmetrix support" OFF)
message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}")

option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF)
message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}")
if(ENABLE_SIMMETRIX)
Expand All @@ -113,6 +119,17 @@ if(ENABLE_SIMMETRIX)
find_package(SimModSuite MODULE REQUIRED)
endif()

option(ENABLE_EGADS "Build with EGADS support" OFF)
message(STATUS "ENABLE_EGADS: ${ENABLE_EGADS}")

if(ENABLE_EGADS)
option(PUMI_USE_EGADSLITE "Build with EGADSlite" ON)
set(ESP_USE_EGADSLITE ${PUMI_USE_EGADSLITE})
message(STATUS "PUMI_USE_EGADSLITE: ${PUMI_USE_EGADSLITE}")

find_package(ESP REQUIRED COMPONENTS egads)
endif()

if(ENABLE_OMEGA_H)
# find the omega_h library
set(SCOREC_USE_Omega_h_DEFAULT ${ENABLE_OMEGA_H})
Expand All @@ -126,6 +143,7 @@ add_subdirectory(lion)
add_subdirectory(pcu)
add_subdirectory(gmi)
add_subdirectory(gmi_sim)
add_subdirectory(gmi_egads)
add_subdirectory(can)
add_subdirectory(mth)
add_subdirectory(apf)
Expand Down
1 change: 1 addition & 0 deletions apf/apfMesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void Mesh::getParamOn(ModelEntity* g, MeshEntity* e, Vector3& p)
ModelEntity* from_g = toModel(e);
if (g == from_g)
return getParam(e, p);

gmi_ent* from = (gmi_ent*)from_g;
gmi_ent* to = (gmi_ent*)g;
Vector3 from_p;
Expand Down
1 change: 1 addition & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_OPTIONAL_PACKAGES
SCORECgmi_sim
SCORECapf_sim
SCORECgmi_egads
LIB_REQUIRED_PACKAGES
SCOREClion
SCORECpcu
Expand Down
256 changes: 256 additions & 0 deletions cmake/FindESP.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
#[=======================================================================[.rst:
FindESP
---------
Copy link
Contributor

Choose a reason for hiding this comment

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

@tuckerbabcock is this something you wrote? The style of the commenting looks different which indicates it might come from elsewhere. If so, we need to include the source/licensing information.

Copy link
Contributor Author

@tuckerbabcock tuckerbabcock Aug 1, 2022

Choose a reason for hiding this comment

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

@jacobmerson you're right, I should have put some attribution in this file. I "wrote" it, by looking at CMake's built in "FindBoost.cmake" file (https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake) and used that as a template


Find ESP include dirs and libraries

Use this module by invoking :command:`find_package` with the form:

.. code-block:: cmake

find_package(ESP
[version] [EXACT] # Minimum or EXACT version e.g. 1.19.0
[REQUIRED] # Fail with error if ESP is not found
[COMPONENTS <libs>...] # ESP libraries by their canonical name
# e.g. "egads" for "libegads"
[OPTIONAL_COMPONENTS <libs>...]
# Optional ESP libraries by their canonical name
) # e.g. "egads" for "libegads"

This module finds headers and requested component libraries from ESP

Result Variables
^^^^^^^^^^^^^^^^

This module defines the following variables:

``ESP_FOUND``
True if headers and requested libraries were found.

``ESP_INCLUDE_DIRS``
ESP include directories.

``ESP_LIBRARY_DIRS``
Link directories for ESP libraries.

``ESP_LIBRARIES``
ESP component libraries to be linked.

``ESP_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found.

``ESP_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include
:command:`target_link_libraries` debug/optimized keywords).

Cache variables
^^^^^^^^^^^^^^^

Search results are saved persistently in CMake cache entries:

``ESP_INCLUDE_DIR``
Directory containing ESP headers.

``ESP_LIBRARY_DIR``
Directory containing ESP libraries.

Hints
^^^^^

This module reads hints about search locations from variables:

``ESP_ROOT``, ``ESPROOT``
Preferred installation prefix.

``ESP_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.

``ESP_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.

``ESP_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not
specified by these hint variables. Default is ``OFF``.

``ESP_ADDITIONAL_VERSIONS``
List of ESP versions not known to this module.
(ESP install locations may contain the version).

Users may set these hints or results as ``CACHE`` entries. Projects
should not read these entries directly but instead use the above
result variables. Note that some hint names start in upper-case
``ESP``. One may specify these as environment variables if they are
not specified as CMake variables or cache entries.

This module first searches for the ESP header files using the above
hint variables (excluding ``ESP_LIBRARYDIR``) and saves the result in
``ESP_INCLUDE_DIR``. Then it searches for requested component libraries
using the above hints (excluding ``ESP_INCLUDEDIR``), "lib" directories
near ``ESP_INCLUDE_DIR``, and the library name configuration settings below.
It saves the library directories in ``ESP_LIBRARY_DIR`` and individual library
locations in ``ESP_<COMPONENT>_LIBRARY``.
When one changes settings used by previous searches in the same build
tree (excluding environment variables) this module discards previous
search results affected by the changes and searches again.

Imported Targets
^^^^^^^^^^^^^^^^

This module defines the following :prop_tgt:`IMPORTED` targets:

``ESP::ESP``
Interface target for all components linking against all components.

``ESP::<component>``
Target for specific component dependency (shared or static library).

It is important to note that the imported targets behave differently
than variables created by this module: multiple calls to
:command:`find_package(ESP)` in the same directory or sub-directories with
different options (e.g. static or shared) will not override the
values of the targets created by the first call.

Examples
^^^^^^^^

Find ESP libraries and use imported targets:

.. code-block:: cmake

find_package(ESP REQUIRED COMPONENTS
egads ocsm)
add_executable(foo foo.cc)
target_link_libraries(foo ESP::egads ESP::aimUtil)

#]=======================================================================]

include(GNUInstallDirs)

set(quiet "")
if(ESP_FIND_QUIETLY)
set(quiet QUIET)
endif()

# ------------------------------------------------------------------------
# Find ESP include dir
# ------------------------------------------------------------------------
if(NOT ESP_INCLUDE_DIR)

set(_ESP_INCLUDE_SEARCH_DIRS "")
if(ESP_INCLUDEDIR)
list(APPEND _ESP_INCLUDE_SEARCH_DIRS ${ESP_INCLUDEDIR})
endif()

if(DEFINED ENV{ESP_ROOT})
list(APPEND _ESP_INCLUDE_SEARCH_DIRS $ENV{ESP_ROOT}/include $ENV{ESP_ROOT})
endif()

if(DEFINED ENV{ESPROOT})
list(APPEND _ESP_INCLUDE_SEARCH_DIRS $ENV{ESPROOT}/include $ENV{ESPROOT})
endif()

find_path(ESP_INCLUDE_DIR NAMES egads.h HINTS ${_ESP_INCLUDE_SEARCH_DIRS})
endif()

message(STATUS "ESP include dir: ${ESP_INCLUDE_DIR}")

# ------------------------------------------------------------------------
# Extract version information from egadsTypes.h
# ------------------------------------------------------------------------
if(ESP_INCLUDE_DIR)

# Extract ESP_VERSION_MAJOR AND ESP_VERISON_MINOR from egadsTypes.h
set(ESP_VERSION_MAJOR 0)
set(ESP_VERSION_MINOR 0)
file(STRINGS "${ESP_INCLUDE_DIR}/egadsTypes.h" _ESP_VERSION_CONTENTS REGEX "#define EGADSMAJOR ")
if("${_ESP_VERSION_CONTENTS}" MATCHES "#define EGADSMAJOR[ \t\r\n]+([0-9]+)")
set(ESP_VERSION_MAJOR "${CMAKE_MATCH_1}")
endif()
unset(_ESP_VERSION_HEADER_CONTENTS)

file(STRINGS "${ESP_INCLUDE_DIR}/egadsTypes.h" _ESP_VERSION_CONTENTS REGEX "#define EGADSMINOR ")
if("${_ESP_VERSION_CONTENTS}" MATCHES "#define EGADSMINOR[ \t\r\n]+([0-9]+)")
set(ESP_VERSION_MINOR "${CMAKE_MATCH_1}")
endif()
unset(_ESP_VERSION_HEADER_CONTENTS)

# ESP versioning does not include a patch number so we set it to zero
SET(ESP_VERSION_PATCH 0)

# Define alias variables for backwards compat.
set(ESP_MAJOR_VERSION ${ESP_VERSION_MAJOR})
set(ESP_MINOR_VERSION ${ESP_VERSION_MINOR})
set(ESP_SUBMINOR_VERSION ${ESP_VERSION_PATCH})

# Define ESP version in x.y.z format
set(ESP_VERSION_STRING "${ESP_VERSION_MAJOR}.${ESP_VERSION_MINOR}.${ESP_VERSION_PATCH}")

# message(STATUS "ESP Version: ${ESP_VERSION_STRING}")
endif()

# ------------------------------------------------------------------------
# Begin finding ESP libraries
# ------------------------------------------------------------------------

# all potential ESP components
set(ESP_COMPONENTS caps egads ocsm)

# if not explicitly asking for any component, find all of them
if(NOT ESP_FIND_COMPONENTS)
set(ESP_FIND_COMPONENTS ${ESP_COMPONENTS})
endif()

foreach(component ${ESP_FIND_COMPONENTS})

if(component STREQUAL "egads")
if (ESP_USE_EGADSLITE)
find_library(egads_LIBRARY NAMES egadslite)
else()
find_library(egads_LIBRARY NAMES egads)
endif()
else()
find_library(${component}_LIBRARY NAMES ${component})
endif()

if(${component}_LIBRARY)
set(ESP_${component}_FOUND True)
else()
set(ESP_${component}_FOUND False)
endif()

# Create a library target only if the above checks passed
if(ESP_${component}_FOUND AND NOT TARGET ESP::${component})
# Can't easily tell how ESP was compiled, so just default to UNKNOWN
# library type and CMake will make a best effort guess
add_library(ESP::${component} UNKNOWN IMPORTED)

set_property(
TARGET ESP::${component} PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${ESP_INCLUDE_DIR}"
)
if(EXISTS "${${component}_LIBRARY}")
set_property(
TARGET ESP::${component} PROPERTY
IMPORTED_LOCATION "${${component}_LIBRARY}"
)
endif()
endif()
endforeach()

# Create INTERFACE target that bundles all the found libraries together
if(NOT TARGET ESP::ESP)
add_library(ESP::ESP INTERFACE IMPORTED)
foreach(component ${ESP_FIND_COMPONENTS})
if(TARGET ESP::${component})
target_link_libraries(ESP::ESP INTERFACE ESP::${component})
endif()
endforeach()
endif()

# Use CMake provided module to check the variables
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ESP
REQUIRED_VARS ESP_INCLUDE_DIR
VERSION_VAR ESP_VERSION_STRING
HANDLE_COMPONENTS
)
43 changes: 43 additions & 0 deletions gmi_egads/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
if(DEFINED TRIBITS_PACKAGE)
include(pkg_tribits.cmake)
return()
endif()

if(NOT ENABLE_EGADS)
return()
endif()

#Sources & Headers
set(SOURCES gmi_egads.c)
set(HEADERS gmi_egads.h)

add_library(gmi_egads ${SOURCES})

target_link_libraries(gmi_egads
PUBLIC
gmi
PRIVATE
ESP::egads
)

target_compile_definitions(gmi_egads
INTERFACE
PUMI_HAS_EGADS
)

if (PUMI_USE_EGADSLITE)
target_compile_definitions(gmi_egads
PRIVATE
PUMI_USE_EGADSLITE
)
endif()

# Include directories
target_include_directories(gmi_egads PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

scorec_export_library(gmi_egads)

bob_end_subdir()
Loading