├── scripts ├── spack │ ├── repo.yaml │ ├── devtools_configs │ │ ├── mirrors.yaml │ │ ├── config.yaml │ │ ├── toss_4_x86_64_ib │ │ │ ├── compilers.yaml │ │ │ └── packages.yaml │ │ └── blueos_3_ppc64le_ib_p9 │ │ │ └── spack.yaml │ ├── configs │ │ ├── defaults.yaml │ │ └── versions.yaml │ ├── devtools.json │ ├── packages │ │ ├── tribol_devtools │ │ │ └── package.py │ │ ├── mfem │ │ │ ├── mfem-4.7-sundials-7.patch │ │ │ ├── mfem-4.7.patch │ │ │ └── package.py │ │ ├── cray-mpich │ │ │ └── package.py │ │ └── axom │ │ │ └── package.py │ └── specs.json ├── github-actions │ ├── docs_ignore_regexs.txt │ └── linux-check.sh ├── shared-macmini │ └── build-and-test.sh ├── update_copyright_date.sh ├── make_release_tarball.sh ├── check_log.py ├── check_for_missing_headers.py └── llnl │ └── build_tpls.py ├── data ├── mortar_ironing_sub_mesh │ ├── ixs.txt │ ├── size_info │ └── ixm.txt ├── mortar_bad_patch │ ├── size_info │ ├── ixs.txt │ └── ixm.txt ├── mortar_good_patch │ ├── size_info │ ├── ixs.txt │ └── ixm.txt ├── mortar_ironing_2 │ ├── size_info │ └── ixs.txt ├── mortar_ironing_3 │ ├── size_info │ └── ixs.txt ├── mortar_sphere_offset │ ├── size_info │ └── ixs.txt ├── mortar_node_on_node_sphere │ ├── size_info │ ├── ixm.txt │ ├── ixs.txt │ ├── xm.txt │ ├── xs.txt │ ├── ym.txt │ ├── ys.txt │ ├── zm.txt │ └── zs.txt ├── mortar_one_seg_rotated_square │ ├── size_info │ ├── ixm.txt │ ├── ixs.txt │ ├── xm.txt │ ├── xs.txt │ ├── ym.txt │ ├── ys.txt │ ├── zm.txt │ └── zs.txt ├── README.md ├── l-shape.mesh ├── two_hex.mesh ├── two_hex_apart.mesh ├── two_hex_overlap.mesh ├── mortar_ironing │ ├── active_nodes │ └── ixs.txt ├── NOTICE ├── star.mesh └── mortar_sphere │ └── ixm.txt ├── .gitignore ├── src ├── redecomp │ ├── README.md │ ├── redecomp.hpp │ ├── partition │ │ ├── PartitionMethod.cpp │ │ ├── PartitionElements.cpp │ │ ├── PartitionElements.hpp │ │ ├── PartitionEntity.hpp │ │ ├── Partitioner.cpp │ │ └── PartitionMethod.hpp │ ├── common │ │ └── TypeDefs.hpp │ ├── transfer │ │ ├── GridFnTransfer.hpp │ │ └── TransferByElements.hpp │ ├── utils │ │ ├── ArrayUtility.hpp │ │ └── MPIUtility.cpp │ ├── CMakeLists.txt │ ├── MultiRedecomp.hpp │ └── RedecompTransfer.hpp ├── shared │ ├── config.hpp.in │ ├── CMakeLists.txt │ └── infrastructure │ │ └── Profiling.hpp ├── tribol │ ├── mesh │ │ ├── InterfacePairs.cpp │ │ └── InterfacePairs.hpp │ ├── interface │ │ ├── CMakeLists.txt │ │ ├── yaml │ │ │ └── tribol_test_mesh_types.yaml │ │ ├── c_fortran │ │ │ ├── wrapTRIBOL_TEST_MESH.cpp │ │ │ ├── wrapTRIBOL_SIMPLE.h │ │ │ ├── typesTRIBOL_SIMPLE.h │ │ │ ├── wrapTestMesh.h │ │ │ └── typesTRIBOL_TEST_MESH.h │ │ ├── test_mesh_shroud.yaml │ │ ├── simple_tribol_shroud.yaml │ │ └── simple_tribol.hpp │ ├── config.hpp.in │ ├── utils │ │ ├── ContactPlaneOutput.hpp │ │ └── DataManager.hpp │ ├── physics │ │ ├── CommonPlane.hpp │ │ ├── Physics.hpp │ │ └── AlignedMortar.hpp │ ├── search │ │ └── InterfacePairFinder.hpp │ ├── geom │ │ ├── NodalNormal.hpp │ │ └── ElementNormal.hpp │ └── common │ │ ├── BasicTypes.hpp │ │ ├── ArrayTypes.hpp │ │ └── ExecModel.hpp ├── tests │ ├── mfem_smoke.cpp │ ├── caliper_smoke.cpp │ ├── tribol_check_tpl.cpp │ ├── enzyme_smoke.cpp │ └── redecomp_massmatrix.cpp └── CMakeLists.txt ├── docs ├── doxygen │ ├── CMakeLists.txt │ └── Doxyfile.in ├── sphinx │ ├── CMakeLists.txt │ ├── index.rst │ └── dev_guide │ │ ├── index.rst │ │ └── git_aliases.rst └── CMakeLists.txt ├── .gitmodules ├── .gitattributes ├── CONTRIBUTING.md ├── .uberenv_config.json ├── cmake ├── TribolCompilerFlags.cmake ├── TribolVersion.cmake ├── Options.cmake └── TribolConfig.cmake ├── .clang-format ├── LICENSE ├── NOTICE ├── .gitlab ├── build_toss4_cray.yml ├── build_toss4.yml └── build_blueos.yml ├── .gitlab-ci.yml ├── CODE-OF-CONDUCT.md └── README.md /scripts/spack/repo.yaml: -------------------------------------------------------------------------------- 1 | repo: 2 | namespace: tribol 3 | -------------------------------------------------------------------------------- /scripts/spack/devtools_configs/mirrors.yaml: -------------------------------------------------------------------------------- 1 | mirrors:: {} 2 | -------------------------------------------------------------------------------- /scripts/spack/devtools_configs/config.yaml: -------------------------------------------------------------------------------- 1 | ../configs/config.yaml -------------------------------------------------------------------------------- /data/mortar_ironing_sub_mesh/ixs.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | 18 4 | 15 5 | 3 6 | 6 7 | 21 8 | 18 9 | -------------------------------------------------------------------------------- /data/mortar_bad_patch/size_info: -------------------------------------------------------------------------------- 1 | 16 189 2 | 9 189 3 | -------------------------------------------------------------------------------- /data/mortar_good_patch/size_info: -------------------------------------------------------------------------------- 1 | 16 189 2 | 9 189 3 | -------------------------------------------------------------------------------- /data/mortar_ironing_2/size_info: -------------------------------------------------------------------------------- 1 | 120 696 2 | 40 696 3 | -------------------------------------------------------------------------------- /data/mortar_ironing_3/size_info: -------------------------------------------------------------------------------- 1 | 120 696 2 | 40 696 3 | -------------------------------------------------------------------------------- /data/mortar_sphere_offset/size_info: -------------------------------------------------------------------------------- 1 | 507 2918 2 | 48 2918 3 | -------------------------------------------------------------------------------- /data/mortar_ironing_sub_mesh/size_info: -------------------------------------------------------------------------------- 1 | 7 663 2 | 4 663 3 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/size_info: -------------------------------------------------------------------------------- 1 | 3 28 2 | 3 28 3 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/size_info: -------------------------------------------------------------------------------- 1 | 1 16 2 | 1 16 3 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/ixm.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 5 3 | 7 4 | 3 5 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/ixs.txt: -------------------------------------------------------------------------------- 1 | 8 2 | 10 3 | 14 4 | 12 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /build-*/ 3 | /install-*/ 4 | /*.cmake 5 | __pycache__/ 6 | /.cache/ 7 | /.vscode/ 8 | /build-*-*-*-* 9 | /compile_commands.json 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /src/redecomp/README.md: -------------------------------------------------------------------------------- 1 | # Redecomp: Contact Repartitioning Library 2 | 3 | ## Quick Start Guide 4 | 5 | See the examples in `../examples/domain_redecomp.cpp` and 6 | `../examples/multidomain_redecomp.cpp` for usage examples. -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/ixm.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 2 3 | 6 4 | 4 5 | 2 6 | 8 7 | 10 8 | 6 9 | 4 10 | 6 11 | 10 12 | 12 13 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/ixs.txt: -------------------------------------------------------------------------------- 1 | 15 2 | 19 3 | 21 4 | 17 5 | 17 6 | 21 7 | 25 8 | 23 9 | 19 10 | 27 11 | 25 12 | 21 13 | -------------------------------------------------------------------------------- /docs/doxygen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | blt_add_doxygen_target( tribol_doxygen ) -------------------------------------------------------------------------------- /data/mortar_ironing_sub_mesh/ixm.txt: -------------------------------------------------------------------------------- 1 | 166 2 | 194 3 | 198 4 | 170 5 | 170 6 | 198 7 | 202 8 | 174 9 | 194 10 | 222 11 | 226 12 | 198 13 | 198 14 | 226 15 | 230 16 | 202 17 | 222 18 | 250 19 | 254 20 | 226 21 | 226 22 | 254 23 | 258 24 | 230 25 | 174 26 | 202 27 | 206 28 | 178 29 | -------------------------------------------------------------------------------- /docs/sphinx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | blt_add_sphinx_target( tribol_guide ) 7 | 8 | if ( DOXYGEN_FOUND ) 9 | add_dependencies( tribol_guide tribol_doxygen ) 10 | endif() -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cmake/blt"] 2 | path = cmake/blt 3 | url = https://github.com/LLNL/blt.git 4 | [submodule "scripts/uberenv"] 5 | path = scripts/uberenv 6 | url = https://github.com/LLNL/uberenv.git 7 | [submodule "scripts/spack/radiuss-spack-configs"] 8 | path = scripts/spack/radiuss-spack-configs 9 | url = https://github.com/LLNL/radiuss-spack-configs.git 10 | -------------------------------------------------------------------------------- /docs/sphinx/index.rst: -------------------------------------------------------------------------------- 1 | .. ## 2 | .. ## Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 3 | .. ## 4 | .. ## Produced at the Lawrence Livermore National Laboratory 5 | .. ## 6 | 7 | #################### 8 | Tribol Documentation 9 | #################### 10 | 11 | **Contents:** 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | 16 | dev_guide/index.rst 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce LF (Unix) line endings for all text files 2 | 3 | # Source code 4 | *.cpp text eol=lf 5 | *.hpp text eol=lf 6 | 7 | # Plain or formatted text 8 | *.md text eol=lf 9 | *.rst text eol=lf 10 | *.txt text eol=lf 11 | 12 | # Scripts 13 | *.py text eol=lf 14 | *.sh text eol=lf 15 | 16 | # Configuration 17 | *.cmake text eol=lf 18 | *.json text eol=lf 19 | *.yaml text eol=lf 20 | *.yml text eol=lf 21 | -------------------------------------------------------------------------------- /data/README.md: -------------------------------------------------------------------------------- 1 | # Tribol Surface Geometry 2 | 3 | This directory stores test data used for the Tribol Interface Physics project 4 | 5 | ## License 6 | 7 | Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. Produced at Lawrence Livermore National Laboratory. 8 | 9 | Unlimited Open Source - CC-BY 4.0 Distribution 10 | 11 | See [LICENSE](LICENSE.txt) and [NOTICE](NOTICE) for details. 12 | 13 | LLNL-MISC-847782 14 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | #------------------------------------------------------------------------------ 7 | 8 | if (DOXYGEN_FOUND) 9 | add_subdirectory(doxygen) 10 | endif() 11 | 12 | if (SPHINX_FOUND) 13 | add_subdirectory(sphinx) 14 | endif() 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Tribol 2 | 3 | We welcome contributions to Tribol. To do so please submit a pull request through our 4 | Tribol github page at https://github.com/LLNL/Tribol. 5 | 6 | All contributions to Tribol must be made under the MIT License. 7 | 8 | Any questions can be sent to wopschall1@llnl.gov. 9 | 10 | # Attribution 11 | 12 | The Tribol project uses git's commit history to track contributions from individual developers. 13 | 14 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/xm.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 0.000000000000000E+000 4 | 0.000000000000000E+000 5 | 4.00000000000000 6 | 4.00000000000000 7 | 4.00000000000000 8 | 4.00000000000000 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 0.000000000000000E+000 12 | 0.000000000000000E+000 13 | 4.00000000000000 14 | 4.00000000000000 15 | 4.00000000000000 16 | 4.00000000000000 17 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/xs.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 0.000000000000000E+000 4 | 0.000000000000000E+000 5 | 4.00000000000000 6 | 4.00000000000000 7 | 4.00000000000000 8 | 4.00000000000000 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 0.000000000000000E+000 12 | 0.000000000000000E+000 13 | 4.00000000000000 14 | 4.00000000000000 15 | 4.00000000000000 16 | 4.00000000000000 17 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/ym.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 4.00000000000000 4 | 4.00000000000000 5 | 0.000000000000000E+000 6 | 0.000000000000000E+000 7 | 4.00000000000000 8 | 4.00000000000000 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 4.00000000000000 12 | 4.00000000000000 13 | 0.000000000000000E+000 14 | 0.000000000000000E+000 15 | 4.00000000000000 16 | 4.00000000000000 17 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/ys.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 4.00000000000000 4 | 4.00000000000000 5 | 0.000000000000000E+000 6 | 0.000000000000000E+000 7 | 4.00000000000000 8 | 4.00000000000000 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 4.00000000000000 12 | 4.00000000000000 13 | 0.000000000000000E+000 14 | 0.000000000000000E+000 15 | 4.00000000000000 16 | 4.00000000000000 17 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/zm.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 1.00000000000000 3 | 0.000000000000000E+000 4 | 1.00000000000000 5 | 0.000000000000000E+000 6 | 4.00000000000000 7 | 0.000000000000000E+000 8 | 4.00000000000000 9 | 1.00000000000000 10 | 8.00000000000000 11 | 1.00000000000000 12 | 8.00000000000000 13 | 4.00000000000000 14 | 8.00000000000000 15 | 4.00000000000000 16 | 8.00000000000000 17 | -------------------------------------------------------------------------------- /data/mortar_one_seg_rotated_square/zs.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 1.00000000000000 3 | 0.000000000000000E+000 4 | 1.00000000000000 5 | 0.000000000000000E+000 6 | 4.00000000000000 7 | 0.000000000000000E+000 8 | 4.00000000000000 9 | 1.00000000000000 10 | 8.00000000000000 11 | 1.00000000000000 12 | 8.00000000000000 13 | 4.00000000000000 14 | 8.00000000000000 15 | 4.00000000000000 16 | 8.00000000000000 17 | -------------------------------------------------------------------------------- /scripts/spack/devtools_configs/toss_4_x86_64_ib/compilers.yaml: -------------------------------------------------------------------------------- 1 | compilers: 2 | - compiler: 3 | environment: {} 4 | extra_rpaths: [] 5 | flags: {} 6 | modules: [] 7 | operating_system: rhel7 8 | paths: 9 | cc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gcc 10 | cxx: /usr/tce/packages/gcc/gcc-8.1.0/bin/g++ 11 | f77: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran 12 | fc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran 13 | spec: gcc@8.1.0 14 | target: x86_64 15 | -------------------------------------------------------------------------------- /scripts/spack/configs/defaults.yaml: -------------------------------------------------------------------------------- 1 | # Globally lock variants of third party libraries 2 | packages: 3 | caliper: 4 | require: 5 | - spec: "~kokkos" 6 | conduit: 7 | require: 8 | - spec: "~shared~test~examples~utilities" 9 | hdf5: 10 | require: 11 | - spec: ~shared~mpi 12 | raja: 13 | require: 14 | - spec: "~shared~examples~exercises" 15 | tribol: 16 | require: 17 | - spec: "~examples~tests" 18 | umpire: 19 | require: 20 | - spec: "~shared~examples~werror" -------------------------------------------------------------------------------- /scripts/spack/devtools.json: -------------------------------------------------------------------------------- 1 | { 2 | "package_name" : "tribol_devtools", 3 | "package_version" : "fakeversion", 4 | "package_source_dir" : "../..", 5 | "package_final_phase" : "", 6 | "spack_url": "https://github.com/spack/spack.git", 7 | "spack_commit": "22f3ef0a212676a16d9ece2562dedb50de7f1999", 8 | "spack_configs_path": "scripts/spack/devtools_configs", 9 | "spack_packages_path": "scripts/spack/packages", 10 | "spack_activate" : {"py-sphinx" : [""],"py-shroud" : [""]}, 11 | "spack_concretizer": "clingo" 12 | } 13 | -------------------------------------------------------------------------------- /scripts/github-actions/docs_ignore_regexs.txt: -------------------------------------------------------------------------------- 1 | # latex error that is specific to the docker image 2 | Error: \/undefined in getenv 3 | Package newunicodechar Warning: Redefining Unicode character on input line 4 | 5 | # doxygen is having problems handling the inherited constructors 6 | .*argument 'mesh' of command @param is not found in the argument list of smith::.*::FiniteElementVector\(typename FunctionSpace\) 7 | .*argument 'name' of command @param is not found in the argument list of smith::.*::FiniteElementVector\(typename FunctionSpace\) -------------------------------------------------------------------------------- /docs/sphinx/dev_guide/index.rst: -------------------------------------------------------------------------------- 1 | .. ## 2 | .. ## Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 3 | .. ## 4 | .. ## Produced at the Lawrence Livermore National Laboratory 5 | .. ## 6 | 7 | ###################### 8 | Tribol Developer Guide 9 | ###################### 10 | 11 | This guide provides information to developers contributing to Tribol regarding 12 | the various software development processes that are in place and workflow 13 | procedures. 14 | 15 | **Contents:** 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | 20 | git_aliases -------------------------------------------------------------------------------- /src/shared/config.hpp.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SHARED_CONFIG_HPP_ 7 | #define SHARED_CONFIG_HPP_ 8 | 9 | /* 10 | * Note: Use only C-style comments in this file 11 | * since it might be included from a C file 12 | */ 13 | 14 | /* 15 | * Build information 16 | */ 17 | #cmakedefine TRIBOL_USE_CALIPER 18 | #cmakedefine TRIBOL_USE_MPI 19 | 20 | #endif /* SHARED_CONFIG_HPP_ */ 21 | -------------------------------------------------------------------------------- /data/l-shape.mesh: -------------------------------------------------------------------------------- 1 | MFEM mesh v1.0 2 | # 3 | # MFEM Geometry Types (see mesh/geom.hpp): 4 | # 5 | # POINT = 0 6 | # SEGMENT = 1 7 | # TRIANGLE = 2 8 | # SQUARE = 3 9 | # TETRAHEDRON = 4 10 | # CUBE = 5 11 | # PRISM = 6 12 | # 13 | 14 | dimension 15 | 2 16 | 17 | elements 18 | 3 19 | 1 3 0 1 4 3 20 | 1 3 3 4 7 6 21 | 1 3 1 2 5 4 22 | 23 | boundary 24 | 8 25 | 1 1 0 1 26 | 1 1 1 2 27 | 1 1 2 5 28 | 1 1 5 4 29 | 1 1 4 7 30 | 1 1 7 6 31 | 1 1 6 3 32 | 1 1 3 0 33 | 34 | vertices 35 | 8 36 | 2 37 | 0 0 38 | 0.5 0 39 | 1 0 40 | 0 0.5 41 | 0.5 0.5 42 | 1 0.5 43 | 0 1 44 | 0.5 1 -------------------------------------------------------------------------------- /scripts/spack/packages/tribol_devtools/package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | from spack.package import * 7 | 8 | class TribolDevtools(BundlePackage): 9 | """This is a set of tools necessary for the developers of Tribol""" 10 | 11 | version('fakeversion') 12 | 13 | depends_on("doxygen") 14 | depends_on("python") 15 | depends_on("py-shroud") 16 | depends_on("py-sphinx") 17 | depends_on("llvm@19+clang") 18 | -------------------------------------------------------------------------------- /.uberenv_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "package_name": "tribol", 3 | "package_version": "develop", 4 | "package_final_phase": "initconfig", 5 | "package_source_dir": "../..", 6 | "spack_url": "https://github.com/spack/spack.git", 7 | "spack_commit": "b4b1c5f271c75e918ce922ff1bcc77542eda3ec9", 8 | "spack_packages_url": "https://github.com/spack/spack-packages.git", 9 | "spack_packages_commit": "a75a7f75182ffc7a51c6ca7f0fec4bf9b2705be8", 10 | "spack_configs_path": "scripts/spack/configs", 11 | "spack_packages_path": ["scripts/spack/radiuss-spack-configs/spack_repo/llnl_radiuss/packages", "scripts/spack/packages"] 12 | } 13 | -------------------------------------------------------------------------------- /data/mortar_bad_patch/ixs.txt: -------------------------------------------------------------------------------- 1 | 125 2 | 129 3 | 145 4 | 141 5 | 129 6 | 133 7 | 149 8 | 145 9 | 133 10 | 137 11 | 153 12 | 149 13 | 141 14 | 145 15 | 161 16 | 157 17 | 145 18 | 149 19 | 165 20 | 161 21 | 149 22 | 153 23 | 169 24 | 165 25 | 157 26 | 161 27 | 177 28 | 173 29 | 161 30 | 165 31 | 181 32 | 177 33 | 165 34 | 169 35 | 185 36 | 181 37 | -------------------------------------------------------------------------------- /src/redecomp/redecomp.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_REDECOMP_HPP_ 7 | #define SRC_REDECOMP_REDECOMP_HPP_ 8 | 9 | #include "partition/Partitioner.hpp" 10 | #include "partition/PartitionElements.hpp" 11 | #include "partition/RCB.hpp" 12 | #include "transfer/MatrixTransfer.hpp" 13 | #include "transfer/SparseMatrixTransfer.hpp" 14 | 15 | #include "MultiRedecomp.hpp" 16 | #include "RedecompTransfer.hpp" 17 | 18 | #endif /* SRC_REDECOMP_REDECOMP_HPP_ */ 19 | -------------------------------------------------------------------------------- /data/mortar_good_patch/ixs.txt: -------------------------------------------------------------------------------- 1 | 125 2 | 129 3 | 145 4 | 141 5 | 129 6 | 133 7 | 149 8 | 145 9 | 133 10 | 137 11 | 153 12 | 149 13 | 141 14 | 145 15 | 161 16 | 157 17 | 145 18 | 149 19 | 165 20 | 161 21 | 149 22 | 153 23 | 169 24 | 165 25 | 157 26 | 161 27 | 177 28 | 173 29 | 161 30 | 165 31 | 181 32 | 177 33 | 165 34 | 169 35 | 185 36 | 181 37 | -------------------------------------------------------------------------------- /scripts/spack/packages/mfem/mfem-4.7-sundials-7.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CHANGELOG b/CHANGELOG 2 | index cc064859e0..5adf5d8639 100644 3 | --- a/CHANGELOG 4 | +++ b/CHANGELOG 5 | @@ -1,3 +1,6 @@ 6 | +# This dummy patch is to prevent the real patch in MFEM's builtin Spack package from being applied. 7 | +# All changes in mfem-4.7-sundials-7.patch are already in MFEM since 4.7.0.2. 8 | +# Original patch: https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/mfem/mfem-4.7-sundials-7.patch 9 | Finite Element Discretization Library 10 | __ 11 | _ __ ___ / _| ___ _ __ ___ 12 | -------------------------------------------------------------------------------- /cmake/TribolCompilerFlags.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | if(TRIBOL_ENABLE_ASAN) 7 | message(STATUS "AddressSanitizer is ON (TRIBOL_ENABLE_ASAN)") 8 | foreach(_flagvar CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS) 9 | string(APPEND ${_flagvar} " -fsanitize=address -fno-omit-frame-pointer") 10 | endforeach() 11 | endif() 12 | 13 | # Need to add symbols to dynamic symtab in order to be visible from stacktraces 14 | string(APPEND CMAKE_EXE_LINKER_FLAGS " -rdynamic") 15 | -------------------------------------------------------------------------------- /cmake/TribolVersion.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | #------------------------------------------------------------------------------ 7 | # Tribol version is set here 8 | #------------------------------------------------------------------------------ 9 | set(TRIBOL_VERSION_MAJOR 0) 10 | set(TRIBOL_VERSION_MINOR 1) 11 | set(TRIBOL_VERSION_PATCH 0) 12 | string(CONCAT TRIBOL_VERSION_FULL 13 | "v${TRIBOL_VERSION_MAJOR}" 14 | ".${TRIBOL_VERSION_MINOR}" 15 | ".${TRIBOL_VERSION_PATCH}" ) 16 | -------------------------------------------------------------------------------- /src/redecomp/partition/PartitionMethod.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #include "PartitionMethod.hpp" 7 | 8 | namespace redecomp { 9 | 10 | template 11 | PartitionMethod::PartitionMethod( const MPI_Comm& comm ) : mpi_{ comm } 12 | { 13 | } 14 | 15 | template 16 | const MPIUtility& PartitionMethod::getMPIUtility() const 17 | { 18 | return mpi_; 19 | } 20 | 21 | template class PartitionMethod<2>; 22 | template class PartitionMethod<3>; 23 | 24 | } // end namespace redecomp 25 | -------------------------------------------------------------------------------- /scripts/spack/packages/cray-mpich/package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | from spack.package import * 7 | from spack_repo.builtin.packages.cray_mpich.package import CrayMpich as BuiltinCrayMpich 8 | 9 | class CrayMpich(BuiltinCrayMpich): 10 | # Adds newer version 11 | version('8.1.13') 12 | 13 | # https://github.com/spack/spack/blob/f50f5859f31d7ba76e044039253fdb1689ea017a/lib/spack/spack/build_systems/cached_cmake.py#L230-L234 14 | variant("slurm", default=True, description="Added to get MPIEXEC_NUMPROC_FLAG right") 15 | -------------------------------------------------------------------------------- /scripts/spack/packages/mfem/mfem-4.7.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 00d50283b..c9be1ddd0 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -1,3 +1,7 @@ 6 | +# This dummy patch is to prevent the real patch in MFEM's builtin Spack package from being applied. 7 | +# All changes in mfem-4.7.patch are already in MFEM since 4.7.0.1. 8 | +# Original patch: https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/mfem/mfem-4.7.patch 9 | + 10 | # Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced 11 | # at the Lawrence Livermore National Laboratory. All Rights reserved. See files 12 | # LICENSE and NOTICE for details. LLNL-CODE-806117. 13 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AccessModifierOffset: -1 3 | ColumnLimit: 120 4 | BreakBeforeBraces: Custom 5 | BraceWrapping: 6 | AfterCaseLabel: false 7 | AfterClass: false 8 | AfterControlStatement: false 9 | AfterEnum: true 10 | AfterFunction: true 11 | AfterNamespace: false 12 | AfterObjCDeclaration: false 13 | AfterStruct: false 14 | AfterUnion: false 15 | AfterExternBlock: false 16 | BeforeCatch: false 17 | BeforeElse: false 18 | IndentBraces: false 19 | SplitEmptyFunction: true 20 | SplitEmptyRecord: true 21 | SplitEmptyNamespace: true 22 | DerivePointerAlignment: false 23 | SortIncludes: false 24 | PointerAlignment: Left 25 | SpacesInParentheses: True 26 | SpaceInEmptyParentheses: False 27 | -------------------------------------------------------------------------------- /scripts/spack/configs/versions.yaml: -------------------------------------------------------------------------------- 1 | # Globally lock version of third party libraries 2 | packages: 3 | axom: 4 | require: 5 | - spec: "@0.10.1.1" 6 | adiak: 7 | require: 8 | - spec: "@0.4.1" 9 | caliper: 10 | require: 11 | - spec: "@2.12.1" 12 | camp: 13 | require: 14 | - spec: "@2024.07.0" 15 | conduit: 16 | require: 17 | - spec: "@0.9.2" 18 | hypre: 19 | require: 20 | - spec: "@2.26.0" 21 | mfem: 22 | require: 23 | - spec: "@4.8.0.1" 24 | petsc: 25 | require: 26 | - spec: "@3.21.6" 27 | raja: 28 | require: 29 | - spec: "@2024.07.0" 30 | sundials: 31 | require: 32 | - spec: "@6.7.0" 33 | umpire: 34 | require: 35 | - spec: "@2024.07.0" -------------------------------------------------------------------------------- /src/tribol/mesh/InterfacePairs.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #include "tribol/mesh/InterfacePairs.hpp" 7 | 8 | namespace tribol { 9 | 10 | TRIBOL_HOST_DEVICE InterfacePair::InterfacePair( IndexT element_id1, IndexT element_id2, bool is_contact_candidate ) 11 | : m_element_id1( element_id1 ), m_element_id2( element_id2 ), m_is_contact_candidate( is_contact_candidate ) 12 | { 13 | } 14 | 15 | TRIBOL_HOST_DEVICE InterfacePair::InterfacePair() 16 | : m_element_id1( -1 ), m_element_id2( -1 ), m_is_contact_candidate( true ) 17 | { 18 | } 19 | 20 | } // namespace tribol 21 | -------------------------------------------------------------------------------- /src/tribol/interface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | #------------------------------------------------------------------------------ 7 | # Generate tribol's C and Fortran interfaces 8 | #------------------------------------------------------------------------------ 9 | 10 | add_shroud( 11 | YAML_INPUT_FILE simple_tribol_shroud.yaml 12 | YAML_OUTPUT_DIR yaml 13 | C_FORTRAN_OUTPUT_DIR c_fortran 14 | ) 15 | 16 | add_shroud( 17 | YAML_INPUT_FILE test_mesh_shroud.yaml 18 | YAML_OUTPUT_DIR yaml 19 | C_FORTRAN_OUTPUT_DIR c_fortran 20 | ) 21 | -------------------------------------------------------------------------------- /data/two_hex.mesh: -------------------------------------------------------------------------------- 1 | MFEM mesh v1.0 2 | 3 | # 4 | # MFEM Geometry Types (see mesh/geom.hpp): 5 | # 6 | # POINT = 0 7 | # SEGMENT = 1 8 | # TRIANGLE = 2 9 | # SQUARE = 3 10 | # TETRAHEDRON = 4 11 | # CUBE = 5 12 | # 13 | 14 | dimension 15 | 3 16 | 17 | elements 18 | 2 19 | 1 5 0 1 3 2 4 5 7 6 20 | 1 5 8 9 11 10 12 13 15 14 21 | 22 | boundary 23 | 12 24 | 3 3 2 3 1 0 25 | 2 3 0 1 5 4 26 | 7 3 3 2 6 7 27 | 1 3 2 0 4 6 28 | 4 3 4 5 7 6 29 | 7 3 1 3 7 5 30 | 5 3 10 11 9 8 31 | 2 3 8 9 13 12 32 | 7 3 11 10 14 15 33 | 1 3 10 8 12 14 34 | 6 3 12 13 15 14 35 | 7 3 9 11 15 13 36 | 37 | vertices 38 | 16 39 | 3 40 | 0 0 0 41 | 1 0 0 42 | 0 1 0 43 | 1 1 0 44 | 0 0 1 45 | 1 0 1 46 | 0 1 1 47 | 1 1 1 48 | 0 0 1 49 | 1 0 1 50 | 0 1 1 51 | 1 1 1 52 | 0 0 2 53 | 1 0 2 54 | 0 1 2 55 | 1 1 2 -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/xm.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 0.000000000000000E+000 4 | 0.000000000000000E+000 5 | 0.848528137423860 6 | 0.989949493661170 7 | 0.692820323027550 8 | 0.808290376865480 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 0.848528137423860 12 | 0.989949493661170 13 | 1.20000000000000 14 | 1.40000000000000 15 | 0.000000000000000E+000 16 | 0.000000000000000E+000 17 | 0.000000000000000E+000 18 | 0.000000000000000E+000 19 | 0.707106781186550 20 | 0.848528137423860 21 | 0.577350269189630 22 | 0.692820323027550 23 | 0.000000000000000E+000 24 | 0.000000000000000E+000 25 | 0.707106781186550 26 | 0.848528137423860 27 | 1.00000000000000 28 | 1.20000000000000 29 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/xs.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 0.000000000000000E+000 4 | 0.000000000000000E+000 5 | 0.848528137423860 6 | 0.989949493661170 7 | 0.692820323027550 8 | 0.808290376865480 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 0.848528137423860 12 | 0.989949493661170 13 | 1.20000000000000 14 | 1.40000000000000 15 | 0.000000000000000E+000 16 | 0.000000000000000E+000 17 | 0.000000000000000E+000 18 | 0.000000000000000E+000 19 | 0.707106781186550 20 | 0.848528137423860 21 | 0.577350269189630 22 | 0.692820323027550 23 | 0.000000000000000E+000 24 | 0.000000000000000E+000 25 | 0.707106781186550 26 | 0.848528137423860 27 | 1.00000000000000 28 | 1.20000000000000 29 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/ym.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 0.848528137423860 4 | 0.989949493661170 5 | 0.000000000000000E+000 6 | 0.000000000000000E+000 7 | 0.692820323027550 8 | 0.808290376865480 9 | 1.20000000000000 10 | 1.40000000000000 11 | 0.848528137423860 12 | 0.989949493661170 13 | 0.000000000000000E+000 14 | 0.000000000000000E+000 15 | 0.000000000000000E+000 16 | 0.000000000000000E+000 17 | 0.707106781186550 18 | 0.848528137423860 19 | 0.000000000000000E+000 20 | 0.000000000000000E+000 21 | 0.577350269189630 22 | 0.692820323027550 23 | 1.00000000000000 24 | 1.20000000000000 25 | 0.707106781186550 26 | 0.848528137423860 27 | 0.000000000000000E+000 28 | 0.000000000000000E+000 29 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/ys.txt: -------------------------------------------------------------------------------- 1 | 0.000000000000000E+000 2 | 0.000000000000000E+000 3 | 0.848528137423860 4 | 0.989949493661170 5 | 0.000000000000000E+000 6 | 0.000000000000000E+000 7 | 0.692820323027550 8 | 0.808290376865480 9 | 1.20000000000000 10 | 1.40000000000000 11 | 0.848528137423860 12 | 0.989949493661170 13 | 0.000000000000000E+000 14 | 0.000000000000000E+000 15 | 0.000000000000000E+000 16 | 0.000000000000000E+000 17 | 0.707106781186550 18 | 0.848528137423860 19 | 0.000000000000000E+000 20 | 0.000000000000000E+000 21 | 0.577350269189630 22 | 0.692820323027550 23 | 1.00000000000000 24 | 1.20000000000000 25 | 0.707106781186550 26 | 0.848528137423860 27 | 0.000000000000000E+000 28 | 0.000000000000000E+000 29 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/zm.txt: -------------------------------------------------------------------------------- 1 | 1.20000000000000 2 | 1.40000000000000 3 | 0.848528137423860 4 | 0.989949493661170 5 | 0.848528137423860 6 | 0.989949493661170 7 | 0.692820323027550 8 | 0.808290376865480 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 0.000000000000000E+000 12 | 0.000000000000000E+000 13 | 0.000000000000000E+000 14 | 0.000000000000000E+000 15 | 1.00000000000000 16 | 1.20000000000000 17 | 0.707106781186550 18 | 0.848528137423860 19 | 0.707106781186550 20 | 0.848528137423860 21 | 0.577350269189630 22 | 0.692820323027550 23 | 0.000000000000000E+000 24 | 0.000000000000000E+000 25 | 0.000000000000000E+000 26 | 0.000000000000000E+000 27 | 0.000000000000000E+000 28 | 0.000000000000000E+000 29 | -------------------------------------------------------------------------------- /data/mortar_node_on_node_sphere/zs.txt: -------------------------------------------------------------------------------- 1 | 1.20000000000000 2 | 1.40000000000000 3 | 0.848528137423860 4 | 0.989949493661170 5 | 0.848528137423860 6 | 0.989949493661170 7 | 0.692820323027550 8 | 0.808290376865480 9 | 0.000000000000000E+000 10 | 0.000000000000000E+000 11 | 0.000000000000000E+000 12 | 0.000000000000000E+000 13 | 0.000000000000000E+000 14 | 0.000000000000000E+000 15 | 1.00000000000000 16 | 1.20000000000000 17 | 0.707106781186550 18 | 0.848528137423860 19 | 0.707106781186550 20 | 0.848528137423860 21 | 0.577350269189630 22 | 0.692820323027550 23 | 0.000000000000000E+000 24 | 0.000000000000000E+000 25 | 0.000000000000000E+000 26 | 0.000000000000000E+000 27 | 0.000000000000000E+000 28 | 0.000000000000000E+000 29 | -------------------------------------------------------------------------------- /src/tribol/interface/yaml/tribol_test_mesh_types.yaml: -------------------------------------------------------------------------------- 1 | # tribol_test_mesh_types.yaml 2 | # This file is generated by Shroud 0.12.1. Do not edit. 3 | # 4 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | # other Tribol Project Developers. See the top-level LICENSE file for details. 6 | # 7 | # SPDX-License-Identifier: (MIT) 8 | # 9 | # Types generated by Shroud for library 'TRIBOL_TEST_MESH' 10 | typemap: 11 | - namespace: tribol 12 | declarations: tribol 13 | - type: TestMesh 14 | fields: 15 | base: shadow 16 | wrap_header: 17 | - typesTRIBOL_TEST_MESH.h 18 | c_type: TRIBOL_TEST_MESH_TestMesh 19 | f_module_name: tribol_test_mesh 20 | f_derived_type: testmesh 21 | f_capsule_data_type: TRIBOL_TEST_MESH_SHROUD_testmesh_capsule 22 | f_to_c: "{f_var}%cxxmem" 23 | -------------------------------------------------------------------------------- /src/tests/mfem_smoke.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | //----------------------------------------------------------------------------- 7 | // 8 | // file: mfem_smoke.cpp 9 | // 10 | //----------------------------------------------------------------------------- 11 | 12 | #include "mfem.hpp" 13 | #include "gtest/gtest.h" 14 | 15 | //----------------------------------------------------------------------------- 16 | TEST( mfem_smoke, basic_use ) 17 | { 18 | // Simple usage of a basic mfem type 19 | mfem::Element* el = new mfem::Quadrilateral( 0, 1, 2, 3 ); 20 | 21 | EXPECT_EQ( mfem::Element::QUADRILATERAL, el->GetType() ); 22 | EXPECT_EQ( 4, el->GetNVertices() ); 23 | 24 | delete el; 25 | } 26 | -------------------------------------------------------------------------------- /data/two_hex_apart.mesh: -------------------------------------------------------------------------------- 1 | MFEM mesh v1.0 2 | 3 | # two unit cubes occupying [0,1]^3 and [0,1]x[0,1]x[1.01,2.01] 4 | 5 | # 6 | # MFEM Geometry Types (see mesh/geom.hpp): 7 | # 8 | # POINT = 0 9 | # SEGMENT = 1 10 | # TRIANGLE = 2 11 | # SQUARE = 3 12 | # TETRAHEDRON = 4 13 | # CUBE = 5 14 | # 15 | 16 | dimension 17 | 3 18 | 19 | elements 20 | 2 21 | 1 5 0 1 3 2 4 5 7 6 22 | 2 5 8 9 11 10 12 13 15 14 23 | 24 | boundary 25 | 12 26 | 3 3 2 3 1 0 27 | 2 3 0 1 5 4 28 | 7 3 3 2 6 7 29 | 1 3 2 0 4 6 30 | 4 3 4 5 7 6 31 | 7 3 1 3 7 5 32 | 5 3 10 11 9 8 33 | 2 3 8 9 13 12 34 | 7 3 11 10 14 15 35 | 1 3 10 8 12 14 36 | 6 3 12 13 15 14 37 | 7 3 9 11 15 13 38 | 39 | vertices 40 | 16 41 | 3 42 | 0 0 0 43 | 1 0 0 44 | 0 1 0 45 | 1 1 0 46 | 0 0 1 47 | 1 0 1 48 | 0 1 1 49 | 1 1 1 50 | 0 0 1.01 51 | 1 0 1.01 52 | 0 1 1.01 53 | 1 1 1.01 54 | 0 0 2.01 55 | 1 0 2.01 56 | 0 1 2.01 57 | 1 1 2.01 -------------------------------------------------------------------------------- /data/two_hex_overlap.mesh: -------------------------------------------------------------------------------- 1 | MFEM mesh v1.0 2 | 3 | # two unit cubes occupying [0,1]^3 and [0,1]x[0,1]x[0.99,1.99] 4 | 5 | # 6 | # MFEM Geometry Types (see mesh/geom.hpp): 7 | # 8 | # POINT = 0 9 | # SEGMENT = 1 10 | # TRIANGLE = 2 11 | # SQUARE = 3 12 | # TETRAHEDRON = 4 13 | # CUBE = 5 14 | # 15 | 16 | dimension 17 | 3 18 | 19 | elements 20 | 2 21 | 1 5 0 1 3 2 4 5 7 6 22 | 1 5 8 9 11 10 12 13 15 14 23 | 24 | boundary 25 | 12 26 | 3 3 2 3 1 0 27 | 2 3 0 1 5 4 28 | 7 3 3 2 6 7 29 | 1 3 2 0 4 6 30 | 4 3 4 5 7 6 31 | 7 3 1 3 7 5 32 | 5 3 10 11 9 8 33 | 2 3 8 9 13 12 34 | 7 3 11 10 14 15 35 | 1 3 10 8 12 14 36 | 6 3 12 13 15 14 37 | 7 3 9 11 15 13 38 | 39 | vertices 40 | 16 41 | 3 42 | 0 0 0 43 | 1 0 0 44 | 0 1 0 45 | 1 1 0 46 | 0 0 1 47 | 1 0 1 48 | 0 1 1 49 | 1 1 1 50 | 0 0 0.99 51 | 1 0 0.99 52 | 0 1 0.99 53 | 1 1 0.99 54 | 0 0 1.99 55 | 1 0 1.99 56 | 0 1 1.99 57 | 1 1 1.99 -------------------------------------------------------------------------------- /docs/doxygen/Doxyfile.in: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | PROJECT_NAME = @PROJECT_NAME@ 7 | PROJECT_BRIEF = "Contact Interface Physics Library" 8 | INPUT = @PROJECT_SOURCE_DIR@/src 9 | RECURSIVE = YES 10 | GENERATE_XML = YES 11 | USE_MATHJAX = YES 12 | MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2 13 | FILE_PATTERNS += *.md *.markdown *.cpp *.hpp 14 | TAB_SIZE = 2 15 | INLINE_INHERITED_MEMB = YES 16 | BUILTIN_STL_SUPPORT = YES 17 | REFERENCED_BY_RELATION = YES 18 | REFERENCES_RELATION = YES 19 | #TYPEDEF_HIDES_STRUCT = NO 20 | GENERATE_TREEVIEW = YES 21 | GENERATE_LATEX = NO 22 | GENERATE_XML = NO 23 | HAVE_DOT = YES 24 | #CALL_GRAPH = YES 25 | #CALLER_GRAPH = YES 26 | INTERACTIVE_SVG = YES 27 | DISTRIBUTE_GROUP_DOC = YES 28 | EXTRACT_PRIVATE = YES 29 | -------------------------------------------------------------------------------- /src/tests/caliper_smoke.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | //----------------------------------------------------------------------------- 7 | // 8 | // file: caliper_smoke.cpp 9 | // 10 | //----------------------------------------------------------------------------- 11 | 12 | #include "gtest/gtest.h" 13 | 14 | #include "caliper/cali-manager.h" 15 | #include "caliper/cali.h" 16 | 17 | void testFunction() 18 | { 19 | CALI_CXX_MARK_FUNCTION; 20 | std::cout << "Writing output..." << std::endl; 21 | } 22 | 23 | TEST( caliper_smoke, basic_use ) { testFunction(); } 24 | 25 | int main( int argc, char* argv[] ) 26 | { 27 | ::testing::InitGoogleTest( &argc, argv ); 28 | 29 | cali::ConfigManager mgr; 30 | mgr.add( "runtime-report,spot" ); 31 | mgr.start(); 32 | 33 | auto result = RUN_ALL_TESTS(); 34 | 35 | mgr.stop(); 36 | mgr.flush(); 37 | 38 | return result; 39 | } 40 | -------------------------------------------------------------------------------- /data/mortar_bad_patch/ixm.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 29 3 | 34 4 | 9 5 | 9 6 | 34 7 | 39 8 | 14 9 | 14 10 | 39 11 | 44 12 | 19 13 | 19 14 | 44 15 | 49 16 | 24 17 | 29 18 | 54 19 | 59 20 | 34 21 | 34 22 | 59 23 | 64 24 | 39 25 | 39 26 | 64 27 | 69 28 | 44 29 | 44 30 | 69 31 | 74 32 | 49 33 | 54 34 | 79 35 | 84 36 | 59 37 | 59 38 | 84 39 | 89 40 | 64 41 | 64 42 | 89 43 | 94 44 | 69 45 | 69 46 | 94 47 | 99 48 | 74 49 | 79 50 | 104 51 | 109 52 | 84 53 | 84 54 | 109 55 | 114 56 | 89 57 | 89 58 | 114 59 | 119 60 | 94 61 | 94 62 | 119 63 | 124 64 | 99 65 | -------------------------------------------------------------------------------- /data/mortar_good_patch/ixm.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 29 3 | 34 4 | 9 5 | 9 6 | 34 7 | 39 8 | 14 9 | 14 10 | 39 11 | 44 12 | 19 13 | 19 14 | 44 15 | 49 16 | 24 17 | 29 18 | 54 19 | 59 20 | 34 21 | 34 22 | 59 23 | 64 24 | 39 25 | 39 26 | 64 27 | 69 28 | 44 29 | 44 30 | 69 31 | 74 32 | 49 33 | 54 34 | 79 35 | 84 36 | 59 37 | 59 38 | 84 39 | 89 40 | 64 41 | 64 42 | 89 43 | 94 44 | 69 45 | 69 46 | 94 47 | 99 48 | 74 49 | 79 50 | 104 51 | 109 52 | 84 53 | 84 54 | 109 55 | 114 56 | 89 57 | 89 58 | 114 59 | 119 60 | 94 61 | 94 62 | 119 63 | 124 64 | 99 65 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/redecomp/partition/PartitionElements.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #include "PartitionElements.hpp" 7 | 8 | namespace redecomp { 9 | 10 | template 11 | std::vector>> PartitionElements::EntityCoordinates( 12 | const std::vector& par_meshes ) const 13 | { 14 | auto elem_centroids = std::vector>>(); 15 | elem_centroids.reserve( par_meshes.size() ); 16 | for ( auto par_mesh : par_meshes ) { 17 | auto n_elems = par_mesh->GetNE(); 18 | elem_centroids.emplace_back( n_elems, n_elems ); 19 | for ( int i{ 0 }; i < n_elems; ++i ) { 20 | auto vec_centroid = mfem::Vector( elem_centroids.back()[i].data(), NDIMS ); 21 | // TODO: const version of GetElementCenter() 22 | const_cast( par_mesh )->GetElementCenter( i, vec_centroid ); 23 | } 24 | } 25 | return elem_centroids; 26 | } 27 | 28 | template class PartitionElements<2>; 29 | template class PartitionElements<3>; 30 | 31 | } // end namespace redecomp 32 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | This work was produced under the auspices of the U.S. Department of 2 | Energy by Lawrence Livermore National Laboratory under Contract 3 | DE-AC52-07NA27344. 4 | 5 | This work was prepared as an account of work sponsored by an agency of 6 | the United States Government. Neither the United States Government nor 7 | Lawrence Livermore National Security, LLC, nor any of their employees 8 | makes any warranty, expressed or implied, or assumes any legal liability 9 | or responsibility for the accuracy, completeness, or usefulness of any 10 | information, apparatus, product, or process disclosed, or represents that 11 | its use would not infringe privately owned rights. 12 | 13 | Reference herein to any specific commercial product, process, or service 14 | by trade name, trademark, manufacturer, or otherwise does not necessarily 15 | constitute or imply its endorsement, recommendation, or favoring by the 16 | United States Government or Lawrence Livermore National Security, LLC. 17 | 18 | The views and opinions of authors expressed herein do not necessarily 19 | state or reflect those of the United States Government or Lawrence 20 | Livermore National Security, LLC, and shall not be used for advertising 21 | or product endorsement purposes. 22 | -------------------------------------------------------------------------------- /.gitlab/build_toss4_cray.yml: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 3 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 4 | # 5 | # SPDX-License-Identifier: (MIT) 6 | ############################################################################## 7 | 8 | #### 9 | # This is the shared configuration of jobs for toss4_cray 10 | .on_toss4_cray: 11 | variables: 12 | SCHEDULER_PARAMETERS: "--queue pci --exclusive --time-limit=${ALLOC_TIME}m --nodes=${ALLOC_NODES}" 13 | COMPILER: "llvm-amdgpu@6.4.2" 14 | HOST_CONFIG: "tuolumne-toss_4_x86_64_ib_cray-${COMPILER}_hip.cmake" 15 | tags: 16 | - batch 17 | - tuolumne 18 | rules: 19 | - if: '$CI_COMMIT_BRANCH =~ /_qnone/ || $ON_TOSS4_CRAY == "OFF"' #run except if ... 20 | when: never 21 | - when: on_success 22 | before_script: 23 | - module load cmake/3.23.1 24 | 25 | #### 26 | # Templates 27 | .src_build_on_toss4_cray: 28 | extends: [.src_build_script, .on_toss4_cray] 29 | 30 | #### 31 | # Build jobs 32 | toss4_cray-llvm_amdgpu_6_4_2-src: 33 | variables: 34 | ALLOC_NODES: "1" 35 | ALLOC_TIME: "30" 36 | extends: .src_build_on_toss4_cray 37 | -------------------------------------------------------------------------------- /src/redecomp/partition/PartitionElements.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_PARTITION_PARTITIONELEMENTS_HPP_ 7 | #define SRC_REDECOMP_PARTITION_PARTITIONELEMENTS_HPP_ 8 | 9 | #include "redecomp/partition/PartitionEntity.hpp" 10 | 11 | namespace redecomp { 12 | 13 | /** 14 | * @brief PartitionEntity class for elements 15 | * 16 | * @tparam NDIMS number of dimensions 17 | */ 18 | template 19 | class PartitionElements : public PartitionEntity { 20 | public: 21 | /** 22 | * @brief Returns lists of entity coordinates (points) from the par_meshes, sorted by mesh 23 | * 24 | * @param par_meshes Input meshes 25 | * @return Vector of array of points from each entity on each mesh 26 | */ 27 | std::vector>> EntityCoordinates( 28 | const std::vector& par_meshes ) const override; 29 | }; 30 | 31 | using PartitionElements2D = PartitionElements<2>; 32 | using PartitionElements3D = PartitionElements<3>; 33 | 34 | } // end namespace redecomp 35 | 36 | #endif /* SRC_REDECOMP_PARTITION_PARTITIONELEMENTS_HPP_ */ 37 | -------------------------------------------------------------------------------- /src/redecomp/common/TypeDefs.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_COMMON_TYPEDEFS_HPP_ 7 | #define SRC_REDECOMP_COMMON_TYPEDEFS_HPP_ 8 | 9 | #include 10 | #include 11 | 12 | #include "axom/primal.hpp" 13 | 14 | #include "redecomp/utils/MPIArray.hpp" 15 | 16 | namespace redecomp { 17 | constexpr double pi = M_PI; 18 | 19 | template 20 | using Point = axom::primal::Point; 21 | 22 | template 23 | using BoundingBox = axom::primal::BoundingBox; 24 | 25 | /** 26 | * @brief In its usage in redecomp, the first pair entry contains a list of 27 | * entity (node or element) indices per rank. The second pair entry is sized 28 | * the same as the first pair entry, and if the entry is true, it denotes the 29 | * entity is in the ghost layer on a corresponding RedecompMesh. This data 30 | * structure lists entities that need to be sent to or are received from other 31 | * MPI ranks. 32 | */ 33 | using EntityIndexByRank = std::pair, MPIArray>; 34 | } // end namespace redecomp 35 | 36 | #endif /* SRC_REDECOMP_COMMON_TYPEDEFS_HPP_ */ 37 | -------------------------------------------------------------------------------- /src/tribol/config.hpp.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef TRIBOL_CONFIG_HPP_ 7 | #define TRIBOL_CONFIG_HPP_ 8 | 9 | /* 10 | * Note: Use only C-style comments in this file since it might be included from a C file 11 | */ 12 | 13 | /* 14 | * Version Information 15 | */ 16 | /* clang-format off */ 17 | #define TRIBOL_VERSION_MAJOR @TRIBOL_VERSION_MAJOR@ 18 | #define TRIBOL_VERSION_MINOR @TRIBOL_VERSION_MINOR@ 19 | #define TRIBOL_VERSION_PATCH @TRIBOL_VERSION_PATCH@ 20 | /* clang-format on */ 21 | #define TRIBOL_VERSION_FULL "@TRIBOL_VERSION_FULL@" 22 | 23 | /* 24 | * Directories 25 | */ 26 | #define TRIBOL_REPO_DIR "@TRIBOL_REPO_DIR@" 27 | #define TRIBOL_BIN_DIR "@TRIBOL_BIN_DIR@" 28 | #define TRIBOL_DATA_DIR "@TRIBOL_DATA_DIR@" 29 | 30 | /* 31 | * Build information 32 | */ 33 | #cmakedefine TRIBOL_USE_SINGLE_PRECISION 34 | #cmakedefine TRIBOL_USE_MPI 35 | #cmakedefine TRIBOL_USE_UMPIRE 36 | #cmakedefine TRIBOL_USE_RAJA 37 | #cmakedefine TRIBOL_USE_ENZYME 38 | #cmakedefine TRIBOL_USE_CUDA 39 | #cmakedefine TRIBOL_USE_HIP 40 | #cmakedefine TRIBOL_USE_OPENMP 41 | #cmakedefine BUILD_REDECOMP 42 | 43 | #endif /* TRIBOL_CONFIG_HPP_ */ 44 | -------------------------------------------------------------------------------- /src/tribol/interface/c_fortran/wrapTRIBOL_TEST_MESH.cpp: -------------------------------------------------------------------------------- 1 | // wrapTRIBOL_TEST_MESH.cpp 2 | // This file is generated by Shroud 0.12.1. Do not edit. 3 | 4 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | // other Tribol Project Developers. See the top-level LICENSE file for details. 6 | // 7 | // SPDX-License-Identifier: (MIT) 8 | 9 | #include 10 | #include "tribol/utils/TestUtils.hpp" 11 | #include "typesTRIBOL_TEST_MESH.h" 12 | 13 | // splicer begin CXX_definitions 14 | // splicer end CXX_definitions 15 | 16 | extern "C" { 17 | 18 | // splicer begin C_definitions 19 | // splicer end C_definitions 20 | 21 | // Release library allocated memory. 22 | void TRIBOL_TEST_MESH_SHROUD_memory_destructor( TRIBOL_TEST_MESH_SHROUD_capsule_data* cap ) 23 | { 24 | void* ptr = cap->addr; 25 | switch ( cap->idtor ) { 26 | case 0: // --none-- 27 | { 28 | // Nothing to delete 29 | break; 30 | } 31 | case 1: // tribol::TestMesh 32 | { 33 | tribol::TestMesh* cxx_ptr = reinterpret_cast( ptr ); 34 | delete cxx_ptr; 35 | break; 36 | } 37 | default: { 38 | // Unexpected case in destructor 39 | break; 40 | } 41 | } 42 | cap->addr = nullptr; 43 | cap->idtor = 0; // avoid deleting again 44 | } 45 | 46 | } // extern "C" 47 | -------------------------------------------------------------------------------- /src/tribol/utils/ContactPlaneOutput.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_UTILS_CONTACTPLANEOUTPUT_HPP_ 7 | #define SRC_UTILS_CONTACTPLANEOUTPUT_HPP_ 8 | 9 | #include "tribol/common/BasicTypes.hpp" 10 | #include "tribol/common/Parameters.hpp" 11 | 12 | // C++ includes 13 | #include 14 | 15 | namespace tribol { 16 | 17 | // forward declarations 18 | class ContactPlaneManager; 19 | 20 | /*! 21 | * 22 | * \brief Write the interface mesh to vtk 23 | * 24 | * \param [in] dir output directory 25 | * \param [in] v_type visualization type 26 | * \param [in] cs_id coupling scheme id 27 | * \param [in] meshId1 id for first mesh in interface 28 | * \param [in] meshId2 id for second mesh in interface 29 | * \param [in] dim spatial dimension 30 | * \param [in] cycle simulation cycle 31 | * \param [in] t simulation time step 32 | * 33 | */ 34 | void WriteContactPlaneMeshToVtk( const std::string& dir, const VisType v_type, const IndexT cs_id, 35 | const IndexT mesh_id1, const IndexT mesh_id2, const int dim, const int cycle, 36 | const RealT t ); 37 | 38 | } // namespace tribol 39 | 40 | #endif /* SRC_UTILS_CONTACTPLANEOUTPUT_HPP_ */ 41 | -------------------------------------------------------------------------------- /data/mortar_ironing/active_nodes: -------------------------------------------------------------------------------- 1 | host active nodes tribol active nodes 2 | 55 55 3 | 56 57 4 | 57 58 5 | 58 60 6 | 59 61 7 | 60 66 8 | 61 67 9 | 62 68 10 | 63 69 11 | 64 70 12 | 65 71 13 | 66 72 14 | 67 73 15 | 68 74 16 | 69 75 17 | 70 76 18 | 71 77 19 | 72 78 20 | 73 80 21 | 74 81 22 | 75 82 23 | 76 83 24 | 77 86 25 | 78 87 26 | 79 88 27 | 80 89 28 | 81 99 29 | 82 100 30 | 83 31 | 84 32 | 85 33 | 86 34 | 87 35 | 88 36 | 89 37 | 90 38 | 91 39 | 92 40 | 93 41 | 94 42 | 95 43 | 96 44 | 97 45 | 98 46 | 99 47 | 100 48 | 101 49 | 102 50 | 103 51 | 104 52 | 105 53 | 106 54 | 107 55 | 108 56 | -------------------------------------------------------------------------------- /data/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 2 | Produced at the Lawrence Livermore National Laboratory 3 | Written by Steven Wopschall (wopschall1@llnl.gov) and Mike Puso (puso1@llnl.gov). 4 | Release number - LLNL-MISC-847782. 5 | All rights reserved. 6 | 7 | 8 | This work was produced under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory 9 | under Contract DE-AC52-07NA27344. 10 | 11 | This work was prepared as an account of work sponsored by an agency of the United States Government. 12 | Neither the United States Government nor Lawrence Livermore National Security, LLC, nor any of their 13 | employees makes any warranty, expressed or implied, or assumes any legal liability or responsibility 14 | for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, 15 | or represents that its use would not infringe privately owned rights. 16 | 17 | Reference herein to any specific commercial product, process, or service by trade name, trademark, 18 | manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, 19 | or favoring by the United States Government or Lawrence Livermore National Security, LLC. 20 | 21 | The views and opinions of authors expressed herein do not necessarily state or reflect those of the 22 | United States Government or Lawrence Livermore National Security, LLC, and shall not be used for 23 | advertising or product endorsement purposes. 24 | -------------------------------------------------------------------------------- /src/tests/tribol_check_tpl.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | // Axom includes 7 | #include "axom/config.hpp" 8 | #include "axom/core.hpp" 9 | #include "axom/slic.hpp" 10 | 11 | // C/C++ includes 12 | #include 13 | #include 14 | 15 | // gtest includes 16 | #include "gtest/gtest.h" 17 | 18 | //------------------------------------------------------------------------------ 19 | // UNIT TESTS 20 | //------------------------------------------------------------------------------ 21 | TEST( tribol_check_tpl, check_axom ) 22 | { 23 | EXPECT_TRUE( AXOM_VERSION_MAJOR >= 0 ); 24 | EXPECT_TRUE( AXOM_VERSION_MINOR >= 0 ); 25 | EXPECT_TRUE( AXOM_VERSION_PATCH >= 0 ); 26 | 27 | std::string axom_version = AXOM_VERSION_FULL; 28 | EXPECT_TRUE( !axom_version.empty() ); 29 | 30 | std::ostringstream oss; 31 | oss << "v" << AXOM_VERSION_MAJOR << "." << AXOM_VERSION_MINOR << "." << AXOM_VERSION_PATCH; 32 | 33 | EXPECT_EQ( axom_version, oss.str() ); 34 | } 35 | 36 | TEST( tribol_check_tpl, print_axom_about ) { axom::about(); } 37 | 38 | //------------------------------------------------------------------------------ 39 | 40 | int main( int argc, char* argv[] ) 41 | { 42 | int result = 0; 43 | 44 | ::testing::InitGoogleTest( &argc, argv ); 45 | 46 | axom::slic::SimpleLogger logger; 47 | 48 | result = RUN_ALL_TESTS(); 49 | 50 | return result; 51 | } 52 | -------------------------------------------------------------------------------- /src/redecomp/transfer/GridFnTransfer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_GRIDFNTRANSFER_HPP_ 7 | #define SRC_REDECOMP_GRIDFNTRANSFER_HPP_ 8 | 9 | #include "mfem.hpp" 10 | 11 | namespace redecomp { 12 | 13 | /** 14 | * @brief GridFnTransfer interface base class 15 | */ 16 | class GridFnTransfer { 17 | public: 18 | /** 19 | * @brief Transfers nodal values from src to dst 20 | * 21 | * @param src A parent ParGridFunction to be transferred to corresponding 22 | * redecomp GridFunction (dst) 23 | * @param dst A redecomp GridFunction which receives values from a parent 24 | * ParGridFunction (src) 25 | */ 26 | virtual void TransferToSerial( const mfem::ParGridFunction& src, mfem::GridFunction& dst ) const = 0; 27 | 28 | /** 29 | * @brief Transfers nodal values from src to dst 30 | * 31 | * @param src A redecomp GridFunction to be transferred to corresponding 32 | * parent ParGridFunction (dst) 33 | * @param dst A parent ParGridFunction which receives values from a redecomp 34 | * GridFunction (src) 35 | */ 36 | virtual void TransferToParallel( const mfem::GridFunction& src, mfem::ParGridFunction& dst ) const = 0; 37 | 38 | /** 39 | * @brief Destroy the GridFnTransfer object 40 | */ 41 | virtual ~GridFnTransfer() = default; 42 | }; 43 | 44 | } // end namespace redecomp 45 | 46 | #endif /* SRC_REDECOMP_GRIDFNTRANSFER_HPP_ */ 47 | -------------------------------------------------------------------------------- /src/tribol/mesh/InterfacePairs.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_MESH_INTERFACE_PAIRS_HPP_ 7 | #define SRC_MESH_INTERFACE_PAIRS_HPP_ 8 | 9 | #include "tribol/common/BasicTypes.hpp" 10 | 11 | namespace tribol { 12 | 13 | struct InterfacePair { 14 | TRIBOL_HOST_DEVICE InterfacePair( IndexT element_id1, IndexT element_id2, bool is_contact_candidate = true ); 15 | 16 | // overload constructor to handle zero input arguments 17 | TRIBOL_HOST_DEVICE InterfacePair(); 18 | 19 | // Element id for face 1 20 | IndexT m_element_id1; 21 | 22 | // Element id for face 2 23 | IndexT m_element_id2; 24 | 25 | // boolean indicating if a binned pair is a contact candidate. 26 | // A contact candidate is defined as a face-pair that is deemed geometrically proximate 27 | // by the binning coarse search, and one that passes the finer computational geometry 28 | // (CG) filter/checks. These finer checks identify face-pairs that are intersecting or 29 | // nearly intersecting with positive areas of overlap. These checks do not indicate 30 | // whether a face-pair is contacting, since the definition of 'contacting' is specific 31 | // to a particular contact method and its enforced contstraints. Rather, the CG filter 32 | // identifies contact candidacy, or face-pairs likely in contact. 33 | bool m_is_contact_candidate; 34 | }; 35 | 36 | } /* namespace tribol */ 37 | 38 | #endif /* SRC_MESH_INTERFACE_PAIRS_HPP_ */ 39 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 3 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 4 | # 5 | # SPDX-License-Identifier: (MIT) 6 | ############################################################################## 7 | 8 | variables: 9 | GIT_STRATEGY: clone 10 | GIT_SUBMODULE_STRATEGY: recursive 11 | PROJECT_ALLOC_NAME: ${CI_PROJECT_NAME}_ci_${CI_PIPELINE_ID} 12 | BUILD_ROOT: ${CI_PROJECT_DIR} 13 | 14 | #### 15 | # Templates 16 | .src_build_script: 17 | script: 18 | # Build source and run unit tests. 19 | - echo -e "section_start:$(date +%s):src_build_and_unit_test\r\e[0K 20 | Source Build and Unit Tests ${CI_PROJECT_NAME}" 21 | - ${ALLOC_COMMAND} python3 scripts/llnl/build_src.py -v --host-config=${HOST_CONFIG} --extra-cmake-options="${EXTRA_CMAKE_OPTIONS}" ${EXTRA_BUILD_OPTIONS} 22 | - echo -e "section_end:$(date +%s):src_build_and_unit_test\r\e[0K" 23 | artifacts: 24 | expire_in: 2 weeks 25 | when: always 26 | paths: 27 | - _tribol_build_and_test_*/output.log*.txt 28 | - _tribol_build_and_test_*/build-*/output.log*.txt 29 | reports: 30 | junit: 31 | - _tribol_build_and_test_*/build-*/junit.xml 32 | 33 | include: 34 | - local: .gitlab/build_toss4.yml 35 | #TODO: swap this for matrix 36 | #- local: .gitlab/build_blueos.yml 37 | - local: .gitlab/build_toss4_cray.yml 38 | # ID token requirement for Gitlab 17.0+ 39 | - project: 'lc-templates/id_tokens' 40 | file: 'id_tokens.yml' 41 | -------------------------------------------------------------------------------- /data/star.mesh: -------------------------------------------------------------------------------- 1 | MFEM mesh v1.0 2 | 3 | # 4 | # MFEM Geometry Types (see mesh/geom.hpp): 5 | # 6 | # POINT = 0 7 | # SEGMENT = 1 8 | # TRIANGLE = 2 9 | # SQUARE = 3 10 | # TETRAHEDRON = 4 11 | # CUBE = 5 12 | # 13 | 14 | dimension 15 | 2 16 | 17 | elements 18 | 20 19 | 1 3 0 11 26 14 20 | 1 3 0 14 27 17 21 | 1 3 0 17 28 20 22 | 1 3 0 20 29 23 23 | 1 3 0 23 30 11 24 | 1 3 11 1 12 26 25 | 1 3 26 12 3 13 26 | 1 3 14 26 13 2 27 | 1 3 14 2 15 27 28 | 1 3 27 15 5 16 29 | 1 3 17 27 16 4 30 | 1 3 17 4 18 28 31 | 1 3 28 18 7 19 32 | 1 3 20 28 19 6 33 | 1 3 20 6 21 29 34 | 1 3 29 21 9 22 35 | 1 3 23 29 22 8 36 | 1 3 23 8 24 30 37 | 1 3 30 24 10 25 38 | 1 3 11 30 25 1 39 | 40 | boundary 41 | 20 42 | 1 1 13 2 43 | 1 1 12 3 44 | 1 1 16 4 45 | 1 1 15 5 46 | 1 1 19 6 47 | 1 1 18 7 48 | 1 1 22 8 49 | 1 1 21 9 50 | 1 1 25 1 51 | 1 1 24 10 52 | 1 1 3 13 53 | 1 1 1 12 54 | 1 1 5 16 55 | 1 1 2 15 56 | 1 1 7 19 57 | 1 1 4 18 58 | 1 1 9 22 59 | 1 1 6 21 60 | 1 1 10 25 61 | 1 1 8 24 62 | 63 | vertices 64 | 31 65 | 2 66 | 0 0 67 | 1 0 68 | 0.309017 0.951057 69 | 1.30902 0.951057 70 | -0.809017 0.587785 71 | -0.5 1.53884 72 | -0.809017 -0.587785 73 | -1.61803 0 74 | 0.309017 -0.951057 75 | -0.5 -1.53884 76 | 1.30902 -0.951057 77 | 0.5 0 78 | 1.15451 0.475529 79 | 0.809019 0.951057 80 | 0.154508 0.475529 81 | -0.0954915 1.24495 82 | -0.654508 1.06331 83 | -0.404508 0.293893 84 | -1.21352 0.293893 85 | -1.21352 -0.293892 86 | -0.404508 -0.293893 87 | -0.654508 -1.06331 88 | -0.0954915 -1.24495 89 | 0.154508 -0.475529 90 | 0.809019 -0.951057 91 | 1.15451 -0.475529 92 | 0.654509 0.475529 93 | -0.25 0.769421 94 | -0.809016 0 95 | -0.25 -0.76942 96 | 0.654509 -0.475529 97 | -------------------------------------------------------------------------------- /scripts/spack/packages/axom/package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | import os 7 | from os.path import join as pjoin 8 | 9 | from spack.package import * 10 | from spack_repo.builtin.packages.axom.package import Axom as BuiltinAxom 11 | 12 | class Axom(BuiltinAxom): 13 | 14 | # Note: We add a number to the end of the real version number to indicate that we have 15 | # moved forward past the release. Increment the last number when updating the commit sha. 16 | version("0.10.1.1", commit="44562f92a400204e33915f48b848eb68e80a1bf1", submodules=False) 17 | 18 | variant("int64", default=True, description="Use 64bit integers for index type") 19 | 20 | def cmake_args(self): 21 | options = [] 22 | 23 | options.append("-DBLT_SOURCE_DIR:PATH={0}".format(self.spec["blt"].prefix)) 24 | 25 | if self.run_tests is False: 26 | options.append("-DENABLE_TESTS=OFF") 27 | else: 28 | options.append("-DENABLE_TESTS=ON") 29 | 30 | options.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) 31 | options.append(self.define_from_variant("AXOM_ENABLE_EXAMPLES", "examples")) 32 | options.append(self.define_from_variant("AXOM_ENABLE_TOOLS", "tools")) 33 | if self.spec.satisfies("~raja") or self.spec.satisfies("+umpire"): 34 | options.append("-DAXOM_ENABLE_MIR:BOOL=OFF") 35 | 36 | options.append(self.define_from_variant("AXOM_USE_64BIT_INDEXTYPE", "int64")) 37 | 38 | return options 39 | -------------------------------------------------------------------------------- /src/redecomp/partition/PartitionEntity.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_PARTITION_PARTITIONENTITY_HPP_ 7 | #define SRC_REDECOMP_PARTITION_PARTITIONENTITY_HPP_ 8 | 9 | #include 10 | 11 | #include "mfem.hpp" 12 | 13 | #include "redecomp/common/TypeDefs.hpp" 14 | 15 | namespace redecomp { 16 | 17 | /** 18 | * @brief PartitionEntity interface class 19 | * 20 | * This class establishes an interface for providing a list of coordinates given 21 | * a vector of ParMeshes. Derived classes will determine what the coordinates 22 | * represent. For instance, the PartitionElements class returns approximate 23 | * element centroids as its list of coordinates. 24 | * 25 | * @tparam NDIMS number of dimensions 26 | */ 27 | template 28 | class PartitionEntity { 29 | public: 30 | /** 31 | * @brief Returns lists of entity coordinates (points) from the par_meshes, sorted by mesh 32 | * 33 | * @param par_meshes Input meshes 34 | * @return Vector of array of points from each entity on each mesh 35 | */ 36 | virtual std::vector>> EntityCoordinates( 37 | const std::vector& par_meshes ) const = 0; 38 | 39 | /** 40 | * @brief Destroy the PartitionEntity object 41 | */ 42 | virtual ~PartitionEntity() = default; 43 | }; 44 | 45 | using PartitionEntity2D = PartitionEntity<2>; 46 | using PartitionEntity3D = PartitionEntity<3>; 47 | 48 | } // end namespace redecomp 49 | 50 | #endif /* SRC_REDECOMP_PARTITION_PARTITIONENTITY_HPP_ */ 51 | -------------------------------------------------------------------------------- /src/tribol/physics/CommonPlane.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_PHYSICS_COMMONPLANE_HPP_ 7 | #define SRC_PHYSICS_COMMONPLANE_HPP_ 8 | 9 | #include "Physics.hpp" 10 | 11 | namespace tribol { 12 | /*! 13 | * 14 | * \brief computes penalty stiffness for Common Plane + Penalty 15 | * 16 | * \param [in] K1/t1 contact spring stiffness for face 1 (bulk_modulus/element_thickness for face 1) 17 | * \param [in] K2/t2 contact spring stiffness for face 2 (bulk_modulus/element_thickness for face 2) 18 | * 19 | * \return face-pair based, element-wise penalty stiffness per area 20 | * 21 | * 22 | * \pre Bulk modulus and element thickness arrays are registered by host code 23 | * 24 | */ 25 | TRIBOL_HOST_DEVICE RealT ComputePenaltyStiffnessPerArea( const RealT K1_over_t1, const RealT K2_over_t2 ); 26 | 27 | /*! 28 | * 29 | * \brief routine to apply interface physics in the direction normal to the interface 30 | * 31 | * \param [in] cs pointer to the coupling scheme 32 | * 33 | * \return 0 if no error 34 | * 35 | */ 36 | template <> 37 | int ApplyNormal( CouplingScheme* cs ); 38 | 39 | /*! 40 | * 41 | * \brief routine to apply interface physics in the direction tangential to the interface 42 | * 43 | * \param [in] cs pointer to the coupling scheme 44 | * 45 | * \return 0 if no error 46 | * 47 | */ 48 | template <> 49 | int ApplyTangential( CouplingScheme* cs ); 50 | 51 | } // end namespace tribol 52 | 53 | #endif /* SRC_PHYSICS_COMMONPLANE_HPP_ */ 54 | -------------------------------------------------------------------------------- /src/tribol/search/InterfacePairFinder.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef TRIBOL_SEARCH_INTERFACE_PAIR_FINDER_HPP_ 7 | #define TRIBOL_SEARCH_INTERFACE_PAIR_FINDER_HPP_ 8 | 9 | #include "tribol/common/Parameters.hpp" 10 | #include "tribol/mesh/MeshData.hpp" 11 | #include "tribol/mesh/CouplingScheme.hpp" 12 | 13 | namespace tribol { 14 | 15 | // Forward Declarations 16 | class SearchBase; 17 | 18 | /// Free functions 19 | 20 | /*! 21 | * \brief Basic geometry/proximity checks for face pairs 22 | * 23 | * \param [in] cs_view View of the coupling scheme 24 | * \param [in] element_id1 id of 1st element in pair 25 | * \param [in] element_id2 id of 2nd element in pair 26 | * 27 | */ 28 | TRIBOL_HOST_DEVICE bool geomFilter( const CouplingScheme::Viewer& cs_view, IndexT element_id1, IndexT element_id2 ); 29 | 30 | /*! 31 | * \class InterfacePairFinder 32 | * 33 | * \brief This class finds pairs of interfering elements in the meshes 34 | * referred to by the CouplingScheme 35 | */ 36 | class InterfacePairFinder { 37 | public: 38 | InterfacePairFinder( CouplingScheme* cs ); 39 | 40 | ~InterfacePairFinder(); 41 | 42 | /*! 43 | * Initializes structures for the candidate search 44 | */ 45 | void initialize(); 46 | 47 | /*! 48 | * Computes the interacting interface pairs between the meshes 49 | * specified in \a m_coupling_scheme 50 | */ 51 | void findInterfacePairs(); 52 | 53 | private: 54 | CouplingScheme* m_coupling_scheme; 55 | SearchBase* m_search; // The search strategy 56 | }; 57 | 58 | } // end namespace tribol 59 | 60 | #endif /* TRIBOL_SEARCH_INTERFACE_PAIR_FINDER_HPP_ */ 61 | -------------------------------------------------------------------------------- /src/tribol/physics/Physics.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_PHYSICS_PHYSICS_HPP_ 7 | #define SRC_PHYSICS_PHYSICS_HPP_ 8 | 9 | #include "tribol/common/Parameters.hpp" 10 | 11 | namespace tribol { 12 | 13 | // forward declarations 14 | class CouplingScheme; 15 | 16 | /*! 17 | * 18 | * \brief applies interface physics method to obtain residual and/or jacobian evaluations 19 | * 20 | * \param [in] cs pointer to the coupling scheme 21 | * \param [in] cycle simulation cycle 22 | * \param [in] t simulation time step 23 | * 24 | * \return 0 if no errors 25 | * 26 | */ 27 | int ApplyInterfacePhysics( CouplingScheme* cs, int cycle, RealT t ); 28 | /*! 29 | * 30 | * \brief applies interface method in the normal direction 31 | * 32 | * \param [in] cs pointer to the coupling scheme 33 | * 34 | * \return 0 if no error 35 | * 36 | */ 37 | template 38 | int ApplyNormal( CouplingScheme* cs ); 39 | 40 | /*! 41 | * 42 | * \brief applies interface method in the tangential direction 43 | * 44 | * \param [in] cs pointer to the coupling scheme 45 | * 46 | * \return 0 if no error 47 | * 48 | */ 49 | template 50 | int ApplyTangential( CouplingScheme* cs ); 51 | 52 | /*! 53 | * 54 | * \brief computes and stores interface physics method specific data 55 | * 56 | * \param [in] cs pointer to the coupling scheme 57 | * 58 | * \return 0 if no error 59 | * 60 | */ 61 | template 62 | int GetMethodData( CouplingScheme* cs ); 63 | 64 | } // namespace tribol 65 | 66 | #endif /* SRC_PHYSICS_PHYSICS_HPP_ */ 67 | -------------------------------------------------------------------------------- /src/redecomp/partition/Partitioner.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #include "Partitioner.hpp" 7 | 8 | #include "redecomp/partition/PartitionMethod.hpp" 9 | #include "redecomp/partition/PartitionEntity.hpp" 10 | 11 | namespace redecomp { 12 | 13 | template 14 | PartitionerByDim::PartitionerByDim( std::unique_ptr> partition_entity, 15 | std::unique_ptr> partition_method ) 16 | : partition_entity_{ std::move( partition_entity ) }, partition_method_{ std::move( partition_method ) } 17 | { 18 | } 19 | 20 | template 21 | const MPIUtility& PartitionerByDim::getMPIUtility() const 22 | { 23 | return partition_method_->getMPIUtility(); 24 | } 25 | 26 | template 27 | std::vector PartitionerByDim::generatePartitioning( 28 | int n_parts, const std::vector& par_meshes, double ghost_size ) const 29 | { 30 | return partition_method_->generatePartitioning( n_parts, partition_entity_->EntityCoordinates( par_meshes ), 31 | ghost_size ); 32 | } 33 | 34 | template 35 | const PartitionEntity* PartitionerByDim::getPartitionEntity() const 36 | { 37 | return partition_entity_.get(); 38 | } 39 | 40 | template 41 | const PartitionMethod* PartitionerByDim::getPartitionMethod() const 42 | { 43 | return partition_method_.get(); 44 | } 45 | 46 | template class PartitionerByDim<2>; 47 | template class PartitionerByDim<3>; 48 | 49 | } // end namespace redecomp 50 | -------------------------------------------------------------------------------- /.gitlab/build_toss4.yml: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 3 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 4 | # 5 | # SPDX-License-Identifier: (MIT) 6 | ############################################################################## 7 | 8 | #### 9 | # This is the shared configuration of jobs for toss4 10 | .on_toss4: 11 | variables: 12 | SCHEDULER_PARAMETERS: "--reservation=ci --exclusive=user --deadline=now+${ALLOC_DEADLINE}minutes -N ${ALLOC_NODES} -t ${ALLOC_TIME}" 13 | ALLOC_DEADLINE: "180" # Allocation times must be less than this value 14 | tags: 15 | - batch 16 | - dane 17 | rules: 18 | - if: '$CI_COMMIT_BRANCH =~ /_qnone/ || $ON_TOSS4 == "OFF"' #run except if ... 19 | when: never 20 | - when: on_success 21 | before_script: 22 | - module load cmake/3.23.1 23 | 24 | 25 | #### 26 | # Templates 27 | .src_build_on_toss4: 28 | extends: [.src_build_script, .on_toss4] 29 | 30 | #### 31 | # Build jobs 32 | 33 | toss4-llvm_19_1_3-src: 34 | variables: 35 | COMPILER: "llvm@19.1.3" 36 | HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake" 37 | ALLOC_NODES: "1" 38 | ALLOC_TIME: "30" 39 | extends: .src_build_on_toss4 40 | 41 | toss4-llvm_19_1_3-src-codevelop: 42 | variables: 43 | COMPILER: "llvm@19.1.3" 44 | HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake" 45 | EXTRA_CMAKE_OPTIONS: "-DCMAKE_BUILD_TYPE=Release" 46 | ALLOC_NODES: "1" 47 | ALLOC_TIME: "30" 48 | extends: .src_build_on_toss4 49 | 50 | toss4-gcc_13_3_1-src: 51 | variables: 52 | COMPILER: "gcc@13.3.1" 53 | HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake" 54 | ALLOC_NODES: "1" 55 | ALLOC_TIME: "20" 56 | extends: .src_build_on_toss4 57 | -------------------------------------------------------------------------------- /scripts/shared-macmini/build-and-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Build and test Tribol on Smith team's shared MacMini, then report results to a set of emails 4 | 5 | # Immediately fail upon error and update environment 6 | set -e 7 | source ~/.bash_profile 8 | 9 | # Variables 10 | CI_ROOT_DIR="/Users/chapman39/dev/.ci/tribol" 11 | PROJECT_DIR="$CI_ROOT_DIR/repo" 12 | OUTPUT_LOG="$CI_ROOT_DIR/logs/macmini-build-and-test-$(date +"%Y_%m_%d_%H_%M_%S").log" 13 | HOST_CONFIG="$PROJECT_DIR/host-configs/other/firion-*.cmake" 14 | RECIPIENTS="chapman39@llnl.gov,chin23@llnl.gov,wopschall1@llnl.gov" 15 | EMAIL_SUBJECT="Tribol Failed! MacMini build and test report $(date)" 16 | EMAIL_BODY="This is automatic weekly report of Tribol's MacMini build. See attached for log." 17 | 18 | function send_email() { 19 | echo "$EMAIL_BODY" | print_run_log mutt -a "$OUTPUT_LOG" -s "$EMAIL_SUBJECT" -- "$RECIPIENTS" 20 | } 21 | 22 | # Send email before exiting from an error 23 | trap "send_email; exit 1" ERR 24 | 25 | # Print command and its output into a log file 26 | print_run_log(){ 27 | echo "####################" >> "$OUTPUT_LOG" 28 | echo "# $@" >> "$OUTPUT_LOG" 29 | echo "####################" >> "$OUTPUT_LOG" 30 | "$@" >> "$OUTPUT_LOG" 2>&1 31 | echo >> "$OUTPUT_LOG" 32 | } 33 | 34 | # Go to project directory 35 | print_run_log cd $PROJECT_DIR 36 | 37 | # Update repo 38 | print_run_log git checkout develop 39 | print_run_log git pull 40 | print_run_log git submodule update --init --recursive 41 | 42 | # Clear previous build(s) 43 | print_run_log rm -rf _tribol_build_and_test* 44 | 45 | # Build and test project 46 | print_run_log python3 ./scripts/llnl/build_src.py --host-config $HOST_CONFIG -v -j16 47 | 48 | # Update email subject to indicate success and send 49 | EMAIL_SUBJECT="Tribol Succeeded! MacMini build and test report $(date)" 50 | send_email 51 | -------------------------------------------------------------------------------- /src/redecomp/utils/ArrayUtility.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_UTILS_ARRAYUTILITY_HPP_ 7 | #define SRC_REDECOMP_UTILS_ARRAYUTILITY_HPP_ 8 | 9 | #include 10 | 11 | #include "axom/core.hpp" 12 | 13 | namespace redecomp { 14 | 15 | /** 16 | * @brief Convenience class for generating common axom::Arrays 17 | */ 18 | class ArrayUtility { 19 | public: 20 | /** 21 | * @brief Create an index array at compile time 22 | * 23 | * @tparam T Array element type 24 | * @tparam N Size of array 25 | * @return axom::Array holding index array [0, ..., N-1] 26 | */ 27 | template 28 | static constexpr axom::Array IndexArray() 29 | { 30 | return IndexArrayImpl( std::make_index_sequence{} ); 31 | } 32 | 33 | /** 34 | * @brief Create an index array at run time. 35 | * 36 | * @tparam T Array element type 37 | * @param n Size of array 38 | * @return axom::Array holding index array [0, ..., n-1] 39 | */ 40 | template 41 | static axom::Array IndexArray( size_t n ) 42 | { 43 | auto index = axom::Array( n, n ); 44 | std::iota( index.begin(), index.end(), 0 ); 45 | return index; 46 | } 47 | 48 | private: 49 | /** 50 | * @brief IndexArray implementation 51 | * 52 | * @tparam T Array element type 53 | * @tparam I Indices 54 | * @return axom::Array holding the index array I 55 | */ 56 | template 57 | static constexpr axom::Array IndexArrayImpl( std::index_sequence ) 58 | { 59 | return axom::Array( { I... } ); 60 | } 61 | }; 62 | 63 | } // end namespace redecomp 64 | 65 | #endif /* SRC_REDECOMP_UTILS_ARRAYUTILITY_HPP_ */ 66 | -------------------------------------------------------------------------------- /.gitlab/build_blueos.yml: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 3 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 4 | # 5 | # SPDX-License-Identifier: (MIT) 6 | ############################################################################## 7 | 8 | #### 9 | # This is the share configuration of jobs for blueos 10 | .on_blueos: 11 | variables: 12 | SCHEDULER_PARAMETERS: -nnodes ${ALLOC_NODES} -W ${ALLOC_TIME} -q pci -G ${ALLOC_BANK} 13 | tags: 14 | - batch 15 | - lassen 16 | rules: 17 | - if: '$CI_COMMIT_BRANCH =~ /_lnone/ || $ON_BLUEOS == "OFF"' #run except if ... 18 | when: never 19 | - when: on_success 20 | before_script: 21 | # python3.8 is needed on blueos to avoid trampling on the x86 clingo wheel 22 | - module load python/3.8 23 | # CMake >= 3.17 is needed for FindCUDAToolkit with caliper 24 | # We could also extract the CMake executable location from the hostconfig in common_build_functions 25 | # like we do in config-build 26 | - module load cmake/3.23.1 27 | # Workaround for multiple before_scripts - see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2301 28 | # See also https://github.com/LLNL/smith/pull/417#discussion_r631194968 29 | - if [[ $CUDA_BUILD == "ON" ]]; then module load cuda/11.8.0; fi 30 | 31 | #### 32 | # Load required CUDA module 33 | .with_cuda: 34 | variables: 35 | CUDA_BUILD: "ON" 36 | 37 | #### 38 | # Template 39 | .src_build_on_blueos: 40 | extends: [.src_build_script, .on_blueos] 41 | 42 | #### 43 | # Build jobs 44 | blueos-clang_14_0_5-src: 45 | variables: 46 | COMPILER: "clang@14.0.5" 47 | HOST_CONFIG: "lassen-blueos_3_ppc64le_ib_p9-${COMPILER}_cuda.cmake" 48 | ALLOC_NODES: "1" 49 | ALLOC_TIME: "20" 50 | extends: [.src_build_on_blueos, .with_cuda] 51 | -------------------------------------------------------------------------------- /cmake/Options.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | # Get value for some options from corresponding blt options 7 | cmake_dependent_option(TRIBOL_USE_CUDA "Enables Tribol with CUDA support" ON "ENABLE_CUDA" OFF) 8 | cmake_dependent_option(TRIBOL_USE_HIP "Enables Tribol with HIP support" ON "ENABLE_HIP" OFF) 9 | cmake_dependent_option(TRIBOL_USE_MPI "Enables MPI in Tribol" ON "ENABLE_MPI" OFF) 10 | cmake_dependent_option(TRIBOL_USE_OPENMP "Enables Tribol with OpenMP support" ON "ENABLE_OPENMP" OFF) 11 | cmake_dependent_option(TRIBOL_ENABLE_TESTS "Enables Tribol Tests" ON "ENABLE_TESTS" OFF) 12 | cmake_dependent_option(TRIBOL_ENABLE_EXAMPLES "Enables Tribol Examples" ON "ENABLE_EXAMPLES" OFF) 13 | cmake_dependent_option(TRIBOL_ENABLE_DOCS "Enables Tribol Docs" ON "ENABLE_DOCS" OFF) 14 | 15 | option(TRIBOL_USE_SINGLE_PRECISION "Use single-precision floating point" OFF) 16 | option(TRIBOL_USE_64BIT_INDEXTYPE "Use 64-bit index type" OFF) 17 | 18 | option(TRIBOL_ENABLE_ASAN "Enable AddressSanitizer for memory checking (Clang or GCC only)" OFF) 19 | if(TRIBOL_ENABLE_ASAN) 20 | if(NOT (C_COMPILER_FAMILY_IS_CLANG OR C_COMPILER_FAMILY_IS_GNU)) 21 | message(FATAL_ERROR "ENABLE_ASAN only supports Clang and GCC") 22 | endif() 23 | endif() 24 | 25 | #-------------------------------------------------------------------------- 26 | # Option to control whether TRIBOL_DEBUG_DEFINE compiler define is enabled 27 | # 28 | # Possible values are: "ON", "OFF" and "DEFAULT" 29 | # By default, TRIBOL_DEBUG is defined in Debug and RelWithDebInfo configurations 30 | #-------------------------------------------------------------------------- 31 | set(TRIBOL_DEBUG_DEFINE "DEFAULT" CACHE STRING "Controls whether TRIBOL_DEBUG compiler define is enabled") 32 | set_property(CACHE TRIBOL_DEBUG_DEFINE PROPERTY STRINGS "DEFAULT" "ON" "OFF") 33 | -------------------------------------------------------------------------------- /src/tests/enzyme_smoke.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | //----------------------------------------------------------------------------- 7 | // 8 | // file: enzyme_smoke.cpp 9 | // 10 | //----------------------------------------------------------------------------- 11 | 12 | #include "gtest/gtest.h" 13 | 14 | template 15 | return_type __enzyme_fwddiff( Args... ); 16 | 17 | void LinearQuadBasis( const double* xi, double* phi ) 18 | { 19 | phi[0] = 0.25 * ( 1 - xi[0] ) * ( 1 - xi[1] ); 20 | phi[1] = 0.25 * ( 1 + xi[0] ) * ( 1 - xi[1] ); 21 | phi[2] = 0.25 * ( 1 + xi[0] ) * ( 1 + xi[1] ); 22 | phi[3] = 0.25 * ( 1 - xi[0] ) * ( 1 + xi[1] ); 23 | } 24 | 25 | void LinearQuadBasisDeriv( const double* xi, double* phi, double* dphi_dxi, double* dphi_deta ) 26 | { 27 | double xi_dot[2] = { 1.0, 0.0 }; 28 | __enzyme_fwddiff( (void*)LinearQuadBasis, xi, xi_dot, phi, dphi_dxi ); 29 | xi_dot[0] = 0.0; 30 | xi_dot[1] = 1.0; 31 | __enzyme_fwddiff( (void*)LinearQuadBasis, xi, xi_dot, phi, dphi_deta ); 32 | } 33 | 34 | TEST( enzyme_smoke, basic_use ) 35 | { 36 | double xi[2] = { 0.2, -0.4 }; 37 | double phi[4] = { 0.0, 0.0, 0.0, 0.0 }; 38 | double dphi_dxi[4] = { 0.0, 0.0, 0.0, 0.0 }; 39 | double dphi_deta[4] = { 0.0, 0.0, 0.0, 0.0 }; 40 | 41 | LinearQuadBasisDeriv( xi, phi, dphi_dxi, dphi_deta ); 42 | 43 | EXPECT_EQ( dphi_dxi[0], -0.25 * ( 1.0 - xi[1] ) ); 44 | EXPECT_EQ( dphi_deta[0], -0.25 * ( 1.0 - xi[0] ) ); 45 | EXPECT_EQ( dphi_dxi[1], 0.25 * ( 1.0 - xi[1] ) ); 46 | EXPECT_EQ( dphi_deta[1], -0.25 * ( 1.0 + xi[0] ) ); 47 | EXPECT_EQ( dphi_dxi[2], 0.25 * ( 1.0 + xi[1] ) ); 48 | EXPECT_EQ( dphi_deta[2], 0.25 * ( 1.0 + xi[0] ) ); 49 | EXPECT_EQ( dphi_dxi[3], -0.25 * ( 1.0 + xi[1] ) ); 50 | EXPECT_EQ( dphi_deta[3], 0.25 * ( 1.0 - xi[0] ) ); 51 | } 52 | -------------------------------------------------------------------------------- /src/redecomp/utils/MPIUtility.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #include "redecomp/utils/MPIUtility.hpp" 7 | 8 | #include "redecomp/utils/ArrayUtility.hpp" 9 | 10 | namespace redecomp { 11 | 12 | MPIUtility::MPIUtility( const MPI_Comm& comm ) : comm_{ comm } 13 | { 14 | MPI_Comm_size( comm, &n_ranks_ ); 15 | MPI_Comm_rank( comm, &my_rank_ ); 16 | } 17 | 18 | MPIUtility::Request::Request( std::unique_ptr request ) : request_{ std::move( request ) } {} 19 | 20 | void MPIUtility::Request::Wait() { MPI_Wait( request_.get(), &status_ ); } 21 | 22 | BisecTree MPIUtility::BuildSendTree( int rank ) const 23 | { 24 | auto send_tree = BisecTree( n_ranks_ ); 25 | auto lvl_it = --send_tree.end(); 26 | *lvl_it = ArrayUtility::IndexArray( n_ranks_ ); 27 | while ( lvl_it != send_tree.begin() ) { 28 | --lvl_it; 29 | for ( auto node_it = send_tree.begin( lvl_it ); node_it != send_tree.end( lvl_it ); ++node_it ) { 30 | auto right_node_it = send_tree.right( lvl_it, node_it ); 31 | *node_it = right_node_it.second == send_tree.end( right_node_it.first ) || *right_node_it.second != rank 32 | ? *send_tree.left( lvl_it, node_it ).second 33 | : rank; 34 | } 35 | } 36 | return send_tree; 37 | } 38 | 39 | template <> 40 | MPI_Datatype MPIUtility::GetMPIType() const 41 | { 42 | return MPI_C_BOOL; 43 | } 44 | 45 | template <> 46 | MPI_Datatype MPIUtility::GetMPIType() const 47 | { 48 | return MPI_DOUBLE; 49 | } 50 | 51 | template <> 52 | MPI_Datatype MPIUtility::GetMPIType() const 53 | { 54 | return MPI_INT; 55 | } 56 | 57 | template <> 58 | MPI_Datatype MPIUtility::GetMPIType() const 59 | { 60 | return MPI_LONG_LONG; 61 | } 62 | 63 | template <> 64 | MPI_Datatype MPIUtility::GetMPIType() const 65 | { 66 | return MPI_LONG; 67 | } 68 | 69 | } // end namespace redecomp 70 | -------------------------------------------------------------------------------- /src/tribol/interface/c_fortran/wrapTRIBOL_SIMPLE.h: -------------------------------------------------------------------------------- 1 | // wrapTRIBOL_SIMPLE.h 2 | // This file is generated by Shroud 0.12.1. Do not edit. 3 | 4 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | // other Tribol Project Developers. See the top-level LICENSE file for details. 6 | // 7 | // SPDX-License-Identifier: (MIT) 8 | 9 | /** 10 | * \file wrapTRIBOL_SIMPLE.h 11 | * \brief Shroud generated wrapper for TRIBOL_SIMPLE library 12 | */ 13 | 14 | // For C users and C++ implementation 15 | 16 | #ifndef WRAPTRIBOL_SIMPLE_H 17 | #define WRAPTRIBOL_SIMPLE_H 18 | 19 | #include "typesTRIBOL_SIMPLE.h" 20 | #ifndef __cplusplus 21 | #include 22 | #endif 23 | 24 | // splicer begin CXX_declarations 25 | // splicer end CXX_declarations 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | // splicer begin C_declarations 32 | // splicer end C_declarations 33 | 34 | int TRIBOL_SIMPLE_initialize_0(const int dim); 35 | 36 | int TRIBOL_SIMPLE_initialize_1(const int dim, bool init_slic); 37 | 38 | int TRIBOL_SIMPLE_finalize_0(void); 39 | 40 | int TRIBOL_SIMPLE_finalize_1(bool finalize_slic); 41 | 42 | void TRIBOL_SIMPLE_simple_coupling_setup(const int dim, int cell_type, int contact_method, int mortar_numCells, int mortar_lengthNodalData, const int * mortar_connectivity, const double * mortar_x, const double * mortar_y, const double * mortar_z, int nonmortar_numCells, int nonmortar_lengthNodalData, const int * nonmortar_connectivity, const double * nonmortar_x, const double * nonmortar_y, const double * nonmortar_z, const double area_frac, double * mortar_gaps, double * mortar_pressures); 43 | 44 | int TRIBOL_SIMPLE_update(double dt); 45 | 46 | int TRIBOL_SIMPLE_get_simple_coupling_csr(int * * I, int * * J, double * * vals, int * n_offsets, int * n_nonzeros); 47 | 48 | int TRIBOL_SIMPLE_get_simple_coupling_csr_bufferify(TRIBOL_SIMPLE_SHROUD_array *DI, TRIBOL_SIMPLE_SHROUD_array *DJ, TRIBOL_SIMPLE_SHROUD_array *Dvals, int * n_offsets, int * n_nonzeros); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif // WRAPTRIBOL_SIMPLE_H 55 | -------------------------------------------------------------------------------- /src/redecomp/transfer/TransferByElements.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_TRANSFERBYELEMENTS_HPP_ 7 | #define SRC_REDECOMP_TRANSFERBYELEMENTS_HPP_ 8 | 9 | #include "redecomp/transfer/GridFnTransfer.hpp" 10 | 11 | namespace redecomp { 12 | 13 | /** 14 | * @brief GridFnTransfer method using elements 15 | * 16 | * The RedecompMesh holds a list of parent elements to send to RedecompMesh and 17 | * a list of RedecompMesh elements to send to parent. Since this method 18 | * transfers degree-of-freedom values element by element, the element lists 19 | * stored in Redecomp suffice. The related TransferByNodes method constructs 20 | * lists of degrees of freedom to transfer from parent to Redecomp and vice 21 | * versa and, therefore, may be faster for repeated transfers of H1 fields. 22 | */ 23 | class TransferByElements : public GridFnTransfer { 24 | public: 25 | /** 26 | * @brief Copies parent-based mfem::ParGridFunction values to a 27 | * RedecompMesh-based mfem::GridFunction 28 | * 29 | * @param src A parent ParGridFunction to be copied to corresponding redecomp 30 | * GridFunction (dst) 31 | * @param dst A redecomp GridFunction which receives values from a parent 32 | * ParGridFunction (src) 33 | */ 34 | void TransferToSerial( const mfem::ParGridFunction& src, mfem::GridFunction& dst ) const override; 35 | 36 | /** 37 | * @brief Copies RedecompMesh-based mfem::GridFunction values to a 38 | * parent-based mfem::ParGridFunction 39 | * 40 | * @param src A redecomp GridFunction to be copied to corresponding parent 41 | * ParGridFunction (dst) 42 | * @param dst A parent ParGridFunction which receives values from a redecomp 43 | * GridFunction (src) 44 | */ 45 | void TransferToParallel( const mfem::GridFunction& src, mfem::ParGridFunction& dst ) const override; 46 | }; 47 | 48 | } // end namespace redecomp 49 | 50 | #endif /* SRC_REDECOMP_TRANSFERBYELEMENTS_HPP_ */ 51 | -------------------------------------------------------------------------------- /scripts/spack/specs.json: -------------------------------------------------------------------------------- 1 | { 2 | "__comment__":"##############################################################################", 3 | "__comment__":"# Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. ", 4 | "__comment__":"# ", 5 | "__comment__":"# Produced at the Lawrence Livermore National Laboratory ", 6 | "__comment__":"##############################################################################", 7 | 8 | "__comment__":"##############################################################################", 9 | "__comment__":"# ", 10 | "__comment__":"# Define specs we support and test on LLNL platforms. SYS_TYPE is used unless ", 11 | "__comment__":"# a more specific machine name is defined. ", 12 | "__comment__":"# ", 13 | "__comment__":"##############################################################################", 14 | 15 | "toss_4_x86_64_ib": 16 | [ "+devtools+raja+umpire+openmp %clang_19", 17 | "+devtools+raja+umpire+openmp %gcc_13" ], 18 | 19 | "__comment__":"# Use amdgpu_target=gfx942 for tuolumne/rzadams", 20 | "__comment__":"# Use amdgpu_target=gfx90a for tioga/rzvernal", 21 | "__comment__":"# Use amdgpu_target=gfx908 for rznevada", 22 | "toss_4_x86_64_ib_cray": 23 | [ "+rocm+umpire+raja %rocmcc@6.2.1 amdgpu_target=gfx942,gfx90a ^hip@6.2.1 ^rocprim@6.2.1 ^hsa-rocr-dev@6.2.1 ^llvm-amdgpu@6.2.1 ^raja~openmp+rocm ^umpire~openmp+rocm", 24 | "+rocm+umpire+raja %rocmcc@6.3.1 amdgpu_target=gfx942,gfx90a ^hip@6.3.1 ^rocprim@6.3.1 ^hsa-rocr-dev@6.3.1 ^llvm-amdgpu@6.3.1 ^raja~openmp+rocm ^umpire~openmp+rocm" ], 25 | 26 | "macos_tahoe_aarch64": 27 | [ "+enzyme" ], 28 | 29 | "linux_ubuntu_24": 30 | [ "+raja+umpire+enzyme+profiling ^hypre+int64 %clang_19", 31 | "+cuda+raja+umpire+enzyme+profiling cuda_arch=86 ^hypre+int64 %clang_19" ] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/tribol/geom/NodalNormal.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_GEOM_NODALNORMAL_HPP_ 7 | #define SRC_GEOM_NODALNORMAL_HPP_ 8 | 9 | #include "tribol/config.hpp" 10 | 11 | #include "tribol/mesh/MeshData.hpp" 12 | 13 | namespace tribol { 14 | 15 | class MethodData; 16 | 17 | /** 18 | * @brief Virtual base class to define the interface for nodal normal calculations 19 | */ 20 | class NodalNormal { 21 | public: 22 | /** 23 | * @brief Destructor 24 | */ 25 | virtual ~NodalNormal() {} 26 | 27 | /** 28 | * @brief Interface for computing and storing nodal normals on a given mesh 29 | * 30 | * @param mesh Mesh data 31 | * @param jacobian_data Method data for storing Jacobian contributions (optional) 32 | */ 33 | virtual void Compute( MeshData& mesh, MethodData* jacobian_data = nullptr ) = 0; 34 | }; 35 | 36 | /** 37 | * @brief Computes nodal normals as the average of connected element normals 38 | */ 39 | class ElementAvgNodalNormal : public NodalNormal { 40 | public: 41 | /** 42 | * @brief Computes nodal normals as the average of connected element normals 43 | * 44 | * @param mesh Mesh data 45 | * @param jacobian_data Method data for storing Jacobian contributions (optional) 46 | */ 47 | void Compute( MeshData& mesh, MethodData* jacobian_data = nullptr ) override; 48 | }; 49 | 50 | /** 51 | * @brief Computes nodal normals by computing the normal on all connected elements at the nodal location and averaging 52 | * the normals 53 | */ 54 | class EdgeAvgNodalNormal : public NodalNormal { 55 | public: 56 | /** 57 | * @brief Computes nodal normals by computing the normal on all connected elements at the nodal location and averaging 58 | * the normals 59 | * 60 | * @param mesh Mesh data 61 | * @param jacobian_data Method data for storing Jacobian contributions (optional) 62 | */ 63 | void Compute( MeshData& mesh, MethodData* jacobian_data = nullptr ) override; 64 | }; 65 | 66 | } // namespace tribol 67 | 68 | #endif /* SRC_GEOM_NODALNORMAL_HPP_ */ 69 | -------------------------------------------------------------------------------- /src/tribol/common/BasicTypes.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef TRIBOL_COMMON_BASICTYPES_HPP_ 7 | #define TRIBOL_COMMON_BASICTYPES_HPP_ 8 | 9 | // Tribol includes 10 | #include "tribol/config.hpp" 11 | 12 | // Axom includes 13 | #include "axom/core/Types.hpp" 14 | 15 | // MPI includes 16 | #ifdef TRIBOL_USE_MPI 17 | #include 18 | #endif 19 | 20 | namespace tribol { 21 | 22 | #ifdef TRIBOL_USE_MPI 23 | 24 | using CommT = MPI_Comm; 25 | #define TRIBOL_COMM_WORLD MPI_COMM_WORLD 26 | #define TRIBOL_COMM_NULL MPI_COMM_NULL 27 | 28 | #else 29 | 30 | using CommT = int; 31 | #define TRIBOL_COMM_WORLD 0 32 | #define TRIBOL_COMM_NULL -1 33 | 34 | #endif 35 | 36 | // match index type used in axom (since data is held in axom data structures) 37 | using IndexT = axom::IndexType; 38 | 39 | #ifdef TRIBOL_USE_SINGLE_PRECISION 40 | 41 | #error "Tribol does not support single precision." 42 | using RealT = float; 43 | 44 | #else 45 | 46 | using RealT = double; 47 | 48 | #endif 49 | 50 | #define TRIBOL_UNUSED_VAR AXOM_UNUSED_VAR 51 | #define TRIBOL_UNUSED_PARAM AXOM_UNUSED_PARAM 52 | 53 | // Execution space specifiers 54 | #if defined( TRIBOL_USE_CUDA ) || defined( TRIBOL_USE_HIP ) 55 | #ifndef __device__ 56 | #error "TRIBOL_USE_CUDA or TRIBOL_USE_HIP but __device__ is undefined. Check include files" 57 | #endif 58 | #define TRIBOL_DEVICE __device__ 59 | #define TRIBOL_HOST_DEVICE __host__ __device__ 60 | #else 61 | #define TRIBOL_DEVICE 62 | #define TRIBOL_HOST_DEVICE 63 | #endif 64 | 65 | // Execution space identifier for defaulted constructors and destructors 66 | #ifdef TRIBOL_USE_HIP 67 | #define TRIBOL_DEFAULT_DEVICE __device__ 68 | #define TRIBOL_DEFAULT_HOST_DEVICE __host__ __device__ 69 | #else 70 | #define TRIBOL_DEFAULT_DEVICE 71 | #define TRIBOL_DEFAULT_HOST_DEVICE 72 | #endif 73 | 74 | // Define variable when loops are computed on host 75 | #if !( defined( TRIBOL_USE_CUDA ) || defined( TRIBOL_USE_HIP ) ) 76 | #define TRIBOL_USE_HOST 77 | #endif 78 | 79 | } // namespace tribol 80 | 81 | #endif /* TRIBOL_COMMON_BASICTYPES_HPP_ */ 82 | -------------------------------------------------------------------------------- /scripts/spack/packages/mfem/package.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019-2024, Lawrence Livermore National Security, LLC and 2 | # other Smith Project Developers. See the top-level COPYRIGHT file for details. 3 | # 4 | # SPDX-License-Identifier: (BSD-3-Clause) 5 | 6 | from spack.package import * 7 | from spack_repo.builtin.packages.mfem.package import Mfem as BuiltinMfem 8 | 9 | class Mfem(BuiltinMfem): 10 | 11 | # Note: Make sure this sha coincides with the git submodule 12 | # Note: We add a number to the end of the real version number to indicate that we have 13 | # moved forward past the release. Increment the last number when updating the commit sha. 14 | version("4.8.0.1", commit="d9c1c34fdfaf3f7a9f56dfc82f7c083082a36fca") 15 | 16 | variant('asan', default=False, description='Add Address Sanitizer flags') 17 | 18 | depends_on("fortran", type="build", when="+strumpack") 19 | 20 | # AddressSanitizer (ASan) is only supported by GCC and (some) LLVM-derived 21 | # compilers. Denylist compilers not known to support ASan 22 | asan_compiler_denylist = { 23 | 'aocc', 'arm', 'cce', 'fj', 'intel', 'nag', 'nvhpc', 'oneapi', 'pgi', 24 | 'xl', 'xl_r' 25 | } 26 | 27 | # Allowlist of compilers known to support Address Sanitizer 28 | asan_compiler_allowlist = {'gcc', 'clang', 'apple-clang'} 29 | 30 | # ASan compiler denylist and allowlist should be disjoint. 31 | assert len(asan_compiler_denylist & asan_compiler_allowlist) == 0 32 | 33 | for compiler_ in asan_compiler_denylist: 34 | conflicts("%{0}".format(compiler_), 35 | when="+asan", 36 | msg="{0} compilers do not support Address Sanitizer".format( 37 | compiler_)) 38 | 39 | def setup_build_environment(self, env): 40 | BuiltinMfem.setup_build_environment(self, env) 41 | 42 | if '+asan' in self.spec: 43 | for flag in ("CFLAGS", "CXXFLAGS", "LDFLAGS"): 44 | env.append_flags(flag, "-fsanitize=address") 45 | 46 | for flag in ("CFLAGS", "CXXFLAGS"): 47 | env.append_flags(flag, "-fno-omit-frame-pointer") 48 | if '+debug' in self.spec: 49 | env.append_flags(flag, "-fno-optimize-sibling-calls") -------------------------------------------------------------------------------- /src/tribol/interface/test_mesh_shroud.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # API for simple tribol test mesh 3 | # 4 | copyright: 5 | - 6 | - Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 7 | - Produced at the Lawrence Livermore National Laboratory 8 | - SPDX-License-Identifier (MIT) 9 | 10 | library: TRIBOL_TEST_MESH 11 | cxx_header: tribol/utils/TestUtils.hpp 12 | namespace: tribol 13 | 14 | format: 15 | debug: True 16 | C_prefix: TRIBOL_TEST_MESH_ 17 | # Any C++ function which returns a string will be wrapped in 18 | # Fortran as a subroutine with an additional character argument 19 | # for the result. 20 | F_string_result_as_arg: name 21 | F_filename_suffix: F 22 | F_name_generic: {library_lower} 23 | 24 | options: 25 | C_line_length: 1000 26 | F_module_name_library_template: "{library_lower}" 27 | F_name_impl_template: "{library_lower}_{underscore_name}{function_suffix}" 28 | F_name_generic_template: "{library_lower}_{underscore_name}" 29 | 30 | declarations: 31 | - decl: class TestMesh 32 | declarations: 33 | - decl: TestMesh() +name(new) 34 | - decl: ~TestMesh() +name(delete) 35 | - decl: void setupContactMeshHex(int numElemsX1, int numElemsY1, int numElemsZ1, 36 | double xMin1, double yMin1, double zMin1, 37 | double xMax1, double yMax1, double zMax1, 38 | int numElemsX2, int numElemsY2, int numElemsZ2, 39 | double xMin2, double yMin2, double zMin2, 40 | double xMax2, double yMax2, double zMax2, 41 | double thetaMortar, double thetaNonmortar ) 42 | - decl: int numTotalNodes +readonly; 43 | - decl: int numMortarFaces +readonly; 44 | - decl: int numNonmortarFaces +readonly; 45 | 46 | - decl: double* getX() const +dimension(numTotalNodes) 47 | - decl: double* getY() const +dimension(numTotalNodes) 48 | - decl: double* getZ() const +dimension(numTotalNodes) 49 | 50 | - decl: int getMortarFaceConnectivitySize() const; 51 | - decl: int* getMortarFaceConnectivity() const +dimension(getMortarFaceConnectivitySize()) 52 | 53 | - decl: int getNonmortarFaceConnectivitySize() const; 54 | - decl: int* getNonmortarFaceConnectivity() const +dimension(getNonmortarFaceConnectivitySize()) 55 | -------------------------------------------------------------------------------- /scripts/update_copyright_date.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 4 | 5 | #============================================================================= 6 | # Attempt to update the copyright date in all source-controlled files 7 | # that contain the text: "Lawrence Livermore National Security, LLC.". 8 | # 9 | # IMPORTANT: Since this file is not modified (it is running the shell 10 | # script commands), you must EDIT THE COPYRIGHT DATES ABOVE MANUALLY. 11 | # 12 | # Edit the 'find' command below to change the set of files that will be 13 | # modified. 14 | # 15 | # Change the 'sed' command below to change the content that is changed 16 | # in each file and what it is changed to. 17 | # 18 | #============================================================================= 19 | # 20 | # If you need to modify this script, you may want to run each of these 21 | # commands individual from the command line to make sure things are doing 22 | # what you think they should be doing. This is why they are separated into 23 | # steps here. 24 | # 25 | #============================================================================= 26 | # 27 | # Note: The following files do not fit this pattern and require hand editing 28 | # (or integration into this script): 29 | # 30 | # < add any such files here > 31 | #============================================================================= 32 | 33 | #============================================================================= 34 | # First find all the files we want to modify 35 | #============================================================================= 36 | git grep -l "Lawrence Livermore National Security, LLC." | grep -v update_copyright > files2change 37 | 38 | #============================================================================= 39 | # Replace the old copyright dates with new dates 40 | #============================================================================= 41 | for i in `cat files2change` 42 | do 43 | echo $i 44 | cp $i $i.sed.bak 45 | sed "s/Copyright (c) 2017-2024/Copyright (c) 2017-2025/" $i.sed.bak > $i 46 | done 47 | 48 | #============================================================================= 49 | # Remove temporary files created in the process 50 | #============================================================================= 51 | find . -name \*.sed.bak -exec rm {} \; 52 | rm files2change 53 | -------------------------------------------------------------------------------- /src/tribol/common/ArrayTypes.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef TRIBOL_COMMON_ARRAYTYPES_HPP_ 7 | #define TRIBOL_COMMON_ARRAYTYPES_HPP_ 8 | 9 | // Tribol includes 10 | #include "tribol/common/ExecModel.hpp" 11 | 12 | #include "axom/core/Array.hpp" 13 | #include "axom/core/ArrayView.hpp" 14 | 15 | namespace tribol { 16 | 17 | /** 18 | * @brief Array allocated on the free store, i.e. the heap 19 | */ 20 | template 21 | using ArrayT = axom::Array::value>; 22 | 23 | /** 24 | * @brief View of (i.e. non-owned) array allocated on the free store 25 | */ 26 | template 27 | using ArrayViewT = axom::ArrayView::value>; 28 | 29 | /** 30 | * @brief Array allocated on automatic storage, i.e. the stack 31 | */ 32 | template 33 | using StackArrayT = axom::StackArray; 34 | 35 | /** 36 | * @brief Convenience definition for a one-dimensional array 37 | */ 38 | template 39 | using Array1D = ArrayT; 40 | 41 | /** 42 | * @brief Convenience definition for a two-dimensional array 43 | */ 44 | template 45 | using Array2D = ArrayT; 46 | 47 | /** 48 | * @brief Convenience definition for a one-dimensional array view 49 | */ 50 | template 51 | using Array1DView = ArrayViewT; 52 | 53 | /** 54 | * @brief Convenience definition for a two-dimensional array view 55 | */ 56 | template 57 | using Array2DView = ArrayViewT; 58 | 59 | /** 60 | * @brief Convenience definition for an array of array views 61 | */ 62 | template 63 | using MultiArrayView = ArrayT, 1, SPACE>; 64 | 65 | /** 66 | * @brief Convenience definition for an array view of array views 67 | */ 68 | template 69 | using MultiViewArrayView = ArrayViewT, 1, SPACE>; 70 | 71 | } // namespace tribol 72 | 73 | #endif /* TRIBOL_COMMON_ARRAYTYPES_HPP_ */ 74 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | #------------------------------------------------------------------------------ 7 | # Set up tribol target 8 | #------------------------------------------------------------------------------ 9 | 10 | #------------------------------------------------------------------------------ 11 | # add shared 12 | #------------------------------------------------------------------------------ 13 | add_subdirectory(shared) 14 | 15 | #------------------------------------------------------------------------------ 16 | # add redecomp 17 | #------------------------------------------------------------------------------ 18 | if ( NOT DEFINED BUILD_REDECOMP ) 19 | set(BUILD_REDECOMP ON) 20 | endif() 21 | if ( BUILD_REDECOMP ) 22 | if ( TRIBOL_USE_MPI ) 23 | add_subdirectory(redecomp) 24 | else() 25 | message(STATUS "Redecomp requested, but MPI not enabled. " 26 | "Build will proceed with redecomp disabled.") 27 | set(BUILD_REDECOMP OFF) 28 | endif() 29 | endif() 30 | 31 | #------------------------------------------------------------------------------ 32 | # add tribol 33 | #------------------------------------------------------------------------------ 34 | add_subdirectory(tribol) 35 | 36 | #------------------------------------------------------------------------------ 37 | # add tribol's and redecomp's tests 38 | #------------------------------------------------------------------------------ 39 | if ( TRIBOL_ENABLE_TESTS ) 40 | add_subdirectory(tests) 41 | endif() 42 | 43 | #------------------------------------------------------------------------------ 44 | # add tribol's and redecomp's examples 45 | #------------------------------------------------------------------------------ 46 | if ( TRIBOL_ENABLE_EXAMPLES ) 47 | add_subdirectory(examples) 48 | endif() 49 | 50 | convert_to_native_escaped_file_path(${PROJECT_SOURCE_DIR} TRIBOL_REPO_DIR) 51 | convert_to_native_escaped_file_path(${CMAKE_BINARY_DIR} TRIBOL_BIN_DIR) 52 | 53 | # Generate config headers 54 | set(TRIBOL_DATA_DIR ${PROJECT_SOURCE_DIR}/data) 55 | tribol_configure_file(${PROJECT_SOURCE_DIR}/src/tribol/config.hpp.in 56 | ${PROJECT_BINARY_DIR}/include/tribol/config.hpp) 57 | 58 | tribol_configure_file(${PROJECT_SOURCE_DIR}/src/shared/config.hpp.in 59 | ${PROJECT_BINARY_DIR}/include/shared/config.hpp) 60 | -------------------------------------------------------------------------------- /src/shared/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | ## list of headers 7 | set(shared_headers 8 | 9 | infrastructure/Profiling.hpp 10 | mesh/MeshBuilder.hpp 11 | ) 12 | 13 | ## list of sources 14 | set(shared_sources 15 | 16 | mesh/MeshBuilder.cpp 17 | ) 18 | 19 | ## setup the dependency list for tribol shared library 20 | set(shared_depends mfem) 21 | blt_list_append(TO shared_depends ELEMENTS blt::mpi IF TRIBOL_USE_MPI ) 22 | blt_list_append(TO shared_depends ELEMENTS caliper IF TRIBOL_USE_CALIPER ) 23 | message(STATUS "Tribol shared library dependencies: ${shared_depends}") 24 | 25 | ## create the library 26 | blt_add_library( 27 | NAME tribol_shared 28 | SOURCES ${shared_sources} 29 | HEADERS ${shared_headers} 30 | DEPENDS_ON ${shared_depends} ${tribol_device_depends} 31 | FOLDER shared 32 | ) 33 | 34 | # Add separable compilation flag 35 | if(ENABLE_HIP) 36 | target_compile_options(tribol_shared PRIVATE -fgpu-rdc) 37 | target_compile_options(tribol_shared PRIVATE 38 | $<$: 39 | -ggdb 40 | > 41 | ) 42 | target_link_options(tribol_shared PRIVATE -fgpu-rdc) 43 | target_link_options(tribol_shared PRIVATE --hip-link) 44 | endif() 45 | 46 | # Don't propagate internal dependencies 47 | target_link_libraries(tribol_shared PRIVATE axom::slic) 48 | 49 | target_include_directories(tribol_shared PUBLIC 50 | $ 51 | $ 52 | $ 53 | ) 54 | 55 | ## mirror the directory structure on the install 56 | foreach( shared_header ${shared_headers} ) 57 | get_filename_component( shared_base_dir ${shared_header} DIRECTORY) 58 | install( FILES ${shared_header} 59 | DESTINATION "include/shared/${shared_base_dir}" ) 60 | endforeach() 61 | 62 | install(TARGETS tribol_shared 63 | EXPORT tribol-targets 64 | DESTINATION lib 65 | ) 66 | 67 | # Add the TRIBOL_DEBUG compile definition, if non-empty 68 | if(TRIBOL_DEBUG_DEFINE_STRING) 69 | blt_add_target_definitions(TO tribol_shared SCOPE PUBLIC TARGET_DEFINITIONS "${TRIBOL_DEBUG_DEFINE_STRING}") 70 | # Define AXOM_DEBUG for SLIC macros 71 | blt_add_target_definitions(TO tribol_shared SCOPE PUBLIC TARGET_DEFINITIONS "${AXOM_DEBUG_DEFINE_STRING}") 72 | endif() 73 | 74 | -------------------------------------------------------------------------------- /cmake/TribolConfig.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | #------------------------------------------------------------------------------ 7 | # Generate tribol-config.cmake for importing Tribol into other CMake packages 8 | #------------------------------------------------------------------------------ 9 | 10 | ## Get Tribol version information 11 | message(STATUS "Configuring Tribol version ${TRIBOL_VERSION_FULL}") 12 | 13 | #------------------------------------------------------------------------------ 14 | # General Build Info 15 | #------------------------------------------------------------------------------ 16 | install(FILES ${PROJECT_BINARY_DIR}/include/tribol/config.hpp DESTINATION include/tribol) 17 | install(FILES ${PROJECT_BINARY_DIR}/include/shared/config.hpp DESTINATION include/shared) 18 | 19 | # Set up some paths, preserve existing cache values (if present) 20 | set(TRIBOL_INSTALL_INCLUDE_DIR "include" CACHE STRING "") 21 | set(TRIBOL_INSTALL_CONFIG_DIR "lib" CACHE STRING "") 22 | set(TRIBOL_INSTALL_LIB_DIR "lib" CACHE STRING "") 23 | set(TRIBOL_INSTALL_BIN_DIR "bin" CACHE STRING "") 24 | set(TRIBOL_INSTALL_CMAKE_MODULE_DIR "${TRIBOL_INSTALL_CONFIG_DIR}/cmake" CACHE STRING "") 25 | 26 | convert_to_native_escaped_file_path(${CMAKE_INSTALL_PREFIX} TRIBOL_INSTALL_PREFIX) 27 | set(TRIBOL_INSTALL_PREFIX ${TRIBOL_INSTALL_PREFIX} CACHE STRING "" FORCE) 28 | 29 | 30 | include(CMakePackageConfigHelpers) 31 | 32 | # Add version helper 33 | write_basic_package_version_file( 34 | ${CMAKE_CURRENT_BINARY_DIR}/tribol-config-version.cmake 35 | VERSION ${TRIBOL_VERSION_FULL} 36 | COMPATIBILITY AnyNewerVersion 37 | ) 38 | 39 | # Set up cmake package config file 40 | configure_package_config_file( 41 | ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tribol-config.cmake.in 42 | ${CMAKE_CURRENT_BINARY_DIR}/tribol-config.cmake 43 | INSTALL_DESTINATION 44 | ${TRIBOL_INSTALL_CONFIG_DIR} 45 | PATH_VARS 46 | TRIBOL_INSTALL_INCLUDE_DIR 47 | TRIBOL_INSTALL_LIB_DIR 48 | TRIBOL_INSTALL_BIN_DIR 49 | TRIBOL_INSTALL_CMAKE_MODULE_DIR 50 | ) 51 | 52 | # Install BLT files 53 | blt_install_tpl_setups(DESTINATION ${TRIBOL_INSTALL_CMAKE_MODULE_DIR}) 54 | 55 | # Install config files 56 | install( 57 | FILES 58 | ${CMAKE_CURRENT_BINARY_DIR}/tribol-config.cmake 59 | ${CMAKE_CURRENT_BINARY_DIR}/tribol-config-version.cmake 60 | DESTINATION 61 | ${TRIBOL_INSTALL_CMAKE_MODULE_DIR} 62 | ) 63 | -------------------------------------------------------------------------------- /src/redecomp/partition/PartitionMethod.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_PARTITION_PARTITIONMETHOD_HPP_ 7 | #define SRC_REDECOMP_PARTITION_PARTITIONMETHOD_HPP_ 8 | 9 | #include "redecomp/common/TypeDefs.hpp" 10 | 11 | namespace redecomp { 12 | 13 | /** 14 | * @brief PartitionMethod base class 15 | * 16 | * The PartitionMethod class is designed to take a list of coordinates on each 17 | * rank and produce a re-balancing of the coordinates over the MPI ranks based 18 | * on the method in the derived class. For instance, RCB re-balances the 19 | * coordinates using the recursive coordinate bisection technique. The list of 20 | * coordinates can be obtained from a PartitionEntity object. 21 | * 22 | * @tparam NDIMS number of dimensions 23 | */ 24 | template 25 | class PartitionMethod { 26 | public: 27 | /** 28 | * @brief Returns a list of entity ids on each rank/subdomain determined by 29 | * the partitioning method 30 | * 31 | * @param n_parts Number of subdomains to cut the list of coords into 32 | * @param coords_by_mesh List of on-rank points (one point-per-entity, sorted 33 | * by entity id) to subdivide sorted by mesh 34 | * @param ghost_size Sets length to include entities as ghost on each 35 | * subdomain 36 | * @return List of entity ids and ghost information on each subdomain sorted 37 | * by mesh 38 | */ 39 | virtual std::vector generatePartitioning( 40 | int n_parts, const std::vector>>& coords_by_mesh, double ghost_size ) const = 0; 41 | 42 | /** 43 | * @brief Returns the MPIUtility 44 | * 45 | * @return MPIUtility reference 46 | */ 47 | const MPIUtility& getMPIUtility() const; 48 | 49 | /** 50 | * @brief Destroy the PartitionMethod object 51 | */ 52 | virtual ~PartitionMethod() = default; 53 | 54 | protected: 55 | /** 56 | * @brief Construct a new PartitionMethod object 57 | * 58 | * @param comm MPI_Comm to used to build MPIUtility 59 | */ 60 | PartitionMethod( const MPI_Comm& comm ); 61 | 62 | private: 63 | /** 64 | * @brief MPIUtility used to hold MPI communication patterns used in redecomp 65 | */ 66 | const MPIUtility mpi_; 67 | }; 68 | 69 | using PartitionMethod2D = PartitionMethod<2>; 70 | using PartitionMethod3D = PartitionMethod<3>; 71 | 72 | } // end namespace redecomp 73 | 74 | #endif /* SRC_REDECOMP_PARTITION_PARTITIONMETHOD_HPP_ */ 75 | -------------------------------------------------------------------------------- /src/redecomp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | ## list of headers 7 | set( redecomp_headers 8 | 9 | redecomp.hpp 10 | MultiRedecomp.hpp 11 | RedecompMesh.hpp 12 | RedecompTransfer.hpp 13 | common/TypeDefs.hpp 14 | partition/PartitionElements.hpp 15 | partition/PartitionEntity.hpp 16 | partition/Partitioner.hpp 17 | partition/PartitionMethod.hpp 18 | partition/RCB.hpp 19 | transfer/GridFnTransfer.hpp 20 | transfer/MatrixTransfer.hpp 21 | transfer/SparseMatrixTransfer.hpp 22 | transfer/TransferByElements.hpp 23 | transfer/TransferByNodes.hpp 24 | utils/ArrayUtility.hpp 25 | utils/BisecTree.hpp 26 | utils/MPIArray.hpp 27 | utils/MPIUtility.hpp 28 | ) 29 | 30 | ## list of sources 31 | set( redecomp_sources 32 | 33 | MultiRedecomp.cpp 34 | RedecompMesh.cpp 35 | RedecompTransfer.cpp 36 | partition/PartitionElements.cpp 37 | partition/Partitioner.cpp 38 | partition/PartitionMethod.cpp 39 | partition/RCB.cpp 40 | transfer/MatrixTransfer.cpp 41 | transfer/SparseMatrixTransfer.cpp 42 | transfer/TransferByElements.cpp 43 | transfer/TransferByNodes.cpp 44 | utils/MPIUtility.cpp 45 | ) 46 | 47 | ## setup the dependency list for redecomp 48 | set(redecomp_depends tribol_shared axom::primal mfem) 49 | blt_list_append(TO redecomp_depends ELEMENTS blt::mpi IF TRIBOL_USE_MPI ) 50 | 51 | ## create the library 52 | blt_add_library( 53 | NAME redecomp 54 | SOURCES ${redecomp_sources} 55 | HEADERS ${redecomp_headers} 56 | DEPENDS_ON ${redecomp_depends} ${tribol_device_depends} 57 | FOLDER redecomp 58 | ) 59 | 60 | target_include_directories(redecomp PUBLIC 61 | $ 62 | ) 63 | 64 | ## mirror the directory structure on the install 65 | foreach( redecomp_header ${redecomp_headers} ) 66 | get_filename_component( redecomp_base_dir ${redecomp_header} DIRECTORY) 67 | install( FILES ${redecomp_header} 68 | DESTINATION "include/redecomp/${redecomp_base_dir}" ) 69 | endforeach() 70 | 71 | install(TARGETS redecomp 72 | EXPORT tribol-targets 73 | DESTINATION lib 74 | ) 75 | 76 | # Add the TRIBOL_DEBUG compile definition, if non-empty 77 | if(TRIBOL_DEBUG_DEFINE_STRING) 78 | blt_add_target_definitions(TO redecomp SCOPE PUBLIC TARGET_DEFINITIONS "${TRIBOL_DEBUG_DEFINE_STRING}") 79 | # Define AXOM_DEBUG for SLIC macros 80 | blt_add_target_definitions(TO redecomp SCOPE PUBLIC TARGET_DEFINITIONS "${AXOM_DEBUG_DEFINE_STRING}") 81 | endif() 82 | -------------------------------------------------------------------------------- /src/redecomp/MultiRedecomp.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_MULTIREDECOMP_HPP_ 7 | #define SRC_REDECOMP_MULTIREDECOMP_HPP_ 8 | 9 | #include 10 | 11 | #include "mfem.hpp" 12 | 13 | #include "redecomp/RedecompMesh.hpp" 14 | 15 | namespace redecomp { 16 | 17 | class MultiRedecomp { 18 | public: 19 | /** 20 | * @brief List of partitioning methods verified to work with MultiRedecomp 21 | */ 22 | enum PartitionType 23 | { 24 | RCB 25 | }; 26 | 27 | /** 28 | * @brief Construct a new MultiRedecomp object 29 | * 30 | * @note This constructor builds the Partitioner object based on the method 31 | * passed. If no method is passed, a RCB Partitioner is constructed. 32 | * 33 | * @param method The method of redecomposition 34 | * @param ghost_len_multiplier Multiplier for the ghost element layer (base 35 | * value set by the approximate largest element size) 36 | */ 37 | MultiRedecomp( int dim, MPI_Comm comm, PartitionType method = RCB, double ghost_len_multiplier = 1.25 ); 38 | 39 | /** 40 | * @brief Construct a new MultiRedecomp object 41 | * 42 | * @note This constructor requires the Partitioner object passed directly to 43 | * it. This can be used to customize the Partitioner used (for example, with 44 | * non-default options with RCB or for a user-defined Partitioner). 45 | * 46 | * @param partitioner Partitioning object used to define redecomposition 47 | * @param ghost_len_multiplier Multiplier for the ghost element layer (base 48 | * value set by the approximate largest element size) 49 | */ 50 | MultiRedecomp( std::unique_ptr partitioner, double ghost_len_multiplier = 1.25 ); 51 | 52 | /** 53 | * @brief Get a vector of Redecomp meshes associated with MultiRedecomp 54 | * 55 | * @note This method can be used to move RedecompMeshes out of the 56 | * MultiRedecomp object. Once the RedecompMeshes are moved, they can no longer 57 | * be accessed in the MultiRedecomp object. If you wish to access a 58 | * RedecompMesh without taking ownership, the getRedecompMesh() method can be 59 | * used. 60 | * 61 | * @return Vector of Redecomp unique pointers 62 | */ 63 | std::vector> createRedecompMeshes( const std::vector& parents ); 64 | 65 | private: 66 | /** 67 | * @brief Partitioning method 68 | */ 69 | std::unique_ptr partitioner_; 70 | 71 | /** 72 | * @brief Multiplier of max element length to include in ghost regions of the 73 | * RedecompMeshes 74 | */ 75 | double ghost_len_multiplier_; 76 | }; 77 | 78 | } // namespace redecomp 79 | 80 | #endif /* SRC_REDECOMP_MULTIREDECOMP_HPP_ */ 81 | -------------------------------------------------------------------------------- /scripts/make_release_tarball.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 4 | 5 | ##----------------------------------------------------------------------------- 6 | ## GLOBAL DEFINITIONS 7 | ##----------------------------------------------------------------------------- 8 | bold=$(tput bold) 9 | reset=$(tput sgr0) 10 | 11 | TAR_CMD=`which tar` 12 | TAR_VERSION=`$TAR_CMD --version |head -n 1` 13 | VERSION=${VERSION:-`git describe --tags`} 14 | 15 | 16 | ##----------------------------------------------------------------------------- 17 | ## HELPER FUNCTIONS 18 | ##----------------------------------------------------------------------------- 19 | function show_help() { 20 | echo 21 | echo -e "$bold SYNOPSIS $reset" 22 | echo -e "\t Generates a release tarball." 23 | echo 24 | echo -e "$bold Usage:$reset ./scripts/make_release_tarball.sh [options]" 25 | echo -e 26 | echo -e "$bold OPTIONS $reset" 27 | 28 | echo -e "\t$bold-h$reset, $bold--help$reset" 29 | echo -e "\t\t Displays this help information and exits." 30 | echo -e 31 | echo -e "$bold To override version string:$reset " 32 | echo -e "\t VERSION=foo ./scripts/make_release_tarball.sh [options] --> generates 'tribol-foo.tar.gz'" 33 | echo -e 34 | } 35 | 36 | ##----------------------------------------------------------------------------- 37 | function info() { 38 | echo "$bold[INFO]:$reset $1" 39 | } 40 | 41 | ##----------------------------------------------------------------------------- 42 | function error() { 43 | echo "$bold[ERROR]:$reset $1" 44 | exit -1 45 | } 46 | 47 | ##----------------------------------------------------------------------------- 48 | ## MAIN 49 | ##----------------------------------------------------------------------------- 50 | 51 | ## parse arguments 52 | while [ "$#" -gt 0 ] 53 | do 54 | case "$1" in 55 | -h|--help) 56 | show_help 57 | exit 0 58 | ;; 59 | esac 60 | shift 61 | done 62 | 63 | info "using tar command [$TAR_CMD]" 64 | info "detected tar version: $TAR_VERSION" 65 | 66 | if [[ $TAR_VERSION != *GNU* ]]; then 67 | error "This script requires GNU tar!" 68 | fi 69 | 70 | info "creating archive for version [$VERSION]" 71 | git archive --prefix=tribol-${VERSION}/ -o tribol-${VERSION}.tar HEAD 2> /dev/null 72 | 73 | info "processing submodules..." 74 | 75 | p=`pwd` && (echo .; git submodule foreach --recursive) | while read entering path; do 76 | temp="${path%\'}"; 77 | temp="${temp#\'}"; 78 | path=$temp; 79 | 80 | if [[ -n $path && "$path" != "data" ]]; then 81 | info "archiving [$path] submodule..." 82 | (cd $path && git archive --prefix=tribol-${VERSION}/$path/ HEAD > $p/tmp.tar && ${TAR_CMD} --concatenate --file=$p/tribol-${VERSION}.tar $p/tmp.tar && rm $p/tmp.tar); 83 | fi 84 | 85 | done 86 | 87 | gzip tribol-${VERSION}.tar 88 | 89 | info "done." 90 | -------------------------------------------------------------------------------- /scripts/github-actions/linux-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ############################################################################## 3 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 4 | # other Tribol Project Developers. See the top-level COPYRIGHT file for details. 5 | # 6 | # SPDX-License-Identifier: (MIT) 7 | ############################################################################## 8 | 9 | set -x 10 | 11 | function or_die () { 12 | "$@" 13 | local status=$? 14 | if [[ $status != 0 ]] ; then 15 | echo ERROR $status command: $@ 16 | exit $status 17 | fi 18 | } 19 | 20 | echo HOST_CONFIG 21 | echo $HOST_CONFIG 22 | 23 | echo "~~~~~~ RUNNING CMAKE ~~~~~~~~" 24 | cmake_args="-DCMAKE_BUILD_TYPE=Debug -DENABLE_CLANGTIDY=OFF -DTRIBOL_ENABLE_CODE_CHECKS=ON" 25 | 26 | if [[ "$CHECK_TYPE" == "coverage" ]] ; then 27 | # Alias llvm-cov to gcov so it acts like gcov 28 | ln -s `which llvm-cov` /home/serac/gcov 29 | cmake_args="$cmake_args -DENABLE_COVERAGE=ON -DGCOV_EXECUTABLE=/home/serac/gcov" 30 | fi 31 | 32 | if [[ "$CHECK_TYPE" == "docs" ]] ; then 33 | SPHINX_EXECUTABLE=/usr/bin/sphinx-build 34 | if [[ ! -f "$SPHINX_EXECUTABLE" ]]; then 35 | echo "sphinx not found: $SPHINX_EXECUTABLE" 36 | exit 1 37 | fi 38 | DOXYGEN_EXECUTABLE=/usr/local/bin/doxygen 39 | if [[ ! -f "$DOXYGEN_EXECUTABLE" ]]; then 40 | echo "doxygen not found: $DOXYGEN_EXECUTABLE" 41 | exit 1 42 | fi 43 | cmake_args="$cmake_args -DENABLE_DOCS=ON -DSPHINX_EXECUTABLE=$SPHINX_EXECUTABLE -DDOXYGEN_EXECUTABLE=$DOXYGEN_EXECUTABLE" 44 | fi 45 | 46 | if [[ "$CHECK_TYPE" == "style" ]] ; then 47 | CLANGFORMAT_EXECUTABLE=/usr/bin/clang-format 48 | if [[ ! -f "$CLANGFORMAT_EXECUTABLE" ]]; then 49 | echo "clang-format not found: $CLANGFORMAT_EXECUTABLE" 50 | exit 1 51 | fi 52 | cmake_args="$cmake_args -DENABLE_CLANGFORMAT=ON -DCLANGFORMAT_EXECUTABLE=$CLANGFORMAT_EXECUTABLE" 53 | fi 54 | 55 | or_die ./config-build.py -hc host-configs/docker/${HOST_CONFIG} -bp build-check-debug -ip install-check-debug $cmake_args 56 | or_die cd build-check-debug 57 | 58 | if [[ "$CHECK_TYPE" == "coverage" ]] ; then 59 | or_die make -j4 60 | or_die make tribol_coverage 61 | # Move cov report to repo dir, so that Github Actions can find it 62 | cp tribol_coverage.info.cleaned .. 63 | fi 64 | 65 | if [[ "$CHECK_TYPE" == "docs" ]] ; then 66 | or_die make VERBOSE=1 docs 2>&1 | tee docs_output 67 | or_die ../scripts/check_log.py -l docs_output -i ../scripts/github-actions/docs_ignore_regexs.txt 68 | fi 69 | 70 | if [[ "$CHECK_TYPE" == "style" ]] ; then 71 | or_die make VERBOSE=1 clangformat_check 72 | fi 73 | 74 | if [[ "$CHECK_TYPE" == "header" ]] ; then 75 | or_die make -j4 76 | or_die make install -j4 77 | or_die ../scripts/check_for_missing_headers.py -i ../install-check-debug -s ../src 78 | fi 79 | 80 | exit 0 81 | -------------------------------------------------------------------------------- /src/shared/infrastructure/Profiling.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_SHARED_INFRASTRUCTURE_PROFILING_HPP_ 7 | #define SRC_SHARED_INFRASTRUCTURE_PROFILING_HPP_ 8 | 9 | /** 10 | * @file Profiling.hpp 11 | * 12 | * @brief Various helper functions and macros for profiling using Caliper 13 | */ 14 | 15 | // Shared config include 16 | #include "shared/config.hpp" 17 | 18 | #ifdef TRIBOL_USE_CALIPER 19 | #include "caliper/cali.h" 20 | #endif 21 | 22 | /** 23 | * @def TRIBOL_MARK_FUNCTION 24 | * Marks a function for Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 25 | */ 26 | 27 | /** 28 | * @def TRIBOL_MARK_LOOP_BEGIN(id, name) 29 | * Marks the beginning of a loop block for Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 30 | */ 31 | 32 | /** 33 | * @def TRIBOL_MARK_LOOP_ITERATION(id, i) 34 | * Marks the beginning of a loop iteration for Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 35 | */ 36 | 37 | /** 38 | * @def TRIBOL_MARK_LOOP_END(id) 39 | * Marks the end of a loop block for Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 40 | */ 41 | 42 | /** 43 | * @def TRIBOL_MARK_BEGIN(id) 44 | * Marks the start of a region Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 45 | */ 46 | 47 | /** 48 | * @def TRIBOL_MARK_END(id) 49 | * Marks the end of a region Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 50 | */ 51 | 52 | /** 53 | * @def TRIBOL_MARK_SCOPE(name) 54 | * Marks a particular scope for Caliper profiling. No-op macro when TRIBOL_ENABLE_PROFILING is off. 55 | */ 56 | 57 | // NOTE: The motivation behind wrapping Caliper macros to avoid conflicting macro definitions in the no-op case, and 58 | // give downstream users the option to disable profiling Smith if it pollutes their timings. 59 | 60 | #ifdef TRIBOL_USE_CALIPER 61 | #define TRIBOL_MARK_FUNCTION CALI_CXX_MARK_FUNCTION 62 | #define TRIBOL_MARK_LOOP_BEGIN( id, name ) CALI_CXX_MARK_LOOP_BEGIN( id, name ) 63 | #define TRIBOL_MARK_LOOP_ITERATION( id, i ) CALI_CXX_MARK_LOOP_ITERATION( id, i ) 64 | #define TRIBOL_MARK_LOOP_END( id ) CALI_CXX_MARK_LOOP_END( id ) 65 | #define TRIBOL_MARK_BEGIN( name ) CALI_MARK_BEGIN( name ) 66 | #define TRIBOL_MARK_END( name ) CALI_MARK_END( name ) 67 | #define TRIBOL_MARK_SCOPE( name ) CALI_CXX_MARK_SCOPE( name ) 68 | #else 69 | // Define no-op macros in case Smith has not been configured with Caliper 70 | #define TRIBOL_MARK_FUNCTION 71 | #define TRIBOL_MARK_LOOP_BEGIN( id, name ) 72 | #define TRIBOL_MARK_LOOP_ITERATION( id, i ) 73 | #define TRIBOL_MARK_LOOP_END( id ) 74 | #define TRIBOL_MARK_BEGIN( name ) 75 | #define TRIBOL_MARK_END( name ) 76 | #define TRIBOL_MARK_SCOPE( name ) 77 | #endif 78 | 79 | #endif // SRC_SHARED_INFRASTRUCTURE_PROFILING_HPP_ 80 | -------------------------------------------------------------------------------- /docs/sphinx/dev_guide/git_aliases.rst: -------------------------------------------------------------------------------- 1 | .. ## 2 | .. ## Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 3 | .. ## 4 | .. ## Produced at the Lawrence Livermore National Laboratory 5 | .. ## 6 | 7 | ****************** 8 | Tribol Git Aliases 9 | ****************** 10 | 11 | This section provides an overview of the various git aliases that are available 12 | upon running the SetupForDevelopment script. 13 | 14 | .. list-table:: Listing of Git Aliases 15 | :widths: 25 25 50 16 | :header-rows: 1 17 | 18 | * - Git Alias 19 | - Description 20 | - Usage Example 21 | * - **git hall-of-fame** 22 | - Lists all contributors ranked by the number of commits 23 | - > git hall-of-fame 24 | * - **git incoming** 25 | - Lists all commits that are on origin/master and are not on the current branch 26 | - > git incoming 27 | * - **git outgoing** 28 | - Lists all commits on the current branch that are not on master 29 | - > git outgoing 30 | * - **git rmtag ** 31 | - Removes a tag both on the local clone and on origin 32 | - > git rmtag 3.9.260 33 | * - **git make-patch ** 34 | - Creates patch file consisting of all the commits from the given tag to the HEAD of the current branch. 35 | - > git make-patch 3.9.260 ~/fix.patch 36 | * - **git apply-patch ** 37 | - Applies the changes from the given patch 38 | - > git apply-patch fix.patch 39 | * - **git changelog ** 40 | - Generates and prints a changelog to STDOUT consisting of the changes in between two different commits 41 | specified with the and arguments. The and can be any git ref object, e.g, a 42 | commit SHA1 or a tag. 43 | - > git changelog 3.9.1 3.9.100 44 | * - **git unstage ** 45 | - Unstages the changes on the given file. 46 | - > git unstage src/main.cpp 47 | * - **git history** 48 | - Displays the history on the current branch 49 | - > git history 50 | * - **git show-config** 51 | - Lists the contents of the git-configuration, i.e., ./git/config for this project 52 | - > git show-config 53 | * - **git show-aliases** 54 | - Displays the current set of git aliases 55 | - > git show-aliases 56 | * - **git prepush** 57 | - Provides a snapshot of the changes to be pushed 58 | - > git prepush 59 | * - **git undo** 60 | - Removes the last commit on the current branch, but leaves the 61 | the changes unstaged in the checkout space 62 | - > git undo 63 | * - **git squash-merge ** 64 | - Merges the given branch by squashing all the commits on that branch in to a single commit at 65 | the HEAD of the current branch 66 | - > git squash-merge feature/stuff 67 | * - **git ff-merge ** 68 | - Merges the given branch by doing a fast-forward merge 69 | - > git ff-merge feature/stuff 70 | -------------------------------------------------------------------------------- /data/mortar_ironing/ixs.txt: -------------------------------------------------------------------------------- 1 | 54 2 | 60 3 | 61 4 | 55 5 | 55 6 | 61 7 | 62 8 | 56 9 | 56 10 | 62 11 | 63 12 | 57 13 | 57 14 | 63 15 | 64 16 | 58 17 | 58 18 | 64 19 | 65 20 | 59 21 | 60 22 | 66 23 | 67 24 | 61 25 | 61 26 | 67 27 | 68 28 | 62 29 | 62 30 | 68 31 | 69 32 | 63 33 | 63 34 | 69 35 | 70 36 | 64 37 | 64 38 | 70 39 | 71 40 | 65 41 | 66 42 | 72 43 | 73 44 | 67 45 | 67 46 | 73 47 | 74 48 | 68 49 | 68 50 | 74 51 | 75 52 | 69 53 | 69 54 | 75 55 | 76 56 | 70 57 | 70 58 | 76 59 | 77 60 | 71 61 | 72 62 | 78 63 | 79 64 | 73 65 | 73 66 | 79 67 | 80 68 | 74 69 | 74 70 | 80 71 | 81 72 | 75 73 | 75 74 | 81 75 | 82 76 | 76 77 | 76 78 | 82 79 | 83 80 | 77 81 | 78 82 | 84 83 | 85 84 | 79 85 | 79 86 | 85 87 | 86 88 | 80 89 | 80 90 | 86 91 | 87 92 | 81 93 | 81 94 | 87 95 | 88 96 | 82 97 | 82 98 | 88 99 | 89 100 | 83 101 | 84 102 | 90 103 | 91 104 | 85 105 | 85 106 | 91 107 | 92 108 | 86 109 | 86 110 | 92 111 | 93 112 | 87 113 | 87 114 | 93 115 | 94 116 | 88 117 | 88 118 | 94 119 | 95 120 | 89 121 | 90 122 | 96 123 | 97 124 | 91 125 | 91 126 | 97 127 | 98 128 | 92 129 | 92 130 | 98 131 | 99 132 | 93 133 | 93 134 | 99 135 | 100 136 | 94 137 | 94 138 | 100 139 | 101 140 | 95 141 | 96 142 | 102 143 | 103 144 | 97 145 | 97 146 | 103 147 | 104 148 | 98 149 | 98 150 | 104 151 | 105 152 | 99 153 | 99 154 | 105 155 | 106 156 | 100 157 | 100 158 | 106 159 | 107 160 | 101 161 | -------------------------------------------------------------------------------- /data/mortar_ironing_2/ixs.txt: -------------------------------------------------------------------------------- 1 | 54 2 | 60 3 | 61 4 | 55 5 | 55 6 | 61 7 | 62 8 | 56 9 | 56 10 | 62 11 | 63 12 | 57 13 | 57 14 | 63 15 | 64 16 | 58 17 | 58 18 | 64 19 | 65 20 | 59 21 | 60 22 | 66 23 | 67 24 | 61 25 | 61 26 | 67 27 | 68 28 | 62 29 | 62 30 | 68 31 | 69 32 | 63 33 | 63 34 | 69 35 | 70 36 | 64 37 | 64 38 | 70 39 | 71 40 | 65 41 | 66 42 | 72 43 | 73 44 | 67 45 | 67 46 | 73 47 | 74 48 | 68 49 | 68 50 | 74 51 | 75 52 | 69 53 | 69 54 | 75 55 | 76 56 | 70 57 | 70 58 | 76 59 | 77 60 | 71 61 | 72 62 | 78 63 | 79 64 | 73 65 | 73 66 | 79 67 | 80 68 | 74 69 | 74 70 | 80 71 | 81 72 | 75 73 | 75 74 | 81 75 | 82 76 | 76 77 | 76 78 | 82 79 | 83 80 | 77 81 | 78 82 | 84 83 | 85 84 | 79 85 | 79 86 | 85 87 | 86 88 | 80 89 | 80 90 | 86 91 | 87 92 | 81 93 | 81 94 | 87 95 | 88 96 | 82 97 | 82 98 | 88 99 | 89 100 | 83 101 | 84 102 | 90 103 | 91 104 | 85 105 | 85 106 | 91 107 | 92 108 | 86 109 | 86 110 | 92 111 | 93 112 | 87 113 | 87 114 | 93 115 | 94 116 | 88 117 | 88 118 | 94 119 | 95 120 | 89 121 | 90 122 | 96 123 | 97 124 | 91 125 | 91 126 | 97 127 | 98 128 | 92 129 | 92 130 | 98 131 | 99 132 | 93 133 | 93 134 | 99 135 | 100 136 | 94 137 | 94 138 | 100 139 | 101 140 | 95 141 | 96 142 | 102 143 | 103 144 | 97 145 | 97 146 | 103 147 | 104 148 | 98 149 | 98 150 | 104 151 | 105 152 | 99 153 | 99 154 | 105 155 | 106 156 | 100 157 | 100 158 | 106 159 | 107 160 | 101 161 | -------------------------------------------------------------------------------- /data/mortar_ironing_3/ixs.txt: -------------------------------------------------------------------------------- 1 | 54 2 | 60 3 | 61 4 | 55 5 | 55 6 | 61 7 | 62 8 | 56 9 | 56 10 | 62 11 | 63 12 | 57 13 | 57 14 | 63 15 | 64 16 | 58 17 | 58 18 | 64 19 | 65 20 | 59 21 | 60 22 | 66 23 | 67 24 | 61 25 | 61 26 | 67 27 | 68 28 | 62 29 | 62 30 | 68 31 | 69 32 | 63 33 | 63 34 | 69 35 | 70 36 | 64 37 | 64 38 | 70 39 | 71 40 | 65 41 | 66 42 | 72 43 | 73 44 | 67 45 | 67 46 | 73 47 | 74 48 | 68 49 | 68 50 | 74 51 | 75 52 | 69 53 | 69 54 | 75 55 | 76 56 | 70 57 | 70 58 | 76 59 | 77 60 | 71 61 | 72 62 | 78 63 | 79 64 | 73 65 | 73 66 | 79 67 | 80 68 | 74 69 | 74 70 | 80 71 | 81 72 | 75 73 | 75 74 | 81 75 | 82 76 | 76 77 | 76 78 | 82 79 | 83 80 | 77 81 | 78 82 | 84 83 | 85 84 | 79 85 | 79 86 | 85 87 | 86 88 | 80 89 | 80 90 | 86 91 | 87 92 | 81 93 | 81 94 | 87 95 | 88 96 | 82 97 | 82 98 | 88 99 | 89 100 | 83 101 | 84 102 | 90 103 | 91 104 | 85 105 | 85 106 | 91 107 | 92 108 | 86 109 | 86 110 | 92 111 | 93 112 | 87 113 | 87 114 | 93 115 | 94 116 | 88 117 | 88 118 | 94 119 | 95 120 | 89 121 | 90 122 | 96 123 | 97 124 | 91 125 | 91 126 | 97 127 | 98 128 | 92 129 | 92 130 | 98 131 | 99 132 | 93 133 | 93 134 | 99 135 | 100 136 | 94 137 | 94 138 | 100 139 | 101 140 | 95 141 | 96 142 | 102 143 | 103 144 | 97 145 | 97 146 | 103 147 | 104 148 | 98 149 | 98 150 | 104 151 | 105 152 | 99 153 | 99 154 | 105 155 | 106 156 | 100 157 | 100 158 | 106 159 | 107 160 | 101 161 | -------------------------------------------------------------------------------- /src/tribol/interface/c_fortran/typesTRIBOL_SIMPLE.h: -------------------------------------------------------------------------------- 1 | // typesTRIBOL_SIMPLE.h 2 | // This file is generated by Shroud 0.12.1. Do not edit. 3 | 4 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | // other Tribol Project Developers. See the top-level LICENSE file for details. 6 | // 7 | // SPDX-License-Identifier: (MIT) 8 | 9 | // For C users and C++ implementation 10 | 11 | #ifndef TYPESTRIBOL_SIMPLE_H 12 | #define TYPESTRIBOL_SIMPLE_H 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* helper ShroudTypeDefines */ 22 | /* Shroud type defines */ 23 | #define SH_TYPE_SIGNED_CHAR 1 24 | #define SH_TYPE_SHORT 2 25 | #define SH_TYPE_INT 3 26 | #define SH_TYPE_LONG 4 27 | #define SH_TYPE_LONG_LONG 5 28 | #define SH_TYPE_SIZE_T 6 29 | 30 | #define SH_TYPE_UNSIGNED_SHORT SH_TYPE_SHORT + 100 31 | #define SH_TYPE_UNSIGNED_INT SH_TYPE_INT + 100 32 | #define SH_TYPE_UNSIGNED_LONG SH_TYPE_LONG + 100 33 | #define SH_TYPE_UNSIGNED_LONG_LONG SH_TYPE_LONG_LONG + 100 34 | 35 | #define SH_TYPE_INT8_T 7 36 | #define SH_TYPE_INT16_T 8 37 | #define SH_TYPE_INT32_T 9 38 | #define SH_TYPE_INT64_T 10 39 | 40 | #define SH_TYPE_UINT8_T SH_TYPE_INT8_T + 100 41 | #define SH_TYPE_UINT16_T SH_TYPE_INT16_T + 100 42 | #define SH_TYPE_UINT32_T SH_TYPE_INT32_T + 100 43 | #define SH_TYPE_UINT64_T SH_TYPE_INT64_T + 100 44 | 45 | /* least8 least16 least32 least64 */ 46 | /* fast8 fast16 fast32 fast64 */ 47 | /* intmax_t intptr_t ptrdiff_t */ 48 | 49 | #define SH_TYPE_FLOAT 22 50 | #define SH_TYPE_DOUBLE 23 51 | #define SH_TYPE_LONG_DOUBLE 24 52 | #define SH_TYPE_FLOAT_COMPLEX 25 53 | #define SH_TYPE_DOUBLE_COMPLEX 26 54 | #define SH_TYPE_LONG_DOUBLE_COMPLEX 27 55 | 56 | #define SH_TYPE_BOOL 28 57 | #define SH_TYPE_CHAR 29 58 | #define SH_TYPE_CPTR 30 59 | #define SH_TYPE_STRUCT 31 60 | #define SH_TYPE_OTHER 32 61 | 62 | // helper capsule_data_helper 63 | struct s_TRIBOL_SIMPLE_SHROUD_capsule_data { 64 | void *addr; /* address of C++ memory */ 65 | int idtor; /* index of destructor */ 66 | }; 67 | typedef struct s_TRIBOL_SIMPLE_SHROUD_capsule_data TRIBOL_SIMPLE_SHROUD_capsule_data; 68 | 69 | // helper array_context 70 | struct s_TRIBOL_SIMPLE_SHROUD_array { 71 | TRIBOL_SIMPLE_SHROUD_capsule_data cxx; /* address of C++ memory */ 72 | union { 73 | const void * base; 74 | const char * ccharp; 75 | } addr; 76 | int type; /* type of element */ 77 | size_t elem_len; /* bytes-per-item or character len in c++ */ 78 | size_t size; /* size of data in c++ */ 79 | int rank; /* number of dimensions, 0=scalar */ 80 | long shape[7]; 81 | }; 82 | typedef struct s_TRIBOL_SIMPLE_SHROUD_array TRIBOL_SIMPLE_SHROUD_array; 83 | 84 | void TRIBOL_SIMPLE_SHROUD_memory_destructor(TRIBOL_SIMPLE_SHROUD_capsule_data *cap); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif // TYPESTRIBOL_SIMPLE_H 91 | -------------------------------------------------------------------------------- /src/tribol/interface/c_fortran/wrapTestMesh.h: -------------------------------------------------------------------------------- 1 | // wrapTestMesh.h 2 | // This file is generated by Shroud 0.12.1. Do not edit. 3 | 4 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | // other Tribol Project Developers. See the top-level LICENSE file for details. 6 | // 7 | // SPDX-License-Identifier: (MIT) 8 | 9 | /** 10 | * \file wrapTestMesh.h 11 | * \brief Shroud generated wrapper for TestMesh class 12 | */ 13 | // For C users and C++ implementation 14 | 15 | #ifndef WRAPTESTMESH_H 16 | #define WRAPTESTMESH_H 17 | 18 | #include "typesTRIBOL_TEST_MESH.h" 19 | 20 | // splicer begin class.TestMesh.CXX_declarations 21 | // splicer end class.TestMesh.CXX_declarations 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | // splicer begin class.TestMesh.C_declarations 28 | // splicer end class.TestMesh.C_declarations 29 | 30 | TRIBOL_TEST_MESH_TestMesh * TRIBOL_TEST_MESH_TestMesh_new(TRIBOL_TEST_MESH_TestMesh * SHC_rv); 31 | 32 | void TRIBOL_TEST_MESH_TestMesh_delete(TRIBOL_TEST_MESH_TestMesh * self); 33 | 34 | void TRIBOL_TEST_MESH_TestMesh_setup_contact_mesh_hex(TRIBOL_TEST_MESH_TestMesh * self, int numElemsX1, int numElemsY1, int numElemsZ1, double xMin1, double yMin1, double zMin1, double xMax1, double yMax1, double zMax1, int numElemsX2, int numElemsY2, int numElemsZ2, double xMin2, double yMin2, double zMin2, double xMax2, double yMax2, double zMax2, double thetaMortar, double thetaNonmortar); 35 | 36 | double * TRIBOL_TEST_MESH_TestMesh_get_x(const TRIBOL_TEST_MESH_TestMesh * self); 37 | 38 | double * TRIBOL_TEST_MESH_TestMesh_get_x_bufferify(const TRIBOL_TEST_MESH_TestMesh * self, TRIBOL_TEST_MESH_SHROUD_array *DSHC_rv); 39 | 40 | double * TRIBOL_TEST_MESH_TestMesh_get_y(const TRIBOL_TEST_MESH_TestMesh * self); 41 | 42 | double * TRIBOL_TEST_MESH_TestMesh_get_y_bufferify(const TRIBOL_TEST_MESH_TestMesh * self, TRIBOL_TEST_MESH_SHROUD_array *DSHC_rv); 43 | 44 | double * TRIBOL_TEST_MESH_TestMesh_get_z(const TRIBOL_TEST_MESH_TestMesh * self); 45 | 46 | double * TRIBOL_TEST_MESH_TestMesh_get_z_bufferify(const TRIBOL_TEST_MESH_TestMesh * self, TRIBOL_TEST_MESH_SHROUD_array *DSHC_rv); 47 | 48 | int TRIBOL_TEST_MESH_TestMesh_get_mortar_face_connectivity_size(const TRIBOL_TEST_MESH_TestMesh * self); 49 | 50 | int * TRIBOL_TEST_MESH_TestMesh_get_mortar_face_connectivity(const TRIBOL_TEST_MESH_TestMesh * self); 51 | 52 | int * TRIBOL_TEST_MESH_TestMesh_get_mortar_face_connectivity_bufferify(const TRIBOL_TEST_MESH_TestMesh * self, TRIBOL_TEST_MESH_SHROUD_array *DSHC_rv); 53 | 54 | int TRIBOL_TEST_MESH_TestMesh_get_nonmortar_face_connectivity_size(const TRIBOL_TEST_MESH_TestMesh * self); 55 | 56 | int * TRIBOL_TEST_MESH_TestMesh_get_nonmortar_face_connectivity(const TRIBOL_TEST_MESH_TestMesh * self); 57 | 58 | int * TRIBOL_TEST_MESH_TestMesh_get_nonmortar_face_connectivity_bufferify(const TRIBOL_TEST_MESH_TestMesh * self, TRIBOL_TEST_MESH_SHROUD_array *DSHC_rv); 59 | 60 | int TRIBOL_TEST_MESH_TestMesh_get_numtotalnodes(TRIBOL_TEST_MESH_TestMesh * self); 61 | 62 | int TRIBOL_TEST_MESH_TestMesh_get_nummortarfaces(TRIBOL_TEST_MESH_TestMesh * self); 63 | 64 | int TRIBOL_TEST_MESH_TestMesh_get_numnonmortarfaces(TRIBOL_TEST_MESH_TestMesh * self); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif // WRAPTESTMESH_H 71 | -------------------------------------------------------------------------------- /src/tribol/interface/simple_tribol_shroud.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # API for simple tribol interface 3 | # 4 | copyright: 5 | - 6 | - Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 7 | - Produced at the Lawrence Livermore National Laboratory 8 | - SPDX-License-Identifier (MIT) 9 | 10 | library: TRIBOL_SIMPLE 11 | cxx_header: tribol/interface/simple_tribol.hpp 12 | 13 | format: 14 | debug: True 15 | C_prefix: TRIBOL_SIMPLE_ 16 | # Any C++ function which returns a string will be wrapped in 17 | # Fortran as a subroutine with an additional character argument 18 | # for the result. 19 | F_string_result_as_arg: name 20 | F_filename_suffix: F 21 | F_name_generic: {library_lower} 22 | 23 | options: 24 | C_line_length: 1000 25 | F_module_name_library_template: "{library_lower}" 26 | F_name_impl_template: "{library_lower}_{underscore_name}{function_suffix}" 27 | F_name_generic_template: "{library_lower}_{underscore_name}" 28 | 29 | declarations: 30 | - decl: int Initialize(const int dim, bool init_slic = true); 31 | - decl: int Finalize(bool finalize_slic = true); 32 | 33 | - decl: >- 34 | void SimpleCouplingSetup( const int dim, 35 | int cell_type, 36 | int contact_method, 37 | int mortar_numCells, 38 | int mortar_lengthNodalData, 39 | const int* mortar_connectivity +intent(IN)+rank(1), 40 | const double* mortar_x +intent(IN)+rank(1), 41 | const double* mortar_y +intent(IN)+rank(1), 42 | const double* mortar_z +intent(IN)+rank(1), 43 | int nonmortar_numCells, 44 | int nonmortar_lengthNodalData, 45 | const int* nonmortar_connectivity +intent(IN)+rank(1), 46 | const double* nonmortar_x +intent(IN)+rank(1), 47 | const double* nonmortar_y +intent(IN)+rank(1), 48 | const double* nonmortar_z +intent(IN)+rank(1), 49 | const double area_frac, 50 | double* mortar_gaps +intent(IN)+rank(1), 51 | double* mortar_pressures +intent(IN)+rank(1) ) 52 | format: 53 | F_name_generic: "tribol_simple_setup_coupling" 54 | options: 55 | F_name_impl_template: "{library_lower}_setup_coupling{function_suffix}" 56 | - decl: int Update( ) 57 | - decl: >- 58 | int GetSimpleCouplingCSR( int** I +intent(OUT)+dimension(n_offsets), 59 | int** J +intent(OUT)+dimension(n_nonzeros), 60 | double** vals +intent(OUT)+dimension(n_nonzeros), 61 | int* n_offsets +intent(OUT)+hidden, 62 | int* n_nonzeros +intent(OUT)+hidden) 63 | format: 64 | F_name_impl: "tribol_simple_get_coupling_CSR" 65 | -------------------------------------------------------------------------------- /src/tribol/interface/c_fortran/typesTRIBOL_TEST_MESH.h: -------------------------------------------------------------------------------- 1 | // typesTRIBOL_TEST_MESH.h 2 | // This file is generated by Shroud 0.12.1. Do not edit. 3 | 4 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | // other Tribol Project Developers. See the top-level LICENSE file for details. 6 | // 7 | // SPDX-License-Identifier: (MIT) 8 | 9 | // For C users and C++ implementation 10 | 11 | #ifndef TYPESTRIBOL_TEST_MESH_H 12 | #define TYPESTRIBOL_TEST_MESH_H 13 | 14 | #include 15 | 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* helper ShroudTypeDefines */ 22 | /* Shroud type defines */ 23 | #define SH_TYPE_SIGNED_CHAR 1 24 | #define SH_TYPE_SHORT 2 25 | #define SH_TYPE_INT 3 26 | #define SH_TYPE_LONG 4 27 | #define SH_TYPE_LONG_LONG 5 28 | #define SH_TYPE_SIZE_T 6 29 | 30 | #define SH_TYPE_UNSIGNED_SHORT SH_TYPE_SHORT + 100 31 | #define SH_TYPE_UNSIGNED_INT SH_TYPE_INT + 100 32 | #define SH_TYPE_UNSIGNED_LONG SH_TYPE_LONG + 100 33 | #define SH_TYPE_UNSIGNED_LONG_LONG SH_TYPE_LONG_LONG + 100 34 | 35 | #define SH_TYPE_INT8_T 7 36 | #define SH_TYPE_INT16_T 8 37 | #define SH_TYPE_INT32_T 9 38 | #define SH_TYPE_INT64_T 10 39 | 40 | #define SH_TYPE_UINT8_T SH_TYPE_INT8_T + 100 41 | #define SH_TYPE_UINT16_T SH_TYPE_INT16_T + 100 42 | #define SH_TYPE_UINT32_T SH_TYPE_INT32_T + 100 43 | #define SH_TYPE_UINT64_T SH_TYPE_INT64_T + 100 44 | 45 | /* least8 least16 least32 least64 */ 46 | /* fast8 fast16 fast32 fast64 */ 47 | /* intmax_t intptr_t ptrdiff_t */ 48 | 49 | #define SH_TYPE_FLOAT 22 50 | #define SH_TYPE_DOUBLE 23 51 | #define SH_TYPE_LONG_DOUBLE 24 52 | #define SH_TYPE_FLOAT_COMPLEX 25 53 | #define SH_TYPE_DOUBLE_COMPLEX 26 54 | #define SH_TYPE_LONG_DOUBLE_COMPLEX 27 55 | 56 | #define SH_TYPE_BOOL 28 57 | #define SH_TYPE_CHAR 29 58 | #define SH_TYPE_CPTR 30 59 | #define SH_TYPE_STRUCT 31 60 | #define SH_TYPE_OTHER 32 61 | 62 | // helper capsule_data_helper 63 | struct s_TRIBOL_TEST_MESH_SHROUD_capsule_data { 64 | void *addr; /* address of C++ memory */ 65 | int idtor; /* index of destructor */ 66 | }; 67 | typedef struct s_TRIBOL_TEST_MESH_SHROUD_capsule_data TRIBOL_TEST_MESH_SHROUD_capsule_data; 68 | 69 | // helper array_context 70 | struct s_TRIBOL_TEST_MESH_SHROUD_array { 71 | TRIBOL_TEST_MESH_SHROUD_capsule_data cxx; /* address of C++ memory */ 72 | union { 73 | const void * base; 74 | const char * ccharp; 75 | } addr; 76 | int type; /* type of element */ 77 | size_t elem_len; /* bytes-per-item or character len in c++ */ 78 | size_t size; /* size of data in c++ */ 79 | int rank; /* number of dimensions, 0=scalar */ 80 | long shape[7]; 81 | }; 82 | typedef struct s_TRIBOL_TEST_MESH_SHROUD_array TRIBOL_TEST_MESH_SHROUD_array; 83 | 84 | // helper capsule_TRIBOL_TEST_MESH_TestMesh 85 | struct s_TRIBOL_TEST_MESH_TestMesh { 86 | void *addr; /* address of C++ memory */ 87 | int idtor; /* index of destructor */ 88 | }; 89 | typedef struct s_TRIBOL_TEST_MESH_TestMesh TRIBOL_TEST_MESH_TestMesh; 90 | 91 | void TRIBOL_TEST_MESH_SHROUD_memory_destructor(TRIBOL_TEST_MESH_SHROUD_capsule_data *cap); 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif // TYPESTRIBOL_TEST_MESH_H 98 | -------------------------------------------------------------------------------- /scripts/check_log.py: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "exec" "python3" "-u" "-B" "$0" "$@" 3 | 4 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 5 | 6 | import argparse 7 | import os 8 | import re 9 | import sys 10 | 11 | def parse_args(): 12 | parser = argparse.ArgumentParser(description="Checks log for warnings and errors") 13 | 14 | parser.add_argument("-l", "--log", type=str, required=True, help="Path to log file to be checked") 15 | parser.add_argument("-i", "--ignore", type=str, required=False, help="Path to file that includes regex's to ignore lines") 16 | 17 | args = parser.parse_args() 18 | 19 | print("~~~~~~~ Given Command line Arguments ~~~~~~~") 20 | print("Ignore file Path: {0}".format(args.ignore)) 21 | print("Log Path: {0}".format(args.log)) 22 | print("") 23 | 24 | return args 25 | 26 | 27 | def main(): 28 | args = parse_args() 29 | 30 | # read lines from log 31 | with open(args.log, "r") as f: 32 | log_lines = f.readlines() 33 | 34 | # read ignore regex's 35 | ignore_regexs = [] 36 | if args.ignore: 37 | with open(args.ignore, "r") as f: 38 | # Only save lines that aren't comments ("#") 39 | for currline in f.readlines(): 40 | stripped = currline.strip() 41 | if stripped != "" and not stripped.startswith("#"): 42 | # Add regex w/o trailing newline characters 43 | ignore_regexs.append(currline.rstrip()) 44 | 45 | # Get warnings/errors out of log file and print ignored as you find them 46 | # with what regex matched 47 | warnings = [] 48 | errors = [] 49 | ignored_count = 0 50 | print("~~~~~~~~~~~~~~~ Ignored ~~~~~~~~~~~~~~~~") 51 | for log_line in log_lines: 52 | # First, check if it is a warning/error 53 | lowered = log_line.lower() 54 | has_warning = "warning:" in lowered 55 | has_error = "error:" in lowered 56 | 57 | # Then, check if it matches any ignore regex's 58 | matches_ignore = False 59 | if has_error or has_warning: 60 | for ignore_regex in ignore_regexs: 61 | if re.search(ignore_regex, log_line.rstrip()): 62 | print("line : {0}".format(log_line.rstrip())) 63 | print("regex: {0}\n".format(ignore_regex)) 64 | matches_ignore = True 65 | ignored_count += 1 66 | break 67 | 68 | if not matches_ignore: 69 | if has_error: 70 | errors.append(log_line) 71 | elif has_warning: 72 | warnings.append(log_line) 73 | 74 | # Print warnings/errors that are found 75 | print("~~~~~~~~~~~~~~~ Warnings ~~~~~~~~~~~~~~~") 76 | for warning in warnings: 77 | print(warning) 78 | print("") 79 | 80 | print("~~~~~~~~~~~~~~~ Errors ~~~~~~~~~~~~~~~~~") 81 | for error in errors: 82 | print(error) 83 | print("") 84 | 85 | # Print summary info 86 | print("~~~~~~~~~~~~~~~~~ Summary ~~~~~~~~~~~~~~~~~~") 87 | print("Warning Count: {0}".format(len(warnings))) 88 | print("Error Count: {0}".format(len(errors))) 89 | print("Ignored Count: {0}".format(ignored_count)) 90 | 91 | # Error out if any found 92 | return len(warnings) + len(errors) 93 | 94 | if __name__ == "__main__": 95 | sys.exit(main()) 96 | -------------------------------------------------------------------------------- /src/tribol/geom/ElementNormal.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_GEOM_ELEMENTNORMAL_HPP_ 7 | #define SRC_GEOM_ELEMENTNORMAL_HPP_ 8 | 9 | #include "tribol/common/BasicTypes.hpp" 10 | 11 | namespace tribol { 12 | 13 | /** 14 | * @brief Virtual base class to define the interface for element normal calculations 15 | */ 16 | class ElementNormal { 17 | public: 18 | /** 19 | * @brief Destructor 20 | */ 21 | TRIBOL_HOST_DEVICE virtual ~ElementNormal() {} 22 | 23 | /** 24 | * @brief Interface for computing an element normal in derived classes 25 | * 26 | * @param [in] x Nodal coordinates for the element (stored by nodes, i.e. [x0, x1, x2, y0, y1, y2, z0, z1, z2]) 27 | * @param [in] c Centroid for the element (length = spatial dimension) 28 | * @param [out] n Unit vector in the normal direction (length = spatial dimension) 29 | * @param [in] num_nodes Number of nodes in the element 30 | * @param [out] area Area of the element 31 | * @return Is face data OK? true = yes; false = no 32 | */ 33 | TRIBOL_HOST_DEVICE virtual bool Compute( const RealT* x, const RealT* c, RealT* n, int num_nodes, 34 | RealT& area ) const = 0; 35 | }; 36 | 37 | /** 38 | * @brief Computes element normal as the average of normal directions of triangular pallets fanned from the element 39 | * centroid. This approach applies to arbitrary polygonal elements. 40 | */ 41 | class PalletAvgNormal : public ElementNormal { 42 | public: 43 | /** 44 | * @brief Computes element normal as the average of normal directions of triangular pallets fanned from the element 45 | * centroid 46 | * 47 | * @param [in] x Nodal coordinates for the element (stored by nodes, i.e. [x0, x1, x2, y0, y1, y2, z0, z1, z2]) 48 | * @param [in] c Centroid for the element (length = spatial dimension) 49 | * @param [out] n Unit vector in the normal direction (length = spatial dimension) 50 | * @param [in] num_nodes Number of nodes in the element 51 | * @param [out] area Area of the element 52 | * @return Is face data OK? true = yes; false = no 53 | */ 54 | TRIBOL_HOST_DEVICE bool Compute( const RealT* x, const RealT* c, RealT* n, int num_nodes, 55 | RealT& area ) const override; 56 | }; 57 | 58 | /** 59 | * @brief Computes element normal at the origin of the isoparametric element (triangle or quadrilateral) 60 | */ 61 | class ElementCentroidNormal : public ElementNormal { 62 | public: 63 | /** 64 | * @brief Computes element normal at the origin of the isoparametric element 65 | * 66 | * @param [in] x Nodal coordinates for the element (stored by nodes, i.e. [x0, x1, x2, y0, y1, y2, z0, z1, z2]) 67 | * @param [in] c Centroid for the element (length = spatial dimension) 68 | * @param [out] n Unit vector in the normal direction (length = spatial dimension) 69 | * @param [in] num_nodes Number of nodes in the element (either 3 or 4) 70 | * @param [out] area Area of the element 71 | * @return Is face data OK? true = yes; false = no 72 | */ 73 | TRIBOL_HOST_DEVICE bool Compute( const RealT* x, const RealT* c, RealT* n, int num_nodes, 74 | RealT& area ) const override; 75 | }; 76 | 77 | } // namespace tribol 78 | 79 | #endif /* SRC_GEOM_ELEMENTNORMAL_HPP_ */ 80 | -------------------------------------------------------------------------------- /data/mortar_sphere/ixm.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | 18 4 | 15 5 | 3 6 | 6 7 | 21 8 | 18 9 | 6 10 | 9 11 | 24 12 | 21 13 | 9 14 | 12 15 | 27 16 | 24 17 | 15 18 | 18 19 | 33 20 | 30 21 | 18 22 | 21 23 | 36 24 | 33 25 | 21 26 | 24 27 | 39 28 | 36 29 | 24 30 | 27 31 | 42 32 | 39 33 | 30 34 | 33 35 | 48 36 | 45 37 | 33 38 | 36 39 | 51 40 | 48 41 | 36 42 | 39 43 | 54 44 | 51 45 | 39 46 | 42 47 | 57 48 | 54 49 | 45 50 | 48 51 | 63 52 | 60 53 | 48 54 | 51 55 | 66 56 | 63 57 | 51 58 | 54 59 | 69 60 | 66 61 | 54 62 | 57 63 | 72 64 | 69 65 | 75 66 | 87 67 | 88 68 | 76 69 | 76 70 | 88 71 | 89 72 | 77 73 | 77 74 | 89 75 | 90 76 | 78 77 | 12 78 | 78 79 | 90 80 | 27 81 | 87 82 | 99 83 | 100 84 | 88 85 | 88 86 | 100 87 | 101 88 | 89 89 | 89 90 | 101 91 | 102 92 | 90 93 | 27 94 | 90 95 | 102 96 | 42 97 | 99 98 | 111 99 | 112 100 | 100 101 | 100 102 | 112 103 | 113 104 | 101 105 | 101 106 | 113 107 | 114 108 | 102 109 | 42 110 | 102 111 | 114 112 | 57 113 | 111 114 | 123 115 | 124 116 | 112 117 | 112 118 | 124 119 | 125 120 | 113 121 | 113 122 | 125 123 | 126 124 | 114 125 | 57 126 | 114 127 | 126 128 | 72 129 | 135 130 | 136 131 | 140 132 | 139 133 | 136 134 | 137 135 | 141 136 | 140 137 | 137 138 | 138 139 | 142 140 | 141 141 | 60 142 | 63 143 | 142 144 | 138 145 | 139 146 | 140 147 | 144 148 | 143 149 | 140 150 | 141 151 | 145 152 | 144 153 | 141 154 | 142 155 | 146 156 | 145 157 | 63 158 | 66 159 | 146 160 | 142 161 | 143 162 | 144 163 | 148 164 | 147 165 | 144 166 | 145 167 | 149 168 | 148 169 | 145 170 | 146 171 | 150 172 | 149 173 | 66 174 | 69 175 | 150 176 | 146 177 | 123 178 | 147 179 | 148 180 | 124 181 | 124 182 | 148 183 | 149 184 | 125 185 | 125 186 | 149 187 | 150 188 | 126 189 | 69 190 | 72 191 | 126 192 | 150 193 | -------------------------------------------------------------------------------- /data/mortar_sphere_offset/ixs.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 3 3 | 18 4 | 15 5 | 3 6 | 6 7 | 21 8 | 18 9 | 6 10 | 9 11 | 24 12 | 21 13 | 9 14 | 12 15 | 27 16 | 24 17 | 15 18 | 18 19 | 33 20 | 30 21 | 18 22 | 21 23 | 36 24 | 33 25 | 21 26 | 24 27 | 39 28 | 36 29 | 24 30 | 27 31 | 42 32 | 39 33 | 30 34 | 33 35 | 48 36 | 45 37 | 33 38 | 36 39 | 51 40 | 48 41 | 36 42 | 39 43 | 54 44 | 51 45 | 39 46 | 42 47 | 57 48 | 54 49 | 45 50 | 48 51 | 63 52 | 60 53 | 48 54 | 51 55 | 66 56 | 63 57 | 51 58 | 54 59 | 69 60 | 66 61 | 54 62 | 57 63 | 72 64 | 69 65 | 75 66 | 87 67 | 88 68 | 76 69 | 76 70 | 88 71 | 89 72 | 77 73 | 77 74 | 89 75 | 90 76 | 78 77 | 12 78 | 78 79 | 90 80 | 27 81 | 87 82 | 99 83 | 100 84 | 88 85 | 88 86 | 100 87 | 101 88 | 89 89 | 89 90 | 101 91 | 102 92 | 90 93 | 27 94 | 90 95 | 102 96 | 42 97 | 99 98 | 111 99 | 112 100 | 100 101 | 100 102 | 112 103 | 113 104 | 101 105 | 101 106 | 113 107 | 114 108 | 102 109 | 42 110 | 102 111 | 114 112 | 57 113 | 111 114 | 123 115 | 124 116 | 112 117 | 112 118 | 124 119 | 125 120 | 113 121 | 113 122 | 125 123 | 126 124 | 114 125 | 57 126 | 114 127 | 126 128 | 72 129 | 135 130 | 136 131 | 140 132 | 139 133 | 136 134 | 137 135 | 141 136 | 140 137 | 137 138 | 138 139 | 142 140 | 141 141 | 60 142 | 63 143 | 142 144 | 138 145 | 139 146 | 140 147 | 144 148 | 143 149 | 140 150 | 141 151 | 145 152 | 144 153 | 141 154 | 142 155 | 146 156 | 145 157 | 63 158 | 66 159 | 146 160 | 142 161 | 143 162 | 144 163 | 148 164 | 147 165 | 144 166 | 145 167 | 149 168 | 148 169 | 145 170 | 146 171 | 150 172 | 149 173 | 66 174 | 69 175 | 150 176 | 146 177 | 123 178 | 147 179 | 148 180 | 124 181 | 124 182 | 148 183 | 149 184 | 125 185 | 125 186 | 149 187 | 150 188 | 126 189 | 69 190 | 72 191 | 126 192 | 150 193 | -------------------------------------------------------------------------------- /scripts/check_for_missing_headers.py: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "exec" "python3" "-u" "-B" "$0" "$@" 3 | 4 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC. 5 | 6 | """ 7 | file: check_for_missing_headers.py 8 | 9 | description: 10 | This script takes a Tribol install and source directory and checks to see 11 | if install includes the same header files. 12 | 13 | """ 14 | 15 | import os 16 | import sys 17 | import argparse 18 | 19 | def parse_arguments(): 20 | parser = argparse.ArgumentParser() 21 | parser.add_argument("-i", 22 | "--install-dir", 23 | default="", 24 | dest="install_dir", 25 | help="specify path of the install directory.") 26 | parser.add_argument("-s", 27 | "--src-dir", 28 | default="", 29 | dest="src_dir", 30 | help="specify path of the src directory.") 31 | return parser.parse_known_args() 32 | 33 | # return list of relative paths to header files 34 | def get_headers_from(dir): 35 | headers = [] 36 | for (dirpath, dirnames, filenames) in os.walk(dir, topdown=True): 37 | # skip tests directories 38 | if "tests" in dirnames: 39 | dirnames.remove("tests") 40 | for f in filenames: 41 | if ".hpp" in f and ".in" not in f: 42 | relative_header_path = dirpath.replace(dir + "/", "") 43 | headers.append({"path": relative_header_path, "headerfile": f}) 44 | return headers 45 | 46 | def main(): 47 | args, unknown_args = parse_arguments() 48 | 49 | # ensure args are valid 50 | install_dir = args.install_dir 51 | if not os.path.isdir(install_dir): 52 | print("Error: install_dir is not a directory or does not exist: {}".format(install_dir)) 53 | return 1 54 | install_dir = os.path.abspath(install_dir) 55 | 56 | src_dir = args.src_dir 57 | if not os.path.isdir(src_dir): 58 | print("Error: src_dir is not a directory or does not exist: {}".format(src_dir)) 59 | return 1 60 | src_dir = os.path.abspath(src_dir) 61 | 62 | print("============================================================") 63 | print("check_for_missing_headers.py args") 64 | print("install_dir: {0}".format(install_dir)) 65 | print("src_dir: {0}".format(src_dir)) 66 | print("============================================================") 67 | 68 | # grab headers from install and src 69 | install_headers = get_headers_from(os.path.join(install_dir, "include", "tribol")) 70 | src_headers = get_headers_from(os.path.join(src_dir, "tribol")) 71 | 72 | # check if each header in src is in install as well 73 | res = 0 74 | for sh in src_headers: 75 | found = False 76 | for ih in install_headers: 77 | src_relative_header = "{0}/{1}".format(sh["path"], sh["headerfile"]) 78 | install_relative_header = "{0}/{1}".format(ih["path"], ih["headerfile"]) 79 | if src_relative_header == install_relative_header: 80 | found = True 81 | break 82 | if not found: 83 | cmakelists_path = os.path.join(src_dir, sh["path"], "CMakeLists.txt") 84 | print("Header '{0}' is missing; it should probably be listed in {1}".format(sh["headerfile"], cmakelists_path)) 85 | res = 1 86 | 87 | if res == 0: 88 | print("No missing headers found.") 89 | 90 | return res 91 | 92 | if __name__ == "__main__": 93 | sys.exit(main()) 94 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 30 | * Other conduct which could reasonably be considered inappropriate in a professional setting 31 | 32 | ## Our Responsibilities 33 | 34 | Project maintainers are responsible for clarifying the standards of acceptable 35 | behavior and are expected to take appropriate and fair corrective action in 36 | response to any instances of unacceptable behavior. 37 | 38 | Project maintainers have the right and responsibility to remove, edit, or 39 | reject comments, commits, code, wiki edits, issues, and other contributions 40 | that are not aligned to this Code of Conduct, or to ban temporarily or 41 | permanently any contributor for other behaviors that they deem inappropriate, 42 | threatening, offensive, or harmful. 43 | 44 | ## Scope 45 | 46 | This Code of Conduct applies both within project spaces and in public spaces 47 | when an individual is representing the project or its community. Examples of 48 | representing a project or community include using an official project e-mail 49 | address, posting via an official social media account, or acting as an appointed 50 | representative at an online or offline event. Representation of a project may be 51 | further defined and clarified by project maintainers. 52 | 53 | ## Enforcement 54 | 55 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 56 | reported by contacting the project team. All 57 | complaints will be reviewed and investigated and will result in a response that 58 | is deemed necessary and appropriate to the circumstances. The project team is 59 | obligated to maintain confidentiality with regard to the reporter of an incident. 60 | Further details of specific enforcement policies may be posted separately. 61 | 62 | Project maintainers who do not follow or enforce the Code of Conduct in good 63 | faith may face temporary or permanent repercussions as determined by other 64 | members of the project's leadership. 65 | 66 | ## Attribution 67 | 68 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 69 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 70 | 71 | [homepage]: https://www.contributor-covenant.org 72 | 73 | For answers to common questions about this code of conduct, see 74 | https://www.contributor-covenant.org/faq 75 | -------------------------------------------------------------------------------- /scripts/llnl/build_tpls.py: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | "exec" "python3" "-u" "-B" "$0" "$@" 3 | 4 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 5 | # other Tribol Project Developers. See the top-level LICENSE file for details. 6 | # 7 | # SPDX-License-Identifier: (MIT) 8 | 9 | """ 10 | file: build_tpls.py 11 | 12 | description: 13 | uses uberenv to install tpls for the set of compilers we want 14 | for current machine. 15 | 16 | """ 17 | 18 | from common_build_functions import * 19 | 20 | from argparse import ArgumentParser 21 | 22 | import os 23 | 24 | 25 | def parse_args(): 26 | "Parses args from command line" 27 | parser = ArgumentParser() 28 | # Directory to do all the building 29 | parser.add_argument("-d", "--directory", 30 | dest="directory", 31 | default="", 32 | help="Location to build all TPL's, sys_type/timestamp directory will be created (Defaults to shared location)") 33 | parser.add_argument("--short-path", 34 | action="store_true", 35 | dest="short_path", 36 | default=False, 37 | help="Does not add sys_type or timestamp to tpl directory (useful for CI).") 38 | # Spack spec to use for the build 39 | parser.add_argument("-s", "--spec", 40 | dest="spec", 41 | nargs="+", 42 | default="", 43 | help="Spack spec to build (defaults to all available on SYS_TYPE)") 44 | parser.add_argument("-v", "--verbose", 45 | action="store_true", 46 | dest="verbose", 47 | default=False, 48 | help="Output logs to screen as well as to files") 49 | parser.add_argument("-m", "--mirror", 50 | dest="mirror", 51 | default="", 52 | help="Mirror location to use (defaults to shared location)") 53 | parser.add_argument("-j", "--jobs", 54 | dest="jobs", 55 | default="", 56 | help="Allow N jobs at once for any `make` commands (empty string means max system amount)") 57 | 58 | ############### 59 | # parse args 60 | ############### 61 | args, _ = parser.parse_known_args() 62 | # we want a dict b/c the values could 63 | # be passed without using argparse 64 | args = vars(args) 65 | return args 66 | 67 | 68 | def main(): 69 | args = parse_args() 70 | 71 | # Handle case where spec is a List (i.e. spec contained spaces and wasn't wrapped in quotes) 72 | spec = args["spec"] 73 | if len(spec) > 0: 74 | spec = " ".join(spec) 75 | 76 | # Determine location to do all the building 77 | if args["directory"] != "": 78 | builds_dir = args["directory"] 79 | if not os.path.exists(builds_dir): 80 | os.makedirs(builds_dir) 81 | else: 82 | builds_dir = get_shared_libs_dir() 83 | builds_dir = os.path.abspath(builds_dir) 84 | 85 | repo_dir = get_repo_dir() 86 | 87 | try: 88 | original_wd = os.getcwd() 89 | os.chdir(repo_dir) 90 | 91 | timestamp = get_timestamp() 92 | res = full_build_and_test_of_tpls(builds_dir, timestamp, spec, args["verbose"], args["short_path"], args["mirror"], args["jobs"]) 93 | finally: 94 | os.chdir(original_wd) 95 | 96 | return res 97 | 98 | 99 | if __name__ == "__main__": 100 | sys.exit(main()) 101 | -------------------------------------------------------------------------------- /src/tribol/interface/simple_tribol.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SIMPLE_TRIBOL_HPP_ 7 | #define SIMPLE_TRIBOL_HPP_ 8 | 9 | #include "tribol/common/Parameters.hpp" 10 | 11 | #include 12 | 13 | //------------------------------------------------------------------------------ 14 | // free functions for simple API usage 15 | //------------------------------------------------------------------------------ 16 | /// \name Contact Library simple API methods 17 | /// @{ 18 | 19 | /*! 20 | * \brief Initializes tribol and optionally initializes slic (logging library) 21 | * 22 | * \param [in] init_slic indicates if we should initialize slic 23 | * \return 0 if no error has occurred 24 | * 25 | */ 26 | int Initialize( bool init_slic = true ); 27 | 28 | /*! 29 | * \brief Finalizes tribol and optionally finalizes slic (logging library) 30 | * 31 | * \param [in] finalize_slic indicates if we should finalize slic 32 | * \return 0 if no error has occurred 33 | * 34 | */ 35 | int Finalize( bool finalize_slic = true ); 36 | 37 | /*! 38 | * \brief Simple coupling setup 39 | * 40 | * \param [in] dim dimension of problem 41 | * \param [in] cell_type type of contact surface cell 42 | * \param [in] contact_method method name 43 | * \param [in] mortar_numCells the number of mortar surface cells 44 | * \param [in] mortar_lengthNodalData the length of the mortar nodal data arrays 45 | * \param [in] mortar_connectivity connectivity array for mortar side 46 | * \param [in] mortar_x x-coordinates of mortar nodes 47 | * \param [in] mortar_y y-coordinates of mortar nodes 48 | * \param [in] mortar_z z-coordinates of mortar nodes 49 | * \param [in] nonmortar_numCells the number of nonmortar surface cells 50 | * \param [in] nonmortar_lengthNodalData the length of the nonmortar nodal data arrays 51 | * \param [in] nonmortar_connectivity connectivity array for nonmortar side 52 | * \param [in] nonmortar_x x-coordinates of nonmortar nodes 53 | * \param [in] nonmortar_y y-coordinates of nonmortar nodes 54 | * \param [in] nonmortar_z z-coordinates of nonmortar nodes 55 | * \param [in] area_frac (optional) area fraction for overlap inclusion. Default value: 1.e-3 56 | * \param [in] mortar_gaps (optional) pointer to nodal mortar gap scalar field 57 | * \param [in] mortar_pressures (optional) pointer to nodal mortar pressures scalar field 58 | */ 59 | void SimpleCouplingSetup( const int dim, int cell_type, int contact_method, int mortar_numCells, 60 | int mortar_lengthNodalData, const tribol::IndexT* mortar_connectivity, const double* mortar_x, 61 | const double* mortar_y, const double* mortar_z, int nonmortar_numCells, 62 | int nonmortar_lengthNodalData, const tribol::IndexT* nonmortar_connectivity, 63 | const double* nonmortar_x, const double* nonmortar_y, const double* nonmortar_z, 64 | const double area_frac = 1.e-3, double* mortar_gaps = nullptr, 65 | double* mortar_pressures = nullptr ); 66 | 67 | /*! 68 | * \brief Update per registered contact method 69 | * 70 | * \params [in,out] dt timestep 71 | * 72 | * \return 0 if no error has occurred and any update to timestep 73 | * 74 | */ 75 | int Update( double& dt ); 76 | 77 | /*! 78 | * \brief Gets the CSR data from the coupling scheme 79 | * 80 | * \param [out] I offsets for nonzero values array 81 | * \param [out] J column index array 82 | * \param [out] vals array of nonzero values 83 | * \param [out] n_offsets size of the I array 84 | * \param [out] n_nonzero size of the J and vals arrays 85 | * 86 | * \return 0 for success, 1 for failure 87 | * 88 | */ 89 | int GetSimpleCouplingCSR( int** I, int** J, double** vals, int* n_offsets, int* n_nonzeros ); 90 | 91 | /// @} 92 | 93 | #endif /* SIMPLE_TRIBOL_HPP_ */ 94 | -------------------------------------------------------------------------------- /src/redecomp/RedecompTransfer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_REDECOMP_REDECOMPTRANSFER_HPP_ 7 | #define SRC_REDECOMP_REDECOMPTRANSFER_HPP_ 8 | 9 | #include "mfem.hpp" 10 | 11 | #include "redecomp/transfer/GridFnTransfer.hpp" 12 | 13 | namespace redecomp { 14 | 15 | /** 16 | * @brief Transfer GridFunctions and QuadratureFunctions to/from Redecomp 17 | * 18 | * Maps Redecomp-based mfem::GridFunctions and mfem::QuadratureFunctions to and 19 | * from a parent mfem::ParGridFunction. 20 | */ 21 | class RedecompTransfer { 22 | public: 23 | /** 24 | * @brief Construct a new RedecompTransfer object 25 | * 26 | * @param gf_transfer A pointer to a custom GridFnTransfer object 27 | */ 28 | RedecompTransfer( std::unique_ptr gf_transfer ); 29 | 30 | /** 31 | * @brief Construct a new RedecompTransfer object with nodal GridFunction 32 | * transfer 33 | * 34 | * @note Nodal GridFunction transfer may be appropriate for repeated transfers 35 | * of H1 fields. Otherwise, the default constructor is usually sufficient. See 36 | * TransferByNodes.hpp for more details. 37 | * 38 | * @param parent_fes A ParFiniteElementSpace built on parent 39 | * @param redecomp_fes A FiniteElementSpace built on a RedecompMesh 40 | */ 41 | RedecompTransfer( const mfem::ParFiniteElementSpace& parent_fes, const mfem::FiniteElementSpace& redecomp_fes ); 42 | 43 | /** 44 | * @brief Construct a new RedecompTransfer object with element GridFunction transfer 45 | */ 46 | RedecompTransfer(); 47 | 48 | /** 49 | * @brief Copies parent-based mfem::ParGridFunction values to a 50 | * RedecompMesh-based mfem::GridFunction 51 | * 52 | * @param src A parent ParGridFunction to be copied to corresponding redecomp 53 | * GridFunction (dst) 54 | * @param dst A redecomp GridFunction which receives values from a parent 55 | * ParGridFunction (src) 56 | */ 57 | void TransferToSerial( const mfem::ParGridFunction& src, mfem::GridFunction& dst ) const; 58 | 59 | /** 60 | * @brief Copies RedecompMesh-based mfem::GridFunction values to a 61 | * parent-based mfem::ParGridFunction 62 | * 63 | * @param src A redecomp GridFunction to be copied to corresponding parent 64 | * ParGridFunction (dst) 65 | * @param dst A parent ParGridFunction which receives values from a redecomp 66 | * GridFunction (src) 67 | */ 68 | void TransferToParallel( const mfem::GridFunction& src, mfem::ParGridFunction& dst ) const; 69 | 70 | /** 71 | * @brief Copies parent-based mfem::QuadratureFunction values to a 72 | * RedecompMesh-based mfem::QuadratureFunction 73 | * 74 | * @param src A parent QuadratureFunction to be copied to corresponding 75 | * redecomp QuadratureFunction (dst) 76 | * @param dst A redecomp QuadratureFunction which receives values from a 77 | * parent QuadratureFunction (src) 78 | */ 79 | void TransferToSerial( const mfem::QuadratureFunction& src, mfem::QuadratureFunction& dst ) const; 80 | 81 | /** 82 | * @brief Copies RedecompMesh-based mfem::QuadratureFunction values to a 83 | * parent-based mfem::QuadratureFunction 84 | * 85 | * @param src A redecomp QuadratureFunction to be copied to corresponding 86 | * parent QuadratureFunction (dst) 87 | * @param dst A parent QuadratureFunction which receives values from a 88 | * redecomp GridFunction (src) 89 | */ 90 | void TransferToParallel( const mfem::QuadratureFunction& src, mfem::QuadratureFunction& dst ) const; 91 | 92 | private: 93 | /** 94 | * @brief Grid function transfer object 95 | */ 96 | std::unique_ptr gf_transfer_; 97 | }; 98 | 99 | } // end namespace redecomp 100 | 101 | #endif /* SRC_REDECOMP_REDECOMPTRANSFER_HPP_ */ 102 | -------------------------------------------------------------------------------- /src/tribol/common/ExecModel.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_COMMON_EXECMODEL_HPP_ 7 | #define SRC_COMMON_EXECMODEL_HPP_ 8 | 9 | // Tribol includes 10 | #include "tribol/common/BasicTypes.hpp" 11 | 12 | // Axom includes 13 | #include "axom/core/memory_management.hpp" 14 | #include "axom/slic.hpp" 15 | 16 | namespace tribol { 17 | 18 | /** 19 | * @brief A MemorySpace ties a resource to an associated pointer 20 | */ 21 | enum class MemorySpace 22 | { 23 | // Dynamic can be used for pointers whose resource is defined not using this 24 | // enum. 25 | Dynamic, 26 | Host, 27 | #ifdef TRIBOL_USE_UMPIRE 28 | Device, 29 | Unified 30 | #endif 31 | }; 32 | 33 | /** 34 | * @brief An ExecutionMode defines what resource should be used to do loop 35 | * computations 36 | */ 37 | enum class ExecutionMode 38 | { 39 | Sequential, 40 | #ifdef TRIBOL_USE_OPENMP 41 | OpenMP, 42 | #endif 43 | #ifdef TRIBOL_USE_CUDA 44 | Cuda, 45 | #endif 46 | #ifdef TRIBOL_USE_HIP 47 | Hip, 48 | #endif 49 | // Dynamic is used to determine the ExecutionMode on the fly. 50 | Dynamic 51 | }; 52 | 53 | /** 54 | * @brief SFINAE struct to deduce axom memory space from a Tribol memory space 55 | * at compile time 56 | * 57 | * @tparam MSPACE 58 | */ 59 | template 60 | struct toAxomMemorySpace { 61 | static constexpr axom::MemorySpace value = axom::MemorySpace::Dynamic; 62 | }; 63 | 64 | #ifdef TRIBOL_USE_UMPIRE 65 | 66 | template <> 67 | struct toAxomMemorySpace { 68 | static constexpr axom::MemorySpace value = axom::MemorySpace::Host; 69 | }; 70 | 71 | template <> 72 | struct toAxomMemorySpace { 73 | static constexpr axom::MemorySpace value = axom::MemorySpace::Device; 74 | }; 75 | 76 | template <> 77 | struct toAxomMemorySpace { 78 | static constexpr axom::MemorySpace value = axom::MemorySpace::Unified; 79 | }; 80 | 81 | #endif 82 | 83 | // Waiting for C++ 17... 84 | // template 85 | // inline constexpr axom::MemorySpace axomMemorySpaceV = toAxomMemorySpace::value; 86 | 87 | #ifdef TRIBOL_USE_UMPIRE 88 | 89 | inline umpire::resource::MemoryResourceType toUmpireMemoryType( MemorySpace mem_space ) 90 | { 91 | switch ( mem_space ) { 92 | case MemorySpace::Host: 93 | return umpire::resource::MemoryResourceType::Host; 94 | case MemorySpace::Device: 95 | return umpire::resource::MemoryResourceType::Device; 96 | case MemorySpace::Unified: 97 | return umpire::resource::MemoryResourceType::Unified; 98 | default: 99 | return umpire::resource::MemoryResourceType::Unknown; 100 | } 101 | }; 102 | 103 | #endif 104 | 105 | inline int getResourceAllocatorID( MemorySpace mem_space ) 106 | { 107 | int allocator_id = axom::getDefaultAllocatorID(); 108 | #ifdef TRIBOL_USE_UMPIRE 109 | if ( mem_space != MemorySpace::Dynamic ) { 110 | allocator_id = axom::getUmpireResourceAllocatorID( toUmpireMemoryType( mem_space ) ); 111 | } 112 | #else 113 | TRIBOL_UNUSED_VAR( mem_space ); 114 | #endif 115 | return allocator_id; 116 | } 117 | 118 | inline bool isOnDevice( ExecutionMode exec ) 119 | { 120 | switch ( exec ) { 121 | #if defined( TRIBOL_USE_CUDA ) 122 | case ExecutionMode::Cuda: 123 | return true; 124 | #elif defined( TRIBOL_USE_HIP ) 125 | case ExecutionMode::Hip: 126 | return true; 127 | #endif 128 | #ifdef TRIBOL_USE_OPENMP 129 | case ExecutionMode::OpenMP: 130 | return false; 131 | #endif 132 | case ExecutionMode::Dynamic: 133 | SLIC_ERROR_ROOT( "Dynamic execution mode does not define a memory space location." ); 134 | return false; 135 | case ExecutionMode::Sequential: 136 | return false; 137 | default: 138 | SLIC_ERROR_ROOT( "Unknown execution mode." ); 139 | return false; 140 | } 141 | } 142 | 143 | } // namespace tribol 144 | 145 | #endif /* SRC_COMMON_EXECMODEL_HPP_ */ 146 | -------------------------------------------------------------------------------- /src/tribol/physics/AlignedMortar.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_PHYSICS_ALIGNEDMORTAR_HPP_ 7 | #define SRC_PHYSICS_ALIGNEDMORTAR_HPP_ 8 | 9 | #include "Mortar.hpp" 10 | #include "Physics.hpp" 11 | 12 | namespace tribol { 13 | 14 | // forward declarations 15 | struct SurfaceContactElem; 16 | 17 | /*! 18 | * 19 | * \brief compute all aligned mortar nonmortar gaps 20 | * 21 | * \param [in] cs pointer to coupling scheme 22 | * 23 | * 24 | */ 25 | void ComputeAlignedMortarGaps( CouplingScheme* cs ); 26 | 27 | /*! 28 | * 29 | * \brief computes the integral of (phi_a * phi_b) over a contact 30 | * overlap for all (a,b) combinations. 31 | * 32 | * \note the mortar weights are stored on the SurfaceContactElem object 33 | * 34 | * \param [in] elem surface contact element object for contact face-pair 35 | * 36 | * \note this is a specialized case for aligned faces using Gauss 37 | * quadrature on a four node quad. 38 | * 39 | */ 40 | void ComputeAlignedMortarWeights( SurfaceContactElem& elem ); 41 | 42 | /*! 43 | * 44 | * \brief compute a contact element's contribution to nodal gaps 45 | * 46 | * \param [in] cs pointer to the coupling scheme 47 | * 48 | */ 49 | template 50 | void ComputeNodalGap( SurfaceContactElem& elem ); 51 | 52 | /*! 53 | * 54 | * \brief compute a contact element's contribution to nodal gaps 55 | * 56 | * \note explicit specialization for single mortar method 57 | * 58 | * \param [in] cs pointer to the coupling scheme 59 | * 60 | */ 61 | template <> 62 | void ComputeNodalGap( SurfaceContactElem& elem ); 63 | 64 | /*! 65 | * 66 | * \brief routine to apply interface physics in the direction normal to the interface 67 | * 68 | * \param [in] cs pointer to the coupling scheme 69 | * 70 | * \return 0 if no error 71 | * 72 | */ 73 | template <> 74 | int ApplyNormal( CouplingScheme* cs ); 75 | 76 | /*! 77 | * 78 | * \brief explicit specialization of method to compute the Jacobian contributions of 79 | * the contact residual term with respect to the primal variable for a single 80 | * contact face-pair. 81 | * 82 | * \param [in] elem surface contact element struct 83 | * 84 | */ 85 | template <> 86 | void ComputeResidualJacobian( SurfaceContactElem& elem ); 87 | 88 | /*! 89 | * 90 | * \brief explicit specialization of method to compute the Jacobian contributions of 91 | * the contact residual term with respect to the dual variable for a single 92 | * contact face-pair. 93 | * 94 | * \param [in] elem surface contact element struct 95 | * 96 | */ 97 | template <> 98 | void ComputeResidualJacobian( SurfaceContactElem& elem ); 99 | 100 | /*! 101 | * 102 | * \brief explicit specialization of method to compute the Jacobian contributions of 103 | * the contact gap constraint with respect to the primal variable for a single 104 | * contact face-pair. 105 | * 106 | * \param [in] elem surface contact element struct 107 | * 108 | */ 109 | template <> 110 | void ComputeConstraintJacobian( SurfaceContactElem& elem ); 111 | 112 | /*! 113 | * 114 | * \brief explicit specialization of method to compute the Jacobian contributions of 115 | * the contact gap constraint with respect to the dual variable for a single 116 | * contact face-pair. 117 | * 118 | * \param [in] elem surface contact element struct 119 | * 120 | */ 121 | template <> 122 | void ComputeConstraintJacobian( SurfaceContactElem& elem ); 123 | 124 | /*! 125 | * 126 | * \brief wrapper to call specific routines to compute block Jacobian contributions 127 | * 128 | * \param [in] elem surface contact element struct 129 | * 130 | */ 131 | void ComputeAlignedMortarJacobian( SurfaceContactElem& elem ); 132 | 133 | } // namespace tribol 134 | 135 | #endif /* SRC_PHYSICS_ALIGNEDMORTAR_HPP_ */ 136 | -------------------------------------------------------------------------------- /src/tribol/utils/DataManager.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #ifndef SRC_UTILS_DATAMANAGER_HPP_ 7 | #define SRC_UTILS_DATAMANAGER_HPP_ 8 | 9 | // C/C++ includes 10 | #include 11 | 12 | // Tribol includes 13 | #include "tribol/common/BasicTypes.hpp" 14 | 15 | // Axom includes 16 | #include "axom/fmt.hpp" 17 | #include "axom/slic.hpp" 18 | 19 | namespace tribol { 20 | 21 | template 22 | class DataManager { 23 | public: 24 | DataManager( const DataManager& other ) = delete; 25 | DataManager( DataManager&& other ) = delete; 26 | void operator=( const DataManager& other ) = delete; 27 | void operator=( DataManager&& other ) = delete; 28 | 29 | /** 30 | * @brief Return the instance of the DataManager singleton 31 | * 32 | * @return Reference to the DataManager 33 | */ 34 | static DataManager& getInstance() 35 | { 36 | static DataManager instance_; 37 | return instance_; 38 | } 39 | 40 | /** 41 | * @brief Returns the element at id 42 | * 43 | * @note Throws std::out_of_range if the element doesn't exist 44 | * 45 | * @param id Integer identifier 46 | * @return Reference to the element 47 | */ 48 | T& at( IndexT id ) { return data_map_.at( id ); } 49 | 50 | /** 51 | * @brief Returns an iterator to the first element 52 | * 53 | * @return std::unordered_map::iterator 54 | */ 55 | typename std::unordered_map::iterator begin() noexcept { return data_map_.begin(); } 56 | 57 | /** 58 | * @brief Returns an iterator to the element following the last element 59 | * 60 | * @return std::unordered_map::iterator 61 | */ 62 | typename std::unordered_map::iterator end() noexcept { return data_map_.end(); } 63 | 64 | /** 65 | * @brief Removes the specified element from the container 66 | * 67 | * @param id Integer identifier of the element to remove 68 | * @return Number of elements removed (0 or 1) 69 | */ 70 | size_t erase( IndexT id ) { return data_map_.erase( id ); } 71 | 72 | /** 73 | * @brief Erases all elements from the container 74 | */ 75 | void clear() noexcept { data_map_.clear(); } 76 | 77 | /** 78 | * @brief Returns the number of elements in the container 79 | * 80 | * @return Number of elements in the container 81 | */ 82 | size_t size() noexcept { return data_map_.size(); } 83 | 84 | /** 85 | * @brief Adds the key/value pair given by id and data 86 | * 87 | * @param id Integer identifier for element 88 | * @param data Element to add 89 | * @return Reference to the element 90 | */ 91 | T& addData( IndexT id, T&& data ) 92 | { 93 | data_map_.erase( id ); 94 | auto data_it = data_map_.emplace( id, std::move( data ) ); 95 | return data_it.first->second; 96 | } 97 | 98 | /** 99 | * @brief Returns a pointer to the element 100 | * 101 | * @param id Integer identifier for element 102 | * @return Pointer to element if found, nullptr otherwise 103 | */ 104 | T* findData( IndexT id ) 105 | { 106 | auto data_it = data_map_.find( id ); 107 | if ( data_it == data_map_.end() ) { 108 | return nullptr; 109 | } else { 110 | return &data_it->second; 111 | } 112 | } 113 | 114 | /** 115 | * @brief Returns a reference to the element 116 | * 117 | * @note Calls SLIC_ERROR_IF macro if element doesn't exist 118 | * 119 | * @param id Integer identifier for element 120 | * @return Reference to element 121 | */ 122 | T& getData( IndexT id ) 123 | { 124 | auto data_it = data_map_.find( id ); 125 | SLIC_ERROR_IF( data_it == data_map_.end(), axom::fmt::format( "No data exists for id = {}.", id ) ); 126 | return data_it->second; 127 | } 128 | 129 | private: 130 | DataManager() = default; 131 | ~DataManager() = default; 132 | 133 | /** 134 | * @brief Map holding elements with an integer key 135 | */ 136 | std::unordered_map data_map_; 137 | }; 138 | 139 | } // end namespace tribol 140 | 141 | #endif /* SRC_UTILS_DATAMANAGER_HPP_ */ 142 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tribol: Contact Interface Physics Library 2 | 3 | [![Build Status](https://github.com/LLNL/tribol/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/LLNL/tribol/actions/workflows/ci-tests.yml) 4 | 5 | High fidelity simulations modeling complex interactions of moving bodies require specialized contact algorithms to 6 | enforce zero-interpenetration constraints between surfaces. Tribol provides a unified interface for various 7 | contact algorithms, including contact search, detection and enforcement, thereby enabling the research and development 8 | of advanced contact algorithms. 9 | 10 | ## Quick Start Guide 11 | 12 | ### Clone the repository 13 | 14 | ``` 15 | git clone --recursive git@github.com:LLNL/Tribol.git 16 | ``` 17 | 18 | ### Setup for development 19 | 20 | Development tools can optionally be installed through the Spack package manager. Development tools are typically not 21 | needed when using Tribol. The command to install development tools is 22 | ``` 23 | python3 scripts/uberenv/uberenv.py --project-json=scripts/spack/devtools.json --spack-env-file=scripts/spack/configs//spack.yaml --prefix=../tribol_devtools 24 | ``` 25 | where `` is one of `blueos_3_ppc64le_ib_p9`, `linux_ubuntu_24`, `toss_4_x86_64_ib`, or 26 | `toss_4_x86_64_ib_cray`. Please verify `scripts/spack/configs//spack.yaml` matches your system configuration. 27 | 28 | ### Installing dependencies 29 | 30 | Tribol dependency installation is managed through uberenv, which invokes a local instance of the spack package manager 31 | to install and manage dependencies. To install dependencies, run 32 | 33 | ``` 34 | python3 scripts/uberenv/uberenv.py --spack-env-file=scripts/spack/configs//spack.yaml --prefix=../tribol_libs 35 | ``` 36 | 37 | See additional options by running 38 | 39 | ``` 40 | python3 scripts/uberenv/uberenv.py --help 41 | ``` 42 | 43 | Tribol is tested on three platforms: 44 | - Ubuntu 24.04 LTS (via Windows WSL 2) 45 | - TOSS 4 46 | - BlueOS 47 | 48 | See `scripts/spack/packages/tribol/package.py` for possible variants in the spack spec. The file 49 | `scripts/spack/specs.json` lists spack specs which are known to build successfully on different platforms. Note the 50 | development tools can be built with dependencies using the `+devtools` variant. 51 | 52 | ### Build the code 53 | 54 | After running uberenv, a host config file is created in the tribol repo root directory. Use the `config-build.py` 55 | script to create build and install directories and invoke CMake. 56 | 57 | ``` 58 | python3 ./config-build.py -hc 59 | ``` 60 | 61 | Enter the build directory and run 62 | 63 | ``` 64 | make -j 65 | ``` 66 | 67 | to build Tribol. 68 | 69 | 70 | ## Dependencies 71 | 72 | The Tribol contact physics library requires: 73 | - CMake 3.14 or higher 74 | - C++14 compiler 75 | - MPI 76 | - mfem 77 | - axom 78 | 79 | Tribol has optional dependencies on: 80 | - CUDA 81 | - HIP 82 | - RAJA 83 | - Umpire 84 | - Enzyme AD 85 | 86 | ## License 87 | 88 | Tribol is distributed under the terms of the MIT license. All new contributions must be 89 | made under this license. 90 | 91 | See [LICENSE](LICENSE) and [NOTICE](NOTICE) for details. 92 | 93 | SPDX-License-Identifier: MIT 94 | 95 | LLNL-CODE-846697 96 | 97 | ## SPDX usage 98 | 99 | Individual files contain SPDX tags instead of the full license text. 100 | This enables machine processing of license information based on the SPDX 101 | License Identifiers that are available here: https://spdx.org/licenses/ 102 | 103 | Files that are licensed as MIT contain the following 104 | text in the license header: 105 | 106 | SPDX-License-Identifier: (MIT) 107 | 108 | ## External Packages 109 | 110 | Tribol bundles some of its external dependencies in its repository. These 111 | packages are covered by various permissive licenses. A summary listing 112 | follows. See the license included with each package for full details. 113 | 114 | 115 | [//]: # (Note: The spaces at the end of each line below add line breaks) 116 | 117 | PackageName: BLT 118 | PackageHomePage: https://github.com/LLNL/blt 119 | PackageLicenseDeclared: BSD-3-Clause 120 | 121 | PackageName: uberenv 122 | PackageHomePage: https://github.com/LLNL/uberenv 123 | PackageLicenseDeclared: BSD-3-Clause 124 | -------------------------------------------------------------------------------- /src/tests/redecomp_massmatrix.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | // other Tribol Project Developers. See the top-level LICENSE file for details. 3 | // 4 | // SPDX-License-Identifier: (MIT) 5 | 6 | #include 7 | 8 | #include "mfem.hpp" 9 | 10 | #include "tribol/config.hpp" 11 | #include "redecomp/redecomp.hpp" 12 | #include "redecomp/utils/ArrayUtility.hpp" 13 | 14 | namespace redecomp { 15 | 16 | /** 17 | * @brief This tests consistency of mass matrix computation performed 1) 18 | * directly on an mfem::ParMesh and 2) on a redecomp::RedecompMesh, then 19 | * transferred to the mfem::ParMesh. 20 | * 21 | */ 22 | class MassMatrixTest : public testing::TestWithParam> { 23 | protected: 24 | double max_error_; 25 | void SetUp() override 26 | { 27 | auto mesh_file = GetParam().first; 28 | auto fe_order = GetParam().second; 29 | 30 | std::string mesh_filename = std::string( TRIBOL_REPO_DIR ) + mesh_file; 31 | mfem::Mesh serial_mesh{ mesh_filename.c_str(), 1, 1, true }; 32 | auto dim = serial_mesh.SpaceDimension(); 33 | serial_mesh.UniformRefinement(); 34 | serial_mesh.UniformRefinement(); 35 | mfem::H1_FECollection h1_elems{ fe_order, dim }; 36 | mfem::ParMesh par_mesh{ MPI_COMM_WORLD, serial_mesh }; 37 | mfem::ParFiniteElementSpace par_fes{ &par_mesh, &h1_elems, dim }; 38 | 39 | // compute mass matrix directly on ParMesh 40 | mfem::ParBilinearForm par_bf{ &par_fes }; 41 | mfem::ConstantCoefficient rho0{ 1.0 }; 42 | par_bf.AddDomainIntegrator( new mfem::VectorMassIntegrator( rho0 ) ); 43 | par_bf.Assemble(); 44 | par_bf.Finalize(); 45 | std::unique_ptr par_hpm{ par_bf.ParallelAssemble() }; 46 | mfem::SparseMatrix par_sm; 47 | par_hpm->MergeDiagAndOffd( par_sm ); 48 | mfem::DenseMatrix mass_direct; 49 | par_sm.ToDenseMatrix( mass_direct ); 50 | 51 | // compute mass matrix on Redecomp and transfer to ParMesh 52 | redecomp::RedecompMesh redecomp_mesh{ par_mesh }; 53 | mfem::FiniteElementSpace redecomp_fes{ &redecomp_mesh, &h1_elems, dim }; 54 | mfem::BilinearForm redecomp_bf{ &redecomp_fes }; 55 | redecomp_bf.AddDomainIntegrator( new mfem::VectorMassIntegrator( rho0 ) ); 56 | int n_els = redecomp_fes.GetNE(); 57 | auto elem_idx = redecomp::ArrayUtility::IndexArray( n_els ); 58 | axom::Array elem_mats{ n_els, n_els }; 59 | for ( int i{ 0 }; i < n_els; ++i ) { 60 | redecomp_bf.ComputeElementMatrix( i, elem_mats[i] ); 61 | } 62 | redecomp::MatrixTransfer matrix_xfer{ par_fes, par_fes, redecomp_fes, redecomp_fes }; 63 | auto redecomp_hpm = matrix_xfer.TransferToParallel( elem_idx, elem_idx, elem_mats ); 64 | mfem::SparseMatrix redecomp_sm; 65 | redecomp_hpm->MergeDiagAndOffd( redecomp_sm ); 66 | mfem::DenseMatrix mass_diff; 67 | redecomp_sm.ToDenseMatrix( mass_diff ); 68 | 69 | mass_diff -= mass_direct; 70 | max_error_ = mass_diff.MaxMaxNorm(); 71 | max_error_ = redecomp_mesh.getMPIUtility().AllreduceValue( max_error_, MPI_MAX ); 72 | } 73 | }; 74 | 75 | TEST_P( MassMatrixTest, mass_matrix_transfer ) 76 | { 77 | EXPECT_LT( max_error_, 1.0e-13 ); 78 | 79 | MPI_Barrier( MPI_COMM_WORLD ); 80 | } 81 | 82 | INSTANTIATE_TEST_SUITE_P( redecomp, MassMatrixTest, 83 | testing::Values( std::make_pair( "/data/star.mesh", 1 ), 84 | std::make_pair( "/data/star.mesh", 3 ), 85 | std::make_pair( "/data/two_hex.mesh", 1 ), 86 | std::make_pair( "/data/two_hex.mesh", 3 ) ) ); 87 | 88 | } // namespace redecomp 89 | 90 | //------------------------------------------------------------------------------ 91 | #include "axom/slic/core/SimpleLogger.hpp" 92 | 93 | int main( int argc, char* argv[] ) 94 | { 95 | int result = 0; 96 | 97 | MPI_Init( &argc, &argv ); 98 | 99 | ::testing::InitGoogleTest( &argc, argv ); 100 | 101 | axom::slic::SimpleLogger logger; // create & initialize test logger, finalized when 102 | // exiting main scope 103 | 104 | result = RUN_ALL_TESTS(); 105 | 106 | MPI_Finalize(); 107 | 108 | return result; 109 | } 110 | -------------------------------------------------------------------------------- /scripts/spack/devtools_configs/blueos_3_ppc64le_ib_p9/spack.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and 2 | # other Tribol Project Developers. See the top-level LICENSE file for details. 3 | # 4 | # SPDX-License-Identifier: (MIT) 5 | 6 | spack: 7 | config: 8 | install_tree: 9 | root: $spack/.. 10 | projections: 11 | all: '{compiler.name}-{compiler.version}/{name}-{version}-{hash}' 12 | misc_cache: $spack/../misc_cache 13 | test_stage: $spack/../test_stage 14 | build_stage:: 15 | - $spack/../build_stage 16 | 17 | view: 18 | default: 19 | root: ../view 20 | projections: 21 | all: '{name}-{version}' 22 | 23 | compilers:: 24 | - compiler: 25 | environment: {} 26 | extra_rpaths: [] 27 | flags: {} 28 | modules: [] 29 | operating_system: rhel7 30 | paths: 31 | cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc 32 | cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ 33 | f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran 34 | fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran 35 | spec: gcc@8.3.1 36 | target: ppc64le 37 | 38 | packages: 39 | all: 40 | compiler: [gcc] 41 | providers: 42 | blas: [netlib-lapack] 43 | lapack: [netlib-lapack] 44 | mpi: [spectrum-mpi] 45 | 46 | # LLNL blueos CUDA 47 | cuda: 48 | externals: 49 | - spec: cuda@11.2.0 50 | prefix: /usr/tce/packages/cuda/cuda-11.2.0 51 | buildable: false 52 | 53 | mpi: 54 | buildable: false 55 | 56 | netlib-lapack: 57 | externals: 58 | # This is the one that has the trailing underscores in name mangling, needed for MFEM compat 59 | - spec: netlib-lapack@3.9.0 60 | prefix: /usr/tcetmp/packages/lapack/lapack-3.9.0-gcc-7.3.1/lib/ 61 | buildable: false 62 | 63 | # System level packages to not build 64 | autoconf: 65 | buildable: false 66 | externals: 67 | - spec: autoconf@2.69 68 | prefix: /usr 69 | automake: 70 | buildable: false 71 | externals: 72 | - spec: automake@1.13.4 73 | prefix: /usr 74 | binutils: 75 | buildable: false 76 | externals: 77 | - spec: binutils@2.27 78 | prefix: /usr 79 | bzip2: 80 | buildable: false 81 | externals: 82 | - spec: bzip2@1.0.6 83 | prefix: /usr 84 | diffutils: 85 | buildable: false 86 | externals: 87 | - spec: diffutils@3.3 88 | prefix: /usr 89 | epoxy: 90 | buildable: false 91 | externals: 92 | - spec: epoxy@0.0.0 93 | prefix: /usr 94 | findutils: 95 | buildable: false 96 | externals: 97 | - spec: findutils@4.5.11 98 | prefix: /usr 99 | gettext: 100 | buildable: false 101 | externals: 102 | - spec: gettext@0.19.8.1 103 | prefix: /usr 104 | ghostscript: 105 | buildable: false 106 | externals: 107 | - spec: ghostscript@9.25 108 | prefix: /usr 109 | groff: 110 | buildable: false 111 | externals: 112 | - spec: groff@1.22.2 113 | prefix: /usr 114 | libtool: 115 | buildable: false 116 | externals: 117 | - spec: libtool@2.4.2 118 | prefix: /usr 119 | m4: 120 | buildable: false 121 | externals: 122 | - spec: m4@1.4.16 123 | prefix: /usr 124 | perl: 125 | buildable: false 126 | externals: 127 | - spec: perl@5.16.3 128 | prefix: /usr 129 | pkg-config: 130 | buildable: false 131 | externals: 132 | - spec: pkg-config@0.27.1 133 | prefix: /usr 134 | readline: 135 | buildable: false 136 | externals: 137 | - spec: readline@6.2 138 | prefix: /usr 139 | tar: 140 | externals: 141 | - spec: tar@1.26 142 | prefix: /usr 143 | buildable: false 144 | 145 | # Lock in versions of Devtools 146 | cmake: 147 | externals: 148 | - spec: cmake@3.18.0 149 | prefix: /usr/tce/packages/cmake/cmake-3.18.0 150 | buildable: false 151 | llvm: 152 | version: [10.0.0] 153 | buildable: false 154 | externals: 155 | - spec: llvm@10.0.0+clang 156 | prefix: /usr/tce/packages/clang/clang-10.0.0 -------------------------------------------------------------------------------- /scripts/spack/devtools_configs/toss_4_x86_64_ib/packages.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | all: 3 | # This defaults us to machine specific flags of ivybridge which allows 4 | # us to run on broadwell as well 5 | target: [ivybridge] 6 | compiler: [gcc, intel, pgi, clang, xl, nag] 7 | providers: 8 | blas: [netlib-lapack] 9 | lapack: [netlib-lapack] 10 | mpi: [mvapich2] 11 | gl: [opengl] 12 | glu: [openglu] 13 | opengl: 14 | buildable: false 15 | externals: 16 | - spec: opengl@1.7.0 17 | prefix: /usr 18 | openglu: 19 | buildable: false 20 | externals: 21 | - spec: openglu@1.3.1 22 | prefix: /usr 23 | 24 | # Lock down which MPI we are using 25 | mpi: 26 | buildable: false 27 | 28 | # blas is a bit more complicated because its a virtual package so fake it with 29 | # the following per spack docs 30 | netlib-lapack: 31 | buildable: false 32 | externals: 33 | - spec: netlib-lapack@3.6.1 34 | prefix: /usr 35 | 36 | # System level packages to not build 37 | autoconf: 38 | buildable: false 39 | externals: 40 | - spec: autoconf@2.69 41 | prefix: /usr 42 | automake: 43 | buildable: false 44 | externals: 45 | - spec: automake@1.13.4 46 | prefix: /usr 47 | binutils: 48 | buildable: false 49 | externals: 50 | - spec: binutils@2.27 51 | prefix: /usr 52 | bzip2: 53 | buildable: false 54 | externals: 55 | - spec: bzip2@1.0.6 56 | prefix: /usr 57 | diffutils: 58 | buildable: false 59 | externals: 60 | - spec: diffutils@3.3 61 | prefix: /usr 62 | epoxy: 63 | buildable: false 64 | externals: 65 | - spec: epoxy@1.5.2 66 | prefix: /usr 67 | findutils: 68 | buildable: false 69 | externals: 70 | - spec: findutils@4.5.11 71 | prefix: /usr 72 | gettext: 73 | buildable: false 74 | externals: 75 | - spec: gettext@0.19.8.1 76 | prefix: /usr 77 | ghostscript: 78 | buildable: false 79 | externals: 80 | - spec: ghostscript@9.25 81 | prefix: /usr 82 | groff: 83 | buildable: false 84 | externals: 85 | - spec: groff@1.22.2 86 | prefix: /usr 87 | graphviz: 88 | buildable: false 89 | externals: 90 | - spec: graphviz@2.30.1 91 | prefix: /usr 92 | libtool: 93 | buildable: false 94 | externals: 95 | - spec: libtool@2.4.2 96 | prefix: /usr 97 | libx11: 98 | buildable: false 99 | externals: 100 | - spec: libx11@1.20.4 101 | prefix: /usr 102 | m4: 103 | buildable: false 104 | externals: 105 | - spec: m4@1.4.16 106 | prefix: /usr 107 | perl: 108 | buildable: false 109 | externals: 110 | - spec: perl@5.16.3 111 | prefix: /usr 112 | pkg-config: 113 | buildable: false 114 | externals: 115 | - spec: pkg-config@0.27.1 116 | prefix: /usr 117 | readline: 118 | buildable: false 119 | externals: 120 | - spec: readline@6.2 121 | prefix: /usr 122 | tar: 123 | buildable: false 124 | externals: 125 | - spec: tar@1.26 126 | prefix: /usr 127 | unzip: 128 | buildable: false 129 | externals: 130 | - spec: unzip@6.0 131 | prefix: /usr 132 | zlib: 133 | buildable: false 134 | externals: 135 | - spec: zlib@1.2.7 136 | prefix: /usr 137 | 138 | # Lock in versions of Devtools 139 | cmake: 140 | version: [3.14.5] 141 | buildable: false 142 | externals: 143 | - spec: cmake@3.14.5 144 | prefix: /usr/tce/packages/cmake/cmake-3.14.5 145 | doxygen: 146 | version: [1.8.5] 147 | buildable: false 148 | externals: 149 | - spec: doxygen@1.8.5 150 | prefix: /usr 151 | llvm: 152 | version: [10.0.0] 153 | buildable: false 154 | externals: 155 | - spec: llvm@10.0.0 156 | prefix: /usr/tce/packages/clang/clang-10.0.0 157 | python: 158 | version: [3.8.2] 159 | buildable: false 160 | externals: 161 | - spec: python@3.8.2 162 | prefix: /usr/tce/packages/python/python-3.8.2 163 | py-shroud: 164 | version: [0.12.1] 165 | buildable: false 166 | externals: 167 | - spec: py-shroud@0.12.1 168 | prefix: ~/.local 169 | py-sphinx: 170 | version: [4.5.0] 171 | buildable: false 172 | externals: 173 | - spec: py-sphinx@4.5.0 174 | prefix: ~/.local 175 | 176 | --------------------------------------------------------------------------------