diff --git a/.github/workflows/AT2.yml b/.github/workflows/AT2.yml index 909cd82a08bd..3b279d9e37e3 100644 --- a/.github/workflows/AT2.yml +++ b/.github/workflows/AT2.yml @@ -35,7 +35,7 @@ jobs: with: skip_after_successful_duplicate: 'true' - gcc10-openmpi416-EXPERIMENTAL: + gcc10-openmpi4: needs: pre-checks runs-on: [self-hosted, gcc-10.3.0_openmpi-4.1.6] if: ${{ needs.pre-checks.outputs.should_skip != 'true' && (github.event.action == 'synchronize' || github.event.action == 'opened' || github.event.review.state == 'APPROVED') }} @@ -221,7 +221,7 @@ jobs: echo "https://github.com/trilinos/Trilinos/wiki/Containers" >> $GITHUB_STEP_SUMMARY echo "https://gitlab-ex.sandia.gov/trilinos-project/trilinos-containers/-/wikis/Containers-at-Sandia" >> $GITHUB_STEP_SUMMARY - cuda11-EXPERIMENTAL: + cuda11: needs: pre-checks runs-on: [self-hosted, cuda-11.4.2_gcc-10.3.0_openmpi-4.1.6] if: ${{ needs.pre-checks.outputs.should_skip != 'true' && (github.event.action == 'synchronize' || github.event.action == 'opened' || github.event.review.state == 'APPROVED') }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0d3fa53c932a..b691b96996d0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Initialize CodeQL - uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 + uses: github/codeql-action/init@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6 with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -108,6 +108,6 @@ jobs: ninja -j 16 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 + uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 0afed4574690..790aee6fcded 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -66,6 +66,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1 + uses: github/codeql-action/upload-sarif@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6 with: sarif_file: results.sarif diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3fcfd0d5f391..7169550f6da9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -26,7 +26,7 @@ jobs: pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-latest steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 with: debug-only: false ascending: true diff --git a/commonTools/framework/github_issue_creator/create_trilinos_github_test_failure_issue_unit_tests.py b/commonTools/framework/github_issue_creator/create_trilinos_github_test_failure_issue_unit_tests.py index 9bf8c2717b23..b5335f86c30b 100644 --- a/commonTools/framework/github_issue_creator/create_trilinos_github_test_failure_issue_unit_tests.py +++ b/commonTools/framework/github_issue_creator/create_trilinos_github_test_failure_issue_unit_tests.py @@ -7,7 +7,6 @@ import sys -import imp import shutil import unittest diff --git a/packages/amesos2/src/Amesos2_EpetraCrsMatrix_MatrixAdapter_decl.hpp b/packages/amesos2/src/Amesos2_EpetraCrsMatrix_MatrixAdapter_decl.hpp index 59aa203dddc0..c68aff8efb58 100644 --- a/packages/amesos2/src/Amesos2_EpetraCrsMatrix_MatrixAdapter_decl.hpp +++ b/packages/amesos2/src/Amesos2_EpetraCrsMatrix_MatrixAdapter_decl.hpp @@ -113,13 +113,20 @@ namespace Amesos2 { int myNRows = this->mat_->NumMyRows(); int myNnz = this->mat_->NumMyNonzeros(); if(current_phase == PREORDERING || current_phase == SYMBFACT) { - // workspace for column major - KV_GS pointers_t; - KV_GO indices_t; - // gether rowptr Kokkos::resize(recvCounts, nRanks); Kokkos::resize(recvDispls, nRanks+1); + + // index-bases + global_ordinal_t rowIndexBase = rowMap->getIndexBase(); + global_ordinal_t colIndexBase = colMap->getIndexBase(); + // map from global to local + host_ordinal_type_array perm_g2l; + host_ordinal_type_array perm_l2g; + // workspace for column major + KV_GS pointers_t; + KV_GO indices_t; + bool need_to_perm = false; { #ifdef HAVE_AMESOS2_TIMERS Teuchos::RCP< Teuchos::Time > gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(rowptr)"); @@ -142,13 +149,38 @@ namespace Amesos2 { } recvDispls(nRanks) = 0; } - if (myRank == 0 && column_major) { + // gether g2l perm (convert to 0-base) + { + host_ordinal_type_array lclMap; + Kokkos::resize(lclMap, myNRows); + if (myRank == 0) { + Kokkos::resize(perm_g2l, nRows); + Kokkos::resize(perm_l2g, nRows); + } else { + Kokkos::resize(perm_g2l, 1); + } + for (int i=0; i < myNRows; i++) { + lclMap(i) = rowMap->getGlobalElement(i); + } + Teuchos::gatherv (lclMap.data(), myNRows, perm_g2l.data(), + recvCounts.data(), recvDispls.data(), + 0, *comm); + if (myRank == 0) { + for (int i=0; i < nRows; i++) { + perm_g2l(i) -= rowIndexBase; + perm_l2g(perm_g2l(i)) = i; + if (i != perm_g2l(i)) need_to_perm = true; + } + } + } + if (myRank == 0 && (column_major || need_to_perm)) { Kokkos::resize(pointers_t, nRows+1); } else if (myRank != 0) { Kokkos::resize(pointers_t, 2); } - int *pointers_ = (myRank != 0 || column_major ? pointers_t.data() : pointers.data()); - Teuchos::gatherv (&lclRowptr[1], myNRows, &pointers_[1], + local_ordinal_t sendIdx = (myNRows > 0 ? 1 : 0); // To skip sending the first rowptr entry (note: 0, if local matrix is empty) + local_ordinal_t *pointers_ = ((myRank != 0 || (column_major || need_to_perm)) ? pointers_t.data() : pointers.data()); + Teuchos::gatherv (&lclRowptr[sendIdx], myNRows, &pointers_[1], recvCounts.data(), recvDispls.data(), 0, *comm); if (myRank == 0) { @@ -157,13 +189,17 @@ namespace Amesos2 { recvCounts(0) = pointers_[recvDispls(1)]; local_ordinal_t displs = recvCounts(0); for (int p = 1; p < nRanks; p++) { - // save recvCounts from pth MPI - recvCounts(p) = pointers_[recvDispls(p+1)]; - // shift pointers for pth MPI to global - for (int i = 1+recvDispls(p); i <= recvDispls(p+1); i++) { - pointers_[i] += displs; + // skip "Empty" submatrix (no rows) + // recvCounts(p) is zero, while pointers_[recvDispls(p+1)] now contains nnz from p-1 + if (recvDispls(p+1) > recvDispls(p)) { + // save recvCounts from pth MPI + recvCounts(p) = pointers_[recvDispls(p+1)]; + // shift pointers for pth MPI to global + for (int i = 1+recvDispls(p); i <= recvDispls(p+1); i++) { + pointers_[i] += displs; + } + displs += recvCounts(p); } - displs += recvCounts(p); } ret = pointers_[nRows]; } @@ -182,43 +218,70 @@ namespace Amesos2 { } // -- convert to global colids KV_GO lclColind_ ("localColind_", myNnz); - for (int i = 0; i < int(myNnz); i++) lclColind_(i) = colMap->getGlobalElement((lclColind[i])); - if (column_major) { + for (int i = 0; i < int(myNnz); i++) lclColind_(i) = (colMap->getGlobalElement((lclColind[i])) - colIndexBase); + if (column_major || need_to_perm) { Kokkos::resize(indices_t, indices.extent(0)); - Teuchos::gatherv (lclColind_.data(), myNnz, indices_t.data(), + Teuchos::gatherv (lclColind_.data(), myNnz, indices_t.data(), recvCounts.data(), recvDispls.data(), 0, *comm); } else { - Teuchos::gatherv (lclColind_.data(), myNnz, indices.data(), + Teuchos::gatherv (lclColind_.data(), myNnz, indices.data(), recvCounts.data(), recvDispls.data(), 0, *comm); } } - if (myRank == 0 && column_major) { + if (myRank == 0) { #ifdef HAVE_AMESOS2_TIMERS Teuchos::RCP< Teuchos::Time > gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(transpose index)"); Teuchos::TimeMonitor GatherTimer(*gatherTime); #endif - // Map to transpose - Kokkos::resize(transpose_map, ret); - // Transopose to convert to CSC - for (int i=0; i<=nRows; i++) { - pointers(i) = 0; - } - for (int k=0; k gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(nzvals)"); Teuchos::TimeMonitor GatherTimer(*gatherTime); #endif - if (column_major) { + // gather nzvals + if (transpose_map.extent(0) > 0) { Kokkos::resize(nzvals_t, nzvals.extent(0)); - Teuchos::gatherv (lclNzvals, myNnz, nzvals_t.data(), + Teuchos::gatherv (lclNzvals, myNnz, nzvals_t.data(), recvCounts.data(), recvDispls.data(), 0, *comm); } else { - Teuchos::gatherv (lclNzvals, myNnz, nzvals.data(), + Teuchos::gatherv (lclNzvals, myNnz, nzvals.data(), recvCounts.data(), recvDispls.data(), 0, *comm); } } - if (myRank == 0 && column_major) { + if (myRank == 0) { // Insert Numerical values to transopose matrix ret = pointers(nRows); - for (int k=0; k 0) { + for (int k=0; k struct slu_dist_mult {}; diff --git a/packages/amesos2/src/Amesos2_TpetraCrsMatrix_MatrixAdapter_def.hpp b/packages/amesos2/src/Amesos2_TpetraCrsMatrix_MatrixAdapter_def.hpp index 770a937246e0..3a3fa27547f4 100644 --- a/packages/amesos2/src/Amesos2_TpetraCrsMatrix_MatrixAdapter_def.hpp +++ b/packages/amesos2/src/Amesos2_TpetraCrsMatrix_MatrixAdapter_def.hpp @@ -122,7 +122,7 @@ namespace Amesos2 { // Create new GID list for RowMap Kokkos::View rowIndexList ("indexList", nRows); for (local_ordinal_t k = 0; k < nRows; k++) { - rowIndexList(k) = frow+k; + rowIndexList(k) = frow+k; // based on index-base of rowMap } // Create new GID list for ColMap Kokkos::View colIndexList ("indexList", nCols); @@ -138,10 +138,11 @@ namespace Amesos2 { RCP importer = rcp (new import_t (rowMap, colMap)); col_mv.doImport (row_mv, *importer, Tpetra::INSERT); { + // col_mv is imported from rowIndexList, which is based on index-base of rowMap auto col_view = col_mv.getLocalViewHost(Tpetra::Access::ReadOnly); for(int i=0; i gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather"); @@ -186,7 +187,6 @@ namespace Amesos2 { auto nRanks = comm->getSize(); auto myRank = comm->getRank(); - global_ordinal_t indexBase = rowMap->getIndexBase(); global_ordinal_t nRows = this->mat_->getGlobalNumRows(); auto lclMatrix = this->mat_->getLocalMatrixDevice(); @@ -200,8 +200,12 @@ namespace Amesos2 { Kokkos::deep_copy(lclRowptr, lclRowptr_d); Kokkos::deep_copy(lclColind, lclColind_d); + // index-bases + global_ordinal_t rowIndexBase = rowMap->getIndexBase(); + global_ordinal_t colIndexBase = colMap->getIndexBase(); // map from global to local host_ordinal_type_array perm_g2l; + host_ordinal_type_array perm_l2g; // workspace to transpose KV_GS pointers_t; KV_GO indices_t; @@ -238,18 +242,20 @@ namespace Amesos2 { Kokkos::resize(lclMap, myNRows); if (myRank == 0) { Kokkos::resize(perm_g2l, nRows); + Kokkos::resize(perm_l2g, nRows); } else { Kokkos::resize(perm_g2l, 1); } for (int i=0; i < myNRows; i++) { lclMap(i) = rowMap->getGlobalElement(i); } - Teuchos::gatherv (lclMap.data(), myNRows, perm_g2l.data(), + Teuchos::gatherv (lclMap.data(), myNRows, perm_g2l.data(), recvCounts.data(), recvDispls.data(), 0, *comm); if (myRank == 0) { for (int i=0; i < nRows; i++) { - perm_g2l(i) -= indexBase; + perm_g2l(i) -= rowIndexBase; + perm_l2g(perm_g2l(i)) = i; if (i != perm_g2l(i)) need_to_perm = true; } } @@ -263,11 +269,11 @@ namespace Amesos2 { } else if (myRank != 0) { Kokkos::resize(pointers_t, 2); } + LocalOrdinal sendIdx = (myNRows > 0 ? 1 : 0); // To skip sending the first rowptr entry (note: 0, if local matrix is empty) LocalOrdinal *pointers_ = ((myRank != 0 || (column_major || need_to_perm)) ? pointers_t.data() : pointers.data()); - Teuchos::gatherv (&lclRowptr_(1), myNRows, &pointers_[1], + Teuchos::gatherv (&lclRowptr_(sendIdx), myNRows, &pointers_[1], recvCounts.data(), recvDispls.data(), 0, *comm); - if (myRank == 0) { // shift to global pointers pointers_[0] = 0; @@ -275,8 +281,8 @@ namespace Amesos2 { LocalOrdinal displs = recvCounts(0); for (int p = 1; p < nRanks; p++) { // skip "Empty" submatrix (no rows) - // recvCounts(p) is zero, while pointers_[recvDispls(p+1)] now contains nnz from p-1 - if (recvDispls(p+1) > recvDispls(p)) { + // recvCounts(p) is zero, while pointers_[recvDispls(p+1)] now contains nnz from p-1 + if (recvDispls(p+1) > recvDispls(p)) { // save recvCounts from pth MPI recvCounts(p) = pointers_[recvDispls(p+1)]; // shift pointers for pth MPI to global @@ -284,7 +290,7 @@ namespace Amesos2 { pointers_[i] += displs; } displs += recvCounts(p); - } + } } ret = pointers_[nRows]; } @@ -303,14 +309,14 @@ namespace Amesos2 { } // -- convert to global colids & convert to 0-base KV_GO lclColind_ ("localColind_", lclColind.extent(0)); - for (int i = 0; i < int(lclColind.extent(0)); i++) lclColind_(i) = (colMap->getGlobalElement((lclColind(i))) - indexBase); + for (int i = 0; i < int(lclColind.extent(0)); i++) lclColind_(i) = (colMap->getGlobalElement((lclColind(i))) - colIndexBase); if (column_major || need_to_perm) { Kokkos::resize(indices_t, indices.extent(0)); - Teuchos::gatherv (lclColind_.data(), lclColind_.extent(0), indices_t.data(), + Teuchos::gatherv (lclColind_.data(), lclColind_.extent(0), indices_t.data(), recvCounts.data(), recvDispls.data(), 0, *comm); } else { - Teuchos::gatherv (lclColind_.data(), lclColind_.extent(0), indices.data(), + Teuchos::gatherv (lclColind_.data(), lclColind_.extent(0), indices.data(), recvCounts.data(), recvDispls.data(), 0, *comm); } @@ -336,8 +342,9 @@ namespace Amesos2 { for (int i=1; i < nRows; i++) { pointers(i+1) += pointers(i); } - for (int i=0; i$(install-root)/io_system/include + : $(install-root)/Sierra/include/io_system ; explicit install-user-include1 ; @@ -222,7 +222,7 @@ install install-user-include6 : [ glob $(seacas-root)/libraries/ioss/src/visualization/utils/*.h $(seacas-root)/libraries/ioss/src/visualization/exodus/*.h $(seacas-root)/libraries/ioss/src/visualization/cgns/*.h ] - : $(install-root)/io_system/include + : $(install-root)/Sierra/include/io_system ; diff --git a/packages/seacas/applications/aprepro/test.inp_app b/packages/seacas/applications/aprepro/test.inp_app index e89ca173fb68..e31d49fc2998 100644 --- a/packages/seacas/applications/aprepro/test.inp_app +++ b/packages/seacas/applications/aprepro/test.inp_app @@ -180,7 +180,7 @@ $ Test int and [] (shortcut for int) $ Test looping - print sin, cos from 0 to 90 by 5 {Loop(19, _angle, 0, 5)} -{_angle} {_sa=sind(_angle)} {_ca=cosd(_angle)} {hypot(_sa, _ca)} +{_angle} {_sa=sind(_angle)} {_ca=cosd(_angle)} {hypot(_sa, _ca)} {EndLoop} $$$$ Test formatting and string concatenation @@ -200,12 +200,12 @@ $$$$ Test string rescanning and executing Original String: {Test} Rescanned String: -{rescan(Test)} +{rescan(Test)} Original String: {Test2} Print Value of variable T = {T} Rescanned String: -{rescan(Test2)} +{rescan(Test2)} Print Value of variable T = {T} Original String: {t1 = "atan2(0,-1)"} diff --git a/packages/seacas/applications/aprepro/test_standard.out b/packages/seacas/applications/aprepro/test_standard.out index 547666f429e2..6135b1970924 100644 --- a/packages/seacas/applications/aprepro/test_standard.out +++ b/packages/seacas/applications/aprepro/test_standard.out @@ -3,7 +3,7 @@ $ Test number representations 1 1 1 1 1 1 1 1 1 1 - + Test assign statements: 5 5 $ Should print 5 5 10 10 $ Should print 10 10 @@ -51,8 +51,8 @@ $ Test ifndef - else lines This line should be echoed (6) This line should be echoed. (7) $ Lines a, b, c, d, 1, 4, 6, 7 should be echoed -$ Check line counting -- should be on line 78: - +$ Check line counting -- should be on line 78: + $ ======================================================================== $ Test string if lines This line should be echoed ("greg") @@ -89,25 +89,25 @@ $ Test int and [] (shortcut for int) 5 -5 $ Test looping - print sin, cos from 0 to 90 by 5 -0 0 1 1 -5 0.08715574275 0.9961946981 1 -10 0.1736481777 0.984807753 1 -15 0.2588190451 0.9659258263 1 -20 0.3420201433 0.9396926208 1 -25 0.4226182617 0.906307787 1 -30 0.5 0.8660254038 1 -35 0.5735764364 0.8191520443 1 -40 0.6427876097 0.7660444431 1 -45 0.7071067812 0.7071067812 1 -50 0.7660444431 0.6427876097 1 -55 0.8191520443 0.5735764364 1 -60 0.8660254038 0.5 1 -65 0.906307787 0.4226182617 1 -70 0.9396926208 0.3420201433 1 -75 0.9659258263 0.2588190451 1 -80 0.984807753 0.1736481777 1 -85 0.9961946981 0.08715574275 1 -90 1 6.123233996e-17 1 +0 0 1 1 +5 0.08715574275 0.9961946981 1 +10 0.1736481777 0.984807753 1 +15 0.2588190451 0.9659258263 1 +20 0.3420201433 0.9396926208 1 +25 0.4226182617 0.906307787 1 +30 0.5 0.8660254038 1 +35 0.5735764364 0.8191520443 1 +40 0.6427876097 0.7660444431 1 +45 0.7071067812 0.7071067812 1 +50 0.7660444431 0.6427876097 1 +55 0.8191520443 0.5735764364 1 +60 0.8660254038 0.5 1 +65 0.906307787 0.4226182617 1 +70 0.9396926208 0.3420201433 1 +75 0.9659258263 0.2588190451 1 +80 0.984807753 0.1736481777 1 +85 0.9961946981 0.08715574275 1 +90 1 6.123233996e-17 1 $$$$ Test formatting and string concatenation %.10g @@ -142,12 +142,12 @@ Original String: Rescanned String: This is line 1: 3.141592654 This is line 2: 0.7071067812 - This is line 3: 0.7071067812 + This is line 3: 0.7071067812 Original String: This has an embedded string: {T = "This is a string"} Print Value of variable T = 0 Rescanned String: -This has an embedded string: This is a string +This has an embedded string: This is a string Print Value of variable T = This is a string Original String: atan2(0,-1) diff --git a/packages/seacas/applications/blot/grpcom.blk b/packages/seacas/applications/blot/grpcom.blk index e1da60206bec..dac995747efe 100644 --- a/packages/seacas/applications/blot/grpcom.blk +++ b/packages/seacas/applications/blot/grpcom.blk @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -7,7 +7,7 @@ C See packages/seacas/LICENSE for details COMMON /GRPCOC/ DEVNAM(2), DEVCOD(2) CHARACTER*3 DEVNAM CHARACTER*8 DEVCOD - COMMON /GRPCOM/ ICURDV, + COMMON /GRPCOM/ ICURDV, & NSNAP(2), IFONT(2), & MAXCOL(2), NUMCOL(0:1,2), MAPALT(2), MAPUSE(2), & ISHARD, DEVOK(2), TALKOK(2), SOFTCH(2), AUTOPL(2) diff --git a/packages/seacas/applications/blot/mshcol.f b/packages/seacas/applications/blot/mshcol.f index 25edee6dacd3..2663c50544db 100644 --- a/packages/seacas/applications/blot/mshcol.f +++ b/packages/seacas/applications/blot/mshcol.f @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -53,7 +53,7 @@ SUBROUTINE MSHCOL (FNCT, IELB, MLNTYP, WIDLIN, BLKCOL, include 'dbnums.blk' include 'linthc.blk' - + CHARACTER*(*) FNCT INTEGER MLNTYP(-1:1) LOGICAL WIDLIN diff --git a/packages/seacas/applications/conjoin/CJ_ExodusFile.C b/packages/seacas/applications/conjoin/CJ_ExodusFile.C index 618f980e20a3..e7f79e1bde1b 100644 --- a/packages/seacas/applications/conjoin/CJ_ExodusFile.C +++ b/packages/seacas/applications/conjoin/CJ_ExodusFile.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -202,6 +202,16 @@ bool Excn::ExodusFile::create_output(const SystemInterface &si) else if (si.zlib()) { ex_set_option(outputId_, EX_OPT_COMPRESSION_TYPE, EX_COMPRESS_ZLIB); } + else if (si.zstd()) { + ex_set_option(outputId_, EX_OPT_COMPRESSION_TYPE, EX_COMPRESS_ZSTD); + } + else if (si.bz2()) { + ex_set_option(outputId_, EX_OPT_COMPRESSION_TYPE, EX_COMPRESS_BZ2); + } + + if (si.quantize()) { + ex_set_option(outputId_, EX_OPT_QUANTIZE_NSD, si.quantize_nsd()); + } } fmt::print("IO Word size is {} bytes.\n", ioWordSize_); diff --git a/packages/seacas/applications/conjoin/CJ_SystemInterface.C b/packages/seacas/applications/conjoin/CJ_SystemInterface.C index 6954ab093785..f74f50f2e776 100644 --- a/packages/seacas/applications/conjoin/CJ_SystemInterface.C +++ b/packages/seacas/applications/conjoin/CJ_SystemInterface.C @@ -65,18 +65,27 @@ void Excn::SystemInterface::enroll_options() options_.enroll("64-bit", GetLongOption::NoValue, "True if forcing the use of 64-bit integers for the output file", nullptr); - options_.enroll( - "zlib", GetLongOption::NoValue, - "Use the Zlib / libz compression method if compression is enabled (default) [exodus only].", - nullptr); + options_.enroll("zlib", GetLongOption::NoValue, + "Use the Zlib / libz compression method if compression is enabled (default) " + "[exodus only, enables netcdf-4].", + nullptr); options_.enroll("szip", GetLongOption::NoValue, "Use SZip compression. [exodus only, enables netcdf-4]", nullptr); + options_.enroll("zstd", GetLongOption::NoValue, + "Use Zstd compression. [exodus only, enables netcdf-4, experimental]", nullptr); + options_.enroll("bzip2", GetLongOption::NoValue, + "Use Bzip2 compression. [exodus only, enables netcdf-4, experimental]", nullptr); + + options_.enroll("compress", GetLongOption::MandatoryValue, + "Specify the compression level to be used. Values depend on algorithm:\n" + "\t\tzlib/bzip2: 0..9\t\tszip: even, 4..32\t\tzstd: -131072..22", + nullptr); - options_.enroll( - "compress", GetLongOption::MandatoryValue, - "Specify the hdf5 (netcdf4) compression level [0..9] to be used on the output file.", nullptr, - nullptr, true); + options_.enroll("quantize_nsd", GetLongOption::MandatoryValue, + "Use the lossy quantize compression method. Value specifies number of digits to " + "retain (1..15) [exodus only]", + nullptr, nullptr, true); options_.enroll("sort_times", GetLongOption::NoValue, "Sort the input files on the minimum timestep time in the file.\n" @@ -242,17 +251,61 @@ bool Excn::SystemInterface::parse_options(int argc, char **argv) omitNodesets_ = options_.retrieve("omit_nodesets") != nullptr; omitSidesets_ = options_.retrieve("omit_sidesets") != nullptr; - if (options_.retrieve("szip") != nullptr) { - szip_ = true; - zlib_ = false; - } zlib_ = (options_.retrieve("zlib") != nullptr); + szip_ = (options_.retrieve("szip") != nullptr); + zstd_ = (options_.retrieve("zstd") != nullptr); + bz2_ = (options_.retrieve("bzip2") != nullptr); + + if (szip_ + zlib_ + zstd_ + bz2_ > 1) { + fmt::print(stderr, + "ERROR: Only one of 'szip' or 'zlib' or 'zstd' or 'bzip2' can be specified.\n"); + } + + { + const char *temp = options_.retrieve("compress"); + if (temp != nullptr) { + compressionLevel_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } - if (szip_ && zlib_) { - fmt::print(stderr, "ERROR: Only one of 'szip' or 'zlib' can be specified.\n"); + if (zlib_ || bz2_) { + if (compressionLevel_ < 0 || compressionLevel_ > 9) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 0 and 9 inclusive " + "for gzip/zlib/bzip2 compression.\n", + compressionLevel_); + return false; + } + } + else if (szip_) { + if (compressionLevel_ % 2 != 0) { + fmt::print( + stderr, + "ERROR: Bad compression level {}. Must be an even value for szip compression.\n", + compressionLevel_); + return false; + } + if (compressionLevel_ < 4 || compressionLevel_ > 32) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 4 and 32 inclusive " + "for szip compression.\n", + compressionLevel_); + return false; + } + } + } } - compressionLevel_ = options_.get_option_value("compress", compressionLevel_); + { + const char *temp = options_.retrieve("quantize_nsd"); + if (temp != nullptr) { + quantizeNSD_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } + } + } if (options_.retrieve("copyright") != nullptr) { fmt::print("{}", copyright("2009-2021")); diff --git a/packages/seacas/applications/conjoin/CJ_SystemInterface.h b/packages/seacas/applications/conjoin/CJ_SystemInterface.h index 56d1a01d2e53..2df7577ac3fc 100644 --- a/packages/seacas/applications/conjoin/CJ_SystemInterface.h +++ b/packages/seacas/applications/conjoin/CJ_SystemInterface.h @@ -17,11 +17,16 @@ namespace Excn { SystemInterface(); bool parse_options(int argc, char **argv); - int debug() const { return debugLevel_; } - int screen_width() const { return screenWidth_; } + int debug() const { return debugLevel_; } + int screen_width() const { return screenWidth_; } + + int quantize_nsd() const { return quantizeNSD_; } int compress_data() const { return compressionLevel_; } bool zlib() const { return zlib_; } bool szip() const { return szip_; } + bool zstd() const { return zstd_; } + bool bz2() const { return bz2_; } + bool quantize() const { return quantizeNSD_ > 0; } bool omit_nodesets() const { return omitNodesets_; } bool omit_sidesets() const { return omitSidesets_; } @@ -60,8 +65,11 @@ namespace Excn { int debugLevel_{0}; int screenWidth_{0}; int compressionLevel_{0}; - bool zlib_{true}; + int quantizeNSD_{0}; + bool zlib_{false}; bool szip_{false}; + bool zstd_{false}; + bool bz2_{false}; bool omitNodesets_{false}; bool omitSidesets_{false}; bool ints64Bit_{false}; diff --git a/packages/seacas/applications/conjoin/Conjoin.C b/packages/seacas/applications/conjoin/Conjoin.C index 6f92ebfab309..00564c918f38 100644 --- a/packages/seacas/applications/conjoin/Conjoin.C +++ b/packages/seacas/applications/conjoin/Conjoin.C @@ -1535,6 +1535,9 @@ namespace { global->elementCount = goffset; global_element_map.resize(goffset); + if (goffset == 0) { + return; + } size_t max_id = global_element_map[global->elementCount - 1].first; bool is_contiguous = max_id == global_element_map.size(); @@ -2203,7 +2206,7 @@ namespace { for (size_t ns = 0; ns < set_ids.size(); ns++) { std::vector glob_ns_nodes(total_node_count + 1); - std::fill(glob_ns_nodes.begin(), glob_ns_nodes.end(), 0); + std::fill(glob_ns_nodes.begin(), glob_ns_nodes.end(), (INT)0); size_t lns = glob_sets[ns].position_; for (size_t p = 0; p < part_count; p++) { @@ -2548,7 +2551,7 @@ namespace { for (size_t b = 0; b < global.count(Excn::ObjectType::EBLK); b++) { status.resize(glob_blocks[b].entity_count()); - std::fill(status.begin(), status.end(), (1.0 - alive)); + std::fill(status.begin(), status.end(), T(1.0 - alive)); size_t boffset = blocks[b].offset_; size_t goffset = glob_blocks[b].offset_; size_t element_count = blocks[b].entity_count(); diff --git a/packages/seacas/applications/cpup/CP_SystemInterface.C b/packages/seacas/applications/cpup/CP_SystemInterface.C index 38007c582c36..1c3d10c4d940 100644 --- a/packages/seacas/applications/cpup/CP_SystemInterface.C +++ b/packages/seacas/applications/cpup/CP_SystemInterface.C @@ -124,19 +124,6 @@ void Cpup::SystemInterface::enroll_options() "large subcycle runs.", nullptr); - options_.enroll( - "zlib", GetLongOption::NoValue, - "Use the Zlib / libz compression method if compression is enabled (default) [exodus only].", - nullptr); - - options_.enroll("szip", GetLongOption::NoValue, - "Use SZip compression. [exodus only, enables netcdf-4]", nullptr); - - options_.enroll("compress_data", GetLongOption::MandatoryValue, - "The output database will be written using compression (netcdf-4 mode only).\n" - "\t\tValue ranges from 0..9 for zlib/gzip or even values 4..32 for szip.", - nullptr, nullptr, true); - options_.enroll("append", GetLongOption::NoValue, "Append to database instead of opening a new database.\n" "\t\tTimestep transfer will start after last timestep on database", @@ -301,18 +288,7 @@ bool Cpup::SystemInterface::parse_options(int argc, char **argv) append_ = options_.retrieve("append") != nullptr; - if (options_.retrieve("szip") != nullptr) { - szip_ = true; - zlib_ = false; - } - zlib_ = (options_.retrieve("zlib") != nullptr); - - if (szip_ && zlib_) { - fmt::print(stderr, "ERROR: Only one of 'szip' or 'zlib' can be specified.\n"); - } - append_ = options_.retrieve("append") != nullptr; - compressData_ = options_.get_option_value("compress_data", compressData_); //subcycle_ = options_.get_option_value("subcycle", subcycle_); cycle_ = options_.get_option_value("cycle", cycle_); subcycleJoin_ = options_.retrieve("join_subcycles") != nullptr; diff --git a/packages/seacas/applications/cpup/CP_SystemInterface.h b/packages/seacas/applications/cpup/CP_SystemInterface.h index a7295f1e62d1..4caf2f9d6915 100644 --- a/packages/seacas/applications/cpup/CP_SystemInterface.h +++ b/packages/seacas/applications/cpup/CP_SystemInterface.h @@ -65,9 +65,6 @@ namespace Cpup { bool map_element_ids() const { return mapIds_; } bool omit_nodesets() const { return omitNodesets_; } bool omit_sidesets() const { return omitSidesets_; } - int compress_data() const { return compressData_; } - bool zlib() const { return zlib_; } - bool szip() const { return szip_; } bool subcycle_join() const { return subcycleJoin_; } bool keep_temporary() const { return keepTemporary_; } bool verify_valid_file() const { return verifyValidFile_; } @@ -132,10 +129,7 @@ namespace Cpup { int partCount_{-1}; int subcycle_{-1}; int cycle_{-1}; - int compressData_{0}; int maxOpenFiles_{0}; - bool zlib_{true}; - bool szip_{false}; bool sumSharedNodes_{false}; bool addProcessorIdField_{false}; bool addProcessorIdMap_{false}; diff --git a/packages/seacas/applications/cpup/cpup.C b/packages/seacas/applications/cpup/cpup.C index 87387a2816a0..8939076414b3 100644 --- a/packages/seacas/applications/cpup/cpup.C +++ b/packages/seacas/applications/cpup/cpup.C @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -35,22 +36,6 @@ unsigned int debug_level = 0; -#if FMT_VERSION >= 90000 -#include "Ioss_ZoneConnectivity.h" -#include "Ioss_StructuredBlock.h" - -namespace fmt { - template <> struct formatter : ostream_formatter - { - }; -} // namespace fmt -namespace fmt { - template <> struct formatter : ostream_formatter - { - }; -} // namespace fmt -#endif - namespace { std::string tsFormat = "[{:%H:%M:%S}] "; @@ -390,7 +375,7 @@ template void cpup(Cpup::SystemInterface &interFace, INT /*dummy* } // Now transfer the fields on the embedded node block... - auto pnb = pblock->get_node_block(); + const auto &pnb = pblock->get_node_block(); fields.clear(); pnb.field_describe(Ioss::Field::TRANSIENT, &fields); for (const auto &field_name : fields) { diff --git a/packages/seacas/applications/ejoin/EJ_SystemInterface.C b/packages/seacas/applications/ejoin/EJ_SystemInterface.C index f1aeecd6d920..b57157fd503b 100644 --- a/packages/seacas/applications/ejoin/EJ_SystemInterface.C +++ b/packages/seacas/applications/ejoin/EJ_SystemInterface.C @@ -196,18 +196,27 @@ void SystemInterface::enroll_options() options_.enroll("64-bit", GetLongOption::NoValue, "True if forcing the use of 64-bit integers for the output file", nullptr); - options_.enroll( - "zlib", GetLongOption::NoValue, - "Use the Zlib / libz compression method if compression is enabled (default) [exodus only].", - nullptr); + options_.enroll("zlib", GetLongOption::NoValue, + "Use the Zlib / libz compression method if compression is enabled (default) " + "[exodus only, enables netcdf-4].", + nullptr); options_.enroll("szip", GetLongOption::NoValue, "Use SZip compression. [exodus only, enables netcdf-4]", nullptr); + options_.enroll("zstd", GetLongOption::NoValue, + "Use Zstd compression. [exodus only, enables netcdf-4, experimental]", nullptr); + options_.enroll("bzip2", GetLongOption::NoValue, + "Use Bzip2 compression. [exodus only, enables netcdf-4, experimental]", nullptr); + + options_.enroll("compress", GetLongOption::MandatoryValue, + "Specify the compression level to be used. Values depend on algorithm:\n" + "\t\tzlib/bzip2: 0..9\t\tszip: even, 4..32\t\tzstd: -131072..22", + nullptr); - options_.enroll( - "compress", GetLongOption::MandatoryValue, - "Specify the hdf5 (netcdf4) compression level [0..9] to be used on the output file.", - nullptr); + options_.enroll("quantize_nsd", GetLongOption::MandatoryValue, + "Use the lossy quantize compression method. Value specifies number of digits to " + "retain (1..15) [exodus only]", + nullptr, nullptr, true); options_.enroll("disable_field_recognition", GetLongOption::NoValue, "Do not try to combine scalar fields into higher-order fields such as\n" @@ -417,17 +426,61 @@ bool SystemInterface::parse_options(int argc, char **argv) ints64bit_ = true; } - if (options_.retrieve("szip") != nullptr) { - szip_ = true; - zlib_ = false; - } zlib_ = (options_.retrieve("zlib") != nullptr); + szip_ = (options_.retrieve("szip") != nullptr); + zstd_ = (options_.retrieve("zstd") != nullptr); + bz2_ = (options_.retrieve("bzip2") != nullptr); - if (szip_ && zlib_) { - fmt::print(stderr, "ERROR: Only one of 'szip' or 'zlib' can be specified.\n"); + if (szip_ + zlib_ + zstd_ + bz2_ > 1) { + fmt::print(stderr, + "ERROR: Only one of 'szip' or 'zlib' or 'zstd' or 'bzip2' can be specified.\n"); } - compressionLevel_ = options_.get_option_value("compress", compressionLevel_); + { + const char *temp = options_.retrieve("compress"); + if (temp != nullptr) { + compressionLevel_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } + + if (zlib_ || bz2_) { + if (compressionLevel_ < 0 || compressionLevel_ > 9) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 0 and 9 inclusive " + "for gzip/zlib/bzip2 compression.\n", + compressionLevel_); + return false; + } + } + else if (szip_) { + if (compressionLevel_ % 2 != 0) { + fmt::print( + stderr, + "ERROR: Bad compression level {}. Must be an even value for szip compression.\n", + compressionLevel_); + return false; + } + if (compressionLevel_ < 4 || compressionLevel_ > 32) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 4 and 32 inclusive " + "for szip compression.\n", + compressionLevel_); + return false; + } + } + } + } + + { + const char *temp = options_.retrieve("quantize_nsd"); + if (temp != nullptr) { + quantizeNSD_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } + } + } if (options_.retrieve("match_node_ids") != nullptr) { matchNodeIds_ = true; @@ -540,7 +593,7 @@ void SystemInterface::show_version() { fmt::print("EJoin\n" "\t(A code for merging Exodus databases; with or without results data.)\n" - "\t(Version: {}) Modified: {}\n", + "\t(Version: {}) Modified: {}\n\n", qainfo[2], qainfo[1]); } diff --git a/packages/seacas/applications/ejoin/EJ_SystemInterface.h b/packages/seacas/applications/ejoin/EJ_SystemInterface.h index 43985e833ae5..76fcd97eab95 100644 --- a/packages/seacas/applications/ejoin/EJ_SystemInterface.h +++ b/packages/seacas/applications/ejoin/EJ_SystemInterface.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-, 20232023, National Technology & Engineering Solutions +// Copyright(C) 1999-2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -36,12 +36,17 @@ class SystemInterface bool use_netcdf4() const { return useNetcdf4_; } bool ignore_element_ids() const { return ignoreElementIds_; } + int quantize_nsd() const { return quantizeNSD_; } + bool quantize() const { return quantizeNSD_ > 0; } int compression_level() const { return compressionLevel_; } bool zlib() const { return zlib_; } bool szip() const { return szip_; } - int step_min() const { return stepMin_; } - int step_max() const { return stepMax_; } - int step_interval() const { return stepInterval_; } + bool zstd() const { return zstd_; } + bool bz2() const { return bz2_; } + + int step_min() const { return stepMin_; } + int step_max() const { return stepMax_; } + int step_interval() const { return stepInterval_; } vector3d offset() const { return offset_; } const std::vector &information_record_parts() const { return infoRecordParts_; } @@ -88,6 +93,12 @@ class SystemInterface int stepMax_{INT_MAX}; int stepInterval_{1}; int compressionLevel_{0}; + int quantizeNSD_{0}; + bool zlib_{false}; + bool szip_{false}; + bool zstd_{false}; + bool bz2_{false}; + bool omitNodesets_{false}; bool omitSidesets_{false}; bool omitAssemblies_{false}; @@ -98,8 +109,7 @@ class SystemInterface bool ints64bit_{false}; bool useNetcdf4_{false}; bool ignoreElementIds_{false}; - bool zlib_{true}; - bool szip_{false}; + bool createAssemblies_{true}; std::string blockPrefix_{"p"}; diff --git a/packages/seacas/applications/ejoin/EJ_Version.h b/packages/seacas/applications/ejoin/EJ_Version.h index 9389859444c1..e90e9789568f 100644 --- a/packages/seacas/applications/ejoin/EJ_Version.h +++ b/packages/seacas/applications/ejoin/EJ_Version.h @@ -9,6 +9,6 @@ static const std::array qainfo{ "ejoin", - "2024/08/06", - "1.6.4", + "2024/08/29", + "1.6.5", }; diff --git a/packages/seacas/applications/ejoin/EJ_vector3d.C b/packages/seacas/applications/ejoin/EJ_vector3d.C index 4778bf3a3890..6bdc73954986 100644 --- a/packages/seacas/applications/ejoin/EJ_vector3d.C +++ b/packages/seacas/applications/ejoin/EJ_vector3d.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -7,17 +7,11 @@ #include "EJ_vector3d.h" #include -//---------------------------------------------------------------------------- -vector3d::vector3d() = default; - //---------------------------------------------------------------------------- vector3d::vector3d(double X, double Y, double Z) : x(X), y(Y), z(Z) {} //---------------------------------------------------------------------------- -vector3d::vector3d(double location[3]) : x(location[0]), y(location[1]), z(location[2]) {} - -//---------------------------------------------------------------------------- -vector3d::vector3d(const vector3d &from) = default; +vector3d::vector3d(const double location[3]) : x(location[0]), y(location[1]), z(location[2]) {} void vector3d::set(double X, double Y, double Z) { @@ -33,8 +27,6 @@ void vector3d::set(const double location[3]) z = location[2]; } -vector3d &vector3d::operator=(const vector3d &from) = default; - vector3d &vector3d::reverse() { x = -x; @@ -43,14 +35,14 @@ vector3d &vector3d::reverse() return *this; } -bool vector3d::operator==(const vector3d &from) const +bool operator==(const vector3d &lhs, const vector3d &rhs) { - return (x == from.x && y == from.y && z == from.z); + return (lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z); } -bool vector3d::operator!=(const vector3d &from) const +bool operator!=(const vector3d &lhs, const vector3d &rhs) { - return (x != from.x || y != from.y || z != from.z); + return (lhs.x != rhs.x || lhs.y != rhs.y || lhs.z == rhs.z); } vector3d operator+(const vector3d &lhs, const vector3d &rhs) diff --git a/packages/seacas/applications/ejoin/EJ_vector3d.h b/packages/seacas/applications/ejoin/EJ_vector3d.h index 0afb3c9195b6..6dd4c6252f37 100644 --- a/packages/seacas/applications/ejoin/EJ_vector3d.h +++ b/packages/seacas/applications/ejoin/EJ_vector3d.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -8,17 +8,12 @@ class vector3d { public: - // construction - vector3d(); + vector3d() = default; vector3d(double X, double Y, double Z); - explicit vector3d(double location[3]); - vector3d(const vector3d &from); + explicit vector3d(const double location[3]); double x{}, y{}, z{}; - vector3d &operator=(const vector3d &from); - bool operator==(const vector3d &from) const; - bool operator!=(const vector3d &from) const; void set(double X, double Y, double Z); void set(const double location[3]); vector3d &reverse(); @@ -33,17 +28,20 @@ class vector3d vector3d &operator*=(double scalar); vector3d &operator/=(double scalar); + friend bool operator==(const vector3d &lhs, const vector3d &rhs); + friend bool operator!=(const vector3d &lhs, const vector3d &rhs); + + friend vector3d operator*(double scalar, const vector3d &from); + friend vector3d operator*(const vector3d &lhs, double scalar); + friend vector3d operator/(const vector3d &lhs, double scalar); + + friend vector3d operator+(const vector3d &lhs, const vector3d &rhs); + friend vector3d operator-(const vector3d &lhs, const vector3d &rhs); + double length() const; vector3d cross(const vector3d &from) const; }; -vector3d operator*(double scalar, const vector3d &from); -vector3d operator*(const vector3d &lhs, double scalar); -vector3d operator/(const vector3d &lhs, double scalar); - -vector3d operator+(const vector3d &lhs, const vector3d &rhs); -vector3d operator-(const vector3d &lhs, const vector3d &rhs); - //---------------------------------------------------------------------------- inline vector3d vector3d::cross(const vector3d &from) const { diff --git a/packages/seacas/applications/ejoin/EJoin.C b/packages/seacas/applications/ejoin/EJoin.C index 8cbbe7315c41..e21872a26882 100644 --- a/packages/seacas/applications/ejoin/EJoin.C +++ b/packages/seacas/applications/ejoin/EJoin.C @@ -31,6 +31,7 @@ #include #include #include +#include #include "EJ_CodeTypes.h" #include "EJ_SystemInterface.h" @@ -44,16 +45,22 @@ #endif namespace { + std::string tsFormat = "[%H:%M:%S] "; + unsigned int debug_level = 0; + bool valid_variable(const std::string &variable, size_t id, const StringIdVector &variable_list); - void define_global_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool check_variable_mismatch(const std::string &type, const StringIdVector &variable_list, + const Ioss::NameList &fields); + + bool define_global_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list); - void define_nodal_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_nodal_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list, SystemInterface &interFace); - void define_element_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_element_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list); - void define_nset_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_nset_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list); - void define_sset_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_sset_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list); void define_nodal_nodeset_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list, SystemInterface &interFace); @@ -120,9 +127,6 @@ namespace { } } -} // namespace - -namespace { void transfer_elementblock(Ioss::Region ®ion, Ioss::Region &output_region, bool create_assemblies, bool debug); void transfer_assembly(const Ioss::Region ®ion, Ioss::Region &output_region, bool debug); @@ -138,17 +142,30 @@ namespace { void transfer_field_data_internal(Ioss::GroupingEntity *ige, Ioss::GroupingEntity *oge, const std::string &field_name); -} // namespace -std::string tsFormat = "[%H:%M:%S] "; + // Used when combining two or more input set into a single output set (WIP) + // May reequire other operations to completly combine the entities... + // This only handles the entity count. + void add_to_entity_count(Ioss::GroupingEntity *ge, int64_t entity_count_increment) + { + auto ec_property = ge->get_property("entity_count"); + auto old_count = ec_property.get_int(); + + auto origin = ec_property.get_origin(); + ge->property_erase("entity_count"); + ge->property_add(Ioss::Property("entity_count", entity_count_increment + old_count, origin)); -// prototypes + auto field_names = ge->field_describe(); + for (const auto &field_name : field_names) { + const auto &field_ref = ge->get_fieldref(field_name); + const_cast(field_ref).reset_count(entity_count_increment + old_count); + } + } +} // namespace template double ejoin(SystemInterface &interFace, std::vector &part_mesh, INT dummy); -unsigned int debug_level = 0; - int main(int argc, char *argv[]) { #ifdef SEACAS_HAVE_MPI @@ -292,15 +309,27 @@ double ejoin(SystemInterface &interFace, std::vector &part_mesh, properties.add(Ioss::Property("FILE_TYPE", "netcdf4")); } - if (interFace.compression_level() > 0 || interFace.szip()) { + if (interFace.compression_level() > 0 || interFace.szip() || interFace.quantize() || + interFace.zlib() || interFace.zstd() || interFace.bz2()) { properties.add(Ioss::Property("FILE_TYPE", "netcdf4")); properties.add(Ioss::Property("COMPRESSION_LEVEL", interFace.compression_level())); - properties.add(Ioss::Property("COMPRESSION_SHUFFLE", true)); - if (interFace.szip()) { + properties.add(Ioss::Property("COMPRESSION_SHUFFLE", 1)); + + if (interFace.zlib()) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "zlib")); + } + else if (interFace.szip()) { properties.add(Ioss::Property("COMPRESSION_METHOD", "szip")); } - else if (interFace.zlib()) { - properties.add(Ioss::Property("COMPRESSION_METHOD", "zlib")); + else if (interFace.zstd()) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "zstd")); + } + else if (interFace.bz2()) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "bzip2")); + } + + if (interFace.quantize()) { + properties.add(Ioss::Property("COMPRESSION_QUANTIZE_NSD", interFace.quantize_nsd())); } } @@ -467,22 +496,29 @@ double ejoin(SystemInterface &interFace, std::vector &part_mesh, output_region.begin_mode(Ioss::STATE_DEFINE_TRANSIENT); - define_global_fields(output_region, part_mesh, interFace.global_var_names()); + bool error = false; + error |= define_global_fields(output_region, part_mesh, interFace.global_var_names()); - define_nodal_fields(output_region, part_mesh, interFace.node_var_names(), interFace); + error |= define_nodal_fields(output_region, part_mesh, interFace.node_var_names(), interFace); define_nodal_nodeset_fields(output_region, part_mesh, interFace.node_var_names(), interFace); - define_element_fields(output_region, part_mesh, interFace.elem_var_names()); + error |= define_element_fields(output_region, part_mesh, interFace.elem_var_names()); if (!interFace.omit_nodesets()) { - define_nset_fields(output_region, part_mesh, interFace.nset_var_names()); + error |= define_nset_fields(output_region, part_mesh, interFace.nset_var_names()); } if (!interFace.omit_sidesets()) { - define_sset_fields(output_region, part_mesh, interFace.sset_var_names()); + error |= define_sset_fields(output_region, part_mesh, interFace.sset_var_names()); } output_region.end_mode(Ioss::STATE_DEFINE_TRANSIENT); + if (error) { + fmt::print(stderr, + "ERROR: Specified field(s) (see above) were not found. Fix input and rerun.\n\n"); + exit(EXIT_FAILURE); + } + // Get database times... // Different parts can have either no times or the times must match //! \todo If ts_min, ts_max, ts_step is specified, then only check steps in that range... @@ -772,6 +808,8 @@ namespace { void define_nodal_nodeset_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list, SystemInterface &interFace) { + // This routine does not check that all variables in `variable_list` have been + // found since the checking has already been done in define_nodal_fields. if (!variable_list.empty() && variable_list[0].first == "none") { return; } @@ -803,17 +841,27 @@ namespace { void transfer_nodesets(Ioss::Region ®ion, Ioss::Region &output_region, bool debug) { - const std::string &prefix = region.name(); + bool combine_similar = false; + const std::string &prefix = region.name(); const Ioss::NodeSetContainer &nss = region.get_nodesets(); for (const auto &ns : nss) { if (!entity_is_omitted(ns)) { std::string name = ns->name(); - if (output_region.get_nodeset(name) != nullptr) { - name = prefix + "_" + ns->name(); - if (output_region.get_nodeset(name) != nullptr) { - fmt::print(stderr, "ERROR: Duplicate node sets named '{}'\n", name); - exit(EXIT_FAILURE); + auto *ons = output_region.get_nodeset(name); + if (ons != nullptr) { + if (combine_similar) { + // Combine nodesets with similar names... + size_t count = ns->entity_count(); + add_to_entity_count(ons, count); + continue; + } + else { + name = prefix + "_" + ns->name(); + if (output_region.get_nodeset(name) != nullptr) { + fmt::print(stderr, "ERROR: Duplicate node sets named '{}'\n", name); + exit(EXIT_FAILURE); + } } } ns->property_add(Ioss::Property("name_in_output", name)); @@ -1328,11 +1376,12 @@ namespace { oge->put_field_data(field_name, data); } - void define_global_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_global_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list) { + bool error = false; if (!variable_list.empty() && variable_list[0].first == "none") { - return; + return error; } for (const auto &pm : part_mesh) { Ioss::NameList fields = pm->field_describe(Ioss::Field::REDUCTION); @@ -1343,13 +1392,23 @@ namespace { } } } + // Now that we have defined all fields, check `variable_list` and make + // sure that all fields that have been explicitly specified now exist + // on `output_region`... + if (!variable_list.empty() && variable_list[0].first != "all") { + // The user has specified at least one variable... + Ioss::NameList fields = output_region.field_describe(Ioss::Field::REDUCTION); + error = check_variable_mismatch("Global", variable_list, fields); + } + return error; } - void define_nodal_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_nodal_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list, SystemInterface &interFace) { + bool error = false; if (!variable_list.empty() && variable_list[0].first == "none") { - return; + return error; } Ioss::NodeBlock *onb = output_region.get_node_blocks()[0]; SMART_ASSERT(onb != nullptr); @@ -1369,15 +1428,28 @@ namespace { } } } + // Now that we have defined all fields, check `variable_list` and make + // sure that all fields that have been explicitly specified now exist + // on `output_region`... + if (!variable_list.empty() && variable_list[0].first != "all") { + // The user has specified at least one variable... + Ioss::NameList fields = onb->field_describe(Ioss::Field::REDUCTION); + error = check_variable_mismatch("Nodal", variable_list, fields); + } + return error; } - void define_element_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_element_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list) { + bool error = false; // Element Block Fields... if (!variable_list.empty() && variable_list[0].first == "none") { - return; + return error; } + bool subsetting_fields = !variable_list.empty() && variable_list[0].first != "all"; + Ioss::NameList defined_fields; + for (const auto &pm : part_mesh) { const Ioss::ElementBlockContainer &iebs = pm->get_element_blocks(); for (const auto &ieb : iebs) { @@ -1395,22 +1467,38 @@ namespace { if (valid_variable(field_name, id, variable_list)) { Ioss::Field field = ieb->get_field(field_name); oeb->field_add(std::move(field)); + if (subsetting_fields) { + defined_fields.push_back(field_name); + } } } } } } } + // Now that we have defined all fields, check `variable_list` and make + // sure that all fields that have been explicitly specified now exist + // on `output_region`... + if (subsetting_fields) { + // The user has specified at least one variable... + Ioss::Utils::uniquify(defined_fields); + error = check_variable_mismatch("Element", variable_list, defined_fields); + } + return error; } - void define_nset_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_nset_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list) { + bool error = false; // Nodeset fields... if (!variable_list.empty() && variable_list[0].first == "none") { - return; + return error; } + bool subsetting_fields = !variable_list.empty() && variable_list[0].first != "all"; + Ioss::NameList defined_fields; + for (const auto &pm : part_mesh) { const Ioss::NodeSetContainer &ins = pm->get_nodesets(); for (const auto &in : ins) { @@ -1429,19 +1517,35 @@ namespace { if (valid_variable(field_name, id, variable_list)) { Ioss::Field field = in->get_field(field_name); ons->field_add(std::move(field)); + if (subsetting_fields) { + defined_fields.push_back(field_name); + } } } } } } + // Now that we have defined all fields, check `variable_list` and make + // sure that all fields that have been explicitly specified now exist + // on `output_region`... + if (subsetting_fields) { + // The user has specified at least one variable... + Ioss::Utils::uniquify(defined_fields); + error = check_variable_mismatch("Nodeset", variable_list, defined_fields); + } + return error; } - void define_sset_fields(Ioss::Region &output_region, RegionVector &part_mesh, + bool define_sset_fields(Ioss::Region &output_region, RegionVector &part_mesh, const StringIdVector &variable_list) { + bool error = false; if (!variable_list.empty() && variable_list[0].first == "none") { - return; + return error; } + bool subsetting_fields = !variable_list.empty() && variable_list[0].first != "all"; + Ioss::NameList defined_fields; + const auto &os = output_region.get_sidesets(); Ioss::SideBlockContainer out_eb; @@ -1469,6 +1573,9 @@ namespace { if (valid_variable(field_name, id, variable_list)) { Ioss::Field field = eb->get_field(field_name); (*II)->field_add(std::move(field)); + if (subsetting_fields) { + defined_fields.push_back(field_name); + } } } ++II; @@ -1476,6 +1583,15 @@ namespace { } } } + // Now that we have defined all fields, check `variable_list` and make + // sure that all fields that have been explicitly specified now exist + // on `output_region`... + if (subsetting_fields) { + // The user has specified at least one variable... + Ioss::Utils::uniquify(defined_fields); + error = check_variable_mismatch("Sideset", variable_list, defined_fields); + } + return error; } void transfer_fields(Ioss::GroupingEntity *ige, Ioss::GroupingEntity *oge, @@ -1516,6 +1632,25 @@ namespace { return false; } + bool check_variable_mismatch(const std::string &type, const StringIdVector &variable_list, + const Ioss::NameList &fields) + { + // Check all variables in `variable_list` and see if they are found in `fields` + if (variable_list.empty() || variable_list[0].first == "all") { + return false; // No error + } + + bool error = false; + for (const auto &var : variable_list) { + if (std::find(fields.begin(), fields.end(), var.first) == std::end(fields)) { + fmt::print(stderr, "ERROR: {} Variable '{}' was not found in the list of valid fields.\n", + type, var.first); + error = true; + } + } + return error; + } + void process_nset_omissions(RegionVector &part_mesh, const Omissions &omit) { size_t part_count = part_mesh.size(); diff --git a/packages/seacas/applications/epu/EP_ExodusFile.C b/packages/seacas/applications/epu/EP_ExodusFile.C index 5cf8f3e742b2..3ff4c5700729 100644 --- a/packages/seacas/applications/epu/EP_ExodusFile.C +++ b/packages/seacas/applications/epu/EP_ExodusFile.C @@ -360,8 +360,18 @@ bool Excn::ExodusFile::create_output(const SystemInterface &si, int cycle) else if (si.zlib()) { ex_set_option(outputId_, EX_OPT_COMPRESSION_TYPE, EX_COMPRESS_ZLIB); } + else if (si.zstd()) { + ex_set_option(outputId_, EX_OPT_COMPRESSION_TYPE, EX_COMPRESS_ZSTD); + } + else if (si.bz2()) { + ex_set_option(outputId_, EX_OPT_COMPRESSION_TYPE, EX_COMPRESS_BZ2); + } ex_set_option(outputId_, EX_OPT_COMPRESSION_LEVEL, si.compress_data()); ex_set_option(outputId_, EX_OPT_COMPRESSION_SHUFFLE, 1); + + if (si.quantize()) { + ex_set_option(outputId_, EX_OPT_QUANTIZE_NSD, si.quantize_nsd()); + } } // EPU Can add a name of "processor_id_epu" which is 16 characters long. diff --git a/packages/seacas/applications/epu/EP_SystemInterface.C b/packages/seacas/applications/epu/EP_SystemInterface.C index ca97eb217f02..aafd4c1f3e94 100644 --- a/packages/seacas/applications/epu/EP_SystemInterface.C +++ b/packages/seacas/applications/epu/EP_SystemInterface.C @@ -162,9 +162,20 @@ void Excn::SystemInterface::enroll_options() options_.enroll("szip", GetLongOption::NoValue, "Use SZip compression. [exodus only, enables netcdf-4]", nullptr); - options_.enroll("compress_data", GetLongOption::MandatoryValue, - "The output database will be written using compression (netcdf-4 mode only).\n" - "\t\tValue ranges from 0..9 for zlib/gzip or even values 4..32 for szip.", + options_.enroll("zstd", GetLongOption::NoValue, + "Use Zstd compression. [exodus only, enables netcdf-4, experimental]", nullptr); + + options_.enroll("bzip2", GetLongOption::NoValue, + "Use Bzip2 compression. [exodus only, enables netcdf-4, experimental]", nullptr); + + options_.enroll("compress", GetLongOption::MandatoryValue, + "Specify the compression level to be used. Values depend on algorithm:\n" + "\t\tzlib/bzip2: 0..9\t\tszip: even, 4..32\t\tzstd: -131072..22", + nullptr); + + options_.enroll("quantize_nsd", GetLongOption::MandatoryValue, + "Use the lossy quantize compression method. Value specifies number of digits to " + "retain (1..15) [exodus only]", nullptr, nullptr, true); options_.enroll("append", GetLongOption::NoValue, @@ -383,17 +394,61 @@ bool Excn::SystemInterface::parse_options(int argc, char **argv) append_ = options_.retrieve("append") != nullptr; intIs64Bit_ = options_.retrieve("64") != nullptr; - if (options_.retrieve("szip") != nullptr) { - szip_ = true; - zlib_ = false; - } zlib_ = (options_.retrieve("zlib") != nullptr); + szip_ = (options_.retrieve("szip") != nullptr); + zstd_ = (options_.retrieve("zstd") != nullptr); + bz2_ = (options_.retrieve("bzip2") != nullptr); - if (szip_ && zlib_) { - fmt::print(stderr, "ERROR: Only one of 'szip' or 'zlib' can be specified.\n"); + if ((szip_ ? 1 : 0) + (zlib_ ? 1 : 0) + (zstd_ ? 1 : 0) + (bz2_ ? 1 : 0) > 1) { + fmt::print(stderr, + "ERROR: Only one of 'szip' or 'zlib' or 'zstd' or 'bzip2' can be specified.\n"); } - compressData_ = options_.get_option_value("compress_data", compressData_); + { + const char *temp = options_.retrieve("compress"); + if (temp != nullptr) { + compressionLevel_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } + + if (zlib_ || bz2_) { + if (compressionLevel_ < 0 || compressionLevel_ > 9) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 0 and 9 inclusive " + "for gzip/zlib compression.\n", + compressionLevel_); + return false; + } + } + else if (szip_) { + if (compressionLevel_ % 2 != 0) { + fmt::print( + stderr, + "ERROR: Bad compression level {}. Must be an even value for szip compression.\n", + compressionLevel_); + return false; + } + if (compressionLevel_ < 4 || compressionLevel_ > 32) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 4 and 32 inclusive " + "for szip compression.\n", + compressionLevel_); + return false; + } + } + } + } + + { + const char *temp = options_.retrieve("quantize_nsd"); + if (temp != nullptr) { + quantizeNSD_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } + } + } sumSharedNodes_ = options_.retrieve("sum_shared_nodes") != nullptr; append_ = options_.retrieve("append") != nullptr; diff --git a/packages/seacas/applications/epu/EP_SystemInterface.h b/packages/seacas/applications/epu/EP_SystemInterface.h index f5b4c4159e64..42edd95120da 100644 --- a/packages/seacas/applications/epu/EP_SystemInterface.h +++ b/packages/seacas/applications/epu/EP_SystemInterface.h @@ -70,9 +70,13 @@ namespace Excn { bool omit_faceblocks() const { return omitFaceBlocks_; } bool int64() const { return intIs64Bit_; } void set_int64() const { intIs64Bit_ = true; } - int compress_data() const { return compressData_; } + int compress_data() const { return compressionLevel_; } bool zlib() const { return zlib_; } bool szip() const { return szip_; } + bool zstd() const { return zstd_; } + bool bz2() const { return bz2_; } + int quantize_nsd() const { return quantizeNSD_; } + bool quantize() const { return quantizeNSD_ > 0; } bool subcycle_join() const { return subcycleJoin_; } bool output_shared_nodes() const { return outputSharedNodes_; } bool is_auto() const { return auto_; } @@ -137,10 +141,13 @@ namespace Excn { int stepInterval_{1}; int subcycle_{-1}; int cycle_{-1}; - int compressData_{0}; + int compressionLevel_{0}; + int quantizeNSD_{0}; int maxOpenFiles_{0}; - bool zlib_{true}; + bool zlib_{false}; bool szip_{false}; + bool zstd_{false}; + bool bz2_{false}; bool sumSharedNodes_{false}; bool addProcessorIdField_{false}; bool addProcessorIdMap_{false}; diff --git a/packages/seacas/applications/epu/epu.C b/packages/seacas/applications/epu/epu.C index 79134fd827b7..dd5d6cdae1f4 100644 --- a/packages/seacas/applications/epu/epu.C +++ b/packages/seacas/applications/epu/epu.C @@ -1452,13 +1452,14 @@ int epu(SystemInterface &interFace, int start_part, int part_count, int cycle, T } for (int ig = 0; ig < global_vars.count(InOut::IN); ig++) { if (proc_global_values[ig] != global_values[ig]) { - fmt::print(stderr, - fmt::runtime("At step {:{}}, Global Variable {:{}}, P{:0{}} = {:15.8g}, P{:0{}} = " - "{:15.8g}\n"), - time_step + 1, ts_max + 1, ig + 1, - get_width(global_vars.count(InOut::IN)), start_part, - get_width(interFace.processor_count()), start_part + p, - get_width(interFace.processor_count()), proc_global_values[ig]); + fmt::print( + stderr, + fmt::runtime( + "At step {:{}}, Global Variable {:{}}, P{:0{}} = {:15.8g}, P{:0{}} = " + "{:15.8g}\n"), + time_step + 1, ts_max + 1, ig + 1, get_width(global_vars.count(InOut::IN)), + start_part, get_width(interFace.processor_count()), start_part + p, + get_width(interFace.processor_count()), proc_global_values[ig]); } } } diff --git a/packages/seacas/applications/exodiff/CMakeLists.txt b/packages/seacas/applications/exodiff/CMakeLists.txt index c508246c1367..60cc07f945c4 100644 --- a/packages/seacas/applications/exodiff/CMakeLists.txt +++ b/packages/seacas/applications/exodiff/CMakeLists.txt @@ -18,7 +18,7 @@ SET(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ED_SystemInterface.C ${CMAKE_CURRENT_SOURCE_DIR}/node_set.C ${CMAKE_CURRENT_SOURCE_DIR}/edge_block.C ${CMAKE_CURRENT_SOURCE_DIR}/side_set.C - ${CMAKE_CURRENT_SOURCE_DIR}/exoII_read.C + ${CMAKE_CURRENT_SOURCE_DIR}/exo_read.C ${CMAKE_CURRENT_SOURCE_DIR}/stringx.C ${CMAKE_CURRENT_SOURCE_DIR}/exo_block.C ${CMAKE_CURRENT_SOURCE_DIR}/util.C) diff --git a/packages/seacas/applications/exodiff/ED_SystemInterface.C b/packages/seacas/applications/exodiff/ED_SystemInterface.C index 44d5dce68784..5c68c68cebf5 100644 --- a/packages/seacas/applications/exodiff/ED_SystemInterface.C +++ b/packages/seacas/applications/exodiff/ED_SystemInterface.C @@ -31,8 +31,7 @@ namespace { } std::string Parse_Variables(std::string xline, std::ifstream &cmd_file, bool &all_flag, - Tolerance &def_tol, std::vector &names, - std::vector &toler); + Tolerance &def_tol, NameList &names, std::vector &toler); bool str_equal(const std::string &s1, const std::string &s2) { @@ -137,7 +136,7 @@ namespace { } } - void Check_Parsed_Names(const std::vector &names, bool &all_flag) + void Check_Parsed_Names(const NameList &names, bool &all_flag) { int num_include = 0; int num_exclude = 0; @@ -326,13 +325,6 @@ void SystemInterface::enroll_options() options_.enroll("ignore_steps", GetLongOption::NoValue, "Don't compare any transient data; compare mesh only.", nullptr); - options_.enroll( - "x", GetLongOption::MandatoryValue, - "Exclude time steps. Does not consider the time steps given in the list of integers.\n" - "\t\tThe format is comma-separated and ranged integers (with no spaces), such as " - "\"1,5-9,28\".\n" - "\t\tThe first time step is the number '1'.", - nullptr); options_.enroll( "exclude", GetLongOption::MandatoryValue, "Exclude time steps. Does not consider the time steps given in the list of integers.\n" @@ -496,6 +488,8 @@ void SystemInterface::enroll_options() nullptr); options_.enroll("T", GetLongOption::MandatoryValue, "Backward-compatible option for -TimeStepOffset", nullptr); + options_.enroll("x", GetLongOption::MandatoryValue, "Backward-compatible option for -exclude", + nullptr); } bool SystemInterface::parse_options(int argc, char **argv) @@ -662,7 +656,7 @@ bool SystemInterface::parse_options(int argc, char **argv) if (temp != nullptr) { // temp should be of the form : where ts# is either a timestep number // (1-based) or 'last' - std::vector tokens = SLIB::tokenize(temp, ":"); + NameList tokens = SLIB::tokenize(temp, ":"); if (tokens.size() == 2) { if (str_equal(tokens[0], "last")) { explicit_steps.first = -1; @@ -1380,8 +1374,7 @@ void SystemInterface::Parse_Command_File() namespace { std::string Parse_Variables(std::string xline, std::ifstream &cmd_file, bool &all_flag, - Tolerance &def_tol, std::vector &names, - std::vector &toler) + Tolerance &def_tol, NameList &names, std::vector &toler) { toler.clear(); names.clear(); diff --git a/packages/seacas/applications/exodiff/ED_SystemInterface.h b/packages/seacas/applications/exodiff/ED_SystemInterface.h index f78794d70bdd..e186a793984a 100644 --- a/packages/seacas/applications/exodiff/ED_SystemInterface.h +++ b/packages/seacas/applications/exodiff/ED_SystemInterface.h @@ -48,37 +48,37 @@ class SystemInterface int max_warnings{100}; - std::vector glob_var_names{}; - Tolerance glob_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector glob_var{}; + NameList glob_var_names{}; + Tolerance glob_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector glob_var{}; - std::vector node_var_names{}; - Tolerance node_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector node_var{}; + NameList node_var_names{}; + Tolerance node_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector node_var{}; - std::vector elmt_var_names{}; - Tolerance elmt_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector elmt_var{}; + NameList elmt_var_names{}; + Tolerance elmt_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector elmt_var{}; - std::vector elmt_att_names{}; - Tolerance elmt_att_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector elmt_att{}; + NameList elmt_att_names{}; + Tolerance elmt_att_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector elmt_att{}; - std::vector ns_var_names{}; - Tolerance ns_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector ns_var{}; + NameList ns_var_names{}; + Tolerance ns_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector ns_var{}; - std::vector ss_var_names{}; - Tolerance ss_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector ss_var{}; + NameList ss_var_names{}; + Tolerance ss_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector ss_var{}; - std::vector eb_var_names{}; - Tolerance eb_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector eb_var{}; + NameList eb_var_names{}; + Tolerance eb_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector eb_var{}; - std::vector fb_var_names{}; - Tolerance fb_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; - std::vector fb_var{}; + NameList fb_var_names{}; + Tolerance fb_var_default{ToleranceMode::RELATIVE_, 1.0e-6, 0.0}; + std::vector fb_var{}; // time step exclusion data std::vector exclude_steps{}; diff --git a/packages/seacas/applications/exodiff/assembly.h b/packages/seacas/applications/exodiff/assembly.h index 838db12bcc40..3bf079bd920f 100644 --- a/packages/seacas/applications/exodiff/assembly.h +++ b/packages/seacas/applications/exodiff/assembly.h @@ -10,7 +10,7 @@ #include -template class ExoII_Read; +template class Exo_Read; template class Assembly : public Exo_Entity { @@ -36,5 +36,5 @@ template class Assembly : public Exo_Entity ex_entity_type assembly_type{EX_INVALID}; std::vector entities{}; - friend class ExoII_Read; + friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/check.C b/packages/seacas/applications/exodiff/check.C index d6d0bc4fe70c..7578917e2f3e 100644 --- a/packages/seacas/applications/exodiff/check.C +++ b/packages/seacas/applications/exodiff/check.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -12,8 +12,8 @@ #include "ED_SystemInterface.h" #include "Tolerance.h" #include "assembly.h" -#include "exoII_read.h" #include "exo_block.h" +#include "exo_read.h" #include "exodusII.h" #include "fmt/ostream.h" #include "fmt/ranges.h" @@ -25,17 +25,17 @@ namespace { template - bool Check_Nodal(ExoII_Read &file1, ExoII_Read &file2, const std::vector &node_map, + bool Check_Nodal(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, const INT *id_map, bool check_only); template - bool Check_Element_Block(ExoII_Read &file1, ExoII_Read &file2, + bool Check_Element_Block(Exo_Read &file1, Exo_Read &file2, const std::vector &elmt_map, const std::vector &node_map); template - bool Check_Nodeset(ExoII_Read &file1, ExoII_Read &file2, - const std::vector &node_map, bool check_only); + bool Check_Nodeset(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, + bool check_only); template - bool Check_Sideset(ExoII_Read &file1, ExoII_Read &file2, - const std::vector &elmt_map, bool check_only); + bool Check_Sideset(Exo_Read &file1, Exo_Read &file2, const std::vector &elmt_map, + bool check_only); template bool Check_Element_Block_Params(const Exo_Block *block1, const Exo_Block *block2); @@ -43,13 +43,13 @@ namespace { bool Check_Element_Block_Connectivity(Exo_Block *block1, Exo_Block *block2, const std::vector &elmt_map, const std::vector &node_map); - template bool Check_Assembly(ExoII_Read &file1, ExoII_Read &file2); + template bool Check_Assembly(Exo_Read &file1, Exo_Read &file2); template bool Check_Assembly_Params(const Assembly *assembly1, const Assembly *assembly2); bool close_compare(const std::string &st1, const std::string &st2); } // namespace -template bool Check_Global(ExoII_Read &file1, ExoII_Read &file2) +template bool Check_Global(Exo_Read &file1, Exo_Read &file2) { bool is_same = true; if (file1.Dimension() != file2.Dimension()) { @@ -82,7 +82,7 @@ template bool Check_Global(ExoII_Read &file1, ExoII_Read -void Check_Compatible_Meshes(ExoII_Read &file1, ExoII_Read &file2, bool check_only, +void Check_Compatible_Meshes(Exo_Read &file1, Exo_Read &file2, bool check_only, const std::vector &node_map, const std::vector &elmt_map, const INT *node_id_map) { @@ -124,7 +124,7 @@ void Check_Compatible_Meshes(ExoII_Read &file1, ExoII_Read &file2, boo namespace { template - bool Check_Nodal(ExoII_Read &file1, ExoII_Read &file2, const std::vector &node_map, + bool Check_Nodal(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, const INT *id_map, bool check_only) { bool is_same = true; @@ -204,7 +204,7 @@ namespace { } template - bool Check_Element_Block(ExoII_Read &file1, ExoII_Read &file2, + bool Check_Element_Block(Exo_Read &file1, Exo_Read &file2, const std::vector &elmt_map, const std::vector &node_map) { bool is_same = true; @@ -244,7 +244,7 @@ namespace { return is_same; } - template bool Check_Assembly(ExoII_Read &file1, ExoII_Read &file2) + template bool Check_Assembly(Exo_Read &file1, Exo_Read &file2) { bool is_same = true; if (file1.Num_Assembly() != file2.Num_Assembly()) { @@ -479,8 +479,8 @@ namespace { } template - bool Check_Nodeset(ExoII_Read &file1, ExoII_Read &file2, - const std::vector &node_map, bool /*unused*/) + bool Check_Nodeset(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, + bool /*unused*/) { // Currently don't set diff flag for most of these since we // can continue (somewhat) with these differences... @@ -605,8 +605,8 @@ namespace { } template - bool Check_Sideset(ExoII_Read &file1, ExoII_Read &file2, - const std::vector &elmt_map, bool /*unused*/) + bool Check_Sideset(Exo_Read &file1, Exo_Read &file2, const std::vector &elmt_map, + bool /*unused*/) { // Currently don't set diff flag for most of these since we // can continue (somewhat) with these differences... @@ -781,13 +781,13 @@ namespace { } } // namespace -template bool Check_Global(ExoII_Read &file1, ExoII_Read &file2); -template void Check_Compatible_Meshes(ExoII_Read &file1, ExoII_Read &file2, - bool check_only, const std::vector &node_map, +template bool Check_Global(Exo_Read &file1, Exo_Read &file2); +template void Check_Compatible_Meshes(Exo_Read &file1, Exo_Read &file2, bool check_only, + const std::vector &node_map, const std::vector &elmt_map, const int *node_id_map); -template bool Check_Global(ExoII_Read &file1, ExoII_Read &file2); -template void Check_Compatible_Meshes(ExoII_Read &file1, ExoII_Read &file2, +template bool Check_Global(Exo_Read &file1, Exo_Read &file2); +template void Check_Compatible_Meshes(Exo_Read &file1, Exo_Read &file2, bool check_only, const std::vector &node_map, const std::vector &elmt_map, const int64_t *node_id_map); diff --git a/packages/seacas/applications/exodiff/create_file.C b/packages/seacas/applications/exodiff/create_file.C index df52f5de01ea..c23fc192c1e6 100644 --- a/packages/seacas/applications/exodiff/create_file.C +++ b/packages/seacas/applications/exodiff/create_file.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -17,29 +17,28 @@ #include // for nullptr #include // for string, char_traits, etc #include // for vector -template class ExoII_Read; +template class Exo_Read; namespace { - void build_variable_names(const char *type, std::vector &names, - std::vector &tols, const Tolerance &default_tol, - bool do_all_flag, const std::vector &var_names1, - const std::vector &var_names2, bool *diff_found); + void build_variable_names(const char *type, NameList &names, std::vector &tols, + const Tolerance &default_tol, bool do_all_flag, + const NameList &var_names1, const NameList &var_names2, + bool *diff_found); template - void build_truth_table(EXOTYPE type, const char *label, std::vector &names, - size_t num_entity, ExoII_Read &file1, ExoII_Read &file2, - const std::vector &var_names1, - const std::vector &var_names2, std::vector &truth_tab, - bool quiet_flag, bool *diff_found); - - void output_exodus_names(int file_id, EXOTYPE type, const std::vector &names); - void output_diff_names(const char *type, const std::vector &names); - void output_compare_names(const char *type, const std::vector &names, + void build_truth_table(EXOTYPE type, const char *label, NameList &names, size_t num_entity, + Exo_Read &file1, Exo_Read &file2, const NameList &var_names1, + const NameList &var_names2, std::vector &truth_tab, bool quiet_flag, + bool *diff_found); + + void output_exodus_names(int file_id, EXOTYPE type, const NameList &names); + void output_diff_names(const char *type, const NameList &names); + void output_compare_names(const char *type, const NameList &names, const std::vector &tol, int num_vars1, int num_vars2); } // namespace template -void Build_Variable_Names(ExoII_Read &file1, ExoII_Read &file2, bool *diff_found) +void Build_Variable_Names(Exo_Read &file1, Exo_Read &file2, bool *diff_found) { // Build (and compare) global variable names. build_variable_names("global", interFace.glob_var_names, interFace.glob_var, @@ -85,7 +84,7 @@ void Build_Variable_Names(ExoII_Read &file1, ExoII_Read &file2, bool * } template -int Create_File(ExoII_Read &file1, ExoII_Read &file2, const std::string &diffile_name, +int Create_File(Exo_Read &file1, Exo_Read &file2, const std::string &diffile_name, bool *diff_found) { // Multiple modes: @@ -261,7 +260,7 @@ int Create_File(ExoII_Read &file1, ExoII_Read &file2, const std::strin } namespace { - void output_exodus_names(int file_id, EXOTYPE type, const std::vector &names) + void output_exodus_names(int file_id, EXOTYPE type, const NameList &names) { if (!names.empty()) { std::vector vars(names.size()); @@ -272,7 +271,7 @@ namespace { } } - void output_compare_names(const char *type, const std::vector &names, + void output_compare_names(const char *type, const NameList &names, const std::vector &tol, int num_vars1, int num_vars2) { if (!names.empty()) { @@ -296,7 +295,7 @@ namespace { } } - void output_diff_names(const char *type, const std::vector &names) + void output_diff_names(const char *type, const NameList &names) { if (!names.empty()) { fmt::print("{} variables to be differenced:\n", type); @@ -309,12 +308,12 @@ namespace { } } - void build_variable_names(const char *type, std::vector &names, - std::vector &tols, const Tolerance &default_tol, - bool do_all_flag, const std::vector &var_names1, - const std::vector &var_names2, bool *diff_found) + void build_variable_names(const char *type, NameList &names, std::vector &tols, + const Tolerance &default_tol, bool do_all_flag, + const NameList &var_names1, const NameList &var_names2, + bool *diff_found) { - std::vector x_list; // exclusion list + NameList x_list; // exclusion list for (auto name : names) { chop_whitespace(name); SMART_ASSERT(!name.empty()); @@ -380,8 +379,8 @@ namespace { } } - std::vector tmp_list; - std::vector tmp_tols; + NameList tmp_list; + std::vector tmp_tols; for (size_t n = 0; n < names.size(); ++n) { std::string name = names[n]; chop_whitespace(name); @@ -425,11 +424,10 @@ namespace { } template - void build_truth_table(EXOTYPE type, const char *label, std::vector &names, - size_t num_entity, ExoII_Read &file1, ExoII_Read &file2, - const std::vector &var_names1, - const std::vector &var_names2, std::vector &truth_tab, - bool quiet_flag, bool *diff_found) + void build_truth_table(EXOTYPE type, const char *label, NameList &names, size_t num_entity, + Exo_Read &file1, Exo_Read &file2, const NameList &var_names1, + const NameList &var_names2, std::vector &truth_tab, bool quiet_flag, + bool *diff_found) { if (!names.empty()) { int num_vars = names.size(); @@ -500,12 +498,11 @@ namespace { } } // End of namespace -template int Create_File(ExoII_Read &file1, ExoII_Read &file2, +template int Create_File(Exo_Read &file1, Exo_Read &file2, const std::string &diffile_name, bool *diff_found); -template void Build_Variable_Names(ExoII_Read &file1, ExoII_Read &file2, - bool *diff_found); +template void Build_Variable_Names(Exo_Read &file1, Exo_Read &file2, bool *diff_found); -template int Create_File(ExoII_Read &file1, ExoII_Read &file2, +template int Create_File(Exo_Read &file1, Exo_Read &file2, const std::string &diffile_name, bool *diff_found); -template void Build_Variable_Names(ExoII_Read &file1, ExoII_Read &file2, +template void Build_Variable_Names(Exo_Read &file1, Exo_Read &file2, bool *diff_found); diff --git a/packages/seacas/applications/exodiff/edge_block.C b/packages/seacas/applications/exodiff/edge_block.C index 6696ecdf980a..afc198e2e2fa 100644 --- a/packages/seacas/applications/exodiff/edge_block.C +++ b/packages/seacas/applications/exodiff/edge_block.C @@ -50,12 +50,13 @@ template void Edge_Block::entity_load_params() if (num_edges_per_elmt < 0 || num_attr < 0) { Error(fmt::format( - fmt::runtime("Edge_Block::entity_load_params(): Data appears corrupt for edge block {}!\n" - "\tnum elmts = {}\n" - "\tnum edges per elmt = {}\n" - "\tnum attributes = {}\n" - " ... Aborting...\n"), - fmt::group_digits(numEntity), num_edges_per_elmt, num_attr)); + fmt::runtime( + "Edge_Block::entity_load_params(): Data appears corrupt for edge block {}!\n" + "\tnum elmts = {}\n" + "\tnum edges per elmt = {}\n" + "\tnum attributes = {}\n" + " ... Aborting...\n"), + fmt::group_digits(numEntity), num_edges_per_elmt, num_attr)); } } diff --git a/packages/seacas/applications/exodiff/edge_block.h b/packages/seacas/applications/exodiff/edge_block.h index f730cd914864..868196261ab9 100644 --- a/packages/seacas/applications/exodiff/edge_block.h +++ b/packages/seacas/applications/exodiff/edge_block.h @@ -8,7 +8,7 @@ #include "exo_entity.h" #include -template class ExoII_Read; +template class Exo_Read; template class Edge_Block : public Exo_Entity { @@ -34,5 +34,5 @@ template class Edge_Block : public Exo_Entity std::string elmt_type{}; int num_edges_per_elmt{-1}; - friend class ExoII_Read; + friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/exo_block.C b/packages/seacas/applications/exodiff/exo_block.C index 4eb93464c746..072936673afe 100644 --- a/packages/seacas/applications/exodiff/exo_block.C +++ b/packages/seacas/applications/exodiff/exo_block.C @@ -53,12 +53,13 @@ template void Exo_Block::entity_load_params() elmt_type = block.topology; if (num_nodes_per_elmt < 0 || num_attr < 0) { - Error(fmt::format(fmt::runtime("Exo_Block::entity_load_params(): Data appears corrupt for block {}!\n" - "\tnum elmts = {}\n" - "\tnum nodes per elmt = {}\n" - "\tnum attributes = {}\n" - " ... Aborting...\n"), - fmt::group_digits(numEntity), num_nodes_per_elmt, num_attr)); + Error(fmt::format( + fmt::runtime("Exo_Block::entity_load_params(): Data appears corrupt for block {}!\n" + "\tnum elmts = {}\n" + "\tnum nodes per elmt = {}\n" + "\tnum attributes = {}\n" + " ... Aborting...\n"), + fmt::group_digits(numEntity), num_nodes_per_elmt, num_attr)); } } diff --git a/packages/seacas/applications/exodiff/exo_block.h b/packages/seacas/applications/exodiff/exo_block.h index 25496a522144..c55c29cc3d78 100644 --- a/packages/seacas/applications/exodiff/exo_block.h +++ b/packages/seacas/applications/exodiff/exo_block.h @@ -6,11 +6,13 @@ #pragma once #include "exo_entity.h" +#include "util.h" + #include #include -template class ExoII_Read; +template class Exo_Read; template class Exo_Block : public Exo_Entity { @@ -49,5 +51,5 @@ template class Exo_Block : public Exo_Entity int64_t offset_{0}; std::vector conn{}; // Array; holds a matrix, num_elmts by num_nodes_per_elmt. - friend class ExoII_Read; + friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/exo_entity.C b/packages/seacas/applications/exodiff/exo_entity.C index a8907ad8962e..e8efe4d953e6 100644 --- a/packages/seacas/applications/exodiff/exo_entity.C +++ b/packages/seacas/applications/exodiff/exo_entity.C @@ -359,7 +359,7 @@ void Exo_Entity::internal_load_params() int err = ex_get_attr_names(fileId, exodus_type(), id_, names); if (err < 0) { Error(fmt::format( - "ExoII_Read::Get_Init_Data(): Failed to get {} attribute names! Aborting...\n", + "Exo_Read::Get_Init_Data(): Failed to get {} attribute names! Aborting...\n", label())); } diff --git a/packages/seacas/applications/exodiff/exo_entity.h b/packages/seacas/applications/exodiff/exo_entity.h index c6fdf920f286..055df6aadb61 100644 --- a/packages/seacas/applications/exodiff/exo_entity.h +++ b/packages/seacas/applications/exodiff/exo_entity.h @@ -5,6 +5,8 @@ // See packages/seacas/LICENSE for details #pragma once +#include "util.h" + #include #include #include @@ -20,7 +22,7 @@ using EXOTYPE = int; using EXOTYPE = int; #endif -template class ExoII_Read; +template class Exo_Read; class Exo_Entity { @@ -52,10 +54,10 @@ class Exo_Entity const double *Get_Attributes(int attr_index) const; void Free_Attributes(); - const std::string &Get_Attribute_Name(int attr_index) const; - const std::string &Name() const { return name_; } - const std::vector &Attribute_Names() const { return attributeNames; } - int Find_Attribute_Index(const std::string &name) const; + const std::string &Get_Attribute_Name(int attr_index) const; + const std::string &Name() const { return name_; } + const NameList &Attribute_Names() const { return attributeNames; } + int Find_Attribute_Index(const std::string &name) const; // Return "Element Block", "Nodeset", "Sideset, depending on underlying type. virtual const char *label() const = 0; @@ -90,7 +92,7 @@ class Exo_Entity int numAttr{0}; // Total number of attributes in the file. std::vector attributes_{}; // Array of pointers (length numAttr) // to arrays of attributes (length num_entity). - std::vector attributeNames{}; + NameList attributeNames{}; - template friend class ExoII_Read; + template friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/exoII_read.C b/packages/seacas/applications/exodiff/exo_read.C similarity index 83% rename from packages/seacas/applications/exodiff/exoII_read.C rename to packages/seacas/applications/exodiff/exo_read.C index 00fb6981b106..ce1bb2505339 100644 --- a/packages/seacas/applications/exodiff/exoII_read.C +++ b/packages/seacas/applications/exodiff/exo_read.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -7,8 +7,8 @@ #include "ED_SystemInterface.h" // for SystemInterface, etc #include "assembly.h" #include "edge_block.h" // for Edge_Block -#include "exoII_read.h" #include "exo_block.h" // for Exo_Block +#include "exo_read.h" #include "exodusII.h" // for ex_init_params, ex_opts, etc #include "face_block.h" // for Face_Block #include "fmt/ostream.h" @@ -32,13 +32,11 @@ namespace { std::vector &varlist); } // namespace -template ExoII_Read::ExoII_Read() = default; +template Exo_Read::Exo_Read() = default; -template ExoII_Read::ExoII_Read(std::string fname) : file_name(std::move(fname)) -{ -} +template Exo_Read::Exo_Read(std::string fname) : file_name(std::move(fname)) {} -template ExoII_Read::~ExoII_Read() +template Exo_Read::~Exo_Read() { try { SMART_ASSERT(Check_State()); @@ -46,7 +44,7 @@ template ExoII_Read::~ExoII_Read() if (file_id >= 0) { std::string err = Close_File(); if (!err.empty()) { - Error(fmt::format("ExoII_Read destructor(): closing file: \"{}\"\n", err)); + Error(fmt::format("Exo_Read destructor(): closing file: \"{}\"\n", err)); } } @@ -54,7 +52,6 @@ template ExoII_Read::~ExoII_Read() delete[] nsets; delete[] ssets; delete[] nodes; - delete[] times; delete[] edge_blocks; delete[] face_blocks; delete[] assemblies; @@ -69,13 +66,12 @@ template ExoII_Read::~ExoII_Read() delete[] global_vals2; delete[] node_map; delete[] elmt_map; - delete[] elmt_order; } catch (...) { } } -template std::string ExoII_Read::Close_File() +template std::string Exo_Read::Close_File() { SMART_ASSERT(Check_State()); @@ -85,7 +81,7 @@ template std::string ExoII_Read::Close_File() int err = ex_close(file_id); if (err < 0) { - Error(fmt::format("ExoII_Read::Close_File(): {}: Unable to close file! Aborting...\n", err)); + Error(fmt::format("Exo_Read::Close_File(): {}: Unable to close file! Aborting...\n", err)); } if (err > 0) { return fmt::format("WARNING: {} issued upon close", err); @@ -96,63 +92,63 @@ template std::string ExoII_Read::Close_File() return ""; } -template double ExoII_Read::Time(int time_num) const +template double Exo_Read::Time(int time_num) const { SMART_ASSERT(Check_State()); - SMART_ASSERT(time_num > 0 && time_num <= num_times)(time_num)(num_times); + SMART_ASSERT(time_num > 0 && time_num <= Num_Times())(time_num)(Num_Times()); return times[time_num - 1]; } -template const std::string &ExoII_Read::Global_Var_Name(int index) const +template const std::string &Exo_Read::Global_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < global_vars.size()); return global_vars[index]; } -template const std::string &ExoII_Read::Nodal_Var_Name(int index) const +template const std::string &Exo_Read::Nodal_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < nodal_vars.size()); return nodal_vars[index]; } -template const std::string &ExoII_Read::Element_Var_Name(int index) const +template const std::string &Exo_Read::Element_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < elmt_vars.size()); return elmt_vars[index]; } -template const std::string &ExoII_Read::Element_Att_Name(int index) const +template const std::string &Exo_Read::Element_Att_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < elmt_atts.size()); return elmt_atts[index]; } -template const std::string &ExoII_Read::NS_Var_Name(int index) const +template const std::string &Exo_Read::NS_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < ns_vars.size()); return ns_vars[index]; } -template const std::string &ExoII_Read::SS_Var_Name(int index) const +template const std::string &Exo_Read::SS_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < ss_vars.size()); return ss_vars[index]; } -template const std::string &ExoII_Read::EB_Var_Name(int index) const +template const std::string &Exo_Read::EB_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < eb_vars.size()); return eb_vars[index]; } -template const std::string &ExoII_Read::FB_Var_Name(int index) const +template const std::string &Exo_Read::FB_Var_Name(int index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(index >= 0 && (unsigned)index < fb_vars.size()); @@ -160,14 +156,14 @@ template const std::string &ExoII_Read::FB_Var_Name(int inde } template -Exo_Block *ExoII_Read::Get_Element_Block_by_Index(size_t block_index) const +Exo_Block *Exo_Read::Get_Element_Block_by_Index(size_t block_index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(block_index < num_elmt_blocks); return &eblocks[block_index]; } -template Exo_Block *ExoII_Read::Get_Element_Block_by_Id(size_t id) const +template Exo_Block *Exo_Read::Get_Element_Block_by_Id(size_t id) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_elmt_blocks; i++) { @@ -179,7 +175,7 @@ template Exo_Block *ExoII_Read::Get_Element_Block_by_Id } template -Exo_Block *ExoII_Read::Get_Element_Block_by_Name(const std::string &name) const +Exo_Block *Exo_Read::Get_Element_Block_by_Name(const std::string &name) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_elmt_blocks; i++) { @@ -191,7 +187,7 @@ Exo_Block *ExoII_Read::Get_Element_Block_by_Name(const std::string &na } template -Assembly *ExoII_Read::Get_Assembly_by_Index(size_t block_index) const +Assembly *Exo_Read::Get_Assembly_by_Index(size_t block_index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(block_index < num_assemblies); @@ -199,7 +195,7 @@ Assembly *ExoII_Read::Get_Assembly_by_Index(size_t block_index) const } template -Assembly *ExoII_Read::Get_Assembly_by_Name(const std::string &name) const +Assembly *Exo_Read::Get_Assembly_by_Name(const std::string &name) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_assemblies; i++) { @@ -210,7 +206,7 @@ Assembly *ExoII_Read::Get_Assembly_by_Name(const std::string &name) co return nullptr; } -template Assembly *ExoII_Read::Get_Assembly_by_Id(size_t set_id) const +template Assembly *Exo_Read::Get_Assembly_by_Id(size_t set_id) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_assemblies; i++) { @@ -222,7 +218,7 @@ template Assembly *ExoII_Read::Get_Assembly_by_Id(size_ } template -Exo_Entity *ExoII_Read::Get_Entity_by_Index(EXOTYPE type, size_t block_index) const +Exo_Entity *Exo_Read::Get_Entity_by_Index(EXOTYPE type, size_t block_index) const { SMART_ASSERT(Check_State()); @@ -237,7 +233,7 @@ Exo_Entity *ExoII_Read::Get_Entity_by_Index(EXOTYPE type, size_t block_inde } } -template Exo_Entity *ExoII_Read::Get_Entity_by_Id(EXOTYPE type, size_t id) const +template Exo_Entity *Exo_Read::Get_Entity_by_Id(EXOTYPE type, size_t id) const { SMART_ASSERT(Check_State()); switch (type) { @@ -289,7 +285,7 @@ template Exo_Entity *ExoII_Read::Get_Entity_by_Id(EXOTYPE ty } template -Exo_Entity *ExoII_Read::Get_Entity_by_Name(EXOTYPE type, const std::string &name) const +Exo_Entity *Exo_Read::Get_Entity_by_Name(EXOTYPE type, const std::string &name) const { SMART_ASSERT(Check_State()); switch (type) { @@ -340,7 +336,7 @@ Exo_Entity *ExoII_Read::Get_Entity_by_Name(EXOTYPE type, const std::string return nullptr; } -template Node_Set *ExoII_Read::Get_Node_Set_by_Id(size_t set_id) const +template Node_Set *Exo_Read::Get_Node_Set_by_Id(size_t set_id) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_node_sets; i++) { @@ -352,7 +348,7 @@ template Node_Set *ExoII_Read::Get_Node_Set_by_Id(size_ } template -Node_Set *ExoII_Read::Get_Node_Set_by_Name(const std::string &name) const +Node_Set *Exo_Read::Get_Node_Set_by_Name(const std::string &name) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_node_sets; i++) { @@ -363,7 +359,7 @@ Node_Set *ExoII_Read::Get_Node_Set_by_Name(const std::string &name) co return nullptr; } -template Side_Set *ExoII_Read::Get_Side_Set_by_Id(size_t set_id) const +template Side_Set *Exo_Read::Get_Side_Set_by_Id(size_t set_id) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_side_sets; i++) { @@ -375,7 +371,7 @@ template Side_Set *ExoII_Read::Get_Side_Set_by_Id(size_ } template -Side_Set *ExoII_Read::Get_Side_Set_by_Name(const std::string &name) const +Side_Set *Exo_Read::Get_Side_Set_by_Name(const std::string &name) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_side_sets; i++) { @@ -386,8 +382,7 @@ Side_Set *ExoII_Read::Get_Side_Set_by_Name(const std::string &name) co return nullptr; } -template -Edge_Block *ExoII_Read::Get_Edge_Block_by_Id(size_t block_id) const +template Edge_Block *Exo_Read::Get_Edge_Block_by_Id(size_t block_id) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_edge_blocks; i++) { @@ -399,7 +394,7 @@ Edge_Block *ExoII_Read::Get_Edge_Block_by_Id(size_t block_id) const } template -Edge_Block *ExoII_Read::Get_Edge_Block_by_Name(const std::string &name) const +Edge_Block *Exo_Read::Get_Edge_Block_by_Name(const std::string &name) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_edge_blocks; i++) { @@ -410,8 +405,7 @@ Edge_Block *ExoII_Read::Get_Edge_Block_by_Name(const std::string &name return nullptr; } -template -Face_Block *ExoII_Read::Get_Face_Block_by_Id(size_t block_id) const +template Face_Block *Exo_Read::Get_Face_Block_by_Id(size_t block_id) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_face_blocks; i++) { @@ -423,7 +417,7 @@ Face_Block *ExoII_Read::Get_Face_Block_by_Id(size_t block_id) const } template -Face_Block *ExoII_Read::Get_Face_Block_by_Name(const std::string &name) const +Face_Block *Exo_Read::Get_Face_Block_by_Name(const std::string &name) const { SMART_ASSERT(Check_State()); for (size_t i = 0; i < num_face_blocks; i++) { @@ -435,7 +429,7 @@ Face_Block *ExoII_Read::Get_Face_Block_by_Name(const std::string &name } template -std::string ExoII_Read::Load_Element_Block_Description(size_t block_index) const +std::string Exo_Read::Load_Element_Block_Description(size_t block_index) const { SMART_ASSERT(Check_State()); if (!Open()) { @@ -450,7 +444,7 @@ std::string ExoII_Read::Load_Element_Block_Description(size_t block_index) return ""; } -template std::string ExoII_Read::Load_Element_Block_Descriptions() const +template std::string Exo_Read::Load_Element_Block_Descriptions() const { SMART_ASSERT(Check_State()); if (!Open()) { @@ -463,7 +457,7 @@ template std::string ExoII_Read::Load_Element_Block_Descript return ""; } -template std::string ExoII_Read::Free_Element_Block(size_t block_index) const +template std::string Exo_Read::Free_Element_Block(size_t block_index) const { SMART_ASSERT(Check_State()); @@ -475,7 +469,7 @@ template std::string ExoII_Read::Free_Element_Block(size_t b return ""; } -template std::string ExoII_Read::Free_Element_Blocks() const +template std::string Exo_Read::Free_Element_Blocks() const { SMART_ASSERT(Check_State()); @@ -487,14 +481,14 @@ template std::string ExoII_Read::Free_Element_Blocks() const return ""; } -template size_t ExoII_Read::Block_Id(size_t block_index) const +template size_t Exo_Read::Block_Id(size_t block_index) const { SMART_ASSERT(Check_State()); SMART_ASSERT(block_index < num_elmt_blocks); return eblocks[block_index].Id(); } -template std::string ExoII_Read::Load_Node_Map() +template std::string Exo_Read::Load_Node_Map() { SMART_ASSERT(Check_State()); @@ -523,7 +517,7 @@ template std::string ExoII_Read::Load_Node_Map() return ""; } -template std::string ExoII_Read::Free_Node_Map() +template std::string Exo_Read::Free_Node_Map() { SMART_ASSERT(Check_State()); @@ -533,7 +527,7 @@ template std::string ExoII_Read::Free_Node_Map() return ""; } -template std::string ExoII_Read::Load_Element_Map() +template std::string Exo_Read::Load_Element_Map() { SMART_ASSERT(Check_State()); @@ -562,7 +556,7 @@ template std::string ExoII_Read::Load_Element_Map() return ""; } -template std::string ExoII_Read::Free_Element_Map() +template std::string Exo_Read::Free_Element_Map() { SMART_ASSERT(Check_State()); @@ -572,7 +566,7 @@ template std::string ExoII_Read::Free_Element_Map() return ""; } -template std::string ExoII_Read::Load_Nodal_Coordinates() +template std::string Exo_Read::Load_Nodal_Coordinates() { SMART_ASSERT(Check_State()); @@ -610,7 +604,7 @@ template std::string ExoII_Read::Load_Nodal_Coordinates() return ""; } -template void ExoII_Read::Free_Nodal_Coordinates() +template void Exo_Read::Free_Nodal_Coordinates() { SMART_ASSERT(Check_State()); delete[] nodes; @@ -618,10 +612,10 @@ template void ExoII_Read::Free_Nodal_Coordinates() } template -std::string ExoII_Read::Load_Nodal_Results(int time_step_num, int var_index) +std::string Exo_Read::Load_Nodal_Results(int time_step_num, int var_index) { SMART_ASSERT(Check_State()); - SMART_ASSERT(time_step_num > 0 && time_step_num <= num_times); + SMART_ASSERT(time_step_num > 0 && time_step_num <= Num_Times()); SMART_ASSERT(var_index >= 0 && (unsigned)var_index < nodal_vars.size()); if (!Open()) { @@ -641,13 +635,13 @@ std::string ExoII_Read::Load_Nodal_Results(int time_step_num, int var_index int err = ex_get_var(file_id, cur_time, EX_NODAL, var_index + 1, 0, num_nodes, results[var_index]); if (err < 0) { - Error("ExoII_Read::Load_Nodal_Results(): Failed to get " + Error("Exo_Read::Load_Nodal_Results(): Failed to get " "nodal variable values! Aborting...\n"); } else if (err > 0) { delete[] results[var_index]; results[var_index] = nullptr; - return fmt::format("ExoII_Read::Load_Nodal_Results(): WARNING: " + return fmt::format("Exo_Read::Load_Nodal_Results(): WARNING: " "Exodus issued warning \"{}\" on call to ex_get_var()!" " I'm not going to keep what it gave me for values.", err); @@ -660,15 +654,15 @@ std::string ExoII_Read::Load_Nodal_Results(int time_step_num, int var_index } template -const double *ExoII_Read::Get_Nodal_Results(int t1, int t2, double proportion, - int var_index) const // Interpolated results. +const double *Exo_Read::Get_Nodal_Results(int t1, int t2, double proportion, + int var_index) const // Interpolated results. { static std::vector st_results; static std::vector st_results2; SMART_ASSERT(Check_State()); - SMART_ASSERT(t1 > 0 && t1 <= num_times); - SMART_ASSERT(t2 > 0 && t2 <= num_times); + SMART_ASSERT(t1 > 0 && t1 <= Num_Times()); + SMART_ASSERT(t2 > 0 && t2 <= Num_Times()); SMART_ASSERT(var_index >= 0 && (unsigned)var_index < nodal_vars.size()); if (!Open()) { @@ -681,7 +675,7 @@ const double *ExoII_Read::Get_Nodal_Results(int t1, int t2, double proporti int err = ex_get_var(file_id, t1, EX_NODAL, var_index + 1, 0, num_nodes, st_results.data()); if (err < 0) { - Error("ExoII_Read::Get_Nodal_Results(): Failed to get " + Error("Exo_Read::Get_Nodal_Results(): Failed to get " "nodal variable values! Aborting...\n"); } @@ -692,7 +686,7 @@ const double *ExoII_Read::Get_Nodal_Results(int t1, int t2, double proporti err = ex_get_var(file_id, t2, EX_NODAL, var_index + 1, 0, num_nodes, st_results2.data()); if (err < 0) { - Error("ExoII_Read::Load_Nodal_Results(): Failed to get " + Error("Exo_Read::Load_Nodal_Results(): Failed to get " "nodal variable values! Aborting...\n"); } @@ -704,7 +698,7 @@ const double *ExoII_Read::Get_Nodal_Results(int t1, int t2, double proporti return st_results.data(); } -template void ExoII_Read::Free_Nodal_Results() +template void Exo_Read::Free_Nodal_Results() { SMART_ASSERT(Check_State()); if (results) { @@ -715,7 +709,7 @@ template void ExoII_Read::Free_Nodal_Results() } } -template void ExoII_Read::Free_Nodal_Results(int var_index) +template void Exo_Read::Free_Nodal_Results(int var_index) { SMART_ASSERT(Check_State()); if (results) { @@ -726,7 +720,7 @@ template void ExoII_Read::Free_Nodal_Results(int var_index) } } -template const double *ExoII_Read::Get_Nodal_Results(int var_index) const +template const double *Exo_Read::Get_Nodal_Results(int var_index) const { SMART_ASSERT(Check_State()); if (cur_time == 0) { @@ -737,10 +731,10 @@ template const double *ExoII_Read::Get_Nodal_Results(int var return results[var_index]; } -template std::string ExoII_Read::Load_Global_Results(int time_step_num) +template std::string Exo_Read::Load_Global_Results(int time_step_num) { SMART_ASSERT(Check_State()); - SMART_ASSERT(time_step_num > 0 && time_step_num <= num_times); + SMART_ASSERT(time_step_num > 0 && time_step_num <= Num_Times()); if (!Open()) { return "WARNING: File not open!"; @@ -761,11 +755,11 @@ template std::string ExoII_Read::Load_Global_Results(int tim int err = ex_get_var(file_id, time_step_num, EX_GLOBAL, 1, 1, global_vars.size(), global_vals); if (err < 0) { - Error("ExoII_Read::Load_Global_Results(): Failed to get " + Error("Exo_Read::Load_Global_Results(): Failed to get " "global variable values! Aborting...\n"); } else if (err > 0) { - return fmt::format("ExoII_Read::Load_Global_Results(): WARNING: " + return fmt::format("Exo_Read::Load_Global_Results(): WARNING: " "Exodus issued warning \"{}\" on call to ex_get_glob_vars()!", err); } @@ -773,11 +767,11 @@ template std::string ExoII_Read::Load_Global_Results(int tim } template -std::string ExoII_Read::Load_Global_Results(int t1, int t2, double proportion) +std::string Exo_Read::Load_Global_Results(int t1, int t2, double proportion) { SMART_ASSERT(Check_State()); - SMART_ASSERT(t1 > 0 && t1 <= num_times); - SMART_ASSERT(t2 > 0 && t2 <= num_times); + SMART_ASSERT(t1 > 0 && t1 <= Num_Times()); + SMART_ASSERT(t2 > 0 && t2 <= Num_Times()); if (!Open()) { return "WARNING: File not open!"; @@ -802,14 +796,14 @@ std::string ExoII_Read::Load_Global_Results(int t1, int t2, double proporti int err = ex_get_var(file_id, t1, EX_GLOBAL, 1, 1, global_vars.size(), global_vals); if (err < 0) { - Error("ExoII_Read::Load_Global_Results(): Failed to get " + Error("Exo_Read::Load_Global_Results(): Failed to get " "global variable values! Aborting...\n"); } if (t2 != t1) { err = ex_get_var(file_id, t2, EX_GLOBAL, 1, 1, global_vars.size(), global_vals2); if (err < 0) { - Error("ExoII_Read::Load_Global_Results(): Failed to get " + Error("Exo_Read::Load_Global_Results(): Failed to get " "global variable values! Aborting...\n"); } @@ -822,7 +816,7 @@ std::string ExoII_Read::Load_Global_Results(int t1, int t2, double proporti } template -Side_Set *ExoII_Read::Get_Side_Set_by_Index(size_t side_set_index) const +Side_Set *Exo_Read::Get_Side_Set_by_Index(size_t side_set_index) const { SMART_ASSERT(Check_State()); @@ -833,8 +827,7 @@ Side_Set *ExoII_Read::Get_Side_Set_by_Index(size_t side_set_index) con return &ssets[side_set_index]; } -template -Node_Set *ExoII_Read::Get_Node_Set_by_Index(size_t set_index) const +template Node_Set *Exo_Read::Get_Node_Set_by_Index(size_t set_index) const { SMART_ASSERT(Check_State()); @@ -846,7 +839,7 @@ Node_Set *ExoII_Read::Get_Node_Set_by_Index(size_t set_index) const } template -Edge_Block *ExoII_Read::Get_Edge_Block_by_Index(size_t edge_block_index) const +Edge_Block *Exo_Read::Get_Edge_Block_by_Index(size_t edge_block_index) const { SMART_ASSERT(Check_State()); @@ -858,7 +851,7 @@ Edge_Block *ExoII_Read::Get_Edge_Block_by_Index(size_t edge_block_inde } template -Face_Block *ExoII_Read::Get_Face_Block_by_Index(size_t face_block_index) const +Face_Block *Exo_Read::Get_Face_Block_by_Index(size_t face_block_index) const { SMART_ASSERT(Check_State()); @@ -874,7 +867,7 @@ Face_Block *ExoII_Read::Get_Face_Block_by_Index(size_t face_block_inde // This function converts an Exodus global element number (1-offset) into // its block index (0-offset) and block element index (0-offset). template -std::pair ExoII_Read::Global_to_Block_Local(size_t global_elmt_num) const +std::pair Exo_Read::Global_to_Block_Local(size_t global_elmt_num) const { SMART_ASSERT(Check_State()); @@ -896,7 +889,7 @@ std::pair ExoII_Read::Global_to_Block_Local(size_t global_elmt return std::make_pair(block_index, global_elmt_num - total - 1); } -template int ExoII_Read::Check_State() const +template int Exo_Read::Check_State() const { SMART_ASSERT(file_id >= -1); SMART_ASSERT(db_version >= 0.0); @@ -912,17 +905,16 @@ template int ExoII_Read::Check_State() const SMART_ASSERT(!(num_nodes == 0 && nodes)); - SMART_ASSERT(num_times >= 0); - SMART_ASSERT(!(num_times > 0 && !times)); + SMART_ASSERT(Num_Times() >= 0); - SMART_ASSERT(cur_time >= 0 && cur_time <= num_times); + SMART_ASSERT(cur_time >= 0 && cur_time <= Num_Times()); SMART_ASSERT(!(!nodal_vars.empty() && !results)); SMART_ASSERT(!(nodal_vars.empty() && results)); return 1; } -template std::string ExoII_Read::File_Name(const char *fname) +template std::string Exo_Read::File_Name(const char *fname) { SMART_ASSERT(Check_State()); @@ -937,7 +929,7 @@ template std::string ExoII_Read::File_Name(const char *fname return ""; } -template std::string ExoII_Read::Open_File(const char *fname) +template std::string Exo_Read::Open_File(const char *fname) { SMART_ASSERT(Check_State()); @@ -984,7 +976,7 @@ template std::string ExoII_Read::Open_File(const char *fname return ""; } -template void ExoII_Read::Get_Init_Data() +template void Exo_Read::Get_Init_Data() { SMART_ASSERT(Check_State()); SMART_ASSERT(file_id >= 0); @@ -1306,7 +1298,7 @@ template void ExoII_Read::Get_Init_Data() read_vars(file_id, EX_FACE_BLOCK, "Faceblock", num_face_vars, fb_vars); // Times: - num_times = ex_inquire_int(file_id, EX_INQ_TIME); + int num_times = ex_inquire_int(file_id, EX_INQ_TIME); if (num_times < 0) { Error(fmt::format("Number of time steps came back negative ({})! Aborting...\n", num_times)); } @@ -1319,9 +1311,8 @@ template void ExoII_Read::Get_Init_Data() } if (num_times) { - times = new double[num_times]; - SMART_ASSERT(times != nullptr); - ex_get_all_times(file_id, times); + times.resize(num_times); + ex_get_all_times(file_id, times.data()); if (time_scale != 1.0 || time_offset != 0.0) { for (int i = 0; i < num_times; i++) { times[i] = time_scale * times[i] + time_offset; @@ -1346,8 +1337,7 @@ template void ExoII_Read::Get_Init_Data() } // End of EXODIFF namespace { - void read_vars(int file_id, EXOTYPE flag, const char *type, int num_vars, - std::vector &varlist) + void read_vars(int file_id, EXOTYPE flag, const char *type, int num_vars, NameList &varlist) { if (num_vars != 0) { int name_size = ex_inquire_int(file_id, EX_INQ_MAX_READ_NAME_LENGTH); @@ -1388,5 +1378,5 @@ namespace { } } } // namespace -template class ExoII_Read; -template class ExoII_Read; +template class Exo_Read; +template class Exo_Read; diff --git a/packages/seacas/applications/exodiff/exoII_read.h b/packages/seacas/applications/exodiff/exo_read.h similarity index 68% rename from packages/seacas/applications/exodiff/exoII_read.h rename to packages/seacas/applications/exodiff/exo_read.h index fc423d057d72..bf2504feab4d 100644 --- a/packages/seacas/applications/exodiff/exoII_read.h +++ b/packages/seacas/applications/exodiff/exo_read.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -6,6 +6,7 @@ #pragma once #include "exo_entity.h" +#include "util.h" #include #include @@ -29,14 +30,14 @@ template class Edge_Block; template class Face_Block; template class Assembly; -template class ExoII_Read +template class Exo_Read { public: - ExoII_Read(); - explicit ExoII_Read(std::string fname); - virtual ~ExoII_Read(); - const ExoII_Read &operator=(const ExoII_Read &) = delete; - ExoII_Read(const ExoII_Read &) = delete; + Exo_Read(); + explicit Exo_Read(std::string fname); + virtual ~Exo_Read(); + const Exo_Read &operator=(const Exo_Read &) = delete; + Exo_Read(const Exo_Read &) = delete; // File operations: @@ -68,28 +69,27 @@ template class ExoII_Read size_t Num_Assembly() const { return num_assemblies; } // Times: - - int Num_Times() const { return num_times; } + int Num_Times() const { return (int)times.size(); } double Time(int time_num) const; // Variables: - size_t Num_Global_Vars() const { return global_vars.size(); } - size_t Num_Nodal_Vars() const { return nodal_vars.size(); } - size_t Num_Element_Vars() const { return elmt_vars.size(); } - size_t Num_Element_Atts() const { return elmt_atts.size(); } - size_t Num_NS_Vars() const { return ns_vars.size(); } - size_t Num_SS_Vars() const { return ss_vars.size(); } - size_t Num_EB_Vars() const { return eb_vars.size(); } - size_t Num_FB_Vars() const { return fb_vars.size(); } - const std::vector &Global_Var_Names() const { return global_vars; } - const std::vector &Nodal_Var_Names() const { return nodal_vars; } - const std::vector &Element_Var_Names() const { return elmt_vars; } - const std::vector &Element_Att_Names() const { return elmt_atts; } - const std::vector &NS_Var_Names() const { return ns_vars; } - const std::vector &SS_Var_Names() const { return ss_vars; } - const std::vector &EB_Var_Names() const { return eb_vars; } - const std::vector &FB_Var_Names() const { return fb_vars; } + size_t Num_Global_Vars() const { return global_vars.size(); } + size_t Num_Nodal_Vars() const { return nodal_vars.size(); } + size_t Num_Element_Vars() const { return elmt_vars.size(); } + size_t Num_Element_Atts() const { return elmt_atts.size(); } + size_t Num_NS_Vars() const { return ns_vars.size(); } + size_t Num_SS_Vars() const { return ss_vars.size(); } + size_t Num_EB_Vars() const { return eb_vars.size(); } + size_t Num_FB_Vars() const { return fb_vars.size(); } + const NameList &Global_Var_Names() const { return global_vars; } + const NameList &Nodal_Var_Names() const { return nodal_vars; } + const NameList &Element_Var_Names() const { return elmt_vars; } + const NameList &Element_Att_Names() const { return elmt_atts; } + const NameList &NS_Var_Names() const { return ns_vars; } + const NameList &SS_Var_Names() const { return ss_vars; } + const NameList &EB_Var_Names() const { return eb_vars; } + const NameList &FB_Var_Names() const { return fb_vars; } const std::string &Global_Var_Name(int index) const; const std::string &Nodal_Var_Name(int index) const; @@ -115,9 +115,8 @@ template class ExoII_Read std::string Load_Element_Map(); std::string Free_Element_Map(); const INT *Get_Element_Map() { return elmt_map; } - inline INT Node_Map(size_t node_num) const; // numbers are global, 1-offset - inline INT Element_Map(size_t elmt_num) const; // numbers are global, 1-offset - inline INT Element_Order(size_t elmt_num) const; // numbers are global, 1-offset + inline INT Node_Map(size_t node_num) const; // numbers are global, 1-offset + inline INT Element_Map(size_t elmt_num) const; // numbers are global, 1-offset // Nodal data: @@ -198,22 +197,22 @@ template class ExoII_Read // GENESIS info: - std::string title{}; - std::vector coord_names{}; - size_t num_nodes{0}; - int dimension{0}; - size_t num_elmts{0}; - size_t num_faces{0}; - size_t num_edges{0}; - size_t num_elmt_blocks{0}; - size_t num_node_sets{0}; - size_t num_side_sets{0}; - size_t num_edge_blocks{0}; - size_t num_face_blocks{0}; - size_t num_assemblies{0}; - float db_version{0.0}; - float api_version{0.0}; - int io_word_size{0}; // Note: The "compute word size" is always 8. + std::string title{}; + NameList coord_names{}; + size_t num_nodes{0}; + int dimension{0}; + size_t num_elmts{0}; + size_t num_faces{0}; + size_t num_edges{0}; + size_t num_elmt_blocks{0}; + size_t num_node_sets{0}; + size_t num_side_sets{0}; + size_t num_edge_blocks{0}; + size_t num_face_blocks{0}; + size_t num_assemblies{0}; + float db_version{0.0}; + float api_version{0.0}; + int io_word_size{0}; // Note: The "compute word size" is always 8. Exo_Block *eblocks{nullptr}; // Array. Node_Set *nsets{nullptr}; // Array. @@ -225,26 +224,27 @@ template class ExoII_Read double *nodes{nullptr}; // Matrix; dimension by num_nodes (row major form). // I.e., all x's then all y's, etc. - INT *node_map{nullptr}; // Array; num_nodes long when filled. - INT *elmt_map{nullptr}; // Array; num_elmts long when filled. - INT *elmt_order{nullptr}; // Array; num_elmts long when filled. + INT *node_map{nullptr}; // Array; num_nodes long when filled. + INT *elmt_map{nullptr}; // Array; num_elmts long when filled. // RESULTS info: - std::vector global_vars{}; - std::vector nodal_vars{}; - std::vector elmt_vars{}; - std::vector elmt_atts{}; - std::vector ns_vars{}; - std::vector ss_vars{}; - std::vector eb_vars{}; - std::vector fb_vars{}; + NameList global_vars{}; + NameList nodal_vars{}; + NameList elmt_vars{}; + NameList elmt_atts{}; + NameList ns_vars{}; + NameList ss_vars{}; + NameList eb_vars{}; + NameList fb_vars{}; + + std::vector change_set_ids{}; + NameList change_set_names{}; - int num_times{0}; double time_scale{1.0}; double time_offset{0.0}; - double *times{nullptr}; + std::vector times{}; int cur_time{0}; // Current timestep number of the results (0 means none). double **results{nullptr}; // Array of pointers (to arrays of results data); @@ -257,7 +257,7 @@ template class ExoII_Read void Get_Init_Data(); // Gets bunch of initial data. }; -template inline INT ExoII_Read::Node_Map(size_t node_num) const +template inline INT Exo_Read::Node_Map(size_t node_num) const { SMART_ASSERT(Check_State()); SMART_ASSERT(node_num <= num_nodes); @@ -268,7 +268,7 @@ template inline INT ExoII_Read::Node_Map(size_t node_num) co return 0; } -template inline INT ExoII_Read::Element_Map(size_t elmt_num) const +template inline INT Exo_Read::Element_Map(size_t elmt_num) const { SMART_ASSERT(Check_State()); SMART_ASSERT(elmt_num <= num_elmts); @@ -278,14 +278,3 @@ template inline INT ExoII_Read::Element_Map(size_t elmt_num) } return 0; } - -template inline INT ExoII_Read::Element_Order(size_t elmt_num) const -{ - SMART_ASSERT(Check_State()); - SMART_ASSERT(elmt_num <= num_elmts); - - if (elmt_order) { - return elmt_order[elmt_num - 1]; - } - return 0; -} diff --git a/packages/seacas/applications/exodiff/exodiff.C b/packages/seacas/applications/exodiff/exodiff.C index 5da26dca13ce..6ab3f4212bd3 100644 --- a/packages/seacas/applications/exodiff/exodiff.C +++ b/packages/seacas/applications/exodiff/exodiff.C @@ -23,8 +23,8 @@ #include "Norm.h" #include "Tolerance.h" #include "edge_block.h" -#include "exoII_read.h" #include "exo_block.h" +#include "exo_read.h" #include "exodiff.h" #include "exodusII.h" #include "face_block.h" @@ -95,17 +95,17 @@ void Print_Banner(const char *prefix) // different blocks. template -extern void Build_Variable_Names(ExoII_Read &file1, ExoII_Read &file2, bool *diff_found); +extern void Build_Variable_Names(Exo_Read &file1, Exo_Read &file2, bool *diff_found); -template extern bool Check_Global(ExoII_Read &file1, ExoII_Read &file2); +template extern bool Check_Global(Exo_Read &file1, Exo_Read &file2); template -extern void Check_Compatible_Meshes(ExoII_Read &file1, ExoII_Read &file2, bool check_only, +extern void Check_Compatible_Meshes(Exo_Read &file1, Exo_Read &file2, bool check_only, const std::vector &node_map, const std::vector &elmt_map, const INT *node_id_map); template -int Create_File(ExoII_Read &file1, ExoII_Read &file2, const std::string &diffile_name, +int Create_File(Exo_Read &file1, Exo_Read &file2, const std::string &diffile_name, bool *diff_found); double To_Double(const std::string &str_val); @@ -114,78 +114,78 @@ double FileDiff(double v1, double v2, ToleranceMode type); void Die_TS(double ts); -template size_t global_elmt_num(ExoII_Read &file, size_t b_idx, size_t e_idx); +template size_t global_elmt_num(Exo_Read &file, size_t b_idx, size_t e_idx); -template double Find_Min_Coord_Sep(ExoII_Read &file); +template double Find_Min_Coord_Sep(Exo_Read &file); int timeStepIsExcluded(int ts); template -const double *get_nodal_values(ExoII_Read &filen, int time_step, size_t idx, size_t fno, +const double *get_nodal_values(Exo_Read &filen, int time_step, size_t idx, size_t fno, const std::string &name, bool *diff_flag); template -const double *get_nodal_values(ExoII_Read &filen, const TimeInterp &t, size_t idx, size_t fno, +const double *get_nodal_values(Exo_Read &filen, const TimeInterp &t, size_t idx, size_t fno, const std::string &name, bool *diff_flag); template -void do_summaries(ExoII_Read &file, int time_step, std::vector &mm_glob, +void do_summaries(Exo_Read &file, int time_step, std::vector &mm_glob, std::vector &mm_node, std::vector &mm_elmt, std::vector &mm_ns, std::vector &mm_ss, std::vector &mm_eb, std::vector &mm_fb, const std::vector &elmt_map, bool *diff_flag); template -void do_diffs(ExoII_Read &file1, ExoII_Read &file2, int time_step1, const TimeInterp &t2, +void do_diffs(Exo_Read &file1, Exo_Read &file2, int time_step1, const TimeInterp &t2, int out_file_id, int output_step, const std::vector &node_map, const INT *node_id_map, const std::vector &elmt_map, const INT *elem_id_map, Exo_Block **blocks2, std::vector &var_vals, bool *diff_flag); template -bool summarize_globals(ExoII_Read &file, int step, std::vector &mm_glob); +bool summarize_globals(Exo_Read &file, int step, std::vector &mm_glob); template -bool summarize_nodals(ExoII_Read &file, int step, std::vector &mm_node); +bool summarize_nodals(Exo_Read &file, int step, std::vector &mm_node); template -bool summarize_element(ExoII_Read &file, int step, const std::vector &elmt_map, +bool summarize_element(Exo_Read &file, int step, const std::vector &elmt_map, std::vector &mm_elmt); template -bool summarize_nodeset(ExoII_Read &file, int step, std::vector &mm_ns); +bool summarize_nodeset(Exo_Read &file, int step, std::vector &mm_ns); template -bool summarize_sideset(ExoII_Read &file, int step, std::vector &mm_ss); +bool summarize_sideset(Exo_Read &file, int step, std::vector &mm_ss); template -bool summarize_edgeblock(ExoII_Read &file, int step, std::vector &mm_eb); +bool summarize_edgeblock(Exo_Read &file, int step, std::vector &mm_eb); template -bool summarize_faceblock(ExoII_Read &file, int step, std::vector &mm_fb); +bool summarize_faceblock(Exo_Read &file, int step, std::vector &mm_fb); template -bool diff_globals(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_globals(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, std::vector &gvals); template -bool diff_nodals(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_nodals(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const std::vector &node_map, const INT *id_map, std::vector &nvals); template -bool diff_element(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_element(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const std::vector &elmt_map, const INT *id_map, Exo_Block **blocks2, std::vector &evals); template -bool diff_element_attributes(ExoII_Read &file1, ExoII_Read &file2, +bool diff_element_attributes(Exo_Read &file1, Exo_Read &file2, const std::vector &elmt_map, const INT *id_map, Exo_Block **blocks2); template -bool diff_nodeset(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_nodeset(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const INT *id_map, std::vector &vals); template -bool diff_sideset(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_sideset(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const INT *id_map, std::vector &vals); template -bool diff_sideset_df(ExoII_Read &file1, ExoII_Read &file2, const INT *id_map); +bool diff_sideset_df(Exo_Read &file1, Exo_Read &file2, const INT *id_map); template -void output_summary(ExoII_Read &file1, MinMaxData &mm_time, std::vector &mm_glob, +void output_summary(Exo_Read &file1, MinMaxData &mm_time, std::vector &mm_glob, std::vector &mm_node, std::vector &mm_elmt, std::vector &mm_ns, std::vector &mm_ss, std::vector &mm_eb, std::vector &mm_fb, @@ -246,7 +246,7 @@ namespace { return size; } - template TimeInterp get_surrounding_times(double time, ExoII_Read &file) + template TimeInterp get_surrounding_times(double time, Exo_Read &file) { TimeInterp tprop; tprop.time = time; @@ -292,7 +292,7 @@ namespace { return tprop; } - template void output_init(ExoII_Read &file, int count, const char *prefix) + template void output_init(Exo_Read &file, int count, const char *prefix) { FileInfo fi(file.File_Name()); fmt::print( @@ -319,7 +319,7 @@ namespace { } } - template bool exodiff(ExoII_Read &file1, ExoII_Read &file2); + template bool exodiff(Exo_Read &file1, Exo_Read &file2); } // namespace int main(int argc, char *argv[]) @@ -388,16 +388,16 @@ int main(int argc, char *argv[]) bool diff_flag = true; if (int_size == 4) { // Open input files. - ExoII_Read file1(file1_name); + Exo_Read file1(file1_name); file1.modify_time_values(interFace.time_value_scale, interFace.time_value_offset); - ExoII_Read file2(file2_name); + Exo_Read file2(file2_name); diff_flag = exodiff(file1, file2); } else { // Open input files. - ExoII_Read file1(file1_name); - ExoII_Read file2(file2_name); + Exo_Read file1(file1_name); + Exo_Read file2(file2_name); diff_flag = exodiff(file1, file2); } #if 0 @@ -416,7 +416,7 @@ int main(int argc, char *argv[]) } namespace { - template bool exodiff(ExoII_Read &file1, ExoII_Read &file2) + template bool exodiff(Exo_Read &file1, Exo_Read &file2) { if (!interFace.quiet_flag && !interFace.summary_flag) { fmt::print("Reading first file ... \n"); @@ -1020,7 +1020,7 @@ void Die_TS(double ts) } } -template size_t global_elmt_num(ExoII_Read &file, size_t b_idx, size_t e_idx) +template size_t global_elmt_num(Exo_Read &file, size_t b_idx, size_t e_idx) { SMART_ASSERT(b_idx < file.Num_Element_Blocks()); @@ -1076,7 +1076,7 @@ bool Equal_Values(const double *values, size_t count, double *value) } template -const double *get_nodal_values(ExoII_Read &filen, int time_step, size_t idx, int fno, +const double *get_nodal_values(Exo_Read &filen, int time_step, size_t idx, int fno, const std::string &name, bool *diff_flag) { const double *vals = nullptr; @@ -1095,7 +1095,7 @@ const double *get_nodal_values(ExoII_Read &filen, int time_step, size_t idx } template -const double *get_nodal_values(ExoII_Read &filen, const TimeInterp &t, size_t idx, int fno, +const double *get_nodal_values(Exo_Read &filen, const TimeInterp &t, size_t idx, int fno, const std::string &name, bool *diff_flag) { const double *vals = nullptr; @@ -1113,7 +1113,7 @@ const double *get_nodal_values(ExoII_Read &filen, const TimeInterp &t, size } template -bool summarize_globals(ExoII_Read &file, int step, std::vector &mm_glob) +bool summarize_globals(Exo_Read &file, int step, std::vector &mm_glob) { bool diff_flag = false; if (interFace.glob_var_names.empty()) { @@ -1139,7 +1139,7 @@ bool summarize_globals(ExoII_Read &file, int step, std::vector } template -bool summarize_nodals(ExoII_Read &file, int step, std::vector &mm_node) +bool summarize_nodals(Exo_Read &file, int step, std::vector &mm_node) { bool diff_flag = false; for (unsigned n_idx = 0; n_idx < interFace.node_var_names.size(); ++n_idx) { @@ -1222,7 +1222,7 @@ const double *get_validated_variable(Exo_Entity *entity, const TimeInterp &t2, i } template -bool summarize_element(ExoII_Read &file, int step, const std::vector &elmt_map, +bool summarize_element(Exo_Read &file, int step, const std::vector &elmt_map, std::vector &mm_elmt) { bool diff_flag = false; @@ -1263,7 +1263,7 @@ bool summarize_element(ExoII_Read &file, int step, const std::vector & } template -bool summarize_nodeset(ExoII_Read &file, int step, std::vector &mm_ns) +bool summarize_nodeset(Exo_Read &file, int step, std::vector &mm_ns) { bool diff_flag = false; for (unsigned e_idx = 0; e_idx < interFace.ns_var_names.size(); ++e_idx) { @@ -1293,7 +1293,7 @@ bool summarize_nodeset(ExoII_Read &file, int step, std::vector } template -bool summarize_sideset(ExoII_Read &file, int step, std::vector &mm_ss) +bool summarize_sideset(Exo_Read &file, int step, std::vector &mm_ss) { bool diff_flag = false; for (unsigned e_idx = 0; e_idx < interFace.ss_var_names.size(); ++e_idx) { @@ -1323,7 +1323,7 @@ bool summarize_sideset(ExoII_Read &file, int step, std::vector } template -bool summarize_edgeblock(ExoII_Read &file, int step, std::vector &mm_eb) +bool summarize_edgeblock(Exo_Read &file, int step, std::vector &mm_eb) { bool diff_flag = false; for (unsigned e_idx = 0; e_idx < interFace.eb_var_names.size(); ++e_idx) { @@ -1354,7 +1354,7 @@ bool summarize_edgeblock(ExoII_Read &file, int step, std::vector -bool summarize_faceblock(ExoII_Read &file, int step, std::vector &mm_fb) +bool summarize_faceblock(Exo_Read &file, int step, std::vector &mm_fb) { bool diff_flag = false; for (unsigned f_idx = 0; f_idx < interFace.fb_var_names.size(); ++f_idx) { @@ -1385,7 +1385,7 @@ bool summarize_faceblock(ExoII_Read &file, int step, std::vector -void do_diffs(ExoII_Read &file1, ExoII_Read &file2, int time_step1, const TimeInterp &t2, +void do_diffs(Exo_Read &file1, Exo_Read &file2, int time_step1, const TimeInterp &t2, int out_file_id, int output_step, const std::vector &node_map, const INT *node_id_map, const std::vector &elmt_map, const INT *elem_id_map, Exo_Block **blocks2, std::vector &var_vals, bool *diff_flag) @@ -1442,7 +1442,7 @@ void do_diffs(ExoII_Read &file1, ExoII_Read &file2, int time_step1, co } template -void do_summaries(ExoII_Read &file, int time_step, std::vector &mm_glob, +void do_summaries(Exo_Read &file, int time_step, std::vector &mm_glob, std::vector &mm_node, std::vector &mm_elmt, std::vector &mm_ns, std::vector &mm_ss, std::vector &mm_eb, std::vector &mm_fb, @@ -1489,7 +1489,7 @@ void output_norms(Norm &norm, const std::string &name) } template -bool diff_globals(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_globals(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, std::vector &gvals) { bool diff_flag = false; @@ -1570,7 +1570,7 @@ bool diff_globals(ExoII_Read &file1, ExoII_Read &file2, int step1, con } template -bool diff_nodals(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_nodals(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const std::vector &node_map, const INT *id_map, std::vector &nvals) { @@ -1700,7 +1700,7 @@ bool diff_nodals(ExoII_Read &file1, ExoII_Read &file2, int step1, cons } template -bool diff_element(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_element(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const std::vector &elmt_map, const INT *id_map, Exo_Block **blocks2, std::vector &evals) { @@ -1886,7 +1886,7 @@ bool diff_element(ExoII_Read &file1, ExoII_Read &file2, int step1, con } template -bool diff_nodeset(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_nodeset(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const INT *id_map, std::vector &vals) { bool diff_flag = false; @@ -1995,7 +1995,7 @@ bool diff_nodeset(ExoII_Read &file1, ExoII_Read &file2, int step1, con } template -bool diff_sideset(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_sideset(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const INT *id_map, std::vector &vals) { bool diff_flag = false; @@ -2107,7 +2107,7 @@ bool diff_sideset(ExoII_Read &file1, ExoII_Read &file2, int step1, con } template -bool diff_sideset_df(ExoII_Read &file1, ExoII_Read &file2, const INT *id_map) +bool diff_sideset_df(Exo_Read &file1, Exo_Read &file2, const INT *id_map) { bool diff_flag = false; @@ -2251,7 +2251,7 @@ bool diff_sideset_df(ExoII_Read &file1, ExoII_Read &file2, const INT * } template -bool diff_edgeblock(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_edgeblock(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const INT * /* id_map */, std::vector &vals) { @@ -2361,7 +2361,7 @@ bool diff_edgeblock(ExoII_Read &file1, ExoII_Read &file2, int step1, c } template -bool diff_faceblock(ExoII_Read &file1, ExoII_Read &file2, int step1, const TimeInterp &t2, +bool diff_faceblock(Exo_Read &file1, Exo_Read &file2, int step1, const TimeInterp &t2, int out_file_id, int output_step, const INT * /* id_map */, std::vector &vals) { @@ -2470,7 +2470,7 @@ bool diff_faceblock(ExoII_Read &file1, ExoII_Read &file2, int step1, c } template -bool diff_element_attributes(ExoII_Read &file1, ExoII_Read &file2, +bool diff_element_attributes(Exo_Read &file1, Exo_Read &file2, const std::vector & /*elmt_map*/, const INT *id_map, Exo_Block ** /*blocks2*/) { @@ -2615,7 +2615,7 @@ bool diff_element_attributes(ExoII_Read &file1, ExoII_Read &f } template -void output_summary(ExoII_Read &file1, MinMaxData &mm_time, std::vector &mm_glob, +void output_summary(Exo_Read &file1, MinMaxData &mm_time, std::vector &mm_glob, std::vector &mm_node, std::vector &mm_elmt, std::vector &mm_ns, std::vector &mm_ss, std::vector &mm_eb, std::vector &mm_fb, diff --git a/packages/seacas/applications/exodiff/face_block.C b/packages/seacas/applications/exodiff/face_block.C index d8d8b7a21f7e..ed1d6ebe2310 100644 --- a/packages/seacas/applications/exodiff/face_block.C +++ b/packages/seacas/applications/exodiff/face_block.C @@ -50,11 +50,12 @@ template void Face_Block::entity_load_params() if (num_faces_per_elmt < 0 || num_attr < 0) { Error(fmt::format( - fmt::runtime("Face_Block::entity_load_params(): Data appears corrupt for face block {}!\n" - "\tnum elmts = {}\n" - "\tnum faces per elmt = {}\n" - "\tnum attributes = {}\n" - " ... Aborting...\n"), + fmt::runtime( + "Face_Block::entity_load_params(): Data appears corrupt for face block {}!\n" + "\tnum elmts = {}\n" + "\tnum faces per elmt = {}\n" + "\tnum attributes = {}\n" + " ... Aborting...\n"), fmt::group_digits(numEntity), num_faces_per_elmt, num_attr)); } } diff --git a/packages/seacas/applications/exodiff/face_block.h b/packages/seacas/applications/exodiff/face_block.h index 9d7e4804b61b..6e0fe94d17a4 100644 --- a/packages/seacas/applications/exodiff/face_block.h +++ b/packages/seacas/applications/exodiff/face_block.h @@ -8,7 +8,7 @@ #include "exo_entity.h" #include -template class ExoII_Read; +template class Exo_Read; template class Face_Block : public Exo_Entity { @@ -33,5 +33,5 @@ template class Face_Block : public Exo_Entity std::string elmt_type{}; int num_faces_per_elmt{-1}; - friend class ExoII_Read; + friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/map.C b/packages/seacas/applications/exodiff/map.C index 62b872ccc7c5..207c6b0ae8f2 100644 --- a/packages/seacas/applications/exodiff/map.C +++ b/packages/seacas/applications/exodiff/map.C @@ -12,8 +12,8 @@ #include "ED_SystemInterface.h" #include "Tolerance.h" -#include "exoII_read.h" #include "exo_block.h" +#include "exo_read.h" #include "fmt/ostream.h" #include "iqsort.h" #include "smart_assert.h" @@ -28,12 +28,12 @@ namespace { const std::vector &id, int dim, bool ignore_dups); template - void Compute_Node_Map(std::vector &node_map, ExoII_Read &file1, ExoII_Read &file2); + void Compute_Node_Map(std::vector &node_map, Exo_Read &file1, Exo_Read &file2); } // namespace template -void Compute_Maps(std::vector &node_map, std::vector &elmt_map, ExoII_Read &file1, - ExoII_Read &file2) +void Compute_Maps(std::vector &node_map, std::vector &elmt_map, Exo_Read &file1, + Exo_Read &file2) { SMART_ASSERT(file1.Open()); SMART_ASSERT(file2.Open()); @@ -313,7 +313,7 @@ void Compute_Maps(std::vector &node_map, std::vector &elmt_map, ExoII_ template void Compute_Partial_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2) + Exo_Read &file1, Exo_Read &file2) { SMART_ASSERT(file1.Open()); SMART_ASSERT(file2.Open()); @@ -637,7 +637,7 @@ namespace { template void Compute_FileId_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2) + Exo_Read &file1, Exo_Read &file2) { // Compute map of nodes and elements in file1 to nodes and elements in file2 // Use the internal exodus node and element number maps in file1 and file2 to @@ -679,7 +679,7 @@ void Compute_FileId_Maps(std::vector &node_map, std::vector &elmt_map, template void Dump_Maps(const std::vector &node_map, const std::vector &elmt_map, - ExoII_Read &file1) + Exo_Read &file1) { size_t ijk; fmt::print("\n=== node number map (file1 -> file2) local ids\n"); @@ -724,7 +724,7 @@ void Dump_Maps(const std::vector &node_map, const std::vector &elmt_ma namespace { template - void Compute_Node_Map(std::vector &node_map, ExoII_Read &file1, ExoII_Read &file2) + void Compute_Node_Map(std::vector &node_map, Exo_Read &file1, Exo_Read &file2) { // This function is called if and only if there are nodes that were // not matched in the Compute_Map function. This is typically the @@ -935,7 +935,7 @@ namespace { } } // namespace -template double Find_Min_Coord_Sep(ExoII_Read &file) +template double Find_Min_Coord_Sep(Exo_Read &file) { size_t num_nodes = file.Num_Nodes(); if (num_nodes < 2) { @@ -1083,7 +1083,7 @@ bool Compare_Maps_Internal(const std::vector &entity_map, bool partial_flag } template -bool Compare_Maps(ExoII_Read &file1, ExoII_Read &file2, const std::vector &node_map, +bool Compare_Maps(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, const std::vector &elmt_map, bool partial_flag) { // Check whether the node and element number maps from both file1 @@ -1124,29 +1124,29 @@ bool Compare_Maps(ExoII_Read &file1, ExoII_Read &file2, const std::vec } template void Compute_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); -template bool Compare_Maps(ExoII_Read &file1, ExoII_Read &file2, + Exo_Read &file1, Exo_Read &file2); +template bool Compare_Maps(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, const std::vector &elmt_map, bool partial_flag); template void Compute_Partial_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); + Exo_Read &file1, Exo_Read &file2); template void Compute_FileId_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); + Exo_Read &file1, Exo_Read &file2); template void Dump_Maps(const std::vector &node_map, const std::vector &elmt_map, - ExoII_Read &file1); -template double Find_Min_Coord_Sep(ExoII_Read &file); + Exo_Read &file1); +template double Find_Min_Coord_Sep(Exo_Read &file); template void Compute_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); -template bool Compare_Maps(ExoII_Read &file1, ExoII_Read &file2, + Exo_Read &file1, Exo_Read &file2); +template bool Compare_Maps(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, const std::vector &elmt_map, bool partial_flag); template void Compute_Partial_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); + Exo_Read &file1, Exo_Read &file2); template void Compute_FileId_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); + Exo_Read &file1, Exo_Read &file2); template void Dump_Maps(const std::vector &node_map, const std::vector &elmt_map, - ExoII_Read &file1); -template double Find_Min_Coord_Sep(ExoII_Read &file); + Exo_Read &file1); +template double Find_Min_Coord_Sep(Exo_Read &file); diff --git a/packages/seacas/applications/exodiff/map.h b/packages/seacas/applications/exodiff/map.h index 3fb92b77c0cd..99d69a53f619 100644 --- a/packages/seacas/applications/exodiff/map.h +++ b/packages/seacas/applications/exodiff/map.h @@ -4,30 +4,30 @@ // // See packages/seacas/LICENSE for details #pragma once -#include "exoII_read.h" +#include "exo_read.h" enum class MapType { FILE_ORDER = 0, PARTIAL, USE_FILE_IDS, DISTANCE }; template -void Compute_Maps(std::vector &node_map, std::vector &elmt_map, ExoII_Read &file1, - ExoII_Read &file2); +void Compute_Maps(std::vector &node_map, std::vector &elmt_map, Exo_Read &file1, + Exo_Read &file2); template void Compute_Partial_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); + Exo_Read &file1, Exo_Read &file2); template void Compute_FileId_Maps(std::vector &node_map, std::vector &elmt_map, - ExoII_Read &file1, ExoII_Read &file2); + Exo_Read &file1, Exo_Read &file2); template void Dump_Maps(const std::vector &node_map, const std::vector &elmt_map, - ExoII_Read &file1); + Exo_Read &file1); template bool Check_Maps(const std::vector &node_map, const std::vector &elmt_map, - const ExoII_Read &file1, const ExoII_Read &file2); + const Exo_Read &file1, const Exo_Read &file2); template -bool Compare_Maps(ExoII_Read &file1, ExoII_Read &file2, const std::vector &node_map, +bool Compare_Maps(Exo_Read &file1, Exo_Read &file2, const std::vector &node_map, const std::vector &elmt_map, bool partial_flag); diff --git a/packages/seacas/applications/exodiff/node_set.h b/packages/seacas/applications/exodiff/node_set.h index cd7a56b5896d..1a6203c008ec 100644 --- a/packages/seacas/applications/exodiff/node_set.h +++ b/packages/seacas/applications/exodiff/node_set.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -6,9 +6,9 @@ #pragma once #include "exo_entity.h" -#include "side_set.h" // for Side_Set +#include "util.h" -template class ExoII_Read; +template class Exo_Read; template class Node_Set : public Exo_Entity { @@ -45,5 +45,5 @@ template class Node_Set : public Exo_Entity mutable INT *nodeIndex{nullptr}; // An index array which orders the nodelist in sorted order. mutable double *dist_factors{nullptr}; // Array. - friend class ExoII_Read; + friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/side_set.h b/packages/seacas/applications/exodiff/side_set.h index 27ce8c3b07a8..25925b8fb801 100644 --- a/packages/seacas/applications/exodiff/side_set.h +++ b/packages/seacas/applications/exodiff/side_set.h @@ -8,7 +8,7 @@ #include "exo_entity.h" #include -template class ExoII_Read; +template class Exo_Read; template class Side_Set : public Exo_Entity { @@ -50,5 +50,5 @@ template class Side_Set : public Exo_Entity mutable INT *dfIndex{nullptr}; mutable double *dist_factors{nullptr}; - friend class ExoII_Read; + friend class Exo_Read; }; diff --git a/packages/seacas/applications/exodiff/stringx.C b/packages/seacas/applications/exodiff/stringx.C index a3a366fdbfce..70e699ef1591 100644 --- a/packages/seacas/applications/exodiff/stringx.C +++ b/packages/seacas/applications/exodiff/stringx.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -6,6 +6,7 @@ #include "smart_assert.h" // for SMART_ASSERT #include "stringx.h" + #include // for tolower, isspace #include // for strspn, strcspn #include // for string, operator== @@ -151,7 +152,7 @@ int count_tokens(const std::string &s, const char *delimiters) return 0; } -int max_string_length(const std::vector &names) +int max_string_length(const NameList &names) { if (names.empty()) { return 0; @@ -182,7 +183,7 @@ char first_character(const std::string &s) return 0; } -int find_string(const std::vector &lst, const std::string &s, bool nocase) +int find_string(const NameList &lst, const std::string &s, bool nocase) { if (nocase) { for (unsigned i = 0; i < lst.size(); ++i) { diff --git a/packages/seacas/applications/exodiff/stringx.h b/packages/seacas/applications/exodiff/stringx.h index f624bb76a31d..0bd980286dd5 100644 --- a/packages/seacas/applications/exodiff/stringx.h +++ b/packages/seacas/applications/exodiff/stringx.h @@ -1,10 +1,11 @@ -// Copyright(C) 1999-2022 National Technology & Engineering Solutions +// Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // // See packages/seacas/LICENSE for details #pragma once +#include "util.h" #include #include @@ -30,7 +31,7 @@ std::string extract_token(std::string &s, const char *delimiters = " \t\n\r"); int count_tokens(const std::string &s, const char *delimiters = " \t\n\r"); //! Runs each string in the vector and returns the maximum size. -int max_string_length(const std::vector &names); +int max_string_length(const NameList &names); //! Replaces each character of the string with its lower case equivalent. void to_lower(std::string &s); @@ -42,4 +43,4 @@ char first_character(const std::string &s); //! Searches the list of strings for a particular string value. Letter case //! will be ignored if the last argument is true. Returns the index of the //! string in the vector if found, otherwise returns -1. -int find_string(const std::vector &lst, const std::string &s, bool nocase); +int find_string(const NameList &lst, const std::string &s, bool nocase); diff --git a/packages/seacas/applications/exodiff/util.h b/packages/seacas/applications/exodiff/util.h index fd25ed12f1ca..b34861081225 100644 --- a/packages/seacas/applications/exodiff/util.h +++ b/packages/seacas/applications/exodiff/util.h @@ -11,6 +11,8 @@ #include #include +using NameList = std::vector; + int name_length(); char **get_name_array(int size, int length); void free_name_array(char **names, int size); diff --git a/packages/seacas/applications/exomatlab/exomatlab.C b/packages/seacas/applications/exomatlab/exomatlab.C index 5afd22d83557..ddc61e4eb652 100644 --- a/packages/seacas/applications/exomatlab/exomatlab.C +++ b/packages/seacas/applications/exomatlab/exomatlab.C @@ -51,7 +51,7 @@ namespace { // ======================================================================== namespace { - std::string codename; + std::string codename; } // namespace int main(int argc, char *argv[]) diff --git a/packages/seacas/applications/explore/CMakeLists.txt b/packages/seacas/applications/explore/CMakeLists.txt index fe46e26a2b84..2818c9fc49b3 100644 --- a/packages/seacas/applications/explore/CMakeLists.txt +++ b/packages/seacas/applications/explore/CMakeLists.txt @@ -26,7 +26,7 @@ TRIBITS_ADD_EXECUTABLE( if (explore_added) if (${CMAKE_PROJECT_NAME} STREQUAL "Seacas") - InstallSymLink(explore ${CMAKE_INSTALL_PREFIX}/bin/grope) + InstallSymLink(explore ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/grope) endif() endif() diff --git a/packages/seacas/applications/explore/exp_comand.f b/packages/seacas/applications/explore/exp_comand.f index d9ce8cb28845..0324234b2ac9 100644 --- a/packages/seacas/applications/explore/exp_comand.f +++ b/packages/seacas/applications/explore/exp_comand.f @@ -170,7 +170,7 @@ SUBROUTINE COMAND (A, IA, EXODUS, DBNAME, QAREC, INFO, 4 'GVARS ', 'NVARS ', 'EVARS ', 'NSVARS ', 'SSVARS ', 5 ' ' / DATA LISTBL / - 1 'TITLE ', 'VARS ', 'QAINFO ', 'QA', 'INFORMATION', + 1 'TITLE ', 'VARS ', 'QAINFO ', 'QA', 'INFORMATION', 2 'COORDINA', 'MAP ', 'NMAP ', 'NODEMAP ', 3 'BLOCKS ', 'MATERIAL', 'LINK ', 'CONNECTI', 'ATTRIBUT', 4 'NSETS ', 'NNODES ', 'NFACTORS', 'INVCON ', diff --git a/packages/seacas/applications/explore/exp_dbsbel.f b/packages/seacas/applications/explore/exp_dbsbel.f index 7fdf59d59a0f..4f4895fa170f 100644 --- a/packages/seacas/applications/explore/exp_dbsbel.f +++ b/packages/seacas/applications/explore/exp_dbsbel.f @@ -1,7 +1,7 @@ -C Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. -C +C C See packages/seacas/LICENSE for details C======================================================================= SUBROUTINE DBSBEL (NELBLK, NUMEL, LENE, INEL, NLISEL, LISEL, ADD) diff --git a/packages/seacas/applications/explore/exp_preb1.f b/packages/seacas/applications/explore/exp_preb1.f index a2eb8706e121..9a20654fbec9 100644 --- a/packages/seacas/applications/explore/exp_preb1.f +++ b/packages/seacas/applications/explore/exp_preb1.f @@ -1,7 +1,7 @@ -C Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. -C +C C See packages/seacas/LICENSE for details C======================================================================= SUBROUTINE PREB1 (OPTION, NOUT, IEL0, NLISEL, LISEL, @@ -157,9 +157,9 @@ SUBROUTINE PREB1 (OPTION, NOUT, IEL0, NLISEL, LISEL, end do end if end if - + RETURN - + 10000 FORMAT (1X, ' Blk Index Global ID ', A, ' ', A) 10001 FORMAT (1X, ' Blk Index Local ID ', A, ' ', A) 10010 FORMAT (1X, I11, I11, 5X, 8I11, :, /, diff --git a/packages/seacas/applications/explore/exp_prelem.f b/packages/seacas/applications/explore/exp_prelem.f index 8d1b17ebf30d..49601e03a741 100644 --- a/packages/seacas/applications/explore/exp_prelem.f +++ b/packages/seacas/applications/explore/exp_prelem.f @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -75,7 +75,7 @@ SUBROUTINE PRELEM (OPTION, NOUT, IF (NLISEL(IELB) .GT. 0) THEN IX0 = LENE(IELB-1) - IXB = LENE(IELB) - LENE(IELB-1) + IXB = LENE(IELB) - LENE(IELB-1) DO IX = 1, IXB IEL = LISEL(IX0+IX) IF (iel .eq. 0) cycle diff --git a/packages/seacas/applications/explore/exp_rmixint.f b/packages/seacas/applications/explore/exp_rmixint.f index e124532300b8..c9ce38b65996 100644 --- a/packages/seacas/applications/explore/exp_rmixint.f +++ b/packages/seacas/applications/explore/exp_rmixint.f @@ -1,7 +1,7 @@ -C Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. -C +C C See packages/seacas/LICENSE for details C======================================================================= diff --git a/packages/seacas/applications/gjoin/gj_munnps.f b/packages/seacas/applications/gjoin/gj_munnps.f index 42db35fd468c..8111bd191299 100644 --- a/packages/seacas/applications/gjoin/gj_munnps.f +++ b/packages/seacas/applications/gjoin/gj_munnps.f @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -51,7 +51,7 @@ SUBROUTINE MUNNPS (NUMNPS, ISTAT, LNPSNL, INTEGER NODSCR(*) character*(namlen) namns(*) character*(namlen) namsc(*) - + IF (NUMNPS .LE. 0) RETURN JNPS = 0 diff --git a/packages/seacas/applications/grepos/gp_attrot.blk b/packages/seacas/applications/grepos/gp_attrot.blk index 66821cdd46ff..4c2c0cc211a6 100644 --- a/packages/seacas/applications/grepos/gp_attrot.blk +++ b/packages/seacas/applications/grepos/gp_attrot.blk @@ -1,11 +1,11 @@ -C Copyright(C) 1999-2020 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C C See packages/seacas/LICENSE for details C -*- Mode: fortran -*- - COMMON /ATTROT/ ATTIND, ATTBLK, + COMMON /ATTROT/ ATTIND, ATTBLK, * ROTATT(3,3), REVATT, ROTALL, ROTTYP INTEGER ATTBLK, ATTIND LOGICAL REVATT diff --git a/packages/seacas/applications/grepos/gp_mapvar.f b/packages/seacas/applications/grepos/gp_mapvar.f index d55dd4d39152..6abb7e341edb 100644 --- a/packages/seacas/applications/grepos/gp_mapvar.f +++ b/packages/seacas/applications/grepos/gp_mapvar.f @@ -46,7 +46,7 @@ subroutine mapvar(nold, nnew, nvar, map, vars, scr) if (isseq) then return end if - + do 30 ivar = 1, nvar do 10 i = 1, nnew scr(i) = vars(map(i) + nold * (ivar-1) ) diff --git a/packages/seacas/applications/mapvar-kd/mapvar-kd.f b/packages/seacas/applications/mapvar-kd/mapvar-kd.f index 48e1f183f3a7..122c16880f63 100644 --- a/packages/seacas/applications/mapvar-kd/mapvar-kd.f +++ b/packages/seacas/applications/mapvar-kd/mapvar-kd.f @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -516,7 +516,7 @@ PROGRAM MAPVAR ICOMPL = 1 IF (IM .GT. 1)THEN C ... Get the block b id from the previous time through... -C `IA(NMAP)` is the root of the `MP(1:3,1:MBLK)` array. +C `IA(NMAP)` is the root of the `MP(1:3,1:MBLK)` array. C ida idb isc ida ida idb isc C Memory ordering (1,1), (2,1), (3,1), (1,2), (2,2), (3,2), ..., (3,3)- C +0 +1 +2 +3 +4 +5 diff --git a/packages/seacas/applications/mapvar/mapvar.f b/packages/seacas/applications/mapvar/mapvar.f index f8d2ca255009..53117046c42a 100644 --- a/packages/seacas/applications/mapvar/mapvar.f +++ b/packages/seacas/applications/mapvar/mapvar.f @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -638,7 +638,7 @@ PROGRAM MAPVAR ICOMPL = 1 IF (IM .GT. 1)THEN C ... Get the block b id from the previous time through... -C `IA(NMAP)` is the root of the `MP(1:3,1:MBLK)` array. +C `IA(NMAP)` is the root of the `MP(1:3,1:MBLK)` array. C ida idb isc ida ida idb isc C Memory ordering (1,1), (2,1), (3,1), (1,2), (2,2), (3,2), ..., (3,3)- C +0 +1 +2 +3 +4 +5 diff --git a/packages/seacas/applications/nem_slice/elb.h b/packages/seacas/applications/nem_slice/elb.h index 6255820f5106..77c42a993f86 100644 --- a/packages/seacas/applications/nem_slice/elb.h +++ b/packages/seacas/applications/nem_slice/elb.h @@ -14,16 +14,11 @@ #include #include -#define ELB_VERSION "5.04 (2024/08/19)" +#define ELB_VERSION "5.04 (2024-10-02)" #define UTIL_NAME "nem_slice" #define ELB_FALSE 0 #define ELB_TRUE 1 -/* Macro for maximum value */ -#ifndef MAX -#define MAX(x, y) (((x) > (y)) ? (x) : (y)) -#endif - /* * Constants for memory allocation of graph structures. The smaller these * values, the more memory-efficient the code will be. Larger values @@ -53,28 +48,52 @@ template void vec_free(std::vector &V) /* Prototype for timing function */ extern double get_time(); +/* Machine types */ +enum class MachineType { INVALID, MESH, HCUBE, HYPERCUBE, CLUSTER }; + /* Structure used for the description of the machine for which the * load balance is to be constructed. */ struct Machine_Description { - int type{-1}; - int num_dims{-1}; - int dim[3]{}; - int num_boxes{-1}; /* added for cluster type machines */ - int procs_per_box{-1}; /* added for cluster type machines, if there is only - one box, then this is the same as num_procs */ + MachineType type{MachineType::INVALID}; + int num_dims{-1}; + int dim[3]{-1, -1, -1}; + int num_boxes{-1}; /* added for cluster type machines */ + int procs_per_box{-1}; /* added for cluster type machines, if there is only + one box, then this is the same as num_procs */ int num_procs{-1}; +}; - Machine_Description() { dim[0] = dim[1] = dim[2] = -1; } +/* Load balance types */ +enum class Balance { + INVALID, + MULTIKL, + SPECTRAL, + INERTIAL, + LINEAR, + RANDOM, + SCATTERED, + INFILE, + KL_REFINE, + NO_REFINE, + NUM_SECTS, + CNCT_DOM, + OUTFILE, + ZPINCH, + BRICK, + ZOLTAN_RCB, + ZOLTAN_RIB, + ZOLTAN_HSFC, + IGNORE_Z }; /* Structure used for the description of what type of load balance is * to be performed. */ template struct LB_Description { - int type{-1}; + Balance type{-1}; int ignore_z{0}; - int refine{-1}; + Balance refine{-1}; int num_sects{-1}; int cnctd_dom{-1}; int outfile{-1}; @@ -97,22 +116,22 @@ template struct LB_Description std::vector> e_cmap_sides{}; std::vector> e_cmap_procs{}; std::vector> e_cmap_neigh{}; - - LB_Description() = default; }; +enum class DecompType { NODAL, ELEMENTAL }; + /* Structure for the problem description. */ struct Problem_Description { - int type{-1}; - int read_coords{-1}; - int coarse_flag{-1}; - int alloc_graph{-1}; - size_t num_vertices{0}; - int vis_out{-1}; - int skip_checks{-1}; /* put in to skip some error checks for some meshes */ - int face_adj{-1}; /* true if using face definition of adjacencies */ - int partial_adj{0}; /* true if allowing partial (3/4) of nodes to */ + DecompType type{-1}; + int read_coords{-1}; + int coarse_flag{-1}; + int alloc_graph{-1}; + size_t num_vertices{0}; + int vis_out{-1}; + int skip_checks{-1}; /* put in to skip some error checks for some meshes */ + int face_adj{-1}; /* true if using face definition of adjacencies */ + int partial_adj{0}; /* true if allowing partial (3/4) of nodes to */ /* determine adjacencies */ int global_mech{-1}; /* true if looking for mechanisms in original mesh */ int local_mech{-1}; /* true if looking for mechanisms in subdivided mesh */ @@ -126,20 +145,30 @@ struct Problem_Description int num_groups{-1}; int int64db{0}; /* integer types for output mesh database */ int int64api{0}; /* integer types for exodus api calls */ - - Problem_Description() = default; }; +/* Solver options */ +enum class SolverOptions { INVALID, TOLER, USE_RQI, VMAX }; + /* Structure for parameters needed for the Eigensolver in Chaco */ struct Solver_Description { - double tolerance{-1.0}; - int rqi_flag{-1}; - int vmax{-1}; - - Solver_Description() = default; + double tolerance{-1.0}; + SolverOptions rqi_flag{SolverOptions::INVALID}; + int vmax{-1}; }; +/* Weighting options */ +/* + * NOTE: the position of NO_WEIGHT, READ_EXO, EL_BLK, and EWGT_ON + * should not be changed. These are the possible values for the + * "type" variable in the Weight struct. They need to b 0, 1, 2, & 4 + * to allow bit masking for the type. The other variables are not + * currently used in the type, but are needed since they appear + * on the command line. + */ +enum WeightingOptions { NO_WEIGHT, READ_EXO, EL_BLK, VAR_INDX, EDGE_WGT, TIME_INDX, VAR_NAME }; + /* Structure used to store information about the weighting scheme, if * any, that is to be used. */ struct Weight_Description @@ -165,31 +194,27 @@ struct Weight_Description std::vector vertices{}; std::vector edges{}; - - Weight_Description() = default; }; /* Structure used to store information about the FEM mesh */ template struct Mesh_Description { - size_t num_nodes{0}; - size_t num_elems{0}; - size_t num_dims{0}; - size_t num_el_blks{0}; - std::vector eb_cnts{}; - std::vector eb_ids{}; - std::vector eb_npe{}; - std::vector eb_type{}; - size_t num_node_sets{0}; - size_t num_side_sets{0}; - size_t max_np_elem{0}; - size_t ns_list_len{0}; - char title[MAX_LINE_LENGTH + 1]{}; - std::vector coords{}; - std::vector elem_type{}; - INT **connect; - - Mesh_Description() : connect(nullptr) {} + size_t num_nodes{0}; + size_t num_elems{0}; + size_t num_dims{0}; + size_t num_el_blks{0}; + std::vector eb_cnts{}; + std::vector eb_ids{}; + std::vector eb_npe{}; + std::vector eb_type{}; + size_t num_node_sets{0}; + size_t num_side_sets{0}; + size_t max_np_elem{0}; + size_t ns_list_len{0}; + char title[MAX_LINE_LENGTH + 1]{}; + std::vector coords{}; + std::vector elem_type{}; + INT **connect{nullptr}; }; /* Structure for handling meshes with spheres */ @@ -199,8 +224,6 @@ struct Sphere_Info std::vector adjust{}; std::vector begin{}; std::vector end{}; - - Sphere_Info() = default; }; /* Structure used to store various information about the graph */ @@ -211,52 +234,11 @@ template struct Graph_Description std::vector adj{}; std::vector start{}; std::vector> sur_elem; - Graph_Description() = default; }; /* Various constants */ -enum DecompType { NODAL, ELEMENTAL }; #define UTIL_NAME "nem_slice" -/* Load balance types */ -enum Balance { - MULTIKL, - SPECTRAL, - INERTIAL, - LINEAR, - RANDOM, - SCATTERED, - INFILE, - KL_REFINE, - NO_REFINE, - NUM_SECTS, - CNCT_DOM, - OUTFILE, - ZPINCH, - BRICK, - ZOLTAN_RCB, - ZOLTAN_RIB, - ZOLTAN_HSFC, - IGNORE_Z -}; - -/* Machine types */ -enum MachineType { MESH, HCUBE, HYPERCUBE, CLUSTER }; - -/* Solver options */ -enum SolverOptions { TOLER, USE_RQI, VMAX }; - /* ISSUES options */ -enum Issues { LOCAL_ISSUES, GLOBAL_ISSUES }; - -/* Weighting options */ -/* - * NOTE: the position of NO_WEIGHT, READ_EXO, EL_BLK, and EWGT_ON - * should not be changed. These are the possible values for the - * "type" variable in the Weight struct. They need to b 0, 1, 2, & 4 - * to allow bit masking for the type. The other variables are not - * currently used in the type, but are needed since they appear - * on the command line. - */ -enum WeightingOptions { NO_WEIGHT, READ_EXO, EL_BLK, VAR_INDX, EDGE_WGT, TIME_INDX, VAR_NAME }; +enum class Issues { LOCAL_ISSUES, GLOBAL_ISSUES }; diff --git a/packages/seacas/applications/nem_slice/elb_elem.C b/packages/seacas/applications/nem_slice/elb_elem.C index f706c25dee7b..d7affc06fe49 100644 --- a/packages/seacas/applications/nem_slice/elb_elem.C +++ b/packages/seacas/applications/nem_slice/elb_elem.C @@ -38,32 +38,32 @@ namespace { * Need the number of dimensions in order to distinguish between * TRI elements in a 2d mesh from TRI elements in a 3d mesh. *****************************************************************************/ -const char *elem_name_from_enum(const E_Type elem_type) +const char *elem_name_from_enum(const ElementType elem_type) { - static const char *elem_names[NULL_EL] = { + static const char *elem_names[(int)ElementType::NULL_EL] = { "SPHERE", "BAR2", "BAR3", "QUAD4", "QUAD8", "QUAD9", "SHELL4", "SHELL8", "SHELL9", "TRI3", "TRI4", "TRI6", "TRI7", "TSHELL3", "TSHELL4", "TSHELL6", "TSHELL7", "HEX8", "HEX16", "HEX20", "HEX27", "HEXSHELL", "TET4", "TET10", "TET8", "TET14", "TET15", "WEDGE6", "WEDGE12", "WEDGE15", "WEDGE16", "WEDGE20", "WEDGE21", "PYRAMID5", "PYRAMID13", - "PYRAMID14", "PYRAMID18", "PYRAMID19", "SHELL2", "SHELL3"}; - return elem_names[elem_type]; + "PYRAMID14", "PYRAMID18", "PYRAMID19", "SHELL2", "SHELL3", "BAR1D2", "BAR1D3"}; + return elem_names[(int)elem_type]; } -E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_dim) +ElementType get_elem_type(const char *elem_name, const int num_nodes, const int num_dim) { - E_Type answer = NULL_EL; + ElementType answer = ElementType::NULL_EL; switch (elem_name[0]) { case 'h': case 'H': if (strncasecmp(elem_name, "HEX", 3) == 0) { switch (num_nodes) { - case 8: answer = HEX8; break; - case 12: answer = HEXSHELL; break; - case 16: answer = HEX16; break; - case 20: answer = HEX20; break; - case 27: answer = HEX27; break; + case 8: answer = ElementType::HEX8; break; + case 12: answer = ElementType::HEXSHELL; break; + case 16: answer = ElementType::HEX16; break; + case 20: answer = ElementType::HEX20; break; + case 27: answer = ElementType::HEX27; break; default: Gen_Error(0, "fatal: unsupported HEX element"); error_report(); @@ -75,20 +75,20 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d case 'c': case 'C': if (strncasecmp(elem_name, "CIRCLE", 6) == 0) { - answer = SPHERE; + answer = ElementType::SPHERE; } break; case 's': case 'S': if (strncasecmp(elem_name, "SPHERE", 6) == 0) { - answer = SPHERE; + answer = ElementType::SPHERE; } else if (strncasecmp(elem_name, "SHELL", 5) == 0) { switch (num_nodes) { case 2: if (num_dim == 2) { - answer = SHELL2; + answer = ElementType::SHELL2; } else { Gen_Error(0, "fatal: unsupported SHELL element"); @@ -98,7 +98,7 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d break; case 3: if (num_dim == 2) { - answer = SHELL3; + answer = ElementType::SHELL3; } else { Gen_Error(0, "fatal: unsupported SHELL element"); @@ -106,9 +106,9 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d exit(1); } break; - case 4: answer = SHELL4; break; - case 8: answer = SHELL8; break; - case 9: answer = SHELL9; break; + case 4: answer = ElementType::SHELL4; break; + case 8: answer = ElementType::SHELL8; break; + case 9: answer = ElementType::SHELL9; break; default: Gen_Error(0, "fatal: unsupported SHELL element"); error_report(); @@ -126,8 +126,8 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d if (strncasecmp(elem_name, "BEAM", 4) == 0 || strncasecmp(elem_name, "TRUSS", 5) == 0 || strncasecmp(elem_name, "ROD", 3) == 0 || strncasecmp(elem_name, "BAR", 3) == 0) { switch (num_nodes) { - case 2: answer = BAR2; break; - case 3: answer = BAR3; break; + case 2: answer = num_dim == 1 ? ElementType::BAR1D2 : ElementType::BAR2; break; + case 3: answer = num_dim == 1 ? ElementType::BAR1D3 : ElementType::BAR3; break; default: Gen_Error(0, "fatal: unsupported BAR/BEAM/TRUSS element"); error_report(); @@ -138,34 +138,34 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d switch (num_nodes) { case 3: if (num_dim == 2) { - answer = TRI3; + answer = ElementType::TRI3; } else { - answer = TSHELL3; + answer = ElementType::TSHELL3; } break; case 4: if (num_dim == 2) { - answer = TRI4; + answer = ElementType::TRI4; } else { - answer = TSHELL4; + answer = ElementType::TSHELL4; } break; case 6: if (num_dim == 2) { - answer = TRI6; + answer = ElementType::TRI6; } else { - answer = TSHELL6; + answer = ElementType::TSHELL6; } break; case 7: if (num_dim == 2) { - answer = TRI7; + answer = ElementType::TRI7; } else { - answer = TSHELL7; + answer = ElementType::TSHELL7; } break; default: @@ -176,11 +176,11 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d } else if (strncasecmp(elem_name, "TET", 3) == 0) { switch (num_nodes) { - case 4: answer = TET4; break; - case 8: answer = TET8; break; - case 10: answer = TET10; break; - case 14: answer = TET14; break; - case 15: answer = TET15; break; + case 4: answer = ElementType::TET4; break; + case 8: answer = ElementType::TET8; break; + case 10: answer = ElementType::TET10; break; + case 14: answer = ElementType::TET14; break; + case 15: answer = ElementType::TET15; break; default: Gen_Error(0, "fatal: unsupported TET element"); error_report(); @@ -195,26 +195,26 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d switch (num_nodes) { case 4: if (num_dim == 2) { - answer = QUAD4; + answer = ElementType::QUAD4; } else { - answer = SHELL4; + answer = ElementType::SHELL4; } break; case 8: if (num_dim == 2) { - answer = QUAD8; + answer = ElementType::QUAD8; } else { - answer = SHELL8; + answer = ElementType::SHELL8; } break; case 9: if (num_dim == 2) { - answer = QUAD9; + answer = ElementType::QUAD9; } else { - answer = SHELL9; + answer = ElementType::SHELL9; } break; default: @@ -229,12 +229,12 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d case 'W': if (strncasecmp(elem_name, "WEDGE", 5) == 0) { switch (num_nodes) { - case 6: answer = WEDGE6; break; - case 12: answer = WEDGE12; break; - case 15: answer = WEDGE15; break; - case 16: answer = WEDGE16; break; - case 20: answer = WEDGE20; break; - case 21: answer = WEDGE21; break; + case 6: answer = ElementType::WEDGE6; break; + case 12: answer = ElementType::WEDGE12; break; + case 15: answer = ElementType::WEDGE15; break; + case 16: answer = ElementType::WEDGE16; break; + case 20: answer = ElementType::WEDGE20; break; + case 21: answer = ElementType::WEDGE21; break; default: Gen_Error(0, "fatal: unsupported WEDGE element"); error_report(); @@ -247,11 +247,11 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d case 'P': if (strncasecmp(elem_name, "PYR", 3) == 0) { switch (num_nodes) { - case 5: answer = PYRAMID5; break; - case 13: answer = PYRAMID13; break; - case 14: answer = PYRAMID14; break; - case 18: answer = PYRAMID18; break; - case 19: answer = PYRAMID19; break; + case 5: answer = ElementType::PYRAMID5; break; + case 13: answer = ElementType::PYRAMID13; break; + case 14: answer = ElementType::PYRAMID14; break; + case 18: answer = ElementType::PYRAMID18; break; + case 19: answer = ElementType::PYRAMID19; break; default: Gen_Error(0, "fatal: unsupported PYRAMID element"); error_report(); @@ -263,7 +263,7 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d default: break; } - if (answer == NULL_EL) { + if (answer == ElementType::NULL_EL) { std::string errstr; errstr = fmt::format("fatal: unknown element type '{}' read", elem_name); Gen_Error(0, errstr); @@ -280,33 +280,35 @@ E_Type get_elem_type(const char *elem_name, const int num_nodes, const int num_d /*****************************************************************************/ /* Convenience functions for code readability *****************************************************************************/ -int is_hex(E_Type etype) +bool is_hex(ElementType etype) { - return static_cast(etype == HEX8 || etype == HEX27 || etype == HEX20 || etype == HEXSHELL); + return etype == ElementType::HEX8 || etype == ElementType::HEX27 || etype == ElementType::HEX20 || + etype == ElementType::HEXSHELL; } -int is_tet(E_Type etype) +bool is_tet(ElementType etype) { - return static_cast(etype == TET4 || etype == TET10 || etype == TET8 || etype == TET14 || - etype == TET15); + return etype == ElementType::TET4 || etype == ElementType::TET10 || etype == ElementType::TET8 || + etype == ElementType::TET14 || etype == ElementType::TET15; } -int is_wedge(E_Type etype) +bool is_wedge(ElementType etype) { - return static_cast(etype == WEDGE6 || etype == WEDGE15 || etype == WEDGE16 || - etype == WEDGE20 || etype == WEDGE21); + return etype == ElementType::WEDGE6 || etype == ElementType::WEDGE15 || + etype == ElementType::WEDGE16 || etype == ElementType::WEDGE20 || + etype == ElementType::WEDGE21; } -int is_pyramid(E_Type etype) +bool is_pyramid(ElementType etype) { - return static_cast(etype == PYRAMID5 || etype == PYRAMID13 || etype == PYRAMID14 || - etype == PYRAMID18 || etype == PYRAMID19); + return etype == ElementType::PYRAMID5 || etype == ElementType::PYRAMID13 || + etype == ElementType::PYRAMID14 || etype == ElementType::PYRAMID18 || + etype == ElementType::PYRAMID19; } -int is_3d_element(E_Type etype) +bool is_3d_element(ElementType etype) { - return static_cast((is_hex(etype) != 0) || (is_tet(etype) != 0) || (is_wedge(etype) != 0) || - (is_pyramid(etype) != 0)); + return is_hex(etype) || is_tet(etype) || is_wedge(etype) || is_pyramid(etype); } /*****************************************************************************/ @@ -316,19 +318,19 @@ int is_3d_element(E_Type etype) *---------------------------------------------------------------------------- * This function returns various information about the input element type. *****************************************************************************/ -int get_elem_info(const int req, const E_Type etype) +int get_elem_info(const ElementInfo req, const ElementType etype) { int answer = 0; switch (etype) /* Switch over the element type */ { - case BAR2: + case ElementType::BAR1D2: switch (req) { - case NNODES: answer = 2; break; - case NSIDE_NODES: answer = 1; break; - case NSIDES: answer = 2; break; - case NDIM: /* number of physical dimensions */ answer = 1; break; + case ElementInfo::NNODES: answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 1; break; + case ElementInfo::NSIDES: answer = 2; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 1; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -336,12 +338,12 @@ int get_elem_info(const int req, const E_Type etype) } break; - case SHELL2: + case ElementType::BAR2: switch (req) { - case NNODES: answer = 2; break; - case NSIDE_NODES: answer = 2; break; - case NSIDES: answer = 1; break; - case NDIM: /* number of physical dimensions */ answer = 1; break; + case ElementInfo::NNODES: answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 1; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 1; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -349,12 +351,12 @@ int get_elem_info(const int req, const E_Type etype) } break; - case SHELL3: + case ElementType::SHELL2: switch (req) { - case NNODES: answer = 3; break; - case NSIDE_NODES: answer = 2; break; - case NSIDES: answer = 1; break; - case NDIM: /* number of physical dimensions */ answer = 1; break; + case ElementInfo::NNODES: answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 1; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 1; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -362,12 +364,12 @@ int get_elem_info(const int req, const E_Type etype) } break; - case BAR3: + case ElementType::SHELL3: switch (req) { - case NNODES: answer = 3; break; - case NSIDE_NODES: answer = 1; break; - case NSIDES: answer = 2; break; - case NDIM: /* number of physical dimensions */ answer = 1; break; + case ElementInfo::NNODES: answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 1; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 1; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -375,22 +377,48 @@ int get_elem_info(const int req, const E_Type etype) } break; - case SPHERE: + case ElementType::BAR1D3: switch (req) { - case NNODES: answer = 1; break; - case NSIDE_NODES: answer = 0; break; - case NSIDES: answer = 0; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 1; break; + case ElementInfo::NSIDES: answer = 2; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 1; break; + default: + Gen_Error(0, "fatal: unknown quantity"); + error_report(); + exit(1); } break; - case QUAD4: /* First order quad */ - switch (req) /* select type of information required*/ + case ElementType::BAR3: + switch (req) { + case ElementInfo::NNODES: answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 1; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 1; break; + default: + Gen_Error(0, "fatal: unknown quantity"); + error_report(); + exit(1); + } + break; + + case ElementType::SPHERE: + switch (req) { + case ElementInfo::NNODES: answer = 1; break; + case ElementInfo::NSIDE_NODES: answer = 0; break; + case ElementInfo::NSIDES: answer = 0; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + } + break; + + case ElementType::QUAD4: /* First order quad */ + switch (req) /* select type of information required*/ { - case NNODES: /* number of nodes */ answer = 4; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 2; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 4; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal:unknown quantity"); error_report(); @@ -398,13 +426,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case QUAD8: /* 2nd order serendipity quad */ - switch (req) /* select type of information required */ + case ElementType::QUAD8: /* 2nd order serendipity quad */ + switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 8; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 3; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 8; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 3; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -412,13 +440,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case QUAD9: /* biquadratic quadrilateral */ - switch (req) /* select type of information required */ + case ElementType::QUAD9: /* biquadratic quadrilateral */ + switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 9; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 3; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 9; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 3; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -427,11 +455,11 @@ int get_elem_info(const int req, const E_Type etype) break; /* NOTE: cannot determine NSIDE_NODES for SHELL element */ - case SHELL4: + case ElementType::SHELL4: switch (req) { - case NNODES: answer = 4; break; - case NSIDES: answer = 6; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NNODES: answer = 4; break; + case ElementInfo::NSIDES: answer = 6; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -439,11 +467,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case SHELL8: + case ElementType::SHELL8: switch (req) { - case NNODES: answer = 8; break; - case NSIDES: answer = 6; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NNODES: answer = 8; break; + case ElementInfo::NSIDES: answer = 6; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -451,11 +479,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case SHELL9: + case ElementType::SHELL9: switch (req) { - case NNODES: answer = 9; break; - case NSIDES: answer = 6; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NNODES: answer = 9; break; + case ElementInfo::NSIDES: answer = 6; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -463,13 +491,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TRI3: + case ElementType::TRI3: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 3; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 2; break; - case NSIDES: answer = 3; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 3; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -477,13 +505,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TRI4: + case ElementType::TRI4: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 4; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 2; break; - case NSIDES: answer = 3; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 4; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 2; break; + case ElementInfo::NSIDES: answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -491,13 +519,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TRI6: + case ElementType::TRI6: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 6; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 3; break; - case NSIDES: answer = 3; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 6; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 3; break; + case ElementInfo::NSIDES: answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -505,13 +533,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TRI7: + case ElementType::TRI7: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 7; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDE_NODES: answer = 3; break; - case NSIDES: answer = 3; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 7; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDE_NODES: answer = 3; break; + case ElementInfo::NSIDES: answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -520,12 +548,12 @@ int get_elem_info(const int req, const E_Type etype) break; /* NOTE: cannot determine NSIDE_NODES for TSHELL element */ - case TSHELL3: + case ElementType::TSHELL3: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 3; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDES: answer = 5; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 3; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDES: answer = 5; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -533,12 +561,12 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TSHELL4: + case ElementType::TSHELL4: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 4; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDES: answer = 5; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 4; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDES: answer = 5; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -546,12 +574,12 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TSHELL6: + case ElementType::TSHELL6: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 6; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDES: answer = 5; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 6; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDES: answer = 5; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -559,12 +587,12 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TSHELL7: + case ElementType::TSHELL7: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 7; break; - case NDIM: /* number of physical dimensions */ answer = 2; break; - case NSIDES: answer = 5; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 7; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 2; break; + case ElementInfo::NSIDES: answer = 5; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -572,13 +600,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case HEX8: /* trilinear hexahedron */ - switch (req) /* select type of information required */ + case ElementType::HEX8: /* trilinear hexahedron */ + switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 8; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 4; break; - case NSIDES: answer = 6; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 8; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 4; break; + case ElementInfo::NSIDES: answer = 6; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -586,11 +614,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case HEX16: /* localization element NSNODES is not consistent... */ + case ElementType::HEX16: /* localization element NSNODES is not consistent... */ switch (req) { - case NNODES: /* number of nodes */ answer = 16; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDES: answer = 6; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 16; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDES: answer = 6; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -598,13 +626,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case HEX20: /* serendipity triquadratic hexahedron */ - switch (req) /* select type of information required */ + case ElementType::HEX20: /* serendipity triquadratic hexahedron */ + switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 20; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 8; break; - case NSIDES: answer = 6; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 20; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 8; break; + case ElementInfo::NSIDES: answer = 6; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -612,13 +640,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case HEX27: /* triquadratic hexahedron */ - switch (req) /* select type of information required*/ + case ElementType::HEX27: /* triquadratic hexahedron */ + switch (req) /* select type of information required*/ { - case NNODES: /* number of nodes */ answer = 27; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 9; break; - case NSIDES: answer = 6; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 27; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 9; break; + case ElementInfo::NSIDES: answer = 6; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -627,11 +655,11 @@ int get_elem_info(const int req, const E_Type etype) break; /* NOTE: cannot determine NSIDE_NODES for HEXSHELL element */ - case HEXSHELL: + case ElementType::HEXSHELL: switch (req) { - case NNODES: answer = 12; break; - case NSIDES: answer = 6; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 12; break; + case ElementInfo::NSIDES: answer = 6; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -639,13 +667,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TET4: /* trilinear tetrahedron */ - switch (req) /* select type of information required*/ + case ElementType::TET4: /* trilinear tetrahedron */ + switch (req) /* select type of information required*/ { - case NNODES: /* number of nodes */ answer = 4; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 3; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 4; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 3; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -653,13 +681,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TET10: /* triquadradic tetrahedron */ - switch (req) /* select type of information required */ + case ElementType::TET10: /* triquadradic tetrahedron */ + switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 10; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 6; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 10; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 6; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -667,13 +695,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TET14: + case ElementType::TET14: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 14; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 7; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 14; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 7; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -681,13 +709,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TET15: + case ElementType::TET15: switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 15; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 7; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 15; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 7; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -695,13 +723,13 @@ int get_elem_info(const int req, const E_Type etype) } break; - case TET8: /* 8-node (midface nodes) tetrahedron */ - switch (req) /* select type of information required */ + case ElementType::TET8: /* 8-node (midface nodes) tetrahedron */ + switch (req) /* select type of information required */ { - case NNODES: /* number of nodes */ answer = 8; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; - case NSIDE_NODES: answer = 4; break; - case NSIDES: answer = 4; break; + case ElementInfo::NNODES: /* number of nodes */ answer = 8; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NSIDE_NODES: answer = 4; break; + case ElementInfo::NSIDES: answer = 4; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -710,11 +738,11 @@ int get_elem_info(const int req, const E_Type etype) break; /* NOTE: cannot determine NSIDE_NODES for WEDGE elements */ - case WEDGE6: + case ElementType::WEDGE6: switch (req) { - case NNODES: answer = 6; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 6; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -722,11 +750,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case WEDGE12: + case ElementType::WEDGE12: switch (req) { - case NNODES: answer = 12; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 12; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -734,11 +762,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case WEDGE15: + case ElementType::WEDGE15: switch (req) { - case NNODES: answer = 15; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 15; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -746,11 +774,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case WEDGE16: + case ElementType::WEDGE16: switch (req) { - case NNODES: answer = 16; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 16; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -758,11 +786,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case WEDGE20: + case ElementType::WEDGE20: switch (req) { - case NNODES: answer = 20; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 20; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -770,11 +798,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case WEDGE21: + case ElementType::WEDGE21: switch (req) { - case NNODES: answer = 21; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 21; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -783,11 +811,11 @@ int get_elem_info(const int req, const E_Type etype) break; /* NOTE: cannot determine NSIDE_NODES for PYRAMID element */ - case PYRAMID5: + case ElementType::PYRAMID5: switch (req) { - case NNODES: answer = 5; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 5; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -795,11 +823,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case PYRAMID13: + case ElementType::PYRAMID13: switch (req) { - case NNODES: answer = 13; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 13; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -807,11 +835,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case PYRAMID14: + case ElementType::PYRAMID14: switch (req) { - case NNODES: answer = 14; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 14; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -819,11 +847,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case PYRAMID18: + case ElementType::PYRAMID18: switch (req) { - case NNODES: answer = 18; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 18; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -831,11 +859,11 @@ int get_elem_info(const int req, const E_Type etype) } break; - case PYRAMID19: + case ElementType::PYRAMID19: switch (req) { - case NNODES: answer = 19; break; - case NSIDES: answer = 5; break; - case NDIM: /* number of physical dimensions */ answer = 3; break; + case ElementInfo::NNODES: answer = 19; break; + case ElementInfo::NSIDES: answer = 5; break; + case ElementInfo::NDIM: /* number of physical dimensions */ answer = 3; break; default: Gen_Error(0, "fatal: unknown quantity"); error_report(); @@ -866,18 +894,16 @@ int get_elem_info(const int req, const E_Type etype) * * Now supoports degenerate faces in HEX elements. *****************************************************************************/ -template int get_side_id(const E_Type etype, const int *connect, const int nsnodes, +template int get_side_id(const ElementType etype, const int *connect, const int nsnodes, int side_nodes[], const int skip_check, const int partial_adj); -template int get_side_id(const E_Type etype, const int64_t *connect, const int nsnodes, +template int get_side_id(const ElementType etype, const int64_t *connect, const int nsnodes, int64_t side_nodes[], const int skip_check, const int partial_adj); template -int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT side_nodes[], +int get_side_id(const ElementType etype, const INT *connect, const int nsnodes, INT side_nodes[], const int skip_check, const int partial_adj) { - int dup; - int location[9]; - int count; + int count = 0; /* min_match for hex elements means that min_match+1 nodes on a face of a hex must match to return the side of the hex on which the nodes exist, i.e., if 3/4 nodes of a hex @@ -891,7 +917,8 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s /* const int min_match = 2; */ /* check if this is a degenerate face */ - dup = 0; + int dup = 0; + std::array location{}; for (int i = 0; i < (nsnodes - 1); i++) { for (int j = (i + 1); j < nsnodes; j++) { if (side_nodes[i] == side_nodes[j]) { @@ -900,7 +927,7 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s } } - int nnodes = get_elem_info(NNODES, etype); + int nnodes = get_elem_info(ElementInfo::NNODES, etype); /* Find all of the side nodes in the connect table */ int num = 0; @@ -943,8 +970,8 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s /* Find the side ID */ switch (etype) { - case BAR2: - case BAR3: + case ElementType::BAR1D2: + case ElementType::BAR1D3: /* SIDE 1 */ if (side_nodes[0] == connect[0]) { return 1; @@ -954,16 +981,18 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s } break; - case SHELL2: - case SHELL3: + case ElementType::BAR2: + case ElementType::BAR3: + case ElementType::SHELL2: + case ElementType::SHELL3: /* SIDE 1 */ if (side_nodes[0] == connect[0] && side_nodes[1] == connect[1]) { return 1; } break; - case QUAD4: - case QUAD8: - case QUAD9: + case ElementType::QUAD4: + case ElementType::QUAD8: + case ElementType::QUAD9: /* SIDE 1 */ if (side_nodes[0] == connect[0] && side_nodes[1] == connect[1]) { return 1; @@ -986,10 +1015,10 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case TRI3: - case TRI4: - case TRI6: - case TRI7: + case ElementType::TRI3: + case ElementType::TRI4: + case ElementType::TRI6: + case ElementType::TRI7: /* SIDE 1 */ if (side_nodes[0] == connect[0] && side_nodes[1] == connect[1]) { return 1; @@ -1007,11 +1036,11 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case TET4: - case TET10: - case TET14: - case TET15: - case TET8: + case ElementType::TET4: + case ElementType::TET10: + case ElementType::TET14: + case ElementType::TET15: + case ElementType::TET8: /* check the # of side nodes */ if (nsnodes < 3) { return 0; @@ -1039,11 +1068,11 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case HEX8: - case HEX16: - case HEX20: - case HEX27: - case HEXSHELL: /* this should be the same as a HEX element */ + case ElementType::HEX8: + case ElementType::HEX16: + case ElementType::HEX20: + case ElementType::HEX27: + case ElementType::HEXSHELL: /* this should be the same as a HEX element */ /* check the # of side nodes */ if (nsnodes < 4) { return 0; @@ -1213,9 +1242,9 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case SHELL4: - case SHELL8: - case SHELL9: + case ElementType::SHELL4: + case ElementType::SHELL8: + case ElementType::SHELL9: /* 2D sides */ if (nsnodes == 2 || nsnodes == 3) { @@ -1258,12 +1287,12 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case WEDGE6: - case WEDGE12: - case WEDGE15: - case WEDGE16: - case WEDGE20: - case WEDGE21: + case ElementType::WEDGE6: + case ElementType::WEDGE12: + case ElementType::WEDGE15: + case ElementType::WEDGE16: + case ElementType::WEDGE20: + case ElementType::WEDGE21: /* quad sides */ if (nsnodes == 4 || nsnodes == 8 || nsnodes == 9) { @@ -1303,13 +1332,14 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case TSHELL3: - case TSHELL4: - case TSHELL6: - case TSHELL7: + case ElementType::TSHELL3: + case ElementType::TSHELL4: + case ElementType::TSHELL6: + case ElementType::TSHELL7: /* 2D sides */ - if (nsnodes == 2 || (etype == TSHELL6 && nsnodes == 3) || (etype == TSHELL7 && nsnodes == 3)) { + if (nsnodes == 2 || (etype == ElementType::TSHELL6 && nsnodes == 3) || + (etype == ElementType::TSHELL7 && nsnodes == 3)) { /* SIDE 3 */ if (side_nodes[0] == connect[0] && side_nodes[1] == connect[1]) { return 3; @@ -1340,11 +1370,11 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case PYRAMID5: - case PYRAMID13: - case PYRAMID14: - case PYRAMID18: - case PYRAMID19: + case ElementType::PYRAMID5: + case ElementType::PYRAMID13: + case ElementType::PYRAMID14: + case ElementType::PYRAMID18: + case ElementType::PYRAMID19: /* triangular sides */ if (nsnodes == 3 || nsnodes == 6 || nsnodes == 7) { /* SIDE 1 */ @@ -1384,7 +1414,7 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s break; - case SPHERE: break; + case ElementType::SPHERE: break; default: { std::string err_buff; @@ -1410,29 +1440,25 @@ int get_side_id(const E_Type etype, const INT *connect, const int nsnodes, INT s * connected to a side of a hex, there are only three nodes connecting * the two. In this case a side id can be found. *****************************************************************************/ -template int get_side_id_hex_tet(const E_Type etype, const int *connect, int nsnodes, +template int get_side_id_hex_tet(const ElementType etype, const int *connect, int nsnodes, const int side_nodes[]); -template int get_side_id_hex_tet(const E_Type etype, const int64_t *connect, int nsnodes, +template int get_side_id_hex_tet(const ElementType etype, const int64_t *connect, int nsnodes, const int64_t side_nodes[]); template -int get_side_id_hex_tet(const E_Type etype, /* The element type */ - const INT *connect, /* The element connectivity */ - int nsnodes, /* The number of side nodes */ - const INT side_nodes[]) /* The list of side node IDs */ +int get_side_id_hex_tet(const ElementType etype, /* The element type */ + const INT *connect, /* The element connectivity */ + int nsnodes, /* The number of side nodes */ + const INT side_nodes[]) /* The list of side node IDs */ { - int nnodes; - int lcnt; - int i1; - int i2; - std::vector loc_node_ids(MAX_SIDE_NODES); + std::array loc_node_ids{}; - nnodes = get_elem_info(NNODES, etype); + int nnodes = get_elem_info(ElementInfo::NNODES, etype); /* Find the local node numbers for nodes forming the side */ - lcnt = 0; - for (i1 = 0; i1 < nnodes; i1++) { - for (i2 = 0; i2 < nsnodes; i2++) { + int lcnt = 0; + for (int i1 = 0; i1 < nnodes; i1++) { + for (int i2 = 0; i2 < nsnodes; i2++) { if (connect[i1] == side_nodes[i2]) { loc_node_ids[lcnt++] = i1 + 1; break; @@ -1444,11 +1470,11 @@ int get_side_id_hex_tet(const E_Type etype, /* The element type */ } switch (etype) { - case TET4: - case TET10: - case TET8: - case TET14: - case TET15: { + case ElementType::TET4: + case ElementType::TET10: + case ElementType::TET8: + case ElementType::TET14: + case ElementType::TET15: { auto il1 = in_list(1, lcnt, Data(loc_node_ids)) >= 0; auto il2 = in_list(2, lcnt, Data(loc_node_ids)) >= 0; auto il3 = in_list(3, lcnt, Data(loc_node_ids)) >= 0; @@ -1471,10 +1497,10 @@ int get_side_id_hex_tet(const E_Type etype, /* The element type */ } } break; - case HEX8: - case HEX16: - case HEX20: - case HEX27: { + case ElementType::HEX8: + case ElementType::HEX16: + case ElementType::HEX20: + case ElementType::HEX27: { auto il1 = in_list(1, lcnt, Data(loc_node_ids)) >= 0 ? 1 : 0; auto il2 = in_list(2, lcnt, Data(loc_node_ids)) >= 0 ? 1 : 0; auto il3 = in_list(3, lcnt, Data(loc_node_ids)) >= 0 ? 1 : 0; @@ -1532,16 +1558,16 @@ int get_side_id_hex_tet(const E_Type etype, /* The element type */ * the element type, and the side id. It also returns the number of nodes * in that side. *****************************************************************************/ -template int ss_to_node_list(const E_Type etype, const int *connect, int side_num, +template int ss_to_node_list(const ElementType etype, const int *connect, int side_num, int ss_node_list[]); -template int ss_to_node_list(const E_Type etype, const int64_t *connect, int side_num, +template int ss_to_node_list(const ElementType etype, const int64_t *connect, int side_num, int64_t ss_node_list[]); template -int ss_to_node_list(const E_Type etype, /* The element type */ - const INT *connect, /* The element connectivity */ - int side_num, /* The element side number */ - INT ss_node_list[]) /* The list of side node IDs */ +int ss_to_node_list(const ElementType etype, /* The element type */ + const INT *connect, /* The element connectivity */ + int side_num, /* The element side number */ + INT ss_node_list[]) /* The list of side node IDs */ { int i = 0; @@ -1670,394 +1696,337 @@ int ss_to_node_list(const E_Type etype, /* The element type */ {1, 4, 3, 2, 9, 8, 7, 6, 14} // side 5 (quad) }; - static int shell_bar_table[1][3] = {{1, 2, 3}}; - static int bar_table[2][1] = {{1}, {2}}; + static int bar_table[1][3] = {{1, 2, 3}}; /* Locally decrement side_num */ side_num--; /* Switch over the element type. */ switch (etype) { - case BAR3: - case BAR2: - /* Bar1 has 2 sides, each is a single node */ - for (i = 0; i < 1; i++) { - ss_node_list[i] = connect[(bar_table[side_num][i] - 1)]; - } + case ElementType::BAR1D2: + case ElementType::BAR1D3: + ss_node_list[0] = connect[side_num]; + i = 1; break; - case SHELL2: + case ElementType::BAR2: + case ElementType::SHELL2: /* Bar1 has 1 side */ for (i = 0; i < 2; i++) { - ss_node_list[i] = connect[(shell_bar_table[side_num][i] - 1)]; + ss_node_list[i] = connect[bar_table[side_num][i] - 1]; } break; - case SHELL3: + case ElementType::BAR3: + case ElementType::SHELL3: /* Bar has 1 side */ for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(shell_bar_table[side_num][i] - 1)]; + ss_node_list[i] = connect[bar_table[side_num][i] - 1]; } break; - case QUAD4: + case ElementType::QUAD4: for (i = 0; i < 2; i++) { - ss_node_list[i] = connect[(quad_table[side_num][i] - 1)]; + ss_node_list[i] = connect[quad_table[side_num][i] - 1]; } break; - case QUAD8: - case QUAD9: + case ElementType::QUAD8: + case ElementType::QUAD9: for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(quad_table[side_num][i] - 1)]; + ss_node_list[i] = connect[quad_table[side_num][i] - 1]; } break; - case SHELL4: - switch (side_num) { - case 0: - case 1: + case ElementType::SHELL4: + if (side_num == 0 || side_num == 1) { for (i = 0; i < 4; i++) { - ss_node_list[i] = connect[(shell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[shell_table[side_num][i] - 1]; } - break; - - default: + } + else { /* * sides 3, 4, 5, & 6 correspond to sides 1, 2, 3, & 4 * of the quad element. */ for (i = 0; i < 2; i++) { - ss_node_list[i] = connect[(quad_table[(side_num - 2)][i] - 1)]; + ss_node_list[i] = connect[quad_table[side_num - 2][i] - 1]; } - break; } break; - case SHELL8: - switch (side_num) { - case 0: - case 1: + case ElementType::SHELL8: + if (side_num == 0 || side_num == 1) { for (i = 0; i < 8; i++) { - ss_node_list[i] = connect[(shell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[shell_table[side_num][i] - 1]; } - break; - - default: + } + else { /* * sides 3, 4, 5, & 6 correspond to sides 1, 2, 3, & 4 * of the quad element. */ for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(quad_table[(side_num - 2)][i] - 1)]; + ss_node_list[i] = connect[quad_table[side_num - 2][i] - 1]; } - break; } break; - case SHELL9: - switch (side_num) { - case 0: - case 1: + case ElementType::SHELL9: + if (side_num == 0 || side_num == 1) { for (i = 0; i < 9; i++) { - ss_node_list[i] = connect[(shell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[shell_table[side_num][i] - 1]; } - break; - - default: + } + else { /* * sides 3, 4, 5, & 6 correspond to sides 1, 2, 3, & 4 * of the quad element. */ for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(quad_table[(side_num - 2)][i] - 1)]; + ss_node_list[i] = connect[quad_table[(side_num - 2)][i] - 1]; } - break; } break; - case TRI3: - case TRI4: + case ElementType::TRI3: + case ElementType::TRI4: for (i = 0; i < 2; i++) { - ss_node_list[i] = connect[(tri_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tri_table[side_num][i] - 1]; } break; - case TRI6: - case TRI7: + case ElementType::TRI6: + case ElementType::TRI7: for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(tri_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tri_table[side_num][i] - 1]; } break; - case TSHELL3: - case TSHELL4: - switch (side_num) { - case 0: - case 1: + case ElementType::TSHELL3: + case ElementType::TSHELL4: + if (side_num == 0 || side_num == 1) { for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(tshell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tshell_table[side_num][i] - 1]; } - break; - - default: + } + else { /* * sides 3, 4 & 5 correspond to sides 1, 2 & 3 * of the tri element. */ for (i = 0; i < 2; i++) { - ss_node_list[i] = connect[(tri_table[(side_num - 2)][i] - 1)]; + ss_node_list[i] = connect[tri_table[(side_num - 2)][i] - 1]; } - break; } break; - case TSHELL6: - case TSHELL7: - switch (side_num) { - case 0: - case 1: + case ElementType::TSHELL6: + case ElementType::TSHELL7: + if (side_num == 0 || side_num == 1) { for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(tshell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tshell_table[side_num][i] - 1]; } - break; - - default: + } + else { /* * sides 3, 4 & 5 correspond to sides 1, 2 & 3 * of the tri element. */ for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(tri_table[(side_num - 2)][i] - 1)]; + ss_node_list[i] = connect[tri_table[(side_num - 2)][i] - 1]; } - break; } break; - case HEX8: + case ElementType::HEX8: for (i = 0; i < 4; i++) { - ss_node_list[i] = connect[(hex_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hex_table[side_num][i] - 1]; } break; - case HEX16: - switch (side_num) { - case 4: - case 5: + case ElementType::HEX16: + if (side_num == 4 || side_num == 5) { for (i = 0; i < 8; i++) { - ss_node_list[i] = connect[(hex16_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hex16_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(hex16_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hex16_table[side_num][i] - 1]; } - break; } break; - case HEX20: + case ElementType::HEX20: for (i = 0; i < 8; i++) { - ss_node_list[i] = connect[(hex_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hex_table[side_num][i] - 1]; } break; - case HEX27: + case ElementType::HEX27: for (i = 0; i < 9; i++) { - ss_node_list[i] = connect[(hex_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hex_table[side_num][i] - 1]; } break; - case TET4: + case ElementType::TET4: for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(tetra_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tetra_table[side_num][i] - 1]; } break; - case TET10: + case ElementType::TET10: for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(tetra_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tetra_table[side_num][i] - 1]; } break; - case TET14: - case TET15: + case ElementType::TET14: + case ElementType::TET15: for (i = 0; i < 7; i++) { - ss_node_list[i] = connect[(tetra_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tetra_table[side_num][i] - 1]; } break; - case TET8: + case ElementType::TET8: for (i = 0; i < 4; i++) { - ss_node_list[i] = connect[(tetra_table[side_num][i] - 1)]; + ss_node_list[i] = connect[tetra_table[side_num][i] - 1]; } break; - case WEDGE6: - switch (side_num) { - case 3: - case 4: + case ElementType::WEDGE6: + if (side_num == 3 || side_num == 4) { for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(wedge6_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge6_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 4; i++) { - ss_node_list[i] = connect[(wedge6_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge6_table[side_num][i] - 1]; } - break; } break; - case WEDGE12: + case ElementType::WEDGE12: for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(wedge12_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge12_table[side_num][i] - 1]; } break; - case WEDGE15: - case WEDGE16: - switch (side_num) { - case 3: - case 4: + case ElementType::WEDGE15: + case ElementType::WEDGE16: + if (side_num == 3 || side_num == 4) { for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(wedge15_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge15_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 8; i++) { - ss_node_list[i] = connect[(wedge15_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge15_table[side_num][i] - 1]; } - break; } break; - case WEDGE20: - switch (side_num) { - case 3: - case 4: + case ElementType::WEDGE20: + if (side_num == 3 || side_num == 4) { for (i = 0; i < 7; i++) { - ss_node_list[i] = connect[(wedge20_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge20_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 9; i++) { - ss_node_list[i] = connect[(wedge20_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge20_table[side_num][i] - 1]; } - break; } break; - case WEDGE21: - switch (side_num) { - case 3: - case 4: + case ElementType::WEDGE21: + if (side_num == 3 || side_num == 4) { for (i = 0; i < 7; i++) { - ss_node_list[i] = connect[(wedge21_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge21_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 9; i++) { - ss_node_list[i] = connect[(wedge21_table[side_num][i] - 1)]; + ss_node_list[i] = connect[wedge21_table[side_num][i] - 1]; } - break; } break; - case HEXSHELL: - switch (side_num) { - case 4: - case 5: + case ElementType::HEXSHELL: + if (side_num == 4 || side_num == 5) { for (i = 0; i < 4; i++) { - ss_node_list[i] = connect[(hexshell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hexshell_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(hexshell_table[side_num][i] - 1)]; + ss_node_list[i] = connect[hexshell_table[side_num][i] - 1]; } - break; } break; - case PYRAMID5: - switch (side_num) { - case 4: + case ElementType::PYRAMID5: + if (side_num == 4) { for (i = 0; i < 4; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 3; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; } break; - case PYRAMID13: - switch (side_num) { - case 4: + case ElementType::PYRAMID13: + if (side_num == 4) { for (i = 0; i < 8; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; } break; - case PYRAMID14: - switch (side_num) { - case 4: + case ElementType::PYRAMID14: + if (side_num == 4) { for (i = 0; i < 9; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 6; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; } break; - case PYRAMID18: - case PYRAMID19: /* Pyramid18 with mid-volume node */ - switch (side_num) { - case 4: + case ElementType::PYRAMID18: + case ElementType::PYRAMID19: /* Pyramid18 with mid-volume node */ + if (side_num == 4) { for (i = 0; i < 9; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; - - default: + } + else { for (i = 0; i < 7; i++) { - ss_node_list[i] = connect[(pyramid_table[side_num][i] - 1)]; + ss_node_list[i] = connect[pyramid_table[side_num][i] - 1]; } - break; } break; - case SPHERE: /* SHPERE's have no side sets */ - case NULL_EL: i = 0; break; + case ElementType::SPHERE: /* SHPERE's have no side sets */ + case ElementType::NULL_EL: i = 0; break; } /* End "switch (etype)" */ /* the variable "i" should be the number of positions that I filled */ - return (i); + return i; } /*-------------------------End ss_to_node_list()---------------------------*/ @@ -2070,16 +2039,16 @@ int ss_to_node_list(const E_Type etype, /* The element type */ * given. This will be the node list of a face that is connected * to this element on this face. *****************************************************************************/ -template int get_ss_mirror(const E_Type etype, const int *ss_node_list, int side_num, +template int get_ss_mirror(const ElementType etype, const int *ss_node_list, int side_num, int mirror_node_list[]); -template int get_ss_mirror(const E_Type etype, const int64_t *ss_node_list, int side_num, +template int get_ss_mirror(const ElementType etype, const int64_t *ss_node_list, int side_num, int64_t mirror_node_list[]); template -int get_ss_mirror(const E_Type etype, /* The element type */ - const INT *ss_node_list, /* The list of side node IDs */ - int side_num, /* The element side number */ - INT mirror_node_list[] /* The list of the mirror side node IDs */ +int get_ss_mirror(const ElementType etype, /* The element type */ + const INT *ss_node_list, /* The list of side node IDs */ + int side_num, /* The element side number */ + INT mirror_node_list[] /* The list of the mirror side node IDs */ ) { int i = 0; @@ -2105,32 +2074,39 @@ int get_ss_mirror(const E_Type etype, /* The element type */ /* Switch over the element type. */ switch (etype) { - case BAR2: - case SHELL2: + case ElementType::BAR1D2: + case ElementType::BAR1D3: + // Side is a single node... + mirror_node_list[0] = ss_node_list[0]; + i = 1; + break; + + case ElementType::BAR2: + case ElementType::SHELL2: for (i = 0; i < 2; i++) { mirror_node_list[i] = ss_node_list[line_table[i]]; } break; - case BAR3: - case SHELL3: + case ElementType::BAR3: + case ElementType::SHELL3: for (i = 0; i < 3; i++) { mirror_node_list[i] = ss_node_list[line_table[i]]; } break; - case QUAD4: + case ElementType::QUAD4: for (i = 0; i < 2; i++) { mirror_node_list[i] = ss_node_list[line_table[i]]; } break; - case QUAD8: - case QUAD9: + case ElementType::QUAD8: + case ElementType::QUAD9: for (i = 0; i < 3; i++) { mirror_node_list[i] = ss_node_list[line_table[i]]; } break; - case SHELL4: + case ElementType::SHELL4: switch (side_num) { case 1: case 2: @@ -2147,7 +2123,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case SHELL8: + case ElementType::SHELL8: switch (side_num) { case 1: case 2: @@ -2164,7 +2140,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case SHELL9: + case ElementType::SHELL9: switch (side_num) { case 1: case 2: @@ -2181,21 +2157,21 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case TRI3: - case TRI4: + case ElementType::TRI3: + case ElementType::TRI4: for (i = 0; i < 2; i++) { mirror_node_list[i] = ss_node_list[line_table[i]]; } break; - case TRI6: - case TRI7: + case ElementType::TRI6: + case ElementType::TRI7: for (i = 0; i < 3; i++) { mirror_node_list[i] = ss_node_list[line_table[i]]; } break; - case TSHELL3: + case ElementType::TSHELL3: switch (side_num) { case 1: case 2: @@ -2212,7 +2188,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case TSHELL4: + case ElementType::TSHELL4: switch (side_num) { case 1: case 2: @@ -2229,7 +2205,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case TSHELL6: + case ElementType::TSHELL6: switch (side_num) { case 1: case 2: @@ -2246,7 +2222,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case TSHELL7: + case ElementType::TSHELL7: switch (side_num) { case 1: case 2: @@ -2263,13 +2239,13 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case HEX8: + case ElementType::HEX8: for (i = 0; i < 4; i++) { mirror_node_list[i] = ss_node_list[sqr_table[i]]; } break; - case HEX16: + case ElementType::HEX16: switch (side_num) { case 4: case 5: @@ -2285,44 +2261,44 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case HEX27: + case ElementType::HEX27: for (i = 0; i < 9; i++) { mirror_node_list[i] = ss_node_list[sqr_table[i]]; } break; - case HEX20: + case ElementType::HEX20: for (i = 0; i < 8; i++) { mirror_node_list[i] = ss_node_list[sqr_table[i]]; } break; - case TET4: + case ElementType::TET4: for (i = 0; i < 3; i++) { mirror_node_list[i] = ss_node_list[tri_table[i]]; } break; - case TET8: + case ElementType::TET8: for (i = 0; i < 4; i++) { mirror_node_list[i] = ss_node_list[tri_table[i]]; } break; - case TET10: + case ElementType::TET10: for (i = 0; i < 6; i++) { mirror_node_list[i] = ss_node_list[tri_table[i]]; } break; - case TET14: - case TET15: + case ElementType::TET14: + case ElementType::TET15: for (i = 0; i < 7; i++) { mirror_node_list[i] = ss_node_list[tri_table[i]]; } break; - case WEDGE6: + case ElementType::WEDGE6: switch (side_num) { case 4: case 5: @@ -2339,14 +2315,14 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case WEDGE12: + case ElementType::WEDGE12: for (i = 0; i < 6; i++) { mirror_node_list[i] = ss_node_list[tri_table[i]]; } break; - case WEDGE15: - case WEDGE16: + case ElementType::WEDGE15: + case ElementType::WEDGE16: switch (side_num) { case 4: case 5: @@ -2363,8 +2339,8 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case WEDGE20: - case WEDGE21: + case ElementType::WEDGE20: + case ElementType::WEDGE21: switch (side_num) { case 4: case 5: @@ -2381,7 +2357,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case HEXSHELL: + case ElementType::HEXSHELL: switch (side_num) { case 5: case 6: @@ -2398,7 +2374,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case PYRAMID5: + case ElementType::PYRAMID5: switch (side_num) { case 5: for (i = 0; i < 4; i++) { @@ -2414,7 +2390,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case PYRAMID13: + case ElementType::PYRAMID13: switch (side_num) { case 5: for (i = 0; i < 8; i++) { @@ -2430,7 +2406,7 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case PYRAMID14: + case ElementType::PYRAMID14: switch (side_num) { case 5: for (i = 0; i < 9; i++) { @@ -2446,8 +2422,8 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case PYRAMID18: - case PYRAMID19: + case ElementType::PYRAMID18: + case ElementType::PYRAMID19: switch (side_num) { case 5: for (i = 0; i < 9; i++) { @@ -2463,12 +2439,12 @@ int get_ss_mirror(const E_Type etype, /* The element type */ } break; - case SPHERE: /* SHPERE's have no side sets */ - case NULL_EL: i = 0; break; + case ElementType::SPHERE: /* SHPERE's have no side sets */ + case ElementType::NULL_EL: i = 0; break; } /* End "switch (etype)" */ /* the variable "i" should be the number of positions that I filled */ - return (i); + return i; } /*-------------------------Ed get_ss_mirror()---------------------------*/ diff --git a/packages/seacas/applications/nem_slice/elb_elem.h b/packages/seacas/applications/nem_slice/elb_elem.h index 5c7a5c5045e0..36f8b75b3be5 100644 --- a/packages/seacas/applications/nem_slice/elb_elem.h +++ b/packages/seacas/applications/nem_slice/elb_elem.h @@ -7,8 +7,11 @@ */ #pragma once +/* Define element info requests */ +enum class ElementInfo { NNODES = 0, NDIM = 2, NSIDE_NODES = 4, NSIDES = 5 }; + /* Define element types */ -enum E_Type { +enum class ElementType { SPHERE, BAR2, BAR3, @@ -49,61 +52,57 @@ enum E_Type { PYRAMID19, SHELL2, SHELL3, + BAR1D2, + BAR1D3, NULL_EL }; -extern const char *elem_name_from_enum(E_Type elem_type); +extern const char *elem_name_from_enum(ElementType elem_type); -extern E_Type get_elem_type(const char *elem_name, /* ExodusII element name */ - int num_nodes, /* Number of nodes in the element */ - int num_dim /* Number of dimensions of the mesh */ +extern ElementType get_elem_type(const char *elem_name, /* ExodusII element name */ + int num_nodes, /* Number of nodes in the element */ + int num_dim /* Number of dimensions of the mesh */ ); -extern int get_elem_info(int info, /* The requested information */ - E_Type elem_type /* The element type */ +extern int get_elem_info(ElementInfo info, /* The requested information */ + ElementType elem_type /* The element type */ ); template -int get_side_id(E_Type etype, const INT *connect, int nsnodes, INT side_nodes[], int skip_check, - int partial_adj); +int get_side_id(ElementType etype, const INT *connect, int nsnodes, INT side_nodes[], + int skip_check, int partial_adj); template -int get_side_id_hex_tet(E_Type etype, /* The element type */ - const INT *conn, /* The element connectivity */ - int nsnodes, /* The number of side nodes */ - const INT side_nodes[] /* The list of side node IDs */ +int get_side_id_hex_tet(ElementType etype, /* The element type */ + const INT *conn, /* The element connectivity */ + int nsnodes, /* The number of side nodes */ + const INT side_nodes[] /* The list of side node IDs */ ); template -int ss_to_node_list(E_Type etype, /* The element type */ - const INT *connect, /* The element connectivity */ - int side_num, /* The element side number */ - INT ss_node_list[] /* The list of side node IDs */ +int ss_to_node_list(ElementType etype, /* The element type */ + const INT *connect, /* The element connectivity */ + int side_num, /* The element side number */ + INT ss_node_list[] /* The list of side node IDs */ ); template -int get_ss_mirror(E_Type etype, /* The element type */ - const INT *ss_node_list, /* The list of side node IDs */ - int side_num, /* The element side number */ - INT mirror_node_list[] /* The list of the mirror side node IDs */ +int get_ss_mirror(ElementType etype, /* The element type */ + const INT *ss_node_list, /* The list of side node IDs */ + int side_num, /* The element side number */ + INT mirror_node_list[] /* The list of the mirror side node IDs */ ); -/* Define element info requests */ -#define NNODES 0 -#define NDIM 2 -#define NSIDE_NODES 4 -#define NSIDES 5 - /* Define for the maximum number of nodes on an element side/face */ -#define MAX_SIDE_NODES 9 +const int MAX_SIDE_NODES = 9; /* * Define for the maximum number of sides (and hence communications * entries) that an element can have */ -#define MAX_ELEM_SIDES 6 +const int MAX_ELEM_SIDES = 6; -int is_hex(E_Type etype); -int is_tet(E_Type etype); -int is_wedge(E_Type etype); -int is_pyramid(E_Type etype); -int is_3d_element(E_Type etype); +bool is_hex(ElementType etype); +bool is_tet(ElementType etype); +bool is_wedge(ElementType etype); +bool is_pyramid(ElementType etype); +bool is_3d_element(ElementType etype); diff --git a/packages/seacas/applications/nem_slice/elb_exo_util.C b/packages/seacas/applications/nem_slice/elb_exo_util.C index 817211d7cc5b..781d3d4abb60 100644 --- a/packages/seacas/applications/nem_slice/elb_exo_util.C +++ b/packages/seacas/applications/nem_slice/elb_exo_util.C @@ -20,7 +20,7 @@ #include #include "elb.h" // for Weight_Description, etc -#include "elb_elem.h" // for get_elem_type, E_Type, etc +#include "elb_elem.h" // for get_elem_type, ElementType, etc #include "elb_err.h" // for Gen_Error, MAX_ERR_MSG #include "elb_exo.h" #include "elb_groups.h" // for parse_groups @@ -56,7 +56,7 @@ int read_exo_weights(Problem_Description *prob, Weight_Description *weight, INT } std::vector values(weight->nvals); - if (prob->type == NODAL) { + if (prob->type == DecompType::NODAL) { size_t tmp_nodes = ex_inquire_int(exoid, EX_INQ_NODES); /* check to make sure the sizes agree */ if ((size_t)weight->nvals != tmp_nodes) { @@ -233,7 +233,7 @@ int read_mesh_params(const std::string &exo_file, Problem_Description *problem, sphere->end[0] = mesh->eb_cnts[cnt]; } - if (mesh->eb_type[cnt] == SPHERE && problem->no_sph != 1) { + if (mesh->eb_type[cnt] == ElementType::SPHERE && problem->no_sph != 1) { sphere->num += mesh->eb_cnts[cnt]; sphere->adjust[cnt] = 0; } @@ -246,7 +246,7 @@ int read_mesh_params(const std::string &exo_file, Problem_Description *problem, sphere->end[cnt] = sphere->begin[cnt] + mesh->eb_cnts[cnt]; } - mesh->max_np_elem = MAX(mesh->max_np_elem, (size_t)nodes_in_elem); + mesh->max_np_elem = std::max(mesh->max_np_elem, (size_t)nodes_in_elem); } /* Close the ExodusII file */ @@ -336,19 +336,19 @@ int read_mesh(const std::string &exo_file, Problem_Description *problem, /* find out if this element block is weighted */ int wgt = -1; - if (weight->type & EL_BLK) { + if (weight->type & WeightingOptions::EL_BLK) { wgt = in_list(mesh->eb_ids[cnt], weight->elemblk); } /* Fill the 2D global connectivity array */ - if (((problem->type == ELEMENTAL) && (weight->type & EL_BLK)) || - ((problem->type == NODAL) && (weight->type & EL_BLK))) { + if (((problem->type == DecompType::ELEMENTAL) && (weight->type & WeightingOptions::EL_BLK)) || + ((problem->type == DecompType::NODAL) && (weight->type & WeightingOptions::EL_BLK))) { for (int64_t cnt2 = 0; cnt2 < mesh->eb_cnts[cnt]; cnt2++) { mesh->elem_type[gelem_cnt] = mesh->eb_type[cnt]; /* while going through the blocks, take care of the weighting */ - if ((problem->type == ELEMENTAL) && (weight->type & EL_BLK)) { + if ((problem->type == DecompType::ELEMENTAL) && (weight->type & WeightingOptions::EL_BLK)) { /* is this block weighted */ if (wgt >= 0) { /* check if there is a read value */ @@ -376,7 +376,7 @@ int read_mesh(const std::string &exo_file, Problem_Description *problem, mesh->connect[gelem_cnt][cnt3] = node; /* deal with the weighting if necessary */ - if ((problem->type == NODAL) && (weight->type & EL_BLK)) { + if ((problem->type == DecompType::NODAL) && (weight->type & EL_BLK)) { /* is this block weighted */ if (wgt >= 0) { /* check if I read an exodus file */ @@ -385,7 +385,8 @@ int read_mesh(const std::string &exo_file, Problem_Description *problem, if (weight->ow_read) { /* check if it has been overwritten already */ if (weight->ow[node]) { - weight->vertices[node] = MAX(weight->vertices[node], weight->elemblk_wgt[wgt]); + weight->vertices[node] = + std::max(weight->vertices[node], weight->elemblk_wgt[wgt]); } else { weight->vertices[node] = weight->elemblk_wgt[wgt]; @@ -394,7 +395,7 @@ int read_mesh(const std::string &exo_file, Problem_Description *problem, } } else { - weight->vertices[node] = MAX(weight->vertices[node], weight->elemblk_wgt[wgt]); + weight->vertices[node] = std::max(weight->vertices[node], weight->elemblk_wgt[wgt]); } } else { @@ -460,7 +461,7 @@ template int init_weight_struct(Problem_Description *problem, Mesh_Description *mesh, Weight_Description *weight) { - if (problem->type == NODAL) { + if (problem->type == DecompType::NODAL) { weight->nvals = mesh->num_nodes; } else { diff --git a/packages/seacas/applications/nem_slice/elb_graph.C b/packages/seacas/applications/nem_slice/elb_graph.C index 3adb1e20b390..147beebf6c46 100644 --- a/packages/seacas/applications/nem_slice/elb_graph.C +++ b/packages/seacas/applications/nem_slice/elb_graph.C @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -97,7 +97,7 @@ namespace { // The hope is that this code will speed up the entire routine even // though we are iterating the complete connectivity array twice. for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - int nnodes = get_elem_info(NNODES, mesh->elem_type[ecnt]); + int nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[ecnt]); for (int ncnt = 0; ncnt < nnodes; ncnt++) { INT node = mesh->connect[ecnt][ncnt]; assert(node < (INT)mesh->num_nodes); @@ -145,7 +145,7 @@ namespace { /* Find the surrounding elements for each node in the mesh */ for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - int nnodes = get_elem_info(NNODES, mesh->elem_type[ecnt]); + int nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[ecnt]); for (int ncnt = 0; ncnt < nnodes; ncnt++) { INT node = mesh->connect[ecnt][ncnt]; @@ -203,14 +203,14 @@ namespace { } /* Find the adjacency for a nodal based decomposition */ - if (problem->type == NODAL) { + if (problem->type == DecompType::NODAL) { graph->nadj = 0; for (size_t ncnt = 0; ncnt < mesh->num_nodes; ncnt++) { graph->start[ncnt] = graph->nadj; assert(graph->nadj == graph->adj.size()); for (size_t ecnt = 0; ecnt < graph->sur_elem[ncnt].size(); ecnt++) { size_t elem = graph->sur_elem[ncnt][ecnt]; - int nnodes = get_elem_info(NNODES, mesh->elem_type[elem]); + int nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[elem]); for (int i = 0; i < nnodes; i++) { INT entry = mesh->connect[elem][i]; @@ -245,18 +245,18 @@ namespace { int nsides = 0; for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - E_Type etype = mesh->elem_type[ecnt]; - E_Type etype_last = NULL_EL; + ElementType etype = mesh->elem_type[ecnt]; + ElementType etype_last = ElementType::NULL_EL; if (etype != etype_last) { etype_last = etype; element_3d = is_3d_element(mesh->elem_type[ecnt]); if (problem->face_adj == 0) { - nnodes = get_elem_info(NNODES, etype); + nnodes = get_elem_info(ElementInfo::NNODES, etype); } - nsides = get_elem_info(NSIDES, etype); + nsides = get_elem_info(ElementInfo::NSIDES, etype); } - if (etype != SPHERE || problem->no_sph == 1) { + if (etype != ElementType::SPHERE || problem->no_sph == 1) { graph->start[cnt] = graph->nadj; assert(graph->nadj == graph->adj.size()); @@ -287,7 +287,7 @@ namespace { /* make sure we're not checking if the element is connected to itself */ - if (ecnt != (size_t)entry && mesh->elem_type[entry] != SPHERE) { + if (ecnt != (size_t)entry && mesh->elem_type[entry] != ElementType::SPHERE) { /* If tmp_element[entry] != ecnt, then entry is not in list... */ if ((size_t)tmp_element[entry] != ecnt) { #if 0 @@ -297,11 +297,11 @@ namespace { tmp_element[entry] = ecnt; (graph->nadj)++; graph->adj.push_back(entry); - if (weight->type & EDGE_WGT) { + if (weight->type & WeightingOptions::EDGE_WGT) { weight->edges.push_back(1.0); } } - else if (weight->type & EDGE_WGT) { + else if (weight->type & WeightingOptions::EDGE_WGT) { int iret = in_list(entry, (graph->nadj) - (graph->start[cnt]), &graph->adj[graph->start[cnt]]); assert(iret >= 0); @@ -480,7 +480,7 @@ namespace { * is connected to only an edge of a quad/tet */ - E_Type etype2 = mesh->elem_type[entry]; + ElementType etype2 = mesh->elem_type[entry]; /* make sure this is a 3d element*/ @@ -526,7 +526,7 @@ namespace { /* if this element 1 is a hexshell, then only require 4 of the 6 nodes to match between elements 1 and 2 */ - if (etype == HEXSHELL && side_cnt == 6) { + if (etype == ElementType::HEXSHELL && side_cnt == 6) { side_cnt = 4; } @@ -554,7 +554,7 @@ namespace { if (sid > 0) { (graph->nadj)++; graph->adj.push_back(entry); - if (weight->type & EDGE_WGT) { + if (weight->type & WeightingOptions::EDGE_WGT) { /* * the edge weight is the number of nodes in the * connecting face @@ -581,7 +581,7 @@ namespace { Gen_Error(0, cmesg); cmesg = fmt::format("Element 1: {}", (ecnt + 1)); Gen_Error(0, cmesg); - nnodes = get_elem_info(NNODES, etype); + nnodes = get_elem_info(ElementInfo::NNODES, etype); cmesg = "connect table:"; for (int ii = 0; ii < nnodes; ii++) { tmpstr = fmt::format(" {}", (size_t)(mesh->connect[ecnt][ii] + 1)); @@ -598,7 +598,7 @@ namespace { Gen_Error(0, cmesg); cmesg = fmt::format("Element 2: {}", (entry + 1)); Gen_Error(0, cmesg); - nnodes = get_elem_info(NNODES, etype2); + nnodes = get_elem_info(ElementInfo::NNODES, etype2); cmesg = "connect table:"; for (int ii = 0; ii < nnodes; ii++) { tmpstr = fmt::format(" {}", (size_t)(mesh->connect[entry][ii] + 1)); @@ -621,7 +621,7 @@ namespace { * 1d or 2d elements */ - nnodes = get_elem_info(NNODES, mesh->elem_type[ecnt]); + nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[ecnt]); for (int ncnt = 0; ncnt < nnodes; ncnt++) { /* node is the node number 'ncnt' of element 'ecnt' */ @@ -646,11 +646,11 @@ namespace { (graph->nadj)++; graph->adj.push_back(entry); - if (weight->type & EDGE_WGT) { + if (weight->type & WeightingOptions::EDGE_WGT) { weight->edges.push_back(1.0); } } - else if (weight->type & EDGE_WGT) { + else if (weight->type & WeightingOptions::EDGE_WGT) { weight->edges[iret + (graph->start[cnt])] += 1.0F; } } @@ -680,7 +680,7 @@ namespace { } /* Adjust for a mesh with spheres */ - if (problem->type == ELEMENTAL && sphere->num) { + if (problem->type == DecompType::ELEMENTAL && sphere->num) { /* Decrement adjacency entries */ for (auto &elem : graph->adj) { for (size_t ecnt = 0; ecnt < mesh->num_el_blks; ecnt++) { diff --git a/packages/seacas/applications/nem_slice/elb_groups.C b/packages/seacas/applications/nem_slice/elb_groups.C index 049508493f12..ba51612b4e9b 100644 --- a/packages/seacas/applications/nem_slice/elb_groups.C +++ b/packages/seacas/applications/nem_slice/elb_groups.C @@ -197,10 +197,10 @@ int get_group_info(Machine_Description *machine, Problem_Description *prob, * calculate how many processors to use for each group * using method from the materials group, haven't really checked it */ - if (machine->type == MESH) { + if (machine->type == MachineType::MESH) { nproc = machine->procs_per_box; } - else if (machine->type == HCUBE) { + else if (machine->type == MachineType::HCUBE) { nproc = ilog2i(machine->procs_per_box); } for (int i = 0; i < prob->num_groups; i++) { diff --git a/packages/seacas/applications/nem_slice/elb_inp.C b/packages/seacas/applications/nem_slice/elb_inp.C index ea0de2ea78f9..68ac7c5b7b19 100644 --- a/packages/seacas/applications/nem_slice/elb_inp.C +++ b/packages/seacas/applications/nem_slice/elb_inp.C @@ -94,14 +94,14 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by const char *weight_subopts[] = {"none", "read", "eb", "var_index", "edges", "time_index", "var_name", nullptr}; - const char *mach_subopts[] = {"mesh", "hcube", "hypercube", "cluster", nullptr}; + const char *mach_subopts[] = {"invalid", "mesh", "hcube", "hypercube", "cluster", nullptr}; - const char *lb_subopts[] = {"multikl", "spectral", "inertial", "linear", "random", - "scattered", "infile", "kl", "none", "num_sects", - "cnctd_dom", "outfile", "zpinch", "brick", "rcb", - "rib", "hsfc", "ignore_z", nullptr}; + const char *lb_subopts[] = {"invalid", "multikl", "spectral", "inertial", "linear", + "random", "scattered", "infile", "kl", "none", + "num_sects", "cnctd_dom", "outfile", "zpinch", "brick", + "rcb", "rib", "hsfc", "ignore_z", nullptr}; - const char *solve_subopts[] = {"tolerance", "use_rqi", "vmax", nullptr}; + const char *solve_subopts[] = {"invalid", "tolerance", "use_rqi", "vmax", nullptr}; /*---------------------------Execution Begins--------------------------------*/ @@ -325,20 +325,20 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by case 'n': /* Nodal decomposition */ - if (prob->type == ELEMENTAL) { + if (prob->type == DecompType::ELEMENTAL) { Gen_Error(0, "FATAL: -e and -n are mutually exclusive"); return 0; } - prob->type = NODAL; + prob->type = DecompType::NODAL; break; case 'e': /* Elemental decomposition */ - if (prob->type == NODAL) { + if (prob->type == DecompType::NODAL) { Gen_Error(0, "FATAL: -e and -n are mutually exclusive\n"); return 0; } - prob->type = ELEMENTAL; + prob->type = DecompType::ELEMENTAL; break; case 'm': @@ -350,26 +350,26 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by while (sub_opt != nullptr && *sub_opt != '\0') { /* Switch over the machine description */ - switch (my_getsubopt(&sub_opt, (char *const *)mach_subopts, &value)) { - case HCUBE: - case HYPERCUBE: - if (machine->type < 0) { - machine->type = HCUBE; + switch ((MachineType)my_getsubopt(&sub_opt, (char *const *)mach_subopts, &value)) { + case MachineType::HCUBE: + case MachineType::HYPERCUBE: + if (machine->type == MachineType::INVALID) { + machine->type = MachineType::HCUBE; max_dim = 1; } FALL_THROUGH; - case MESH: - if (machine->type < 0) { - machine->type = MESH; + case MachineType::MESH: + if (machine->type == MachineType::INVALID) { + machine->type = MachineType::MESH; max_dim = 3; } cptr = value; /* want to set this for both mesh and hcube */ FALL_THROUGH; - case CLUSTER: - if (machine->type < 0) /* so, get the number of boxes */ + case MachineType::CLUSTER: + if (machine->type == MachineType::INVALID) /* so, get the number of boxes */ { if (value == nullptr || strlen(value) == 0) { Gen_Error(0, "FATAL: need to specify number of boxes"); @@ -379,11 +379,11 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by /* now need to find what each box consists of */ cptr = strpbrk(value, "mMhH"); if (*cptr == 'm' || *cptr == 'M') { - machine->type = MESH; + machine->type = MachineType::MESH; max_dim = 3; } else if (*cptr == 'h' || *cptr == 'H') { - machine->type = HCUBE; + machine->type = MachineType::HCUBE; max_dim = 1; } else { @@ -448,30 +448,30 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by string_to_lower(sub_opt, '\0'); } while (sub_opt != nullptr && *sub_opt != '\0') { - switch (my_getsubopt(&sub_opt, (char *const *)lb_subopts, &value)) { - case MULTIKL: lb->type = MULTIKL; break; + switch ((Balance)my_getsubopt(&sub_opt, (char *const *)lb_subopts, &value)) { + case Balance::MULTIKL: lb->type = Balance::MULTIKL; break; - case SPECTRAL: lb->type = SPECTRAL; break; + case Balance::SPECTRAL: lb->type = Balance::SPECTRAL; break; - case INERTIAL: lb->type = INERTIAL; break; + case Balance::INERTIAL: lb->type = Balance::INERTIAL; break; - case ZPINCH: lb->type = ZPINCH; break; + case Balance::ZPINCH: lb->type = Balance::ZPINCH; break; - case BRICK: lb->type = BRICK; break; + case Balance::BRICK: lb->type = Balance::BRICK; break; - case ZOLTAN_RCB: lb->type = ZOLTAN_RCB; break; + case Balance::ZOLTAN_RCB: lb->type = Balance::ZOLTAN_RCB; break; - case ZOLTAN_RIB: lb->type = ZOLTAN_RIB; break; + case Balance::ZOLTAN_RIB: lb->type = Balance::ZOLTAN_RIB; break; - case ZOLTAN_HSFC: lb->type = ZOLTAN_HSFC; break; + case Balance::ZOLTAN_HSFC: lb->type = Balance::ZOLTAN_HSFC; break; - case LINEAR: lb->type = LINEAR; break; + case Balance::LINEAR: lb->type = Balance::LINEAR; break; - case RANDOM: lb->type = RANDOM; break; + case Balance::RANDOM: lb->type = Balance::RANDOM; break; - case SCATTERED: lb->type = SCATTERED; break; + case Balance::SCATTERED: lb->type = Balance::SCATTERED; break; - case INFILE: + case Balance::INFILE: if (value == nullptr) { Gen_Error(0, "FATAL: need to specify a value with file"); return 0; @@ -483,14 +483,14 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by Gen_Error(0, "FATAL: invalid value associated with file"); return 0; } - lb->type = INFILE; + lb->type = Balance::INFILE; break; - case KL_REFINE: lb->refine = KL_REFINE; break; + case Balance::KL_REFINE: lb->refine = Balance::KL_REFINE; break; - case NO_REFINE: lb->refine = NO_REFINE; break; + case Balance::NO_REFINE: lb->refine = Balance::NO_REFINE; break; - case NUM_SECTS: + case Balance::NUM_SECTS: if (value == nullptr) { Gen_Error(0, "FATAL: need to specify a value with num_sects"); return 0; @@ -502,11 +502,11 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by } break; - case CNCT_DOM: lb->cnctd_dom = 1; break; + case Balance::CNCT_DOM: lb->cnctd_dom = 1; break; - case IGNORE_Z: lb->ignore_z = 1; break; + case Balance::IGNORE_Z: lb->ignore_z = 1; break; - case OUTFILE: + case Balance::OUTFILE: if (value == nullptr) { Gen_Error(0, "FATAL: need to specify a value with outfile"); return 0; @@ -539,8 +539,8 @@ int cmd_line_arg_parse(int argc, char *argv[], /* Args as passed by string_to_lower(sub_opt, '\0'); } while (sub_opt != nullptr && *sub_opt != '\0') { - switch (my_getsubopt(&sub_opt, (char *const *)solve_subopts, &value)) { - case TOLER: + switch ((SolverOptions)my_getsubopt(&sub_opt, (char *const *)solve_subopts, &value)) { + case SolverOptions::TOLER: if (value == nullptr) { fmt::print(stderr, "FATAL: tolerance specification requires \ value\n"); @@ -554,24 +554,26 @@ value\n"); break; - case USE_RQI: - if (solver->rqi_flag == USE_RQI) { - solver->rqi_flag = -1; + case SolverOptions::USE_RQI: + if (solver->rqi_flag == SolverOptions::USE_RQI) { + solver->rqi_flag = SolverOptions::INVALID; } else { - solver->rqi_flag = USE_RQI; + solver->rqi_flag = SolverOptions::USE_RQI; } break; - case VMAX: + case SolverOptions::VMAX: if (value == nullptr) { - fmt::print(stderr, "FATAL: must specify a value with {}\n", solve_subopts[VMAX]); + fmt::print(stderr, "FATAL: must specify a value with {}\n", + solve_subopts[(int)SolverOptions::VMAX]); return 0; } iret = sscanf(value, "%d", &(solver->vmax)); if (iret != 1) { - fmt::print(stderr, "FATAL: invalid value read for {}\n", solve_subopts[VMAX]); + fmt::print(stderr, "FATAL: invalid value read for {}\n", + solve_subopts[(int)SolverOptions::VMAX]); return 0; } @@ -715,7 +717,7 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, } else if (token_compare(cptr, "decomposition method")) { /* The method to use for decomposing the graph */ - if (lb->type < 0 || lb->refine < 0 || lb->num_sects < 0) { + if (lb->type == Balance::INVALID || lb->refine == Balance::INVALID || lb->num_sects < 0) { /* Search to the first null character */ cptr = strchr(cptr, '\0'); @@ -726,63 +728,63 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, strip_string(cptr, " \t\n"); string_to_lower(cptr, '\0'); if (strcmp(cptr, "multikl") == 0) { - if (lb->type < 0) { - lb->type = MULTIKL; + if (lb->type == Balance::INVALID) { + lb->type = Balance::MULTIKL; } } else if (strcmp(cptr, "spectral") == 0) { - if (lb->type < 0) { - lb->type = SPECTRAL; + if (lb->type == Balance::INVALID) { + lb->type = Balance::SPECTRAL; } } else if (strcmp(cptr, "scattered") == 0) { - if (lb->type < 0) { - lb->type = SCATTERED; + if (lb->type == Balance::INVALID) { + lb->type = Balance::SCATTERED; } } else if (strcmp(cptr, "linear") == 0) { - if (lb->type < 0) { - lb->type = LINEAR; + if (lb->type == Balance::INVALID) { + lb->type = Balance::LINEAR; } } else if (strcmp(cptr, "inertial") == 0) { - if (lb->type < 0) { - lb->type = INERTIAL; + if (lb->type == Balance::INVALID) { + lb->type = Balance::INERTIAL; } } else if (strcmp(cptr, "zpinch") == 0) { - if (lb->type < 0) { - lb->type = ZPINCH; + if (lb->type == Balance::INVALID) { + lb->type = Balance::ZPINCH; } } else if (strcmp(cptr, "brick") == 0) { - if (lb->type < 0) { - lb->type = BRICK; + if (lb->type == Balance::INVALID) { + lb->type = Balance::BRICK; } } else if (strcmp(cptr, "rcb") == 0) { - if (lb->type < 0) { - lb->type = ZOLTAN_RCB; + if (lb->type == Balance::INVALID) { + lb->type = Balance::ZOLTAN_RCB; } } else if (strcmp(cptr, "rib") == 0) { - if (lb->type < 0) { - lb->type = ZOLTAN_RIB; + if (lb->type == Balance::INVALID) { + lb->type = Balance::ZOLTAN_RIB; } } else if (strcmp(cptr, "hsfc") == 0) { - if (lb->type < 0) { - lb->type = ZOLTAN_HSFC; + if (lb->type == Balance::INVALID) { + lb->type = Balance::ZOLTAN_HSFC; } } else if (strcmp(cptr, "random") == 0) { - if (lb->type < 0) { - lb->type = RANDOM; + if (lb->type == Balance::INVALID) { + lb->type = Balance::RANDOM; } } else if (strstr(cptr, "infile")) { - if (lb->type < 0) { - lb->type = INFILE; + if (lb->type == Balance::INVALID) { + lb->type = Balance::INFILE; cptr2 = strchr(cptr, '='); if (cptr2 == nullptr) { Gen_Error(0, "FATAL: need to specify a value with infile"); @@ -799,14 +801,12 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, } } else if (strcmp(cptr, "kl") == 0) { - if (lb->refine < 0) { - lb->refine = KL_REFINE; + if (lb->refine == Balance::INVALID) { + lb->refine = Balance::KL_REFINE; } } else if (strcmp(cptr, "none") == 0) { - if (lb->refine < 0) { - lb->refine = NS_NONE; - } + ; // Do nothing. } else if (strcmp(cptr, "ignore_z") == 0) { lb->ignore_z = 1; @@ -892,11 +892,11 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, } } else if (strcmp(cptr, "use_rqi") == 0) { - if (solver->rqi_flag == USE_RQI) { - solver->rqi_flag = -1; + if (solver->rqi_flag == SolverOptions::USE_RQI) { + solver->rqi_flag = SolverOptions::INVALID; } else { - solver->rqi_flag = USE_RQI; + solver->rqi_flag = SolverOptions::USE_RQI; } } else if (strstr(cptr, "vmax")) { @@ -924,26 +924,24 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, } } else if (token_compare(cptr, "graph type")) { - if (problem->type < 0) { - cptr = strtok(nullptr, "\t="); - strip_string(cptr, " \t\n"); - string_to_lower(cptr, '\0'); - if (strcmp(cptr, "nodal") == 0) { - problem->type = NODAL; - } - else if (strcmp(cptr, "node") == 0) { - problem->type = NODAL; - } - else if (strcmp(cptr, "elemental") == 0) { - problem->type = ELEMENTAL; - } - else if (strcmp(cptr, "element") == 0) { - problem->type = ELEMENTAL; - } - else { - Gen_Error(0, "FATAL: unknown graph type specified"); - return 0; - } + cptr = strtok(nullptr, "\t="); + strip_string(cptr, " \t\n"); + string_to_lower(cptr, '\0'); + if (strcmp(cptr, "nodal") == 0) { + problem->type = DecompType::NODAL; + } + else if (strcmp(cptr, "node") == 0) { + problem->type = DecompType::NODAL; + } + else if (strcmp(cptr, "elemental") == 0) { + problem->type = DecompType::ELEMENTAL; + } + else if (strcmp(cptr, "element") == 0) { + problem->type = DecompType::ELEMENTAL; + } + else { + Gen_Error(0, "FATAL: unknown graph type specified"); + return 0; } } else if (token_compare(cptr, "machine description")) { @@ -966,11 +964,11 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, /* Find out the machine type */ strip_string(cptr, " \t\n"); if (strcasecmp(cptr, "mesh") == 0) { - machine->type = MESH; + machine->type = MachineType::MESH; max_dim = 3; } else if (strcasecmp(cptr, "hcube") == 0 || strcasecmp(cptr, "hypercube") == 0) { - machine->type = HCUBE; + machine->type = MachineType::HCUBE; max_dim = 1; } else if (strcasecmp(cptr, "cluster") == 0) { @@ -978,11 +976,11 @@ int read_cmd_file(std::string &ascii_inp_file, std::string &exoII_inp_file, cptr = cptr2 + 1; cptr2 = strpbrk(cptr, "mMhH"); if (*cptr2 == 'm' || *cptr2 == 'M') { - machine->type = MESH; + machine->type = MachineType::MESH; max_dim = 3; } else if (*cptr2 == 'h' || *cptr2 == 'H') { - machine->type = HCUBE; + machine->type = MachineType::HCUBE; max_dim = 1; } else { @@ -1339,16 +1337,16 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* Check the machine specification */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - if (machine->type != MESH && machine->type != HCUBE) { + if (machine->type != MachineType::MESH && machine->type != MachineType::HCUBE) { Gen_Error(0, "FATAL: machine type not properly set"); return 0; } - if (machine->type == HCUBE && machine->num_dims != 1) { + if (machine->type == MachineType::HCUBE && machine->num_dims != 1) { Gen_Error(0, "FATAL: improper number of dimension for a hypercube, only" " 1 allowed"); return 0; } - if (machine->type == MESH && machine->num_dims > 3) { + if (machine->type == MachineType::MESH && machine->num_dims > 3) { Gen_Error(0, "FATAL: maximum of 3 dimensions for a mesh exceeded"); return 0; } @@ -1359,7 +1357,7 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, } /* Find out the number of processors */ - if (machine->type == HCUBE) { + if (machine->type == MachineType::HCUBE) { machine->procs_per_box = 1 << machine->dim[0]; } else { @@ -1384,7 +1382,7 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* Check the problem specifications */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - if (prob->type != ELEMENTAL && prob->type != NODAL) { + if (prob->type != DecompType::ELEMENTAL && prob->type != DecompType::NODAL) { Gen_Error(0, "FATAL: unknown problem type specified"); return 0; } @@ -1401,7 +1399,7 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, * using face definition of adjacencies only makes sense * with an elemental decomposition */ - if (prob->type != ELEMENTAL && prob->face_adj) { + if (prob->type != DecompType::ELEMENTAL && prob->face_adj) { Gen_Error(1, "WARNING: can only use face definition of"); Gen_Error(1, "WARNING: adjacency with elemental decomposition"); Gen_Error(1, "WARNING: face definition turned off"); @@ -1412,7 +1410,7 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, * Detecting columns and fixing their partitioning only makes sense * with an elemental decomposition */ - if (prob->type != ELEMENTAL && prob->fix_columns) { + if (prob->type != DecompType::ELEMENTAL && prob->fix_columns) { Gen_Error(1, "WARNING: can only use fix columns options"); Gen_Error(1, "WARNING: with elemental decomposition"); Gen_Error(1, "WARNING: fix columns option turned off"); @@ -1422,27 +1420,29 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* Check the load balance parameters */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - if (lb->type != MULTIKL && lb->type != SPECTRAL && lb->type != INERTIAL && lb->type != LINEAR && - lb->type != RANDOM && lb->type != SCATTERED && lb->type != INFILE && lb->type != ZPINCH && - lb->type != BRICK && lb->type != ZOLTAN_RCB && lb->type != ZOLTAN_RIB && - lb->type != ZOLTAN_HSFC) { + if (lb->type != Balance::MULTIKL && lb->type != Balance::SPECTRAL && + lb->type != Balance::INERTIAL && lb->type != Balance::LINEAR && lb->type != Balance::RANDOM && + lb->type != Balance::SCATTERED && lb->type != Balance::INFILE && + lb->type != Balance::ZPINCH && lb->type != Balance::BRICK && + lb->type != Balance::ZOLTAN_RCB && lb->type != Balance::ZOLTAN_RIB && + lb->type != Balance::ZOLTAN_HSFC) { Gen_Error(0, "FATAL: unknown load balance type requested"); return 0; } - if ((sizeof(INT) == 8) && (lb->type != LINEAR && lb->type != SCATTERED)) { + if ((sizeof(INT) == 8) && (lb->type != Balance::LINEAR && lb->type != Balance::SCATTERED)) { Gen_Error(1, "WARNING: This mesh is using 64-bit integers. The only supported"); Gen_Error(1, " load balance methods for 64-bit integers are 'linear' or 'scattered'"); Gen_Error(1, " The load balance method will be automatically changed to 'linear'."); - lb->type = LINEAR; + lb->type = Balance::LINEAR; } - if (lb->type == MULTIKL) { - lb->refine = KL_REFINE; + if (lb->type == Balance::MULTIKL) { + lb->refine = Balance::KL_REFINE; } - if (lb->refine != KL_REFINE && lb->refine != NO_REFINE) { - lb->refine = NO_REFINE; /* Default if not specified */ + if (lb->refine != Balance::KL_REFINE && lb->refine != Balance::NO_REFINE) { + lb->refine = Balance::NO_REFINE; /* Default if not specified */ } if (lb->num_sects <= 0) { @@ -1463,13 +1463,13 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, lb->outfile = ELB_FALSE; } - if (lb->type == INFILE) { + if (lb->type == Balance::INFILE) { if (lb->outfile) { Gen_Error(0, "FATAL: both infile and outfile cannot be specified"); return 0; } - if (lb->refine != NO_REFINE) { + if (lb->refine != Balance::NO_REFINE) { Gen_Error(1, "WARNING: no refinement can be specified with infile"); return 0; } @@ -1478,17 +1478,13 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* Check the eigensolver parameters */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - if (lb->type == SPECTRAL || lb->type == MULTIKL) { + if (lb->type == Balance::SPECTRAL || lb->type == Balance::MULTIKL) { if (solver->tolerance < 0.0) { Gen_Error(1, "WARNING: using default value for eigensolver" " tolerance"); solver->tolerance = 1.0e-3; } - if (solver->rqi_flag < 0) { - solver->rqi_flag = 0; - } - if (solver->vmax < 0) { Gen_Error(1, "WARNING: no value for vmax specified," " using default"); @@ -1506,14 +1502,15 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, */ std::string ctemp2; switch (machine->type) { - case MESH: ctemp2 = fmt::format("-m{}-", machine->num_procs); break; + case MachineType::MESH: ctemp2 = fmt::format("-m{}-", machine->num_procs); break; - case HCUBE: ctemp2 = fmt::format("-h{}-", machine->num_procs); break; + case MachineType::HCUBE: ctemp2 = fmt::format("-h{}-", machine->num_procs); break; + default:; // do nothing } switch (lb->type) { - case MULTIKL: - case SPECTRAL: + case Balance::MULTIKL: + case Balance::SPECTRAL: if (lb->num_sects == 1) { ctemp2 += "b"; } @@ -1526,24 +1523,25 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, break; - case INERTIAL: ctemp2 += "i"; break; + case Balance::INERTIAL: ctemp2 += "i"; break; - case ZPINCH: ctemp2 += "z"; break; + case Balance::ZPINCH: ctemp2 += "z"; break; - case BRICK: ctemp2 += "x"; break; + case Balance::BRICK: ctemp2 += "x"; break; - case ZOLTAN_RCB: - case ZOLTAN_RIB: - case ZOLTAN_HSFC: ctemp2 += "Z"; break; + case Balance::ZOLTAN_RCB: + case Balance::ZOLTAN_RIB: + case Balance::ZOLTAN_HSFC: ctemp2 += "Z"; break; - case SCATTERED: ctemp2 += "s"; break; + case Balance::SCATTERED: ctemp2 += "s"; break; - case RANDOM: ctemp2 += "r"; break; + case Balance::RANDOM: ctemp2 += "r"; break; - case LINEAR: ctemp2 += "l"; break; + case Balance::LINEAR: ctemp2 += "l"; break; + default:; // do nothing } - if (lb->refine == KL_REFINE) { + if (lb->refine == Balance::KL_REFINE) { ctemp2 += "KL"; } @@ -1595,7 +1593,7 @@ int check_inp_specs(std::string &exoII_inp_file, std::string &nemI_out_file, } ex_entity_type type; - if (prob->type == NODAL) { + if (prob->type == DecompType::NODAL) { type = EX_NODAL; } else { diff --git a/packages/seacas/applications/nem_slice/elb_loadbal.C b/packages/seacas/applications/nem_slice/elb_loadbal.C index f716bccf9f93..64886545ecaf 100644 --- a/packages/seacas/applications/nem_slice/elb_loadbal.C +++ b/packages/seacas/applications/nem_slice/elb_loadbal.C @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2023, 2024, 2025 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -25,7 +25,7 @@ #include "chaco.h" // for input_assign, interface #include "elb.h" // for LB_Description, etc -#include "elb_elem.h" // for E_Type, get_elem_info, etc +#include "elb_elem.h" // for ElementType, get_elem_info, etc #include "elb_err.h" // for Gen_Error #include "elb_graph.h" // for generate_graph #include "elb_groups.h" // for get_group_info @@ -89,7 +89,7 @@ namespace { template int identify_mechanisms(Machine_Description *machine, Problem_Description *problem, Mesh_Description *mesh, LB_Description *lb, - Graph_Description *graph, int check_type); + Graph_Description *graph, Issues check_type); int extract_connected_lists(int nrow, const int *columns, const int *rows, int *list, std::vector &list_ptr); @@ -180,9 +180,10 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, working on the loadbalance */ - if (problem->type == ELEMENTAL && problem->global_mech == 1 && problem->alloc_graph == ELB_TRUE) { + if (problem->type == DecompType::ELEMENTAL && problem->global_mech == 1 && + problem->alloc_graph == ELB_TRUE) { fmt::print("\n==============Looking For Global Issues=================\n"); - identify_mechanisms(machine, problem, mesh, lb, graph, GLOBAL_ISSUES); + identify_mechanisms(machine, problem, mesh, lb, graph, Issues::GLOBAL_ISSUES); fmt::print("============================================================\n"); fmt::print("\n"); } @@ -198,10 +199,11 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, } } - if (((problem->type == NODAL) && (lb->type == INERTIAL)) || - ((problem->type == ELEMENTAL) && - (lb->type == INERTIAL || lb->type == ZPINCH || lb->type == BRICK || lb->type == ZOLTAN_RCB || - lb->type == ZOLTAN_RIB || lb->type == ZOLTAN_HSFC))) { + if (((problem->type == DecompType::NODAL) && (lb->type == Balance::INERTIAL)) || + ((problem->type == DecompType::ELEMENTAL) && + (lb->type == Balance::INERTIAL || lb->type == Balance::ZPINCH || + lb->type == Balance::BRICK || lb->type == Balance::ZOLTAN_RCB || + lb->type == Balance::ZOLTAN_RIB || lb->type == Balance::ZOLTAN_HSFC))) { if (problem->read_coords != ELB_TRUE) { Gen_Error(0, "FATAL: internal logic error. Reading coordinates, but read_coords not set"); return 0; @@ -240,9 +242,10 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, * or ZOLTAN geometric load balancing, * I need to come up with coordinates for the elements. */ - if ((problem->type == ELEMENTAL) && - (lb->type == INERTIAL || lb->type == ZPINCH || lb->type == BRICK || lb->type == ZOLTAN_RCB || - lb->type == ZOLTAN_RIB || lb->type == ZOLTAN_HSFC)) { + if ((problem->type == DecompType::ELEMENTAL) && + (lb->type == Balance::INERTIAL || lb->type == Balance::ZPINCH || lb->type == Balance::BRICK || + lb->type == Balance::ZOLTAN_RCB || lb->type == Balance::ZOLTAN_RIB || + lb->type == Balance::ZOLTAN_HSFC)) { if (problem->read_coords != ELB_TRUE) { Gen_Error(0, "FATAL: internal logic error. Reading coordinates, but read_coords not set"); return 0; @@ -257,13 +260,13 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, size_t cnt = 0; for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - if (mesh->elem_type[ecnt] != SPHERE || problem->no_sph == 1) { + if (mesh->elem_type[ecnt] != ElementType::SPHERE || problem->no_sph == 1) { /* * for our purposes, the coordinate of the element will * be the average of the coordinates of the nodes that make * up that element */ - size_t nnodes = get_elem_info(NNODES, mesh->elem_type[cnt]); + size_t nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[cnt]); for (size_t ncnt = 0; ncnt < nnodes; ncnt++) { x_elem_ptr[cnt] += x_ptr[(mesh->connect[ecnt][ncnt])]; y_elem_ptr[cnt] += y_ptr[(mesh->connect[ecnt][ncnt])]; @@ -287,7 +290,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, (lb->type==INERTIAL||ZPINCH||BRICK||ZOLTAN))"*/ /* Allocate memory for the vertex to processor vector */ - if (problem->type == ELEMENTAL) { + if (problem->type == DecompType::ELEMENTAL) { lb->vertex2proc = reinterpret_cast(malloc(((problem->num_vertices) + sphere->num) * sizeof(int))); } @@ -300,23 +303,23 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, return 0; } - if (machine->type == HCUBE) { + if (machine->type == MachineType::HCUBE) { arch = 0; num_level = ilog2i(static_cast(machine->procs_per_box)); } - if (machine->type == MESH) { + if (machine->type == MachineType::MESH) { arch = machine->num_dims; num_level = 0; } - if (lb->refine == KL_REFINE) { + if (lb->refine == Balance::KL_REFINE) { refine = 1; } else { refine = 2; } - if (lb->type == INFILE) { + if (lb->type == Balance::INFILE) { assignfile = lb->file.c_str(); fp = fopen(assignfile, "r"); if (fp == nullptr) { @@ -331,21 +334,22 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, } switch (lb->type) { - case MULTIKL: glob_method = 1; break; - case SPECTRAL: glob_method = 2; break; - case INERTIAL: glob_method = 3; break; - case ZPINCH: - case BRICK: - case ZOLTAN_RCB: - case ZOLTAN_RIB: - case ZOLTAN_HSFC: + case Balance::MULTIKL: glob_method = 1; break; + case Balance::SPECTRAL: glob_method = 2; break; + case Balance::INERTIAL: glob_method = 3; break; + case Balance::ZPINCH: + case Balance::BRICK: + case Balance::ZOLTAN_RCB: + case Balance::ZOLTAN_RIB: + case Balance::ZOLTAN_HSFC: glob_method = 999; /* Chaco methods don't apply to ZPINCH, BRICK ZOLTAN_RCB, ZOLTAN_RIB, ZOLTAN_HSFC */ break; - case LINEAR: glob_method = 4; break; - case RANDOM: glob_method = 5; break; - case SCATTERED: glob_method = 6; break; - case INFILE: glob_method = 7; break; + case Balance::LINEAR: glob_method = 4; break; + case Balance::RANDOM: glob_method = 5; break; + case Balance::SCATTERED: glob_method = 6; break; + case Balance::INFILE: glob_method = 7; break; + default:; // do nothing } /* check if Chaco is supposed to make sure that the domains are connected */ @@ -397,12 +401,13 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, fmt::print("=======================Call Chaco===========================\n"); time1 = get_time(); - if (lb->type == INFILE) { + if (lb->type == Balance::INFILE) { flag = input_assign(fp, const_cast(assignfile), problem->num_vertices, lb->vertex2proc); } - if (lb->type == ZPINCH || lb->type == BRICK || lb->type == ZOLTAN_RCB || - lb->type == ZOLTAN_RIB || lb->type == ZOLTAN_HSFC) { + if (lb->type == Balance::ZPINCH || lb->type == Balance::BRICK || + lb->type == Balance::ZOLTAN_RCB || lb->type == Balance::ZOLTAN_RIB || + lb->type == Balance::ZOLTAN_HSFC) { fmt::print(stderr, "KDD -- ZPINCH, BRICK, ZOLTAN_RCB, ZOLTAN_RIB, and " "ZOLTAN_HSFC not supported with num_boxes > 1.\n"); fmt::print(stderr, "KDD -- Contact Karen Devine, kddevin@sandia.gov.\n"); @@ -412,7 +417,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, flag = INTER_FACE(problem->num_vertices, (int *)Data(graph->start), (int *)Data(graph->adj), Data(weight->vertices), Data(weight->edges), x_ptr, y_ptr, z_ptr, const_cast(assignfile), (char *)nullptr, lb->vertex2proc, tmp_arch, - tmp_lev, dim, goal, glob_method, refine, solve->rqi_flag, solve->vmax, + tmp_lev, dim, goal, glob_method, refine, (int)solve->rqi_flag, solve->vmax, lb->num_sects, solve->tolerance, seed); } @@ -605,7 +610,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, * num_level are already set for each box. */ if (problem->num_groups > 1) { - if (machine->type == MESH) { + if (machine->type == MachineType::MESH) { /* * mesh and groups are in conflict. the only way to resolve @@ -646,7 +651,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, for (int cnt = 0; cnt < upper; cnt++) { tmpdim[cnt] = machine->dim[cnt]; } - if (machine->type == MESH) { + if (machine->type == MachineType::MESH) { totalproc = tmpdim[0]; if (tmpdim[1] != 0) { totalproc *= tmpdim[1]; @@ -660,40 +665,41 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, } } - if (lb->type == INFILE) { + if (lb->type == Balance::INFILE) { flag = input_assign(fp, const_cast(assignfile), tmp_nv, tmp_v2p); } - else if (lb->type == ZPINCH) { + else if (lb->type == Balance::ZPINCH) { flag = ZPINCH_assign(machine, tmp_nv, tmp_x, tmp_y, tmp_z, tmp_v2p); BALANCE_STATS(machine, nullptr, tmp_nv, tmp_v2p); } - else if (lb->type == BRICK) { + else if (lb->type == Balance::BRICK) { flag = BRICK_assign(machine, tmp_nv, tmp_x, tmp_y, tmp_z, tmp_v2p); BALANCE_STATS(machine, nullptr, tmp_nv, tmp_v2p); } #ifdef USE_ZOLTAN - else if (lb->type == ZOLTAN_RCB) { + else if (lb->type == Balance::ZOLTAN_RCB) { flag = ZOLTAN_assign("RCB", totalproc, tmp_nv, tmp_vwgts, tmp_x, tmp_y, tmp_z, lb->ignore_z, tmp_v2p, argc, argv); BALANCE_STATS(machine, tmp_vwgts, tmp_nv, tmp_v2p); } - else if (lb->type == ZOLTAN_RIB) { + else if (lb->type == Balance::ZOLTAN_RIB) { flag = ZOLTAN_assign("RIB", totalproc, tmp_nv, tmp_vwgts, tmp_x, tmp_y, tmp_z, lb->ignore_z, tmp_v2p, argc, argv); BALANCE_STATS(machine, tmp_vwgts, tmp_nv, tmp_v2p); } - else if (lb->type == ZOLTAN_HSFC) { + else if (lb->type == Balance::ZOLTAN_HSFC) { flag = ZOLTAN_assign("HSFC", totalproc, tmp_nv, tmp_vwgts, tmp_x, tmp_y, tmp_z, lb->ignore_z, tmp_v2p, argc, argv); BALANCE_STATS(machine, tmp_vwgts, tmp_nv, tmp_v2p); } #else - else if (lb->type == ZOLTAN_RCB || lb->type == ZOLTAN_RIB || lb->type == ZOLTAN_HSFC) { + else if (lb->type == Balance::ZOLTAN_RCB || lb->type == Balance::ZOLTAN_RIB || + lb->type == Balance::ZOLTAN_HSFC) { Gen_Error(0, "fatal: Invalid load balance types -- Zoltan is not supported in this build"); goto cleanup; } #endif - else if (lb->type == LINEAR) { + else if (lb->type == Balance::LINEAR) { fmt::print(stderr, "Using internal linear decomposition\n"); /* assign the elements to the processors linearly */ size_t cnt = mesh->num_elems / machine->num_procs; @@ -719,7 +725,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, assert(lb->vertex2proc[i] < machine->num_procs); } } - else if (lb->type == SCATTERED) { + else if (lb->type == Balance::SCATTERED) { // Bad decomposition, useful for maximizing communication for testing algorithms... /* each element 'e' assigned to processor 'e' % 'num_proc' */ @@ -741,7 +747,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, time1 = get_time(); flag = INTER_FACE(tmp_nv, (int *)tmp_start, (int *)tmp_adj, tmp_vwgts, tmp_ewgts, tmp_x, tmp_y, tmp_z, const_cast(assignfile), (char *)nullptr, tmp_v2p, - arch, num_level, tmpdim, goal, glob_method, refine, solve->rqi_flag, + arch, num_level, tmpdim, goal, glob_method, refine, (int)solve->rqi_flag, solve->vmax, lb->num_sects, solve->tolerance, seed); time2 = get_time(); fmt::print("========================================================\n"); @@ -814,7 +820,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, vec_free(weight->edges); } - if (problem->type == ELEMENTAL) { + if (problem->type == DecompType::ELEMENTAL) { /* * If this is an elemental load balance and there are spheres present * then adjust lb->vertex2proc accordingly. The spheres are then @@ -824,7 +830,8 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, // If type == LINEAR || SCATTERED, then the spheres were handled above (unless the model // is // all spheres...) - if ((lb->type != LINEAR && lb->type != SCATTERED) || sphere->num == mesh->num_elems) { + if ((lb->type != Balance::LINEAR && lb->type != Balance::SCATTERED) || + sphere->num == mesh->num_elems) { if (sphere->num != mesh->num_elems) { // If all spheres, don't need to open up space... @@ -833,7 +840,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, * First generate "holes" in the vertex2proc vector where the * sphere assignments will be. */ - if (mesh->elem_type[ecnt] == SPHERE) { + if (mesh->elem_type[ecnt] == ElementType::SPHERE) { for (size_t cnt = (problem->num_vertices); cnt > ecnt; cnt--) { lb->vertex2proc[cnt] = lb->vertex2proc[cnt - 1]; } @@ -854,7 +861,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, size_t cnt2 = 0; for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - if (mesh->elem_type[ecnt] == SPHERE) { + if (mesh->elem_type[ecnt] == ElementType::SPHERE) { lb->vertex2proc[ecnt] = iproc; cnt2++; @@ -883,7 +890,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, fmt::print("\n==============Looking For Local Issues==================\n"); if (problem->face_adj == 1 && problem->alloc_graph == ELB_TRUE) { - identify_mechanisms(machine, problem, mesh, lb, graph, LOCAL_ISSUES); + identify_mechanisms(machine, problem, mesh, lb, graph, Issues::LOCAL_ISSUES); } else { /* need to free the bigger graph and create a face adjacent graph */ @@ -919,7 +926,7 @@ int generate_loadbal(Machine_Description *machine, Problem_Description *problem, graph->adj[cnt]++; } - identify_mechanisms(machine, problem, mesh, lb, graph, LOCAL_ISSUES); + identify_mechanisms(machine, problem, mesh, lb, graph, Issues::LOCAL_ISSUES); problem->alloc_graph = tmp_alloc_graph; problem->face_adj = tmp_adjacency; @@ -962,7 +969,7 @@ cleanup: } } - if (lb->type == INFILE) { + if (lb->type == Balance::INFILE) { fclose(fp); } @@ -1025,7 +1032,7 @@ int generate_maps(Machine_Description *machine, Problem_Description *problem, /*-----------------------------Execution Begins------------------------------*/ /* Generate the map for a nodal load balance */ - if (problem->type == NODAL) { + if (problem->type == DecompType::NODAL) { /* * Generate the nodal and elemental distribution for a nodal * decomposition. @@ -1064,7 +1071,7 @@ namespace { template int identify_mechanisms(Machine_Description *machine, Problem_Description *problem, Mesh_Description *mesh, LB_Description *lb, - Graph_Description *graph, int check_type) + Graph_Description *graph, Issues check_type) { std::vector list_ptr; @@ -1074,7 +1081,7 @@ namespace { */ if (problem->find_cnt_domains == 1) { - if (check_type == GLOBAL_ISSUES) { + if (check_type == Issues::GLOBAL_ISSUES) { size_t nrow = mesh->num_elems; std::vector rows(nrow + 1); std::vector list(nrow); @@ -1112,7 +1119,7 @@ namespace { } } - if (check_type == LOCAL_ISSUES) { + if (check_type == Issues::LOCAL_ISSUES) { std::vector proc_cnt(machine->num_procs); std::vector local_number(mesh->num_elems); @@ -1236,7 +1243,7 @@ namespace { std::vector proc_cnt(machine->num_procs); std::vector local_number(mesh->num_elems); - if (check_type == LOCAL_ISSUES) { + if (check_type == Issues::LOCAL_ISSUES) { for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { int proc = lb->vertex2proc[ecnt]; assert(proc < machine->num_procs); @@ -1247,21 +1254,21 @@ namespace { size_t num_found = 0; for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - E_Type etype = mesh->elem_type[ecnt]; + ElementType etype = mesh->elem_type[ecnt]; /* need to check for volume elements */ if (is_3d_element(etype)) { - int nnodes = get_elem_info(NNODES, mesh->elem_type[ecnt]); + int nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[ecnt]); for (int ncnt = 0; ncnt < nnodes; ncnt++) { size_t node = mesh->connect[ecnt][ncnt]; problems[node] = 0; } - int nsides = get_elem_info(NSIDES, etype); + int nsides = get_elem_info(ElementInfo::NSIDES, etype); int proc = 0; - if (check_type == LOCAL_ISSUES) { + if (check_type == Issues::LOCAL_ISSUES) { proc = lb->vertex2proc[ecnt]; } else { @@ -1292,28 +1299,29 @@ namespace { */ for (size_t pcnt = 0; pcnt < nhold; pcnt++) { - size_t el2 = graph->sur_elem[node][pcnt]; - E_Type etype2 = mesh->elem_type[el2]; + size_t el2 = graph->sur_elem[node][pcnt]; + ElementType etype2 = mesh->elem_type[el2]; int proc2 = 0; - if (check_type == LOCAL_ISSUES) { + if (check_type == Issues::LOCAL_ISSUES) { proc2 = lb->vertex2proc[el2]; } assert(proc2 < machine->num_procs); if (ecnt != el2 && proc == proc2) { - if (etype2 == BAR2 || etype2 == BAR3 || etype2 == SHELL2 || etype2 == SHELL3) { + if (etype2 == ElementType::BAR2 || etype2 == ElementType::BAR3 || + etype2 == ElementType::SHELL2 || etype2 == ElementType::SHELL3) { problems[node] = el2 + 1; } - else if (etype2 == SHELL4 || etype2 == SHELL8 || etype2 == TSHELL3 || - etype2 == TSHELL6) { + else if (etype2 == ElementType::SHELL4 || etype2 == ElementType::SHELL8 || + etype2 == ElementType::TSHELL3 || etype2 == ElementType::TSHELL6) { /* * look for an element connect to one of the shells faces (not edges) * one can look at elements connected to 3 of the nodes - cannot use * diagonals due to triangular shells */ - int nsides2 = get_elem_info(NSIDES, etype2); + int nsides2 = get_elem_info(ElementInfo::NSIDES, etype2); size_t count = 0; for (int cnt = 0; cnt < nsides2; cnt++) { @@ -1359,10 +1367,10 @@ namespace { for (int ncnt = 0; ncnt < nnodes; ncnt++) { size_t node = mesh->connect[ecnt][ncnt]; if (problems[node]) { - size_t el2 = problems[node] - 1; - E_Type etype2 = mesh->elem_type[el2]; + size_t el2 = problems[node] - 1; + ElementType etype2 = mesh->elem_type[el2]; - if (check_type == LOCAL_ISSUES) { + if (check_type == Issues::LOCAL_ISSUES) { fmt::print("WARNING: On Processor {} Local Element {}" " ({}) has a mechanism through Global Node {}" " with Local Element {} ({})\n", @@ -1386,7 +1394,7 @@ namespace { if (num_found) { fmt::print("Total mechanisms found = {}\n", num_found); - if (check_type == LOCAL_ISSUES) { + if (check_type == Issues::LOCAL_ISSUES) { if (problem->mech_add_procs == 1) { machine->num_procs++; fmt::print("\n!!! Processor count increased to {} processors\n", machine->num_procs); @@ -1425,9 +1433,9 @@ namespace { int internal = 1; int flag = 0; for (size_t ecnt = 0; ecnt < graph->sur_elem[ncnt].size(); ecnt++) { - int elem = graph->sur_elem[ncnt][ecnt]; - E_Type etype = mesh->elem_type[elem]; - int nnodes = get_elem_info(NNODES, etype); + int elem = graph->sur_elem[ncnt][ecnt]; + ElementType etype = mesh->elem_type[elem]; + int nnodes = get_elem_info(ElementInfo::NNODES, etype); for (size_t i = 0; i < static_cast(nnodes); i++) { int proc_n = lb->vertex2proc[mesh->connect[elem][i]]; assert(proc_n < machine->num_procs); @@ -1463,8 +1471,8 @@ namespace { /* Find the internal elements */ time1 = get_time(); for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { - E_Type etype = mesh->elem_type[ecnt]; - int nnodes = get_elem_info(NNODES, etype); + ElementType etype = mesh->elem_type[ecnt]; + int nnodes = get_elem_info(ElementInfo::NNODES, etype); for (size_t ncnt = 0; ncnt < static_cast(nnodes); ncnt++) { int node = mesh->connect[ecnt][ncnt]; int proc = lb->vertex2proc[node]; @@ -1493,25 +1501,6 @@ namespace { Mesh_Description *mesh, Graph_Description *graph, Problem_Description *problem) { - int sid; - int hflag1; - int hflag2; - int tflag1; - int tflag2; - int dflag; - - INT nelem; - INT side_nodes[MAX_SIDE_NODES]; - INT mirror_nodes[MAX_SIDE_NODES]; - int side_cnt; - - double time2; - - std::string cmesg; - std::string tmpstr; - - /*-----------------------------Execution Begins------------------------------*/ - /* Allocate memory */ lb->int_nodes.resize(machine->num_procs); lb->bor_nodes.resize(machine->num_procs); @@ -1541,14 +1530,18 @@ namespace { for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { int proce = lb->vertex2proc[ecnt]; auto etype = mesh->elem_type[ecnt]; - int nsides = get_elem_info(NSIDES, etype); + int nsides = get_elem_info(ElementInfo::NSIDES, etype); assert(nsides == 2); /* check each side of this element */ for (int nscnt = 0; nscnt < nsides; nscnt++) { /* get the node on this element side (should only be one)*/ - side_cnt = ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes); + std::array side_nodes; +#ifndef NDEBUG + int side_cnt = +#endif + ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes.data()); assert(side_cnt == 1); size_t nhold = graph->sur_elem[side_nodes[0]].size(); @@ -1586,64 +1579,59 @@ namespace { } } else { + std::array side_nodes; for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { int proc = lb->vertex2proc[ecnt]; assert(proc < machine->num_procs); - bool internal = true; - int flag = 0; - auto etype = mesh->elem_type[ecnt]; - int dim1 = get_elem_info(NDIM, etype); + bool internal = true; + int flag = 0; + ElementType etype = mesh->elem_type[ecnt]; + int dim1 = get_elem_info(ElementInfo::NDIM, etype); /* need to check for hex's or tet's */ - hflag1 = is_hex(etype); + bool hflag1 = is_hex(etype); - /* a tet10 cannot connect to a hex */ - tflag1 = is_tet(etype); + /* a TET10 cannot connect to a HEX */ + bool tflag1 = is_tet(etype); - int nsides = get_elem_info(NSIDES, etype); + int nsides = get_elem_info(ElementInfo::NSIDES, etype); /* check each side of this element */ for (int nscnt = 0; nscnt < nsides; nscnt++) { /* get the list of nodes on this element side */ - side_cnt = ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes); + int side_cnt = + ss_to_node_list(etype, mesh->connect[ecnt], (nscnt + 1), side_nodes.data()); /* * now determine how many side set nodes are needed to * determine if there is an element connected to this side. * - * 1-d - need one node - * 2-d - need two nodes, so find one intersection - * 3-d - need three nodes, so find two intersections - * note: must check to make sure that this number is not - * larger than the number of nodes on the sides (ie - shell). + * 2-D - need two nodes, so find one intersection + * 3-D - need three nodes, so find two intersections + * NOTE: must check to make sure that this number is not + * larger than the number of nodes on the sides (ie - SHELL). */ int nnodes = mesh->num_dims; if (side_cnt < nnodes) { nnodes = side_cnt; } - if (nnodes > 1) - nnodes--; /* decrement to find the number of intersections needed */ + nnodes--; /* decrement to find the number of intersections needed */ - nelem = 0; /* reset this in case no intersections are needed */ + INT nelem = 0; /* reset this in case no intersections are needed */ /* * need to handle hex's differently because of * the tet/hex combination */ - if (!hflag1) { /* not a hex */ + if (!hflag1) { /* Not a hex */ - if (etype == BAR2 || etype == BAR3) { - size_t nhold = graph->sur_elem[side_nodes[0]].size(); - if (nhold > 1) { - for (size_t ncnt = 0; ncnt < nhold; ncnt++) { - hold_elem[ncnt] = graph->sur_elem[side_nodes[0]][ncnt]; - } - } - } - else if (!((etype == BAR2 || etype == SHELL2) && side_nodes[0] == side_nodes[1])) { + /* ignore degenerate bars */ + + if (!((etype == ElementType::BAR2 || etype == ElementType::SHELL2) && + side_nodes[0] == side_nodes[1])) { size_t nhold = graph->sur_elem[side_nodes[0]].size(); for (size_t ncnt = 0; ncnt < nhold; ncnt++) { @@ -1682,7 +1670,7 @@ namespace { */ /* first need to check for a degenerate element */ - dflag = 0; + int dflag = 0; if (side_nodes[0] == side_nodes[1] || side_nodes[0] == side_nodes[3]) { dflag++; } @@ -1827,9 +1815,9 @@ namespace { if (proc != proc2) { - E_Type etype2 = mesh->elem_type[elem]; + ElementType etype2 = mesh->elem_type[elem]; - int dim2 = get_elem_info(NDIM, etype2); + int dim2 = get_elem_info(ElementInfo::NDIM, etype2); int diff = abs(dim1 - dim2); @@ -1843,10 +1831,11 @@ namespace { if (diff < 2) { /* need to check for hex's */ - hflag2 = is_hex(etype2); - tflag2 = is_tet(etype2); + bool hflag2 = is_hex(etype2); + bool tflag2 = is_tet(etype2); /* check here for tet/hex combinations */ + int sid = 0; if ((tflag1 && hflag2) || (hflag1 && tflag2)) { /* * have to call a special function to get the side id @@ -1861,20 +1850,22 @@ namespace { * with the hex. */ sid = get_side_id_hex_tet(mesh->elem_type[elem], mesh->connect[elem], side_cnt, - side_nodes); + side_nodes.data()); } else { /* * get the side id of elem. Make sure that ecnt is * trying to communicate to a valid side of elem */ - side_cnt = get_ss_mirror(etype, side_nodes, (nscnt + 1), mirror_nodes); + std::array mirror_nodes; + side_cnt = + get_ss_mirror(etype, side_nodes.data(), (nscnt + 1), mirror_nodes.data()); /* * small kludge to handle 6 node faces butted up against * 4 node faces */ - if (etype == HEXSHELL && side_cnt == 6) { + if (etype == ElementType::HEXSHELL && side_cnt == 6) { side_cnt = 4; } @@ -1883,7 +1874,8 @@ namespace { * get the mirror of the side of ecnt */ sid = get_side_id(mesh->elem_type[elem], mesh->connect[elem], side_cnt, - mirror_nodes, problem->skip_checks, problem->partial_adj); + mirror_nodes.data(), problem->skip_checks, + problem->partial_adj); } if (sid > 0) { @@ -1905,15 +1897,15 @@ namespace { * too many errors with bad meshes, print out * more information here for diagnostics */ - cmesg = + std::string cmesg = fmt::format("Error returned while getting side id for communication map."); Gen_Error(0, cmesg); cmesg = fmt::format("Element 1: {}", (ecnt + 1)); Gen_Error(0, cmesg); - nnodes = get_elem_info(NNODES, etype); + nnodes = get_elem_info(ElementInfo::NNODES, etype); cmesg = "connect table:"; for (int i = 0; i < nnodes; i++) { - tmpstr = fmt::format(" {}", (size_t)(mesh->connect[ecnt][i] + 1)); + std::string tmpstr = fmt::format(" {}", (size_t)(mesh->connect[ecnt][i] + 1)); cmesg += tmpstr; } Gen_Error(0, cmesg); @@ -1921,16 +1913,16 @@ namespace { Gen_Error(0, cmesg); cmesg = "side nodes:"; for (int i = 0; i < side_cnt; i++) { - tmpstr = fmt::format(" {}", (size_t)(side_nodes[i] + 1)); + std::string tmpstr = fmt::format(" {}", (size_t)(side_nodes[i] + 1)); cmesg += tmpstr; } Gen_Error(0, cmesg); cmesg = fmt::format("Element 2: {}", (size_t)(elem + 1)); Gen_Error(0, cmesg); - nnodes = get_elem_info(NNODES, etype2); + nnodes = get_elem_info(ElementInfo::NNODES, etype2); cmesg = "connect table:"; for (int i = 0; i < nnodes; i++) { - tmpstr = fmt::format(" {}", (size_t)(mesh->connect[elem][i] + 1)); + std::string tmpstr = fmt::format(" {}", (size_t)(mesh->connect[elem][i] + 1)); cmesg += tmpstr; } Gen_Error(0, cmesg); @@ -1948,8 +1940,7 @@ namespace { } } /* End "for(ecnt=0; ecnt < mesh->num_elems; ecnt++)" */ } - - time2 = get_time(); + double time2 = get_time(); fmt::print("Time for elemental categorization: {}s\n", time2 - time1); /* Find the internal and border nodes */ @@ -2363,7 +2354,7 @@ namespace { exit(-1); } - if (machine->type != MESH) { + if (machine->type != MachineType::MESH) { fmt::print(stderr, "KDD -- Machine must be a MESH " "with # wedges * # slices processors.\n"); fmt::print(stderr, "KDD -- Use nem_slice argument -m mesh=AxB, \n"); @@ -2569,7 +2560,7 @@ namespace { exit(-1); } - if (machine->type != MESH) { + if (machine->type != MachineType::MESH) { fmt::print(stderr, "KDD -- Machine must be a MESH " "with nx * ny * nz processors.\n"); fmt::print(stderr, "KDD -- Use nem_slice argument -m mesh=AxBxC, \n"); diff --git a/packages/seacas/applications/nem_slice/elb_main.C b/packages/seacas/applications/nem_slice/elb_main.C index d63a64c8a834..8dff8197d764 100644 --- a/packages/seacas/applications/nem_slice/elb_main.C +++ b/packages/seacas/applications/nem_slice/elb_main.C @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -20,7 +20,7 @@ #include "add_to_log.h" // for add_to_log #include "elb.h" // for LB_Description, get_time, etc #include "elb_allo.h" // for array_alloc -#include "elb_elem.h" // for E_Type, ::NULL_EL +#include "elb_elem.h" // for ElementType, ::NULL_EL #include "elb_err.h" // for error_report, Gen_Error, etc #include "elb_exo.h" // for init_weight_struct, etc #include "elb_graph.h" // for generate_graph @@ -245,7 +245,8 @@ template int internal_main(int argc, char *argv[], INT /* dummy * error_report(); exit(1); } - else if ((problem.type == ELEMENTAL) && ((mesh.num_elems) / (machine.num_procs) < 1)) { + else if ((problem.type == DecompType::ELEMENTAL) && + ((mesh.num_elems) / (machine.num_procs) < 1)) { Gen_Error(0, "fatal: problem divided among too many processors"); error_report(); exit(1); @@ -276,26 +277,26 @@ template int internal_main(int argc, char *argv[], INT /* dummy * } /* Initialize various parameters */ - if (lb.type == INERTIAL || lb.type == ZPINCH || lb.type == BRICK || lb.type == ZOLTAN_RCB || - lb.type == ZOLTAN_RIB || lb.type == ZOLTAN_HSFC || problem.vis_out == 1 || - problem.vis_out == 2) { + if (lb.type == Balance::INERTIAL || lb.type == Balance::ZPINCH || lb.type == Balance::BRICK || + lb.type == Balance::ZOLTAN_RCB || lb.type == Balance::ZOLTAN_RIB || + lb.type == Balance::ZOLTAN_HSFC || problem.vis_out == 1 || problem.vis_out == 2) { problem.read_coords = ELB_TRUE; } else { problem.read_coords = ELB_FALSE; } - if (lb.type != SPECTRAL) { + if (lb.type != Balance::SPECTRAL) { problem.coarse_flag = ELB_FALSE; } else { problem.coarse_flag = ELB_TRUE; } - if (lb.refine == KL_REFINE) { + if (lb.refine == Balance::KL_REFINE) { problem.alloc_graph = ELB_TRUE; } - else if (lb.type == SPECTRAL) { + else if (lb.type == Balance::SPECTRAL) { problem.alloc_graph = ELB_TRUE; } else { @@ -316,10 +317,10 @@ template int internal_main(int argc, char *argv[], INT /* dummy * } /* Allocate necessary memory */ - if (problem.type == NODAL) { + if (problem.type == DecompType::NODAL) { problem.num_vertices = mesh.num_nodes; } - else if (problem.type == ELEMENTAL) { + else if (problem.type == DecompType::ELEMENTAL) { problem.num_vertices = (mesh.num_elems - sphere.num); } @@ -455,27 +456,27 @@ template int internal_main(int argc, char *argv[], INT /* dummy * for (int cnt = 0; cnt < machine.num_procs; cnt++) { vec_free(lb.int_nodes[cnt]); vec_free(lb.bor_nodes[cnt]); - if (problem.type == NODAL) { + if (problem.type == DecompType::NODAL) { vec_free(lb.ext_nodes[cnt]); vec_free(lb.ext_procs[cnt]); } vec_free(lb.int_elems[cnt]); - if (problem.type == ELEMENTAL) { + if (problem.type == DecompType::ELEMENTAL) { vec_free(lb.bor_elems[cnt]); } } vec_free(lb.int_nodes); - if (problem.type == NODAL) { + if (problem.type == DecompType::NODAL) { vec_free(lb.ext_nodes); vec_free(lb.ext_procs); } vec_free(lb.int_elems); - if (problem.type == ELEMENTAL) { + if (problem.type == DecompType::ELEMENTAL) { vec_free(lb.bor_elems); for (int cnt = 0; cnt < machine.num_procs; cnt++) { for (size_t cnt1 = 0; cnt1 < lb.bor_nodes[cnt].size(); cnt1++) { @@ -521,9 +522,9 @@ namespace { fmt::print("Performing "); switch (prob->type) { - case NODAL: fmt::print("a nodal "); break; + case DecompType::NODAL: fmt::print("a nodal "); break; - case ELEMENTAL: fmt::print("an elemental "); break; + case DecompType::ELEMENTAL: fmt::print("an elemental "); break; } fmt::print("load balance with the following parameters...\n"); @@ -540,26 +541,29 @@ namespace { fmt::print("\tarchitecture: "); } switch (machine->type) { - case HCUBE: fmt::print("hypercube\n"); break; - - case MESH: fmt::print("mesh\n"); break; + case MachineType::HCUBE: fmt::print("hypercube\n"); break; + case MachineType::MESH: fmt::print("mesh\n"); break; + default: fmt::print("invalid/unknown\n"); break; } + if (machine->num_boxes > 1) { fmt::print("\tdimension(s) of each box: "); } else { fmt::print("\tdimension(s): "); } + switch (machine->type) { - case HCUBE: fmt::print("{}\n", machine->dim[0]); break; + case MachineType::HCUBE: fmt::print("{}\n", machine->dim[0]); break; - case MESH: + case MachineType::MESH: for (int cnt = 0; cnt < (machine->num_dims) - 1; cnt++) { fmt::print("{}x", machine->dim[cnt]); } fmt::print("{}\n", machine->dim[(machine->num_dims) - 1]); break; + default:; /* do nothing */ } fmt::print("\ttotal number of processors: {}\n", machine->num_procs); @@ -568,44 +572,46 @@ namespace { /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ fmt::print("Load Balance Parameters\n"); switch (lb->type) { - case MULTIKL: + case Balance::MULTIKL: fmt::print("\ttype: multilevel\n"); fmt::print("\tnumber of sections: {}\n", lb->num_sects); break; - case SPECTRAL: + case Balance::SPECTRAL: fmt::print("\ttype: spectral\n"); fmt::print("\tnumber of sections: {}\n", lb->num_sects); break; - case INERTIAL: fmt::print("\ttype: inertial\n"); break; + case Balance::INERTIAL: fmt::print("\ttype: inertial\n"); break; - case ZPINCH: fmt::print("\ttype: zpinch\n"); break; + case Balance::ZPINCH: fmt::print("\ttype: zpinch\n"); break; - case BRICK: fmt::print("\ttype: brick\n"); break; + case Balance::BRICK: fmt::print("\ttype: brick\n"); break; - case ZOLTAN_RCB: fmt::print("\ttype: rcb\n"); break; + case Balance::ZOLTAN_RCB: fmt::print("\ttype: rcb\n"); break; - case ZOLTAN_RIB: fmt::print("\ttype: rib\n"); break; + case Balance::ZOLTAN_RIB: fmt::print("\ttype: rib\n"); break; - case ZOLTAN_HSFC: fmt::print("\ttype: hsfc\n"); break; + case Balance::ZOLTAN_HSFC: fmt::print("\ttype: hsfc\n"); break; - case LINEAR: fmt::print("\ttype: linear\n"); break; + case Balance::LINEAR: fmt::print("\ttype: linear\n"); break; - case RANDOM: fmt::print("\ttype: random\n"); break; + case Balance::RANDOM: fmt::print("\ttype: random\n"); break; - case SCATTERED: fmt::print("\ttype: scattered\n"); break; + case Balance::SCATTERED: fmt::print("\ttype: scattered\n"); break; - case INFILE: + case Balance::INFILE: fmt::print("\ttype: input from file\n"); fmt::print("\tfile name: {}\n", lb->file); break; + default:; /* do nothing */ } fmt::print("\trefinement: "); switch (lb->refine) { - case KL_REFINE: fmt::print("Kernighan-Lin\n"); break; + case Balance::KL_REFINE: fmt::print("Kernighan-Lin\n"); break; - case NO_REFINE: fmt::print("none\n"); break; + case Balance::NO_REFINE: fmt::print("none\n"); break; + default:; /* do nothing */ } if (lb->cnctd_dom) { fmt::print("\tConnected Domain enforced\n"); @@ -618,10 +624,10 @@ namespace { /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /* EIGENSOLVER PARAMETERS */ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - if (lb->type == MULTIKL || lb->type == SPECTRAL) { + if (lb->type == Balance::MULTIKL || lb->type == Balance::SPECTRAL) { fmt::print("Eigensolver Parameters\n"); fmt::print("\teignsolver tolerance: {}\n", solver->tolerance); - if (solver->rqi_flag == USE_RQI) { + if (solver->rqi_flag == SolverOptions::USE_RQI) { fmt::print("\tusing RQI/Symmlq eigensolver\n"); fmt::print("\tnumber of vertices to coarsen down to: {}\n", solver->vmax); } diff --git a/packages/seacas/applications/nem_slice/elb_output.C b/packages/seacas/applications/nem_slice/elb_output.C index 7e0869e38b04..f501b811851f 100644 --- a/packages/seacas/applications/nem_slice/elb_output.C +++ b/packages/seacas/applications/nem_slice/elb_output.C @@ -103,7 +103,7 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine, ex_set_option(exoid, EX_OPT_COMPRESSION_SHUFFLE, 1); /* Create the title */ - if (problem->type == NODAL) { + if (problem->type == DecompType::NODAL) { method1 = "nodal"; } else { @@ -116,26 +116,29 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine, method2 = "method2: "; switch (lb->type) { - case MULTIKL: + case Balance::MULTIKL: method1 += "Multilevel-KL decomposition"; method2 += "With Kernighan-Lin refinement"; break; - case SPECTRAL: method1 += "Spectral decomposition"; break; - case INERTIAL: method1 += "Inertial decomposition"; break; - case ZPINCH: method1 += "ZPINCH decomposition"; break; - case BRICK: method1 += "BRICK decomposition"; break; - case ZOLTAN_RCB: method1 += "RCB decomposition"; break; - case ZOLTAN_RIB: method1 += "RIB decomposition"; break; - case ZOLTAN_HSFC: method1 += "HSFC decomposition"; break; - case LINEAR: method1 += "Linear decomposition"; break; - case RANDOM: method1 += "Random decomposition"; break; - case SCATTERED: method1 += "Scattered decomposition"; break; - } - - if (lb->refine == KL_REFINE && lb->type != MULTIKL) { + case Balance::SPECTRAL: method1 += "Spectral decomposition"; break; + case Balance::INERTIAL: method1 += "Inertial decomposition"; break; + case Balance::ZPINCH: method1 += "ZPINCH decomposition"; break; + case Balance::BRICK: method1 += "BRICK decomposition"; break; + case Balance::ZOLTAN_RCB: method1 += "RCB decomposition"; break; + case Balance::ZOLTAN_RIB: method1 += "RIB decomposition"; break; + case Balance::ZOLTAN_HSFC: method1 += "HSFC decomposition"; break; + case Balance::LINEAR: method1 += "Linear decomposition"; break; + case Balance::RANDOM: method1 += "Random decomposition"; break; + case Balance::SCATTERED: method1 += "Scattered decomposition"; break; + case Balance::INFILE: method1 += "Infile decomposition"; break; + case Balance::INVALID: method1 += "ERROR: Invalid decomposition"; break; + default:; // do nothing + } + + if (lb->refine == Balance::KL_REFINE && lb->type != Balance::MULTIKL) { method2 += "with Kernighan-Lin refinement"; } - else if (lb->type != MULTIKL) { + else if (lb->type != Balance::MULTIKL) { method2 += "no refinement"; } @@ -150,7 +153,7 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine, /* Sort node maps */ gds_qsort(Data(lb->int_nodes[proc]), lb->int_nodes[proc].size()); - if (problem->type == NODAL) { + if (problem->type == DecompType::NODAL) { sort2(lb->ext_nodes[proc].size(), Data(lb->ext_nodes[proc]), Data(lb->ext_procs[proc])); } @@ -223,7 +226,7 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine, std::vector num_nmap_cnts(machine->num_procs); std::vector num_emap_cnts(machine->num_procs); - if (problem->type == NODAL) { + if (problem->type == DecompType::NODAL) { /* need to check and make sure that there really are comm maps */ for (int cnt = 0; cnt < machine->num_procs; cnt++) { if (!lb->bor_nodes[cnt].empty()) { @@ -275,7 +278,7 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine, } } - if (problem->type == NODAL) /* Nodal load balance output */ + if (problem->type == DecompType::NODAL) /* Nodal load balance output */ { /* Set up for the concatenated communication map parameters */ std::vector node_proc_ptr(machine->num_procs + 1); @@ -328,7 +331,7 @@ int write_nemesis(std::string &nemI_out_file, Machine_Description *machine, } /* End "for(proc=0; proc < machine->num_procs; proc++)" */ } - else if (problem->type == ELEMENTAL) /* Elemental load balance output */ + else if (problem->type == DecompType::ELEMENTAL) /* Elemental load balance output */ { std::vector node_proc_ptr(machine->num_procs + 1); std::vector node_cmap_ids_cc(machine->num_procs); @@ -459,7 +462,7 @@ int write_vis(std::string &nemI_out_file, std::string &exoII_inp_file, Machine_D * number of element blocks. */ int vis_nelem_blks; - if (prob->type == ELEMENTAL) { + if (prob->type == DecompType::ELEMENTAL) { vis_nelem_blks = machine->num_procs; } else { @@ -572,12 +575,12 @@ int write_vis(std::string &nemI_out_file, std::string &exoII_inp_file, Machine_D std::vector tmp_connect(nsize); for (size_t ecnt = 0; ecnt < mesh->num_elems; ecnt++) { elem_map[ecnt] = ecnt + 1; - if (prob->type == ELEMENTAL) { + if (prob->type == DecompType::ELEMENTAL) { elem_block[ecnt] = lb->vertex2proc[ecnt]; } else { int proc = lb->vertex2proc[mesh->connect[ecnt][0]]; - int nnodes = get_elem_info(NNODES, mesh->elem_type[ecnt]); + int nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[ecnt]); elem_block[ecnt] = proc; for (int ncnt = 1; ncnt < nnodes; ncnt++) { if (lb->vertex2proc[mesh->connect[ecnt][ncnt]] != proc) { @@ -602,7 +605,7 @@ int write_vis(std::string &nemI_out_file, std::string &exoII_inp_file, Machine_D old_pos += pos + 1; ecnt = mesh->num_elems - old_pos; el_ptr = Data(elem_block) + old_pos; - int nnodes = get_elem_info(NNODES, mesh->elem_type[old_pos - 1]); + int nnodes = get_elem_info(ElementInfo::NNODES, mesh->elem_type[old_pos - 1]); for (int ncnt = 0; ncnt < nnodes; ncnt++) { tmp_connect[ccnt++] = mesh->connect[old_pos - 1][ncnt] + 1; } @@ -651,7 +654,7 @@ int write_vis(std::string &nemI_out_file, std::string &exoII_inp_file, Machine_D } const char *var_names[] = {"proc"}; - if (prob->type == NODAL) { + if (prob->type == DecompType::NODAL) { /* Allocate memory for the nodal values */ std::vector proc_vals(mesh->num_nodes); @@ -682,7 +685,7 @@ int write_vis(std::string &nemI_out_file, std::string &exoII_inp_file, Machine_D return 0; } } - else if (prob->type == ELEMENTAL) { + else if (prob->type == DecompType::ELEMENTAL) { /* Allocate memory for the element values */ std::vector proc_vals(mesh->num_elems); diff --git a/packages/seacas/applications/nem_slice/fix_column_partitions.C b/packages/seacas/applications/nem_slice/fix_column_partitions.C index c84981847878..57a8a5e90610 100644 --- a/packages/seacas/applications/nem_slice/fix_column_partitions.C +++ b/packages/seacas/applications/nem_slice/fix_column_partitions.C @@ -34,7 +34,7 @@ namespace { */ template - void find_adjacent_element(INT cur_elem, E_Type etype, int side_id, int nadj, INT const *adj, + void find_adjacent_element(INT cur_elem, ElementType etype, int side_id, int nadj, INT const *adj, Mesh_Description const *const mesh, INT *adj_elem, int *adj_side) { *adj_elem = -1; @@ -54,8 +54,8 @@ namespace { get_ss_mirror(etype, Data(side_nodes), side_id, Data(side_nodes_flipped)); for (int i = 0; i < nadj; i++) { - INT adj_elem_id = adj[i] - 1; // Adjacency graph entries start from 1 - E_Type etype2 = mesh->elem_type[adj_elem_id]; + INT adj_elem_id = adj[i] - 1; // Adjacency graph entries start from 1 + ElementType etype2 = mesh->elem_type[adj_elem_id]; // Does this side occurs in the adjacent element? @@ -113,7 +113,7 @@ int fix_column_partitions(LB_Description *lb, Mesh_Description const * continue; } - E_Type etype = mesh->elem_type[i]; + ElementType etype = mesh->elem_type[i]; // Only hexes and wedges can be stacked in columns if (!is_hex(etype) && !is_wedge(etype)) { @@ -124,7 +124,7 @@ int fix_column_partitions(LB_Description *lb, Mesh_Description const * // local numbering of nodes with respect to the element node list INT *elnodes = mesh->connect[i]; - int nelnodes = get_elem_info(NNODES, etype); + int nelnodes = get_elem_info(ElementInfo::NNODES, etype); float elcoord[27][3]; for (int j = 0; j < nelnodes; j++) { @@ -135,7 +135,7 @@ int fix_column_partitions(LB_Description *lb, Mesh_Description const * int top_side0 = 0; int bot_side0 = 0; - int nelfaces = get_elem_info(NSIDES, etype); + int nelfaces = get_elem_info(ElementInfo::NSIDES, etype); // Find top and bottom faces by eliminating lateral faces under // the assumption that lateral face normals have no Z component diff --git a/packages/seacas/applications/numbers/nu_multi_cavity.f b/packages/seacas/applications/numbers/nu_multi_cavity.f index 1bc6e4c7db9b..3c8c3bf4a39c 100644 --- a/packages/seacas/applications/numbers/nu_multi_cavity.f +++ b/packages/seacas/applications/numbers/nu_multi_cavity.f @@ -1,14 +1,14 @@ -C Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C C See packages/seacas/LICENSE for details C ... Each cavity is a single sideset id, but calculates volume of each cavity -C simultaneously and then outputs all data at the end. Only reads the +C simultaneously and then outputs all data at the end. Only reads the C displacements a single time for all cavities instead of once per cavity - SUBROUTINE MULTI_CAVITY (A, CRD, IDESS, NEESS, NNESS, IPEESS, + SUBROUTINE MULTI_CAVITY (A, CRD, IDESS, NEESS, NNESS, IPEESS, * IPNESS, LTEESS, LTNESS, FACESS, DISP, NUMNP, NDIM, NUMESS, * TIME, ITMSEL, TITLE, CENT, CENTER) @@ -128,4 +128,4 @@ SUBROUTINE MULTI_CAVITY (A, CRD, IDESS, NEESS, NNESS, IPEESS, RETURN END - + diff --git a/packages/seacas/applications/slice/SL_Decompose.C b/packages/seacas/applications/slice/SL_Decompose.C index a93ef4586665..fdf58a9d1828 100644 --- a/packages/seacas/applications/slice/SL_Decompose.C +++ b/packages/seacas/applications/slice/SL_Decompose.C @@ -22,9 +22,6 @@ #include #include -#if !defined __NVCC__ -#include -#endif #include #include #include @@ -160,7 +157,7 @@ namespace { template void decompose_metis(const Ioss::Region ®ion, SystemInterface &interFace, - std::vector &elem_to_proc, IOSS_MAYBE_UNUSED INT dummy) + std::vector &elem_to_proc, INT dummy) { size_t element_count = region.get_property("element_count").get_int(); @@ -272,15 +269,13 @@ namespace { } // namespace template std::vector decompose_elements(const Ioss::Region ®ion, SystemInterface &interFace, - const std::vector &weights, - IOSS_MAYBE_UNUSED int dummy); + const std::vector &weights, int dummy); template std::vector decompose_elements(const Ioss::Region ®ion, SystemInterface &interFace, - const std::vector &weights, - IOSS_MAYBE_UNUSED int64_t dummy); + const std::vector &weights, int64_t dummy); template std::vector decompose_elements(const Ioss::Region ®ion, SystemInterface &interFace, - const std::vector &weights, IOSS_MAYBE_UNUSED INT dummy) + const std::vector &weights, INT dummy) { progress(__func__); // Populate the 'elem_to_proc' vector with a mapping from element to processor. diff --git a/packages/seacas/applications/slice/SL_SystemInterface.C b/packages/seacas/applications/slice/SL_SystemInterface.C index b8c0859a1a3a..6d5372f6f181 100644 --- a/packages/seacas/applications/slice/SL_SystemInterface.C +++ b/packages/seacas/applications/slice/SL_SystemInterface.C @@ -157,20 +157,30 @@ void SystemInterface::enroll_options() options_.enroll("64-bit", GetLongOption::NoValue, "Use 64-bit integers on output database", nullptr, nullptr, true); - options_.enroll("shuffle", GetLongOption::NoValue, - "Use a netcdf4 hdf5-based file and use hdf5s shuffle mode with compression.", + options_.enroll("zlib", GetLongOption::NoValue, + "Use the Zlib / libz compression method if compression is enabled (default) " + "[exodus only, enables netcdf-4].", nullptr); - options_.enroll( - "zlib", GetLongOption::NoValue, - "Use the Zlib / libz compression method if compression is enabled (default) [exodus only].", - nullptr); - options_.enroll("szip", GetLongOption::NoValue, "Use SZip compression. [exodus only, enables netcdf-4]", nullptr); + options_.enroll("zstd", GetLongOption::NoValue, + "Use Zstd compression. [exodus only, enables netcdf-4, experimental]", nullptr); + options_.enroll("bz2", GetLongOption::NoValue, + "Use Bzip2 compression. [exodus only, enables netcdf-4, experimental]", nullptr); + + options_.enroll("shuffle", GetLongOption::NoValue, + "Use a netcdf4 hdf5-based file and use hdf5s shuffle mode with compression.", + nullptr); options_.enroll("compress", GetLongOption::MandatoryValue, - "Specify the hdf5 compression level [0..9] to be used on the output file.", + "Specify the compression level to be used. Values depend on algorithm:\n" + "\t\tzlib/bzip2: 0..9\t\tszip: even, 4..32\t\tzstd: -131072..22", + nullptr); + + options_.enroll("quantize_nsd", GetLongOption::MandatoryValue, + "Use the lossy quantize compression method. Value specifies number of digits to " + "retain (1..15) [exodus only]", nullptr, nullptr, true); options_.enroll("debug", GetLongOption::MandatoryValue, @@ -328,18 +338,62 @@ bool SystemInterface::parse_options(int argc, char **argv) } shuffle_ = (options_.retrieve("shuffle") != nullptr); + zlib_ = (options_.retrieve("zlib") != nullptr); + szip_ = (options_.retrieve("szip") != nullptr); + zstd_ = (options_.retrieve("zstd") != nullptr); + bz2_ = (options_.retrieve("bzip2") != nullptr); + + if ((szip_ ? 1 : 0) + (zlib_ ? 1 : 0) + (zstd_ ? 1 : 0) + (bz2_ ? 1 : 0) > 1) { + fmt::print(stderr, + "ERROR: Only one of 'szip' or 'zlib' or 'zstd' or 'bzip2' can be specified.\n"); + } + + { + const char *temp = options_.retrieve("compress"); + if (temp != nullptr) { + compressionLevel_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } - if (options_.retrieve("szip") != nullptr) { - szip_ = true; - zlib_ = false; + if (zlib_ || bz2_) { + if (compressionLevel_ < 0 || compressionLevel_ > 9) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 0 and 9 inclusive " + "for gzip/zlib compression.\n", + compressionLevel_); + return false; + } + } + else if (szip_) { + if (compressionLevel_ % 2 != 0) { + fmt::print( + stderr, + "ERROR: Bad compression level {}. Must be an even value for szip compression.\n", + compressionLevel_); + return false; + } + if (compressionLevel_ < 4 || compressionLevel_ > 32) { + fmt::print(stderr, + "ERROR: Bad compression level {}, valid value is between 4 and 32 inclusive " + "for szip compression.\n", + compressionLevel_); + return false; + } + } + } } - zlib_ = (options_.retrieve("zlib") != nullptr); - if (szip_ && zlib_) { - fmt::print(stderr, "ERROR: Only one of 'szip' or 'zlib' can be specified.\n"); + { + const char *temp = options_.retrieve("quantize_nsd"); + if (temp != nullptr) { + quantizeNSD_ = std::strtol(temp, nullptr, 10); + if (!szip_ && !zlib_ && !zstd_ && !bz2_) { + zlib_ = true; + } + } } - compressionLevel_ = options_.get_option_value("compress", compressionLevel_); contig_ = options_.retrieve("contiguous_decomposition") != nullptr; outputDecompMap_ = options_.retrieve("output_decomp_map") != nullptr; outputDecompField_ = options_.retrieve("output_decomp_field") != nullptr; diff --git a/packages/seacas/applications/slice/SL_SystemInterface.h b/packages/seacas/applications/slice/SL_SystemInterface.h index c0f5aef74a33..d95961315638 100644 --- a/packages/seacas/applications/slice/SL_SystemInterface.h +++ b/packages/seacas/applications/slice/SL_SystemInterface.h @@ -90,13 +90,16 @@ class SystemInterface public: int compressionLevel_{0}; + int quantizeNSD_{0}; bool shuffle_{false}; bool ints64Bit_{false}; bool netcdf4_{false}; bool netcdf5_{false}; bool disableFieldRecognition_{false}; + bool zlib_{false}; bool szip_{false}; - bool zlib_{true}; + bool zstd_{false}; + bool bz2_{false}; bool outputDecompMap_{false}; bool outputDecompField_{false}; bool ignore_x_{false}; diff --git a/packages/seacas/applications/slice/Slice.C b/packages/seacas/applications/slice/Slice.C index 2bba93b462ed..d43a141cedb9 100644 --- a/packages/seacas/applications/slice/Slice.C +++ b/packages/seacas/applications/slice/Slice.C @@ -89,15 +89,27 @@ namespace { properties.add(Ioss::Property("FILE_TYPE", "netcdf5")); } - if (interFace.compressionLevel_ > 0 || interFace.shuffle_ || interFace.szip_) { + if (interFace.compressionLevel_ > 0 || interFace.shuffle_ || interFace.szip_ || + interFace.zlib_ || interFace.zstd_) { properties.add(Ioss::Property("FILE_TYPE", "netcdf4")); properties.add(Ioss::Property("COMPRESSION_LEVEL", interFace.compressionLevel_)); properties.add(Ioss::Property("COMPRESSION_SHUFFLE", static_cast(interFace.shuffle_))); - if (interFace.szip_) { + + if (interFace.zlib_) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "zlib")); + } + else if (interFace.szip_) { properties.add(Ioss::Property("COMPRESSION_METHOD", "szip")); } - else if (interFace.zlib_) { - properties.add(Ioss::Property("COMPRESSION_METHOD", "zlib")); + else if (interFace.zstd_) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "zstd")); + } + else if (interFace.bz2_) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "bzip2")); + } + + if (interFace.quantizeNSD_ > 0) { + properties.add(Ioss::Property("COMPRESSION_QUANTIZE_NSD", interFace.quantizeNSD_)); } } @@ -1418,7 +1430,10 @@ namespace { } if (debug_level & 32) { - Ioss::DecompUtils::output_decomposition_statistics(elem_to_proc, interFace.processor_count()); + auto work_per_rank = + Ioss::DecompUtils::get_work_per_rank(elem_to_proc, interFace.processor_count()); + auto avg_median = Ioss::DecompUtils::output_decomposition_statistics(work_per_rank); + Ioss::DecompUtils::output_histogram(work_per_rank, avg_median.first, avg_median.second); } if (!create_split_files) { diff --git a/packages/seacas/applications/zellij/Grid.C b/packages/seacas/applications/zellij/Grid.C index d4324c3e47e6..572b533e1c74 100644 --- a/packages/seacas/applications/zellij/Grid.C +++ b/packages/seacas/applications/zellij/Grid.C @@ -1,4 +1,4 @@ -// Copyright(C) 2021, 2022, 2023 National Technology & Engineering Solutions +// Copyright(C) 2021, 2022, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -793,7 +793,7 @@ template void Grid::output_node_map(const Cell &cell, INT /*dummy auto count = cell.added_node_count(Mode::PROCESSOR, m_equivalenceNodes); if (parallel_size() == 1) { - auto gid = cell.m_globalNodeIdOffset + 1; + INT gid = cell.m_globalNodeIdOffset + 1; std::vector map(count); std::iota(map.begin(), map.end(), gid); int exoid = output_region(rank)->get_database()->get_file_pointer(); @@ -852,7 +852,7 @@ template void Grid::output_element_map(Cell &cell, INT /*dummy*/) auto *block = cell.region()->get_element_block(output_element_block->name()); if (block != nullptr) { - auto gid = cell.m_globalElementIdOffset[block->name()] + 1 + global_id_offset; + INT gid = cell.m_globalElementIdOffset[block->name()] + 1 + global_id_offset; auto element_count = block->entity_count(); std::vector map(element_count); diff --git a/packages/seacas/libraries/aprepro_lib/CMakeLists.txt b/packages/seacas/libraries/aprepro_lib/CMakeLists.txt index 13fcf791dda3..207c5cbe414c 100644 --- a/packages/seacas/libraries/aprepro_lib/CMakeLists.txt +++ b/packages/seacas/libraries/aprepro_lib/CMakeLists.txt @@ -113,7 +113,7 @@ if (${PACKAGE_NAME}_ENABLE_TESTS) TRIBITS_ADD_ADVANCED_TEST( aprepro_lib_unit_test TEST_0 EXEC aprepro_lib_test - ARGS -o test.output ${CMAKE_CURRENT_SOURCE_DIR}/test.inp_app + ARGS -o test.output ${CMAKE_CURRENT_SOURCE_DIR}/test.inp_app NOEXEPREFIX NOEXESUFFIX PASS_ANY TEST_1 CMND diff ARGS -w diff --git a/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc b/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc index 2f0a5e62e059..db9b016184b3 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_aprepro.cc @@ -33,8 +33,8 @@ #endif namespace { - const std::string version_short{"6.32"}; - const std::string version_date{"(2024/05/20)"}; + const std::string version_short{"6.35"}; + const std::string version_date{"(2024/11/06)"}; const std::string version_string = version_short + " " + version_date; void output_copyright(); @@ -137,7 +137,7 @@ namespace SEAMS { std::string Aprepro::long_version() const { - auto comment = getsym("_C_")->value.svar; + const auto &comment = getsym("_C_")->value.svar; return comment + " Algebraic Preprocessor (Aprepro) version " + version(); } @@ -447,7 +447,7 @@ namespace SEAMS { const std::string &short_opt, size_t min_length) { // See if `option` starts with 1 or 2 leading `-`. - int number_dash = option[0] == '-' ? (option[1] == '-' ? 2 : 1) : 0; + size_t number_dash = option[0] == '-' ? (option[1] == '-' ? 2 : 1) : 0; // See if `option` contains a `=`, save position... auto equals = option.find('='); @@ -632,7 +632,7 @@ namespace SEAMS { return ret_value; } - array *Aprepro::make_array(int r, int c) + array *Aprepro::make_array(size_t r, size_t c) { auto ptr = new array(r, c); array_allocations.push_back(ptr); diff --git a/packages/seacas/libraries/aprepro_lib/apr_array.cc b/packages/seacas/libraries/aprepro_lib/apr_array.cc index b161a3360c9a..3261b06f4846 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_array.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_array.cc @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -59,13 +59,14 @@ namespace SEAMS { } double value = 0.0; - int cols = arr->cols; - int rows = arr->rows; + auto cols = arr->cols; + auto rows = arr->rows; if (row >= 0 && row < rows && col >= 0 && col < cols) { if (row != static_cast(row) || col != static_cast(col)) { value = array_interpolate(arr, row, col); } else { + int irow = row; int icol = col; int offset = irow * cols + icol; @@ -81,7 +82,7 @@ namespace SEAMS { array *array_add(const array *a, const array *b) { auto array_data = aprepro->make_array(a->rows, a->cols); - for (int i = 0; i < a->rows * a->cols; i++) { + for (size_t i = 0; i < a->rows * a->cols; i++) { array_data->data[i] = a->data[i] + b->data[i]; } return array_data; @@ -91,7 +92,7 @@ namespace SEAMS { { auto array_data = aprepro->make_array(a->rows, a->cols); - for (int i = 0; i < a->rows * a->cols; i++) { + for (size_t i = 0; i < a->rows * a->cols; i++) { array_data->data[i] = a->data[i] - b->data[i]; } return array_data; @@ -101,7 +102,7 @@ namespace SEAMS { { auto array_data = aprepro->make_array(a->rows, a->cols); - for (int i = 0; i < a->rows * a->cols; i++) { + for (size_t i = 0; i < a->rows * a->cols; i++) { array_data->data[i] = a->data[i] * s; } @@ -115,10 +116,10 @@ namespace SEAMS { auto array_data = aprepro->make_array(a->rows, b->cols); - for (int i = 0; i < b->cols; i++) { - for (int j = 0; j < a->rows; j++) { + for (size_t i = 0; i < b->cols; i++) { + for (size_t j = 0; j < a->rows; j++) { double sum = 0.0; - for (int k = 0; k < a->cols; k++) { + for (size_t k = 0; k < a->cols; k++) { sum += a->data[j * ac + k] * b->data[k * bc + i]; } array_data->data[j * bc + i] = sum; diff --git a/packages/seacas/libraries/aprepro_lib/apr_builtin.cc b/packages/seacas/libraries/aprepro_lib/apr_builtin.cc index a6af6761c18f..7acaed41e8b0 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_builtin.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_builtin.cc @@ -108,7 +108,7 @@ namespace SEAMS { reset_error(); double temp = (x < 0 ? -std::floor(-(x)) : std::floor(x)); SEAMS::math_error("int"); - return (temp); + return temp; } // DO_NINT: Calculate integer nearest value @@ -117,7 +117,7 @@ namespace SEAMS { reset_error(); double temp = (x < 0 ? -std::floor(0.5 - x) : std::floor(x + 0.5)); SEAMS::math_error("nint"); - return (temp); + return temp; } // DO_DIST: Calculate distance between point 1 at (x1,y1) and @@ -128,7 +128,7 @@ namespace SEAMS { reset_error(); double temp = std::hypot((x1 - x2), (y1 - y2)); SEAMS::math_error("hypot"); - return (temp); + return temp; } // DO_ANGLE: Calculate angle (radians) between vector 1 at (0,0; x1,y1) and @@ -140,7 +140,7 @@ namespace SEAMS { reset_error(); temp = acos(temp); SEAMS::math_error("angle"); - return (temp); + return temp; } // DO_ANGLE: Calculate angle (degrees) between vector 1 at (0,0; x1,y1) and @@ -152,7 +152,7 @@ namespace SEAMS { reset_error(); temp = r2d(acos(temp)); SEAMS::math_error("angled"); - return (temp); + return temp; } // DO_HYPOT: calculate sqrt(p^2 + q^2) @@ -169,7 +169,7 @@ namespace SEAMS { reset_error(); double temp = max(x, y); SEAMS::math_error("max"); - return (temp); + return temp; } double do_min(double x, double y) @@ -177,7 +177,7 @@ namespace SEAMS { reset_error(); double temp = min(x, y); SEAMS::math_error("min"); - return (temp); + return temp; } double do_d2r(double x) { return (d2r(x)); } @@ -189,7 +189,7 @@ namespace SEAMS { reset_error(); double temp = sin(d2r(x)); SEAMS::math_error("sind"); - return (temp); + return temp; } double do_sin(double x) @@ -197,7 +197,7 @@ namespace SEAMS { reset_error(); double temp = sin(x); SEAMS::math_error("sin"); - return (temp); + return temp; } double do_cosd(double x) @@ -205,7 +205,7 @@ namespace SEAMS { reset_error(); double temp = cos(d2r(x)); SEAMS::math_error("cosd"); - return (temp); + return temp; } double do_cos(double x) @@ -213,7 +213,7 @@ namespace SEAMS { reset_error(); double temp = cos(x); SEAMS::math_error("cos"); - return (temp); + return temp; } double do_tand(double x) @@ -221,7 +221,7 @@ namespace SEAMS { reset_error(); double temp = tan(d2r(x)); SEAMS::math_error("tand"); - return (temp); + return temp; } double do_tan(double x) @@ -229,7 +229,7 @@ namespace SEAMS { reset_error(); double temp = tan(x); SEAMS::math_error("tan"); - return (temp); + return temp; } double do_atan2d(double x, double y) @@ -237,7 +237,7 @@ namespace SEAMS { reset_error(); double temp = r2d(atan2(x, y)); SEAMS::math_error("atan2d"); - return (temp); + return temp; } double do_atan2(double x, double y) @@ -245,7 +245,7 @@ namespace SEAMS { reset_error(); double temp = atan2(x, y); SEAMS::math_error("atan2"); - return (temp); + return temp; } double do_atand(double x) @@ -253,7 +253,7 @@ namespace SEAMS { reset_error(); double temp = r2d(atan(x)); SEAMS::math_error("atand"); - return (temp); + return temp; } double do_atan(double x) @@ -261,7 +261,7 @@ namespace SEAMS { reset_error(); double temp = atan(x); SEAMS::math_error("atan"); - return (temp); + return temp; } double do_asind(double x) @@ -269,7 +269,7 @@ namespace SEAMS { reset_error(); double temp = r2d(asin(x)); SEAMS::math_error("asind"); - return (temp); + return temp; } double do_asin(double x) @@ -277,7 +277,7 @@ namespace SEAMS { reset_error(); double temp = asin(x); SEAMS::math_error("asin"); - return (temp); + return temp; } double do_acosd(double x) @@ -285,7 +285,7 @@ namespace SEAMS { reset_error(); double temp = r2d(acos(x)); SEAMS::math_error("acosd"); - return (temp); + return temp; } double do_acos(double x) @@ -293,7 +293,7 @@ namespace SEAMS { reset_error(); double temp = acos(x); SEAMS::math_error("acos"); - return (temp); + return temp; } // do_srand(x) Seed the random generator with the specified integer value @@ -333,7 +333,7 @@ namespace SEAMS { reset_error(); double temp = (y) >= 0 ? fabs(x) : -fabs(x); SEAMS::math_error("sign"); - return (temp); + return temp; } double do_dim(double x, double y) @@ -341,7 +341,7 @@ namespace SEAMS { reset_error(); double temp = x - (min(x, y)); SEAMS::math_error("dim"); - return (temp); + return temp; } double do_fabs(double x) @@ -349,7 +349,7 @@ namespace SEAMS { reset_error(); double temp = fabs(x); SEAMS::math_error("fabs"); - return (temp); + return temp; } double do_ceil(double x) @@ -357,7 +357,7 @@ namespace SEAMS { reset_error(); double temp = ceil(x); SEAMS::math_error("ceil"); - return (temp); + return temp; } double do_cosh(double x) @@ -365,7 +365,7 @@ namespace SEAMS { reset_error(); double temp = cosh(x); SEAMS::math_error("cosh"); - return (temp); + return temp; } double do_exp(double x) @@ -381,7 +381,7 @@ namespace SEAMS { else { reset_error(); } - return (temp); + return temp; } double do_expm1(double x) @@ -389,7 +389,7 @@ namespace SEAMS { reset_error(); double temp = std::expm1(x); SEAMS::math_error("exp"); - return (temp); + return temp; } double do_erf(double x) { return std::erf(x); } @@ -401,7 +401,7 @@ namespace SEAMS { reset_error(); double temp = floor(x); SEAMS::math_error("floor"); - return (temp); + return temp; } double do_fmod(double x, double y) @@ -409,7 +409,7 @@ namespace SEAMS { reset_error(); double temp = fmod(x, y); SEAMS::math_error("fmod"); - return (temp); + return temp; } double do_log(double x) @@ -417,7 +417,7 @@ namespace SEAMS { reset_error(); double temp = std::log(x); SEAMS::math_error("log"); - return (temp); + return temp; } double do_log10(double x) @@ -425,7 +425,7 @@ namespace SEAMS { reset_error(); double temp = std::log10(x); SEAMS::math_error("log10"); - return (temp); + return temp; } double do_sinh(double x) @@ -433,7 +433,7 @@ namespace SEAMS { reset_error(); double temp = sinh(x); SEAMS::math_error("sinh"); - return (temp); + return temp; } double do_sqrt(double x) @@ -444,7 +444,7 @@ namespace SEAMS { if (fetestexcept(FE_INVALID | FE_OVERFLOW | FE_DIVBYZERO) != 0) { SEAMS::math_error("sqrt"); } - return (temp); + return temp; } double do_cbrt(double x) @@ -455,7 +455,7 @@ namespace SEAMS { if (fetestexcept(FE_INVALID | FE_OVERFLOW | FE_DIVBYZERO) != 0) { SEAMS::math_error("sqrt"); } - return (temp); + return temp; } double do_tanh(double x) @@ -463,7 +463,7 @@ namespace SEAMS { reset_error(); double temp = tanh(x); SEAMS::math_error("tanh"); - return (temp); + return temp; } double do_polarX(double rad, double ang) { return (rad * cos(d2r(ang))); } @@ -577,7 +577,7 @@ namespace SEAMS { char *p = string; while (*p != '\0') { if (isupper(static_cast(*p)) != 0) { - *p = tolower(static_cast(*p)); + *p = static_cast(tolower(static_cast(*p))); } p++; } @@ -589,7 +589,7 @@ namespace SEAMS { char *p = string; while (*p != '\0') { if (islower(static_cast(*p)) != 0) { - *p = toupper(static_cast(*p)); + *p = static_cast(toupper(static_cast(*p))); } p++; } @@ -683,6 +683,10 @@ namespace SEAMS { auto &tokens = get_tokenized_strings(string, delm); auto in = static_cast(n); + if (in == 0) { + aprepro->error("Index to get_word must be positive.", false); + return ""; + } if (tokens.size() >= in) { char *word = nullptr; new_string(tokens[in - 1], &word); @@ -830,6 +834,14 @@ namespace SEAMS { return (tmp); } + const char *do_format(double var, char *format) + { + auto tmpstr = std::strlen(format) > 0 ? fmt::sprintf(format, var) : fmt::format("{}", var); + char *tmp; + new_string(tmpstr.c_str(), &tmp); + return tmp; + } + const char *do_execute(char *string) { aprepro->lexer->execute(string); @@ -851,13 +863,13 @@ namespace SEAMS { const char *do_if(double x) { aprepro->inIfdefGetvar = false; - aprepro->lexer->if_handler(x); + aprepro->lexer->if_handler((x != 0.0)); return nullptr; } const char *do_notif(double x) { - aprepro->lexer->if_handler(!x); + aprepro->lexer->if_handler(x == 0.0); return nullptr; } @@ -911,7 +923,7 @@ namespace SEAMS { // does not appear, then return the remainder of the string. If // 'begin' == "", then start at beginning; if 'end' == "", then // return remainder of the string. - char *start = string; + auto *start = string; if (std::strlen(begin) > 0) { start = std::strstr(string, begin); @@ -920,11 +932,11 @@ namespace SEAMS { } } - int len = std::strlen(start); + auto len = std::strlen(start); if (std::strlen(end) > 0) { - char *finish = std::strstr(start, end); + auto *finish = std::strstr(start, end); if (finish != nullptr) { - len = finish - start; + len = static_cast(finish - start); } } @@ -955,17 +967,17 @@ namespace SEAMS { if (my_array_data != nullptr) { std::ostringstream lines; - int rows = my_array_data->rows; - int cols = my_array_data->cols; + auto rows = my_array_data->rows; + auto cols = my_array_data->cols; - int idx = 0; + size_t idx = 0; - for (int ir = 0; ir < rows; ir++) { + for (size_t ir = 0; ir < rows; ir++) { if (ir > 0) { lines << "\n"; } lines << "\t"; - for (int ic = 0; ic < cols; ic++) { + for (size_t ic = 0; ic < cols; ic++) { const SEAMS::symrec *format = aprepro->getsym("_FORMAT"); if (format->value.svar.empty()) { fmt::print(lines, "{}", my_array_data->data[idx++]); @@ -996,15 +1008,15 @@ namespace SEAMS { array *do_make_array(double rows, double cols) { - auto array_data = aprepro->make_array(rows, cols); + auto array_data = aprepro->make_array(static_cast(rows), static_cast(cols)); return array_data; } array *do_make_array_init(double rows, double cols, double init) { - auto array_data = aprepro->make_array(rows, cols); - int isize = (int)rows * int(cols); - for (int i = 0; i < isize; i++) { + auto array_data = aprepro->make_array(static_cast(rows), static_cast(cols)); + auto isize = static_cast(rows) * static_cast(cols); + for (size_t i = 0; i < isize; i++) { array_data->data[i] = init; } return array_data; @@ -1012,10 +1024,10 @@ namespace SEAMS { array *do_identity(double size) { - auto array_data = aprepro->make_array(size, size); + auto array_data = aprepro->make_array(static_cast(size), static_cast(size)); - int isize = size; - for (int i = 0; i < isize; i++) { + size_t isize = static_cast(size); + for (size_t i = 0; i < isize; i++) { array_data->data[i * isize + i] = 1.0; } return array_data; @@ -1025,11 +1037,11 @@ namespace SEAMS { { // Create 1D array with `count` rows and 1 column. // Values are linearly spaced from `init` to `final` - int isize = count; - auto array_data = aprepro->make_array(count, 1); + auto isize = static_cast(count); + auto array_data = aprepro->make_array(isize, 1); double inc = (final - init) / (count - 1); - for (int i = 0; i < isize; i++) { + for (size_t i = 0; i < isize; i++) { array_data->data[i] = init + (double)i * inc; } return array_data; @@ -1039,8 +1051,8 @@ namespace SEAMS { { auto array_data = aprepro->make_array(a->cols, a->rows); - for (int i = 0; i < a->rows; i++) { - for (int j = 0; j < a->cols; j++) { + for (size_t i = 0; i < a->rows; i++) { + for (size_t j = 0; j < a->cols; j++) { array_data->data[j * a->rows + i] = a->data[i * a->cols + j]; } } @@ -1145,8 +1157,8 @@ namespace SEAMS { file->clear(); file->seekg(0); - int idx = 0; - rows = 0; + size_t idx = 0; + rows = 0; while (std::getline(*file, line)) { if (++rows > rows_to_skip) { auto tokens = tokenize(line, delim); @@ -1186,14 +1198,14 @@ namespace SEAMS { } } - auto array_data = aprepro->make_array(rows, cols); + auto array_data = aprepro->make_array(static_cast(rows), static_cast(cols)); // Read file again storing entries in array_data->data file->clear(); file->seekg(0); - int idx = 0; - rows = 0; + size_t idx = 0; + rows = 0; while (std::getline(*file, line)) { if (line[0] != comment[0]) { rows++; @@ -1208,7 +1220,7 @@ namespace SEAMS { } } } - assert((int)rows == array_data->rows); + assert(static_cast(rows) == array_data->rows); delete file; return array_data; } @@ -1220,7 +1232,7 @@ namespace SEAMS { auto tokens = SEAMS::tokenize(string, delm); auto array_data = aprepro->make_array(tokens.size(), 1); - int idx = 0; + size_t idx = 0; for (const auto &token : tokens) { array_data->data[idx++] = std::stod(token); } diff --git a/packages/seacas/libraries/aprepro_lib/apr_builtin.h b/packages/seacas/libraries/aprepro_lib/apr_builtin.h index bf8ee7340b86..91c9ebb20ff6 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_builtin.h +++ b/packages/seacas/libraries/aprepro_lib/apr_builtin.h @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -107,6 +107,7 @@ namespace SEAMS { const char *do_switch(double x); const char *do_case(double x); + const char *do_format(double n, char *form); const char *do_get_word(double n, char *string, char *delm); const char *do_print_array(const array *my_array_data); diff --git a/packages/seacas/libraries/aprepro_lib/apr_getline.cc b/packages/seacas/libraries/aprepro_lib/apr_getline.cc index 3840eee6f4c5..ba6e10d4e4d7 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_getline.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_getline.cc @@ -248,14 +248,14 @@ namespace { void gl_puts(const char *const buf) { if (buf) { - int len = strlen(buf); + auto len = strlen(buf); write(1, buf, len); } } [[noreturn]] void gl_error(const char *const buf) { - int len = strlen(buf); + auto len = strlen(buf); gl_cleanup(); write(2, buf, len); @@ -268,7 +268,7 @@ namespace { if (gl_init_done < 0) { /* -1 only on startup */ const char *cp = (const char *)getenv("COLUMNS"); if (cp != nullptr) { - int w = strtol(cp, nullptr, 10); + auto w = strtoul(cp, nullptr, 10); if (w > 20) SEAMS::gl_setwidth(w); } @@ -295,7 +295,7 @@ namespace { } // namespace namespace SEAMS { - void gl_setwidth(int w) + void gl_setwidth(size_t w) { if (w > 250) { w = 250; @@ -604,9 +604,9 @@ namespace { gl_width = gl_termw - strlen(prompt); } else if (strcmp(prompt, last_prompt) != 0) { - int l1 = strlen(last_prompt); - int l2 = strlen(prompt); - gl_cnt = gl_cnt + l1 - l2; + auto l1 = strlen(last_prompt); + auto l2 = strlen(prompt); + gl_cnt = gl_cnt + l1 - l2; copy_string(last_prompt, prompt, 80); gl_putc('\r'); gl_puts(prompt); @@ -744,11 +744,11 @@ namespace SEAMS { p++; } if (*p) { - int len = strlen(buf); + auto len = strlen(buf); if (strchr(p, '\n')) { /* previously line already has NL stripped */ len--; } - if ((prev == nullptr) || ((int)strlen(prev) != len) || strncmp(prev, buf, (size_t)len) != 0) { + if ((prev == nullptr) || (strlen(prev) != len) || strncmp(prev, buf, len) != 0) { hist_buf[hist_last] = hist_save(buf); prev = hist_buf[hist_last]; hist_last = (hist_last + 1) % HIST_SIZE; @@ -800,7 +800,7 @@ namespace { /* makes a copy of the string */ { char *s = nullptr; - size_t len = strlen(p); + auto len = strlen(p); const char *nl = strpbrk(p, "\n\r"); if (nl) { diff --git a/packages/seacas/libraries/aprepro_lib/apr_getline.h b/packages/seacas/libraries/aprepro_lib/apr_getline.h index 81b394a1c147..d3857e773647 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_getline.h +++ b/packages/seacas/libraries/aprepro_lib/apr_getline.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 1991, 1992, 1993, 2022, 2023 by Chris Thewalt (thewalt@ce.berkeley.edu) + * Copyright (C) 1991, 1992, 1993, 2022, 2023, 2024, 2024 by Chris Thewalt (thewalt@ce.berkeley.edu) * * Permission to use, copy, modify, and distribute this software * for any purpose and without fee is hereby granted, provided @@ -19,6 +19,6 @@ namespace SEAMS { char *getline_int(const char *); /* read a line of input */ - void gl_setwidth(int); /* specify width of screen */ + void gl_setwidth(size_t); /* specify width of screen */ void gl_histadd(const char *); /* adds entries to hist */ } // namespace SEAMS diff --git a/packages/seacas/libraries/aprepro_lib/apr_init.cc b/packages/seacas/libraries/aprepro_lib/apr_init.cc index 62b068689608..da7091dc453f 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_init.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_init.cc @@ -18,11 +18,11 @@ #include // for string namespace SEAMS { - init arith_0_fncts[] = { + const init arith_0_fncts[] = { {"seconds", do_time, "seconds()", "Seconds since epoch (useful for srand())."}, {nullptr, nullptr, nullptr, nullptr}}; - init_d arith_fncts[] = { + const init_d arith_fncts[] = { {"abs", do_fabs, "abs(x)", "Absolute value of x. |x|."}, {"acos", do_acos, "acos(x)", "Inverse cosine of x, returns radians."}, {"acosd", do_acosd, "acosd(x)", "Inverse cosine of x, returns degrees."}, @@ -68,12 +68,12 @@ namespace SEAMS { "Convert temperature x from degrees C to degrees F (100C -> 212F)"}, {nullptr, nullptr, nullptr, nullptr}}; - init_a arith_a_fncts[] = { + const init_a arith_a_fncts[] = { {"rows", do_rows, "rows(array)", "Returns the number of rows in the array. "}, {"cols", do_cols, "cols(array)", "Returns the number of columns in the array. "}, {nullptr, nullptr, nullptr, nullptr}}; - init_dd arith_dd_fncts[] = { + const init_dd arith_dd_fncts[] = { {"atan2", do_atan2, "atan2(y,x)", "Inverse tangent of y/x, returns radians."}, {"atan2d", do_atan2d, "atan2d(y,x)", "Inverse tangent of y/x, returns degrees."}, {"dim", do_dim, "dim(x,y)", "x - min(x,y)"}, @@ -94,7 +94,7 @@ namespace SEAMS { {"sign", do_sign, "sign(x,y)", "x * sgn(y)"}, {nullptr, nullptr, nullptr, nullptr}}; - init_dddd arith_dddd_fncts[] = { + const init_dddd arith_dddd_fncts[] = { {"Vangle", do_angle, "Vangle(x1,y1,x2,y2)", "Angle (radians) between vector x1_i+y1_j and x2_i+y2_j."}, {"Vangled", do_angled, "Vangled(x1,y1,x2,y2)", @@ -102,37 +102,38 @@ namespace SEAMS { {"dist", do_dist, "dist(x1,y1, x2,y2)", "sqrt((x1-x2)^2 + (y1-y2)^2)"}, {nullptr, nullptr, nullptr, nullptr}}; - init_cc arith_cc_fncts[] = {{"word_count", do_word_count, "word_count(svar,del)", - "Number of words in svar. Words are separated by one or more of the " - "characters\n\t\t\tin the " - "string variable 'del'."}, - {nullptr, nullptr, nullptr, nullptr}}; + const init_cc arith_cc_fncts[] = { + {"word_count", do_word_count, "word_count(svar,del)", + "Number of words in svar. Words are separated by one or more of the " + "characters\n\t\t\tin the " + "string variable 'del'."}, + {nullptr, nullptr, nullptr, nullptr}}; - init_ccc arith_ccc_fncts[] = { + const init_ccc arith_ccc_fncts[] = { {"find_word", do_find_word, "find_word(w,s,d)", "Find the 1-based index of word 'w' in variable 's'. Words are separated " "by one or more of the\n\t\t\tcharacters in the " "string variable 'd'. Returns 0 if not found."}, {nullptr, nullptr, nullptr, nullptr}}; - init_c arith_c_fncts[] = {{"strtod", do_strtod, "strtod(svar)", - "Returns a double-precision floating-point number " - "equal to the value represented by the\n\t\t\tcharacter " - "string pointed to by svar."}, - {nullptr, nullptr, nullptr, nullptr}}; + const init_c arith_c_fncts[] = {{"strtod", do_strtod, "strtod(svar)", + "Returns a double-precision floating-point number " + "equal to the value represented by the\n\t\t\tcharacter " + "string pointed to by svar."}, + {nullptr, nullptr, nullptr, nullptr}}; - init_cd arith_cd_fncts[] = {{"option", do_option, "option(?,?)", "Internal"}, - {nullptr, nullptr, nullptr, nullptr}}; + const init_cd arith_cd_fncts[] = {{"option", do_option, "option(?,?)", "Internal"}, + {nullptr, nullptr, nullptr, nullptr}}; - init_ddd arith_ddd_fncts[] = { + const init_ddd arith_ddd_fncts[] = { {"julday", do_julday, "julday(mm, dd, yy)", "Julian day corresponding to mm/dd/yy. "}, {nullptr, nullptr, nullptr, nullptr}}; - init_dddddd arith_dddddd_fncts[] = {{"juldayhms", do_juldayhms, "juldayhms(m,d,y,h,m,s)", - "Julian day corresponding to m/d/y at h:m:s "}, - {nullptr, nullptr, nullptr, nullptr}}; + const init_dddddd arith_dddddd_fncts[] = {{"juldayhms", do_juldayhms, "juldayhms(m,d,y,h,m,s)", + "Julian day corresponding to m/d/y at h:m:s "}, + {nullptr, nullptr, nullptr, nullptr}}; - str_init string_fncts[] = { + const str_init string_fncts[] = { {"DUMP", do_dumpsym, "DUMP()", "Output a list of all user-defined variables and their value."}, {"DUMP_JSON", do_dumpsym_json, "DUMP_JSON()", @@ -154,7 +155,7 @@ namespace SEAMS { "Return the version string (See also _VERSION variable)"}, {nullptr, nullptr, nullptr, nullptr}}; - str_c_init string_c_fncts[] = { + const str_c_init string_c_fncts[] = { {"DUMP", do_dumpsym1, "DUMP(str)", "Output a list of all defined variables and their value if name contains 'str'."}, {"DUMP_FUNC", do_dumpfunc1, "DUMP_FUNC(str)", @@ -230,7 +231,7 @@ namespace SEAMS { #endif {nullptr, nullptr, nullptr, nullptr}}; - str_d_init string_d_fncts[] = { + const str_d_init string_d_fncts[] = { {"IO", do_intout, "IO(x)", "Convert x to an integer and then to a string. "}, {"to_string", do_tostring, "to_string(x)", "Returns a string representation of the numerical variable x. The variable x is unchanged."}, @@ -266,13 +267,18 @@ namespace SEAMS { "Switch statement. A case used in a containing switch statement."}, {nullptr, nullptr, nullptr, nullptr}}; - str_dcc_init string_dcc_fncts[] = { + const str_dc_init string_dc_fncts[] = { + {"format", do_format, "format(variable, output_format)", + "Print `variable` using the format specified in `output_format`"}, + {nullptr, nullptr, nullptr, nullptr}}; + + const str_dcc_init string_dcc_fncts[] = { {"get_word", do_get_word, "get_word(n,svar,del)", "Returns a string containing the nth word of svar. The words are separated by one or more " "\n\t\t\tcharacters in the string variable del "}, {nullptr, nullptr, nullptr, nullptr}}; - str_ccc_init string_ccc_fncts[] = { + const str_ccc_init string_ccc_fncts[] = { {"extract", do_extract, "extract(s, b, e)", "Return substring [b,e). 'b' is included; 'e' is not. If 'b' not found, return empty; If " "'e' not found,\n\t\t\treturn rest of string. If 'b' empty, start at beginning; if 'e' " @@ -284,22 +290,22 @@ namespace SEAMS { #endif {nullptr, nullptr, nullptr, nullptr}}; - str_cc_init string_cc_fncts[] = { + const str_cc_init string_cc_fncts[] = { #if defined(EXODUS_SUPPORT) {"exodus_info", do_exodus_info, "exodus_info(filename, prefix)", "Parses the info records that begin with 'prefix' extracted from the exodus file 'ex_fn'"}, #endif {nullptr, nullptr, nullptr, nullptr}}; - str_a_init string_a_fncts[] = { + const str_a_init string_a_fncts[] = { {"print_array", do_print_array, "print_array(array)", "Prints the data in the array."}, {nullptr, nullptr, nullptr, nullptr}}; - array_c_init array_c_fncts[] = {{"csv_array", do_csv_array1, "csv_array(filename)", - "Create a 2D array from the data in a csv file."}, - {nullptr, nullptr, nullptr, nullptr}}; + const array_c_init array_c_fncts[] = {{"csv_array", do_csv_array1, "csv_array(filename)", + "Create a 2D array from the data in a csv file."}, + {nullptr, nullptr, nullptr, nullptr}}; - array_cd_init array_cd_fncts[] = { + const array_cd_init array_cd_fncts[] = { {"csv_array", do_csv_array, "csv_array(filename, [skip])", "Create a 2D array from the data in a csv file optionally skipping rows." " If skip is integer\n\t\t\tskip that many rows; if skip is a character, skip lines " @@ -307,7 +313,7 @@ namespace SEAMS { "that character"}, {nullptr, nullptr, nullptr, nullptr}}; - array_cc_init array_cc_fncts[] = { + const array_cc_init array_cc_fncts[] = { {"csv_array", do_csv_array2, "csv_array(filename, [skip])", "Create a 2D array from the data in a csv file optionally skipping rows." " If skip is integer skip that many rows; if skip is a character, skip lines beginning with " @@ -323,31 +329,31 @@ namespace SEAMS { "string variable delim. Order is xx, yy, zz, xy, yz, xz."}, {nullptr, nullptr, nullptr, nullptr}}; - array_ddd_init array_ddd_fncts[] = { + const array_ddd_init array_ddd_fncts[] = { {"linear_array", do_linear_array, "linear_array(init, final, count)", "Create a 1D array of 'count' rows. Values linearly spaced from 'init' to 'final'."}, {"make_array", do_make_array_init, "make_array(rows, cols, init=0)", "Create a 2D array of size 'rows' by 'cols' initialized to 'init'. 0 if not specified."}, {nullptr, nullptr, nullptr, nullptr}}; - array_dd_init array_dd_fncts[] = { + const array_dd_init array_dd_fncts[] = { {"make_array", do_make_array, "make_array(rows, cols)", "Create a 2D array of size 'rows' by 'cols' initialized to zero."}, {nullptr, nullptr, nullptr, nullptr}}; - array_d_init array_d_fncts[] = { + const array_d_init array_d_fncts[] = { {"identity", do_identity, "identity(size)", "Create a 2D identity array with 'size' rows and columns. Diagonal = 1.0"}, {nullptr, nullptr, nullptr, nullptr}}; - array_a_init array_a_fncts[] = { + const array_a_init array_a_fncts[] = { {"transpose", do_transpose, "transpose(array)", "Return the transpose of input array"}, {"principal_stress", do_principal, "principal_stress(array)", "Calculate principal stresses of symmetric 3x3 stress tensor (array)."}, {nullptr, nullptr, nullptr, nullptr}}; // clang-format off - var_init variables[] = { + const var_init variables[] = { {"DEG", 57.29577951308232087680}, /* 180/pi, degrees per radian */ {"RAD", 0.01745329251994329576}, /* pi/180, radians per degree */ {"E", 2.71828182845904523536}, /* e, base of natural log */ @@ -363,9 +369,9 @@ namespace SEAMS { }; // clang-format on - svar_init svariables[] = {{"_FORMAT", "%.10g"}, /* Default output format */ - {"_UNITS_SYSTEM", "none"}, - {nullptr, nullptr}}; + const svar_init svariables[] = {{"_FORMAT", "%.10g"}, /* Default output format */ + {"_UNITS_SYSTEM", "none"}, + {nullptr, nullptr}}; /* NOTE: The current comment is stored in "_C_" * Since it can be changed by user on command line, we * initialize is differently than the other string variables. @@ -401,6 +407,7 @@ namespace SEAMS { internal_init_table(string_fncts, strfnct, SYMBOL_TYPE::STRING_FUNCTION); internal_init_table(string_c_fncts, strfnct_c, SYMBOL_TYPE::STRING_FUNCTION); internal_init_table(string_d_fncts, strfnct_d, SYMBOL_TYPE::STRING_FUNCTION); + internal_init_table(string_dc_fncts, strfnct_dc, SYMBOL_TYPE::STRING_FUNCTION); internal_init_table(string_dcc_fncts, strfnct_dcc, SYMBOL_TYPE::STRING_FUNCTION); internal_init_table(string_ccc_fncts, strfnct_ccc, SYMBOL_TYPE::STRING_FUNCTION); internal_init_table(string_cc_fncts, strfnct_cc, SYMBOL_TYPE::STRING_FUNCTION); diff --git a/packages/seacas/libraries/aprepro_lib/apr_parser.cc b/packages/seacas/libraries/aprepro_lib/apr_parser.cc index f9aef0ff570e..eeee0b22805b 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_parser.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_parser.cc @@ -2,7 +2,7 @@ // Skeleton implementation for Bison LALR(1) parsers in C++ -// Copyright (C) 2002-2015, 2018-2021, 2024 Free Software Foundation, Inc. +// Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -380,6 +380,7 @@ namespace SEAMS { int yylen = 0; // Error handling. + int yynerrs_ = 0; int yyerrstatus_ = 0; /// The lookahead symbol. @@ -1208,7 +1209,13 @@ namespace SEAMS { &(yylhs.value.string)); } break; - case 109: // sexp: SFNCT LPAR exp COMMA exp RPAR + case 109: // sexp: sexp PLU sexp + { + concat_string((yystack_[2].value.string), (yystack_[0].value.string), + &(yylhs.value.string)); + } break; + + case 110: // sexp: SFNCT LPAR exp COMMA exp RPAR { if (arg_check((yystack_[5].value.tptr), (yystack_[5].value.tptr)->value.strfnct_dd == NULL)) @@ -1218,7 +1225,7 @@ namespace SEAMS { (yylhs.value.string) = (char *)""; } break; - case 110: // sexp: SFNCT LPAR exp COMMA sexp COMMA sexp COMMA sexp COMMA sexp RPAR + case 111: // sexp: SFNCT LPAR exp COMMA sexp COMMA sexp COMMA sexp COMMA sexp RPAR { if (arg_check((yystack_[11].value.tptr), (yystack_[11].value.tptr)->value.strfnct_dcccc == NULL)) @@ -1229,7 +1236,7 @@ namespace SEAMS { (yylhs.value.string) = (char *)""; } break; - case 111: // sexp: SFNCT LPAR exp COMMA sexp COMMA sexp RPAR + case 112: // sexp: SFNCT LPAR exp COMMA sexp COMMA sexp RPAR { if (arg_check((yystack_[7].value.tptr), (yystack_[7].value.tptr)->value.strfnct_dcc == NULL)) @@ -1239,7 +1246,17 @@ namespace SEAMS { (yylhs.value.string) = (char *)""; } break; - case 112: // sexp: SFNCT LPAR sexp COMMA sexp COMMA sexp RPAR + case 113: // sexp: SFNCT LPAR exp COMMA sexp RPAR + { + if (arg_check((yystack_[5].value.tptr), + (yystack_[5].value.tptr)->value.strfnct_dc == NULL)) + (yylhs.value.string) = (char *)(*((yystack_[5].value.tptr)->value.strfnct_dc))( + (yystack_[3].value.val), (yystack_[1].value.string)); + else + (yylhs.value.string) = (char *)""; + } break; + + case 114: // sexp: SFNCT LPAR sexp COMMA sexp COMMA sexp RPAR { if (arg_check((yystack_[7].value.tptr), (yystack_[7].value.tptr)->value.strfnct_ccc == NULL)) @@ -1250,7 +1267,7 @@ namespace SEAMS { (yylhs.value.string) = (char *)""; } break; - case 113: // sexp: SFNCT LPAR sexp COMMA sexp RPAR + case 115: // sexp: SFNCT LPAR sexp COMMA sexp RPAR { if (arg_check((yystack_[5].value.tptr), (yystack_[5].value.tptr)->value.strfnct_cc == NULL)) @@ -1260,65 +1277,142 @@ namespace SEAMS { (yylhs.value.string) = (char *)""; } break; - case 114: // sexp: bool QUEST sexp COLON sexp + case 116: // sexp: bool QUEST sexp COLON sexp { (yylhs.value.string) = ((yystack_[4].value.val)) ? ((yystack_[2].value.string)) : ((yystack_[0].value.string)); } break; - case 115: // exp: NUM + case 117: // sexp: exp TIM sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Multiplying an arithmetic with a string is not defined"); + yyerrok; + } break; + + case 118: // sexp: sexp TIM exp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Multiplying a string with an arithmetic is not defined"); + yyerrok; + } break; + + case 119: // sexp: sexp TIM sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Multiplying a string with a string is not defined"); + yyerrok; + } break; + + case 120: // sexp: sexp DIV exp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Dividing a string by an arithmetic is not defined"); + yyerrok; + } break; + + case 121: // sexp: exp DIV sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Dividing an arithmetic by a string is not defined"); + yyerrok; + } break; + + case 122: // sexp: sexp DIV sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Dividing a string by a string is not defined"); + yyerrok; + } break; + + case 123: // sexp: exp PLU sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Adding an arithmetic and a string is not defined"); + yyerrok; + } break; + + case 124: // sexp: sexp PLU exp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Adding a string and an arithmetic is not defined"); + yyerrok; + } break; + + case 125: // sexp: exp SUB sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Subtracting an arithmetic and a string is not defined"); + yyerrok; + } break; + + case 126: // sexp: sexp SUB exp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Subtracting a string and an arithmetic is not defined"); + yyerrok; + } break; + + case 127: // sexp: sexp SUB sexp + { + (yylhs.value.string) = (char *)""; + yyerror(aprepro, "Subtracting a string from a string is not defined"); + yyerrok; + } break; + + case 128: // exp: NUM { (yylhs.value.val) = (yystack_[0].value.val); } break; - case 116: // exp: INC NUM + case 129: // exp: INC NUM { (yylhs.value.val) = (yystack_[0].value.val) + 1; } break; - case 117: // exp: DEC NUM + case 130: // exp: DEC NUM { (yylhs.value.val) = (yystack_[0].value.val) - 1; } break; - case 118: // exp: VAR + case 131: // exp: VAR { (yylhs.value.val) = (yystack_[0].value.tptr)->value.var; } break; - case 119: // exp: IMMVAR + case 132: // exp: IMMVAR { (yylhs.value.val) = (yystack_[0].value.tptr)->value.var; } break; - case 120: // exp: INC VAR + case 133: // exp: INC VAR { (yylhs.value.val) = ++((yystack_[0].value.tptr)->value.var); } break; - case 121: // exp: DEC VAR + case 134: // exp: DEC VAR { (yylhs.value.val) = --((yystack_[0].value.tptr)->value.var); } break; - case 122: // exp: VAR INC + case 135: // exp: VAR INC { (yylhs.value.val) = ((yystack_[1].value.tptr)->value.var)++; } break; - case 123: // exp: VAR DEC + case 136: // exp: VAR DEC { (yylhs.value.val) = ((yystack_[1].value.tptr)->value.var)--; } break; - case 124: // exp: VAR EQUAL exp + case 137: // exp: VAR EQUAL exp { (yylhs.value.val) = (yystack_[0].value.val); (yystack_[2].value.tptr)->value.var = (yystack_[0].value.val); redefined_warning(aprepro, (yystack_[2].value.tptr)); } break; - case 125: // exp: SVAR EQUAL exp + case 138: // exp: SVAR EQUAL exp { (yylhs.value.val) = (yystack_[0].value.val); (yystack_[2].value.tptr)->value.var = (yystack_[0].value.val); @@ -1326,7 +1420,7 @@ namespace SEAMS { set_type(aprepro, (yystack_[2].value.tptr), token::VAR); } break; - case 126: // exp: AVAR EQUAL exp + case 139: // exp: AVAR EQUAL exp { (yylhs.value.val) = (yystack_[0].value.val); aprepro.redefine_array((yystack_[2].value.tptr)->value.avar); @@ -1335,31 +1429,31 @@ namespace SEAMS { set_type(aprepro, (yystack_[2].value.tptr), token::VAR); } break; - case 127: // exp: VAR EQ_PLUS exp + case 140: // exp: VAR EQ_PLUS exp { (yystack_[2].value.tptr)->value.var += (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; } break; - case 128: // exp: VAR EQ_MINUS exp + case 141: // exp: VAR EQ_MINUS exp { (yystack_[2].value.tptr)->value.var -= (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; } break; - case 129: // exp: VAR EQ_TIME exp + case 142: // exp: VAR EQ_TIME exp { (yystack_[2].value.tptr)->value.var *= (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; } break; - case 130: // exp: VAR EQ_DIV exp + case 143: // exp: VAR EQ_DIV exp { (yystack_[2].value.tptr)->value.var /= (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; } break; - case 131: // exp: VAR EQ_POW exp + case 144: // exp: VAR EQ_POW exp { reset_error(); (yystack_[2].value.tptr)->value.var = @@ -1368,114 +1462,114 @@ namespace SEAMS { SEAMS::math_error(aprepro, "Power"); } break; - case 132: // exp: INC IMMVAR + case 145: // exp: INC IMMVAR { (yylhs.value.val) = (yystack_[0].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[0].value.tptr)); } break; - case 133: // exp: DEC IMMVAR + case 146: // exp: DEC IMMVAR { (yylhs.value.val) = (yystack_[0].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[0].value.tptr)); } break; - case 134: // exp: IMMVAR INC + case 147: // exp: IMMVAR INC { (yylhs.value.val) = (yystack_[1].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[1].value.tptr)); } break; - case 135: // exp: IMMVAR DEC + case 148: // exp: IMMVAR DEC { (yylhs.value.val) = (yystack_[1].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[1].value.tptr)); } break; - case 136: // exp: IMMVAR EQUAL exp + case 149: // exp: IMMVAR EQUAL exp { (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[2].value.tptr)); } break; - case 137: // exp: IMMSVAR EQUAL exp + case 150: // exp: IMMSVAR EQUAL exp { immutable_modify(aprepro, (yystack_[2].value.tptr)); YYERROR; } break; - case 138: // exp: IMMVAR EQ_PLUS exp + case 151: // exp: IMMVAR EQ_PLUS exp { (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[2].value.tptr)); } break; - case 139: // exp: IMMVAR EQ_MINUS exp + case 152: // exp: IMMVAR EQ_MINUS exp { (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[2].value.tptr)); } break; - case 140: // exp: IMMVAR EQ_TIME exp + case 153: // exp: IMMVAR EQ_TIME exp { (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[2].value.tptr)); } break; - case 141: // exp: IMMVAR EQ_DIV exp + case 154: // exp: IMMVAR EQ_DIV exp { (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[2].value.tptr)); } break; - case 142: // exp: IMMVAR EQ_POW exp + case 155: // exp: IMMVAR EQ_POW exp { (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; immutable_modify(aprepro, (yystack_[2].value.tptr)); } break; - case 143: // exp: UNDVAR + case 156: // exp: UNDVAR { (yylhs.value.val) = (yystack_[0].value.tptr)->value.var; undefined_error(aprepro, (yystack_[0].value.tptr)->name); } break; - case 144: // exp: INC UNDVAR + case 157: // exp: INC UNDVAR { (yylhs.value.val) = ++((yystack_[0].value.tptr)->value.var); set_type(aprepro, (yystack_[0].value.tptr), token::VAR); undefined_error(aprepro, (yystack_[0].value.tptr)->name); } break; - case 145: // exp: DEC UNDVAR + case 158: // exp: DEC UNDVAR { (yylhs.value.val) = --((yystack_[0].value.tptr)->value.var); set_type(aprepro, (yystack_[0].value.tptr), token::VAR); undefined_error(aprepro, (yystack_[0].value.tptr)->name); } break; - case 146: // exp: UNDVAR INC + case 159: // exp: UNDVAR INC { (yylhs.value.val) = ((yystack_[1].value.tptr)->value.var)++; set_type(aprepro, (yystack_[1].value.tptr), token::VAR); undefined_error(aprepro, (yystack_[1].value.tptr)->name); } break; - case 147: // exp: UNDVAR DEC + case 160: // exp: UNDVAR DEC { (yylhs.value.val) = ((yystack_[1].value.tptr)->value.var)--; set_type(aprepro, (yystack_[1].value.tptr), token::VAR); undefined_error(aprepro, (yystack_[1].value.tptr)->name); } break; - case 148: // exp: UNDVAR EQUAL exp + case 161: // exp: UNDVAR EQUAL exp { (yylhs.value.val) = (yystack_[0].value.val); (yystack_[2].value.tptr)->value.var = (yystack_[0].value.val); set_type(aprepro, (yystack_[2].value.tptr), token::VAR); } break; - case 149: // exp: UNDVAR EQ_PLUS exp + case 162: // exp: UNDVAR EQ_PLUS exp { (yystack_[2].value.tptr)->value.var += (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; @@ -1483,7 +1577,7 @@ namespace SEAMS { undefined_error(aprepro, (yystack_[2].value.tptr)->name); } break; - case 150: // exp: UNDVAR EQ_MINUS exp + case 163: // exp: UNDVAR EQ_MINUS exp { (yystack_[2].value.tptr)->value.var -= (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; @@ -1491,7 +1585,7 @@ namespace SEAMS { undefined_error(aprepro, (yystack_[2].value.tptr)->name); } break; - case 151: // exp: UNDVAR EQ_TIME exp + case 164: // exp: UNDVAR EQ_TIME exp { (yystack_[2].value.tptr)->value.var *= (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; @@ -1499,7 +1593,7 @@ namespace SEAMS { undefined_error(aprepro, (yystack_[2].value.tptr)->name); } break; - case 152: // exp: UNDVAR EQ_DIV exp + case 165: // exp: UNDVAR EQ_DIV exp { (yystack_[2].value.tptr)->value.var /= (yystack_[0].value.val); (yylhs.value.val) = (yystack_[2].value.tptr)->value.var; @@ -1507,7 +1601,7 @@ namespace SEAMS { undefined_error(aprepro, (yystack_[2].value.tptr)->name); } break; - case 153: // exp: UNDVAR EQ_POW exp + case 166: // exp: UNDVAR EQ_POW exp { reset_error(); (yystack_[2].value.tptr)->value.var = @@ -1518,7 +1612,7 @@ namespace SEAMS { undefined_error(aprepro, (yystack_[2].value.tptr)->name); } break; - case 154: // exp: FNCT LPAR RPAR + case 167: // exp: FNCT LPAR RPAR { if (arg_check((yystack_[2].value.tptr), (yystack_[2].value.tptr)->value.fnctptr == NULL)) @@ -1527,7 +1621,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 155: // exp: FNCT LPAR exp RPAR + case 168: // exp: FNCT LPAR exp RPAR { if (arg_check((yystack_[3].value.tptr), (yystack_[3].value.tptr)->value.fnctptr_d == NULL)) @@ -1537,7 +1631,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 156: // exp: FNCT LPAR sexp RPAR + case 169: // exp: FNCT LPAR sexp RPAR { if (arg_check((yystack_[3].value.tptr), (yystack_[3].value.tptr)->value.fnctptr_c == NULL)) @@ -1547,7 +1641,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 157: // exp: FNCT LPAR aexp RPAR + case 170: // exp: FNCT LPAR aexp RPAR { if (arg_check((yystack_[3].value.tptr), (yystack_[3].value.tptr)->value.fnctptr_a == NULL)) @@ -1557,7 +1651,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 158: // exp: FNCT LPAR sexp COMMA exp RPAR + case 171: // exp: FNCT LPAR sexp COMMA exp RPAR { if (arg_check((yystack_[5].value.tptr), (yystack_[5].value.tptr)->value.fnctptr_cd == NULL)) @@ -1567,7 +1661,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 159: // exp: FNCT LPAR exp COMMA sexp RPAR + case 172: // exp: FNCT LPAR exp COMMA sexp RPAR { if (arg_check((yystack_[5].value.tptr), (yystack_[5].value.tptr)->value.fnctptr_dc == NULL)) @@ -1577,7 +1671,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 160: // exp: FNCT LPAR sexp COMMA sexp RPAR + case 173: // exp: FNCT LPAR sexp COMMA sexp RPAR { if (arg_check((yystack_[5].value.tptr), (yystack_[5].value.tptr)->value.fnctptr_cc == NULL)) @@ -1587,7 +1681,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 161: // exp: FNCT LPAR sexp COMMA sexp COMMA sexp RPAR + case 174: // exp: FNCT LPAR sexp COMMA sexp COMMA sexp RPAR { if (arg_check((yystack_[7].value.tptr), (yystack_[7].value.tptr)->value.fnctptr_ccc == NULL)) @@ -1598,7 +1692,7 @@ namespace SEAMS { yyerrok; } break; - case 162: // exp: FNCT LPAR exp COMMA exp RPAR + case 175: // exp: FNCT LPAR exp COMMA exp RPAR { if (arg_check((yystack_[5].value.tptr), (yystack_[5].value.tptr)->value.fnctptr_dd == NULL)) @@ -1608,7 +1702,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 163: // exp: FNCT LPAR exp COMMA exp COMMA exp RPAR + case 176: // exp: FNCT LPAR exp COMMA exp COMMA exp RPAR { if (arg_check((yystack_[7].value.tptr), (yystack_[7].value.tptr)->value.fnctptr_ddd == NULL)) @@ -1618,7 +1712,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 164: // exp: FNCT LPAR sexp COMMA sexp COMMA exp RPAR + case 177: // exp: FNCT LPAR sexp COMMA sexp COMMA exp RPAR { if (arg_check((yystack_[7].value.tptr), (yystack_[7].value.tptr)->value.fnctptr_ccd == NULL)) @@ -1628,7 +1722,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 165: // exp: FNCT LPAR exp COMMA exp SEMI exp COMMA exp RPAR + case 178: // exp: FNCT LPAR exp COMMA exp SEMI exp COMMA exp RPAR { if (arg_check((yystack_[9].value.tptr), (yystack_[9].value.tptr)->value.fnctptr_dddd == NULL)) @@ -1639,7 +1733,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 166: // exp: FNCT LPAR exp COMMA exp COMMA exp COMMA exp RPAR + case 179: // exp: FNCT LPAR exp COMMA exp COMMA exp COMMA exp RPAR { if (arg_check((yystack_[9].value.tptr), (yystack_[9].value.tptr)->value.fnctptr_dddd == NULL)) @@ -1650,7 +1744,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 167: // exp: FNCT LPAR exp COMMA exp COMMA exp COMMA exp COMMA sexp RPAR + case 180: // exp: FNCT LPAR exp COMMA exp COMMA exp COMMA exp COMMA sexp RPAR { if (arg_check((yystack_[11].value.tptr), (yystack_[11].value.tptr)->value.fnctptr_ddddc == NULL)) @@ -1661,7 +1755,7 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 168: // exp: FNCT LPAR exp COMMA exp COMMA exp COMMA exp COMMA exp COMMA exp RPAR + case 181: // exp: FNCT LPAR exp COMMA exp COMMA exp COMMA exp COMMA exp COMMA exp RPAR { if (arg_check((yystack_[13].value.tptr), (yystack_[13].value.tptr)->value.fnctptr_dddddd == NULL)) @@ -1672,22 +1766,22 @@ namespace SEAMS { (yylhs.value.val) = 0.0; } break; - case 169: // exp: exp PLU exp + case 182: // exp: exp PLU exp { (yylhs.value.val) = (yystack_[2].value.val) + (yystack_[0].value.val); } break; - case 170: // exp: exp SUB exp + case 183: // exp: exp SUB exp { (yylhs.value.val) = (yystack_[2].value.val) - (yystack_[0].value.val); } break; - case 171: // exp: exp TIM exp + case 184: // exp: exp TIM exp { (yylhs.value.val) = (yystack_[2].value.val) * (yystack_[0].value.val); } break; - case 172: // exp: exp DIV exp + case 185: // exp: exp DIV exp { if ((yystack_[0].value.val) == 0.) { (yylhs.value.val) = std::numeric_limits::infinity(); @@ -1698,9 +1792,9 @@ namespace SEAMS { (yylhs.value.val) = (yystack_[2].value.val) / (yystack_[0].value.val); } break; - case 173: // exp: exp MOD exp + case 186: // exp: exp MOD exp { - if ((yystack_[0].value.val) == 0.) { + if ((int)(yystack_[0].value.val) == 0.) { (yylhs.value.val) = (int)(yystack_[2].value.val); yyerror(aprepro, "Zero divisor"); yyerrok; @@ -1709,29 +1803,29 @@ namespace SEAMS { (yylhs.value.val) = (int)(yystack_[2].value.val) % (int)(yystack_[0].value.val); } break; - case 174: // exp: SUB exp + case 187: // exp: SUB exp { (yylhs.value.val) = -(yystack_[0].value.val); } break; - case 175: // exp: PLU exp + case 188: // exp: PLU exp { (yylhs.value.val) = (yystack_[0].value.val); } break; - case 176: // exp: exp POW exp + case 189: // exp: exp POW exp { reset_error(); (yylhs.value.val) = std::pow((yystack_[2].value.val), (yystack_[0].value.val)); SEAMS::math_error(aprepro, "Power"); } break; - case 177: // exp: LPAR exp RPAR + case 190: // exp: LPAR exp RPAR { (yylhs.value.val) = (yystack_[1].value.val); } break; - case 178: // exp: LBRACK exp RBRACK + case 191: // exp: LBRACK exp RBRACK { reset_error(); (yylhs.value.val) = @@ -1740,30 +1834,30 @@ namespace SEAMS { SEAMS::math_error(aprepro, "floor (int)"); } break; - case 179: // exp: bool + case 192: // exp: bool { (yylhs.value.val) = ((yystack_[0].value.val)) ? 1 : 0; } break; - case 180: // exp: bool QUEST exp COLON exp + case 193: // exp: bool QUEST exp COLON exp { (yylhs.value.val) = ((yystack_[4].value.val)) ? ((yystack_[2].value.val)) : ((yystack_[0].value.val)); } break; - case 181: // exp: AVAR LBRACK exp RBRACK + case 194: // exp: AVAR LBRACK exp RBRACK { (yylhs.value.val) = array_value((yystack_[3].value.tptr)->value.avar, (yystack_[1].value.val), 0); } break; - case 182: // exp: AVAR LBRACK exp COMMA exp RBRACK + case 195: // exp: AVAR LBRACK exp COMMA exp RBRACK { (yylhs.value.val) = array_value((yystack_[5].value.tptr)->value.avar, (yystack_[3].value.val), (yystack_[1].value.val)); } break; - case 183: // exp: AVAR LBRACK exp RBRACK EQUAL exp + case 196: // exp: AVAR LBRACK exp RBRACK EQUAL exp { (yylhs.value.val) = (yystack_[0].value.val); array *arr = (yystack_[5].value.tptr)->value.avar; @@ -1787,7 +1881,7 @@ namespace SEAMS { } } break; - case 184: // exp: AVAR LBRACK exp COMMA exp RBRACK EQUAL exp + case 197: // exp: AVAR LBRACK exp COMMA exp RBRACK EQUAL exp { (yylhs.value.val) = (yystack_[0].value.val); array *arr = (yystack_[7].value.tptr)->value.avar; @@ -1834,6 +1928,7 @@ namespace SEAMS { yyerrlab: // If not already recovering from an error, report this error. if (!yyerrstatus_) { + ++yynerrs_; context yyctx(*this, yyla); std::string msg = yysyntax_error_(yyctx); error(YY_MOVE(msg)); @@ -2104,201 +2199,200 @@ namespace SEAMS { return yyres; } - const signed char Parser::yypact_ninf_ = -25; + const signed char Parser::yypact_ninf_ = -32; const signed char Parser::yytable_ninf_ = -1; const short Parser::yypact_[] = { - -25, 22, -25, -13, 224, -25, -25, -25, -25, -25, 1649, -21, -8, 306, -5, - 68, 6, 27, 44, 380, 380, -25, 380, 445, 380, 122, 252, 38, 176, 47, - 1685, 445, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - -25, -25, 445, 380, 380, 380, 380, 380, -25, -25, 445, 380, 380, 380, 380, - 380, 380, -25, -25, 380, 380, 445, 333, 400, 445, 1667, 979, 56, 165, 380, - 160, -24, 1386, 1600, 4, -25, 4, 4, -25, -25, -25, -25, -25, -25, -25, - -25, 380, 460, 505, -25, 445, 445, 380, 445, -25, 520, 565, 580, 625, 640, - 685, 380, -25, 700, 745, 760, 805, 820, 865, 880, 925, 380, 380, 380, 445, - 380, 380, 262, -24, 1735, 1751, 1751, 1751, 1751, 1751, 55, 1782, -25, 1796, 70, - 208, 70, 208, 70, 208, 70, 208, 70, 208, 70, 208, 262, -24, 1735, 1751, - 1751, 1751, 1751, 1751, 262, -24, 1735, -24, 1751, 1751, 1751, 1751, 1751, 1751, -24, - 1751, 1121, 262, -24, 1735, -25, 34, 251, 1151, -25, 120, 276, 1181, 130, 941, - 1211, 380, 380, 380, 380, 4, -25, -25, 380, -25, 1699, 1719, 1667, 55, 1782, - 1667, -25, 1796, 93, 1735, 93, 1767, -25, 1767, 1667, 70, 208, 1667, 70, 208, - 1667, 70, 208, 1667, 70, 208, 1667, 70, 208, 1667, 70, 208, -25, 1751, 1667, - 55, 1782, 1667, -25, 1796, 1667, 70, 208, 1667, 70, 208, 1667, 70, 208, 1667, - 70, 208, 1667, 70, 208, 1667, 70, 208, 110, 110, 4, -25, 4, 4, 4, - 380, 104, -25, 380, -25, 380, -25, -25, 380, -25, 380, -25, -25, 380, -25, - 380, -25, 1751, 1751, 1751, 1751, 4, 380, 380, 1625, 380, 951, 1413, 87, 1092, - 976, 911, 1440, 1012, 1467, 1241, -24, 1751, 121, 1751, 380, -25, -25, -25, 380, - -25, 380, 380, -25, 380, -25, -25, -25, 380, -25, 380, 1034, 1494, 1271, 1330, - 1040, 982, 1521, 1751, -25, -25, 380, -25, 380, -25, 380, -25, -25, 1301, 1548, - 1006, 380, -25, -25, 380, 1062, 1359, 1068, -25, 380, -25, 1575, -25}; + -32, 22, -32, 4, 352, -32, -32, -32, -32, -32, 1865, -21, 20, 178, 28, + 140, 44, 51, 54, 121, 121, -32, 121, 494, 121, 253, 325, 162, 235, 115, + 1901, 494, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + -32, -32, 494, 121, 121, 121, 121, 121, -32, -32, 494, 121, 121, 121, 121, + 121, 121, -32, -32, 121, 121, 494, 421, 479, 494, 1883, 324, 50, 158, 121, + 148, 1932, 1602, 1816, 39, -32, 39, 39, -32, -32, -32, -32, -32, -32, -32, + -32, 121, 539, 554, -32, 494, 494, 121, 494, -32, 599, 614, 659, 674, 719, + 734, 121, 121, 121, 121, 121, -32, 779, 794, 839, 854, 899, 914, 959, 974, + 121, 121, 121, 494, 121, 121, 188, 1932, 1951, 1967, 1967, 1967, 1967, 1967, 55, + 1998, -32, 2012, -31, 263, -31, 263, -31, 263, -31, 263, -31, 263, -31, 263, + 188, 1932, 1951, 1967, 1967, 1967, 1967, 1967, 188, 1932, 1951, 1932, 1967, 1967, 1967, + 1967, 1967, 1967, 1932, 1967, 1337, 188, 1932, 1951, -32, 179, 175, 1367, -32, 225, + 993, 1397, 255, 1021, 1427, 121, 121, 121, 121, 39, -32, -32, 121, -32, 344, + 1918, 1883, 55, 1998, 1883, -32, 2012, -29, 1951, -29, 1983, -32, 1983, 1883, -31, + 263, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, -31, + 263, -27, 99, -27, 99, 25, 39, 25, 39, -32, 1967, 1883, 55, 1998, 1883, + -32, 2012, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, -31, 263, 1883, + -31, 263, 1883, -31, 263, -27, 99, -27, 99, 25, 39, -32, 25, 39, 39, + 39, 121, 63, -32, 121, -32, 121, -32, -32, 121, -32, 121, -32, -32, 121, + -32, 121, -32, 1967, 1967, 1967, 1967, 39, 121, 121, 1841, 121, 1049, 1629, 42, + 1308, 1077, 1105, 1656, 1176, 1683, 1457, 1932, 1967, 73, 1967, 121, -32, -32, -32, + 121, -32, 121, 121, -32, 121, -32, -32, -32, -32, 121, -32, 121, 1202, 1710, + 1487, 1546, 1228, 1133, 1737, 1967, -32, -32, 121, -32, 121, -32, 121, -32, -32, + 1517, 1764, 1150, 121, -32, -32, 121, 1254, 1575, 1280, -32, 121, -32, 1791, -32}; const unsigned char Parser::yydefact_[] = { - 2, 0, 1, 0, 0, 4, 3, 9, 115, 95, 143, 118, 96, 119, 97, 76, 0, 0, 0, - 0, 0, 8, 0, 0, 0, 0, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 146, 147, 0, 0, 0, 0, 0, 0, 122, 123, 0, 0, - 0, 0, 0, 0, 0, 134, 135, 0, 0, 0, 0, 0, 0, 143, 118, 96, 0, 0, 179, - 0, 0, 0, 175, 89, 174, 12, 116, 144, 120, 132, 117, 145, 121, 133, 0, 0, 0, 7, - 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 87, 98, 148, 149, 150, 151, 152, 153, 32, 26, 33, - 27, 52, 64, 53, 65, 54, 66, 55, 67, 56, 68, 57, 69, 85, 100, 124, 127, 128, 129, - 130, 131, 84, 99, 125, 103, 136, 138, 139, 140, 141, 142, 102, 137, 0, 86, 101, 126, 154, - 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 25, 177, 0, 178, - 0, 0, 30, 19, 21, 31, 20, 22, 88, 0, 90, 92, 94, 91, 58, 34, 46, 59, 35, - 47, 60, 36, 48, 61, 37, 49, 62, 38, 50, 63, 39, 51, 108, 0, 28, 23, 17, 29, - 24, 18, 70, 40, 10, 71, 41, 11, 72, 42, 13, 73, 43, 14, 74, 44, 15, 75, 45, - 16, 169, 170, 172, 93, 171, 173, 176, 0, 181, 157, 0, 156, 0, 155, 107, 0, 104, 0, - 106, 83, 0, 77, 0, 82, 148, 124, 125, 126, 171, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 114, 180, 182, 183, 0, 160, 158, 159, 0, 162, 0, 0, 113, - 0, 109, 79, 78, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 184, 161, 164, 0, 163, - 0, 112, 0, 111, 80, 0, 0, 0, 0, 166, 165, 0, 0, 0, 0, 167, 0, 110, 0, - 168}; - - const signed char Parser::yypgoto_[] = {-25, -25, -25, 39, 126, 98, -4}; - - const unsigned char Parser::yydefgoto_[] = {0, 1, 6, 27, 28, 76, 223}; + 2, 0, 1, 0, 0, 4, 3, 9, 128, 95, 156, 131, 96, 132, 97, 76, 0, 0, 0, + 0, 0, 8, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 159, 160, 0, 0, 0, 0, 0, 0, 135, 136, 0, 0, + 0, 0, 0, 0, 0, 147, 148, 0, 0, 0, 0, 0, 0, 156, 131, 96, 0, 0, 192, + 0, 0, 0, 188, 89, 187, 12, 129, 157, 133, 145, 130, 158, 134, 146, 0, 0, 0, 7, + 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 98, 161, 162, 163, 164, 165, + 166, 32, 26, 33, 27, 52, 64, 53, 65, 54, 66, 55, 67, 56, 68, 57, 69, 85, 100, + 137, 140, 141, 142, 143, 144, 84, 99, 138, 103, 149, 151, 152, 153, 154, 155, 102, 150, 0, + 86, 101, 139, 167, 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 187, + 25, 190, 0, 191, 0, 0, 30, 19, 21, 31, 20, 22, 88, 0, 90, 92, 94, 91, 58, + 34, 46, 59, 35, 47, 60, 36, 48, 61, 37, 49, 62, 38, 50, 63, 39, 51, 109, 124, + 127, 126, 122, 120, 119, 118, 108, 0, 28, 23, 17, 29, 24, 18, 70, 40, 10, 71, 41, + 11, 72, 42, 13, 73, 43, 14, 74, 44, 15, 75, 45, 16, 123, 182, 125, 183, 121, 185, + 93, 117, 184, 186, 189, 0, 194, 170, 0, 169, 0, 168, 107, 0, 104, 0, 106, 83, 0, + 77, 0, 82, 161, 137, 138, 139, 184, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 116, 193, 195, 196, 0, 173, 171, 172, 0, 175, 0, 0, 115, 0, 113, 110, + 79, 78, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 197, 174, 177, 0, 176, 0, 114, + 0, 112, 80, 0, 0, 0, 0, 179, 178, 0, 0, 0, 0, 180, 0, 111, 0, 181}; + + const short Parser::yypgoto_[] = {-32, -32, -32, 30, 231, 130, -4}; + + const unsigned char Parser::yydefgoto_[] = {0, 1, 6, 27, 28, 76, 235}; const short Parser::yytable_[] = { - 30, 47, 48, 49, 50, 51, 52, 7, 100, 101, 102, 103, 104, 105, 55, 77, 78, 64, 79, - 81, 82, 67, 2, 3, 106, 53, 54, 124, 125, 126, 127, 128, 129, 131, 133, 135, 137, 139, - 141, 143, 145, 4, 68, 148, 149, 150, 151, 152, 153, 121, 257, 156, 158, 159, 160, 161, 162, - 163, 75, 69, 165, 166, 169, 173, 177, 180, 91, 99, 92, 93, 185, 5, 95, 96, 97, 98, - 130, 132, 183, 100, 101, 102, 103, 104, 105, 65, 93, 191, 194, 197, 66, 199, 199, 201, 203, - 106, 206, 209, 212, 215, 218, 221, 29, 298, 226, 229, 232, 235, 238, 241, 244, 247, 248, 249, - 250, 252, 253, 254, 106, 100, 101, 102, 103, 104, 105, 83, 280, 84, 85, 123, 86, 193, 196, - 97, 98, 106, 262, 134, 136, 138, 140, 142, 144, 310, 0, 147, 267, 225, 228, 80, 118, 188, - 120, 155, 157, 121, 0, 122, 95, 96, 97, 98, 164, 0, 168, 172, 176, 179, 95, 96, 97, - 98, 0, 146, 0, 0, 186, 272, 273, 274, 275, 154, 65, 0, 276, 0, 0, 184, 91, 190, - 92, 93, 167, 171, 175, 178, 94, 0, 205, 208, 211, 214, 217, 220, 222, 0, 0, 0, 231, - 234, 237, 240, 243, 246, 95, 96, 97, 98, 0, 0, 0, 198, 200, 0, 202, 0, 0, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 19, 0, 20, 0, 0, 21, 251, 116, - 117, 118, 188, 120, 279, 0, 121, 282, 87, 284, 88, 89, 0, 90, 287, 22, 23, 289, 258, - 290, 259, 24, 0, 25, 26, 0, 0, 292, 0, 294, 0, 0, 123, 147, 155, 168, 100, 101, - 102, 103, 104, 105, 0, 263, 312, 264, 0, 0, 313, 0, 314, 0, 106, 95, 96, 97, 98, - 317, 0, 318, 0, 100, 101, 102, 103, 104, 105, 0, 0, 0, 328, 0, 329, 0, 0, 0, - 0, 106, 0, 0, 336, 56, 57, 58, 59, 60, 61, 0, 341, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 0, 19, 170, 20, 0, 62, 63, 0, 0, 281, 0, 283, 0, 0, - 285, 0, 286, 0, 0, 288, 0, 0, 0, 0, 22, 23, 0, 0, 291, 0, 24, 0, 25, - 26, 0, 0, 8, 9, 70, 71, 72, 13, 14, 73, 16, 17, 311, 0, 19, 0, 20, 0, - 0, 315, 0, 316, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 19, 174, 20, - 22, 74, 0, 0, 0, 330, 24, 0, 25, 26, 0, 335, 0, 0, 337, 0, 0, 0, 0, - 0, 22, 23, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 0, 19, 0, 20, 8, 9, 192, 71, 72, 13, 14, 73, 16, 17, 0, 0, - 19, 0, 20, 0, 0, 0, 0, 0, 22, 23, 0, 0, 0, 0, 24, 0, 25, 26, 0, - 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 195, 71, 72, - 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 204, 71, 72, 13, 14, 73, 16, - 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, - 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, - 207, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 210, 71, 72, 13, - 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, - 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, - 26, 8, 9, 213, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 216, - 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, - 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, - 24, 0, 25, 26, 8, 9, 219, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, - 8, 9, 224, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, - 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, - 0, 0, 0, 24, 0, 25, 26, 8, 9, 227, 71, 72, 13, 14, 73, 16, 17, 0, 0, - 19, 0, 20, 8, 9, 230, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, - 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, - 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 233, 71, 72, 13, 14, 73, 16, - 17, 0, 0, 19, 0, 20, 8, 9, 236, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, + 30, 47, 48, 49, 50, 51, 52, 106, 107, 108, 109, 97, 98, 108, 109, 77, 78, 110, 79, + 81, 82, 110, 2, 3, 7, 53, 54, 128, 129, 130, 131, 132, 133, 135, 137, 139, 141, 143, + 145, 147, 149, 4, 55, 152, 153, 154, 155, 156, 157, 75, 64, 160, 162, 163, 164, 165, 166, + 167, 314, 67, 169, 170, 173, 177, 181, 184, 68, 134, 136, 69, 189, 5, 187, 110, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 125, 296, 93, 195, 198, 201, 110, 203, 203, 205, 207, + 327, 210, 213, 216, 219, 222, 225, 227, 229, 231, 233, 0, 0, 238, 241, 244, 247, 250, 253, + 256, 259, 261, 263, 265, 268, 269, 270, 197, 200, 8, 9, 70, 71, 72, 13, 14, 73, 16, + 17, 29, 99, 19, 0, 20, 122, 192, 124, 237, 240, 125, 0, 0, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 65, 0, 22, 74, 127, 66, 110, 190, 24, 0, 25, 26, 138, 140, + 142, 144, 146, 148, 65, 91, 151, 92, 93, 188, 288, 289, 290, 291, 159, 161, 0, 292, 274, + 91, 275, 92, 93, 168, 273, 172, 176, 180, 183, 56, 57, 58, 59, 60, 61, 0, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 95, 96, 97, 98, 194, 0, 110, 62, 63, 95, 96, + 97, 98, 209, 212, 215, 218, 221, 224, 226, 228, 230, 232, 234, 278, 0, 0, 243, 246, 249, + 252, 255, 258, 260, 262, 264, 267, 80, 94, 83, 0, 84, 85, 0, 86, 126, 95, 96, 97, + 98, 295, 0, 0, 298, 283, 300, 95, 96, 97, 98, 303, 150, 0, 305, 0, 306, 0, 0, + 0, 158, 0, 0, 0, 308, 0, 310, 95, 96, 97, 98, 171, 175, 179, 182, 120, 121, 122, + 192, 124, 0, 329, 125, 0, 0, 330, 0, 331, 0, 127, 151, 159, 172, 0, 0, 334, 267, + 335, 0, 0, 202, 204, 87, 206, 88, 89, 0, 90, 345, 0, 346, 0, 0, 0, 0, 0, + 0, 0, 353, 0, 186, 48, 49, 50, 51, 52, 358, 0, 266, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 0, 19, 0, 20, 53, 54, 21, 293, 0, 0, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 0, 0, 0, 0, 22, 23, 110, 0, 0, 0, 24, 0, 25, + 26, 0, 0, 0, 0, 297, 0, 299, 0, 0, 301, 0, 302, 0, 0, 304, 0, 0, 0, + 0, 0, 0, 0, 0, 307, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 19, + 174, 20, 0, 0, 328, 0, 0, 0, 0, 0, 0, 332, 0, 333, 0, 0, 0, 0, 0, + 0, 0, 0, 22, 23, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 347, 0, 0, + 0, 0, 0, 352, 0, 0, 354, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, + 19, 178, 20, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, 19, 0, 20, 0, + 0, 0, 0, 0, 22, 23, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, + 22, 23, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 196, 71, 72, 13, 14, 73, 16, + 17, 0, 0, 19, 0, 20, 8, 9, 199, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, - 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 239, 71, 72, 13, - 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 242, 71, 72, 13, 14, 73, 16, 17, + 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 208, 71, 72, 13, + 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 211, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, - 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 304, 25, 26, 8, 9, 245, - 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 100, 101, 102, 103, 104, 105, 0, - 0, 0, 0, 0, 0, 268, 0, 269, 0, 106, 0, 0, 0, 22, 74, 295, 0, 296, 0, - 24, 0, 25, 26, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 100, 101, 102, 103, 104, - 105, 106, 302, 0, 303, 0, 0, 0, 325, 0, 326, 106, 0, 182, 48, 49, 50, 51, 52, - 0, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 334, 0, 0, 0, 106, 53, - 54, 0, 306, 0, 106, 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, 100, - 101, 102, 103, 104, 105, 319, 0, 0, 0, 106, 0, 324, 0, 0, 0, 106, 0, 0, 0, - 0, 0, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 338, 0, 0, 0, 106, - 0, 340, 0, 0, 0, 106, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, 100, 101, - 102, 103, 104, 105, 299, 0, 300, 0, 106, 0, 0, 301, 0, 0, 106, 0, 0, 0, 0, - 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 255, 0, 121, 0, 256, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 188, 120, 0, 260, 121, 261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 0, 265, 121, - 266, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 0, 270, 121, 271, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 0, 308, 121, 309, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 0, 321, 121, 322, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 188, 120, 0, 331, 121, 332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 323, 0, 121, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 188, 120, 339, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 187, 0, 121, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 188, 120, 297, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 305, 0, 121, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, - 120, 307, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 188, 120, 320, 0, 121, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 327, 0, - 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 188, 120, 333, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 342, 0, 121, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 188, 120, 189, 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 188, 120, 293, 0, 121, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 0, 0, 121, 31, - 32, 33, 34, 35, 36, 0, 0, 37, 38, 39, 40, 41, 42, 43, 44, 0, 0, 181, 32, - 33, 34, 35, 36, 45, 46, 37, 38, 39, 40, 41, 42, 43, 44, 107, 0, 0, 0, 0, - 0, 0, 0, 45, 46, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 277, - 0, 121, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, - 278, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 0, 0, 121, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 0, 0, 121, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 188, 120, 0, 0, 121, 108, 109, 110, 111, 112, 113, 114, 115, - 0, 0, 0, 0, 120, 0, 0, 121, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, - 120, 0, 0, 121, 110, 111, 112, 113, 114, 115, 116, 117, 118, 188, 120, 0, 0, 121}; + 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 214, + 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 217, 71, 72, 13, 14, + 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, + 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, + 8, 9, 220, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 223, 71, + 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, + 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, + 0, 25, 26, 8, 9, 236, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 8, + 9, 239, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, + 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, 74, 0, 0, + 0, 0, 24, 0, 25, 26, 8, 9, 242, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, + 0, 20, 8, 9, 245, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, 20, 0, 0, + 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 0, 0, 22, + 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 248, 71, 72, 13, 14, 73, 16, 17, + 0, 0, 19, 0, 20, 8, 9, 251, 71, 72, 13, 14, 73, 16, 17, 0, 0, 19, 0, + 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, + 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 8, 9, 254, 71, 72, 13, 14, + 73, 16, 17, 0, 0, 19, 0, 20, 8, 9, 257, 71, 72, 13, 14, 73, 16, 17, 0, + 0, 19, 0, 20, 0, 0, 0, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, + 279, 0, 280, 0, 0, 22, 74, 0, 0, 0, 0, 24, 0, 25, 26, 0, 0, 0, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 284, 0, 285, 0, 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 311, + 0, 312, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 318, 0, 319, 0, 0, 0, 110, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 320, 0, + 321, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 342, 0, 343, 0, 0, 0, 110, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 351, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 0, 0, 0, + 0, 0, 0, 110, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 323, 0, 0, 0, 0, + 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 336, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 341, 0, 0, 0, 0, 0, 110, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 355, 0, 0, + 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 357, 0, 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 315, 0, 316, 0, 0, 0, 110, 317, + 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 192, 124, 271, 0, 125, 0, 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 0, 276, 125, 277, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 0, 281, 125, 282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 0, 286, 125, 287, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 0, 325, 125, 326, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 0, + 338, 125, 339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 0, 348, 125, 349, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 192, 124, 340, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 356, 0, 125, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 192, 124, 191, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 313, 0, 125, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, + 322, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 192, 124, 324, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 337, 0, 125, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 192, 124, 344, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 350, 0, 125, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 192, 124, 359, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 193, 0, 125, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 309, 0, 125, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 192, 124, 0, 0, 125, 31, 32, 33, 34, 35, 36, 0, 0, 37, 38, 39, 40, 41, + 42, 43, 44, 0, 0, 185, 32, 33, 34, 35, 36, 45, 46, 37, 38, 39, 40, 41, 42, + 43, 44, 111, 0, 0, 0, 0, 0, 0, 0, 45, 46, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 294, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 192, 124, 0, 0, 125, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 0, 0, + 0, 0, 0, 0, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 0, + 0, 125, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 192, 124, 0, 0, 125, 112, + 113, 114, 115, 116, 117, 118, 119, 0, 0, 0, 0, 124, 0, 0, 125, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 192, 124, 0, 0, 125, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 192, 124, 0, 0, 125}; const short Parser::yycheck_[] = { - 4, 22, 23, 24, 25, 26, 27, 20, 32, 33, 34, 35, 36, 37, 22, 19, 20, 22, 22, - 23, 24, 15, 0, 1, 48, 46, 47, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 19, 15, 47, 48, 49, 50, 51, 52, 45, 16, 55, 56, 57, 58, 59, 60, - 61, 19, 15, 64, 65, 66, 67, 68, 69, 28, 20, 30, 31, 74, 49, 38, 39, 40, 41, - 37, 38, 22, 32, 33, 34, 35, 36, 37, 17, 31, 91, 92, 93, 22, 95, 96, 97, 98, - 48, 100, 101, 102, 103, 104, 105, 4, 16, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 48, 32, 33, 34, 35, 36, 37, 3, 22, 5, 6, 31, 8, 92, 93, - 40, 41, 48, 16, 39, 40, 41, 42, 43, 44, 22, -1, 47, 16, 108, 109, 23, 40, 41, - 42, 55, 56, 45, -1, 31, 38, 39, 40, 41, 64, -1, 66, 67, 68, 69, 38, 39, 40, - 41, -1, 47, -1, -1, 16, 181, 182, 183, 184, 55, 17, -1, 188, -1, -1, 22, 28, 91, - 30, 31, 66, 67, 68, 69, 20, -1, 100, 101, 102, 103, 104, 105, 106, -1, -1, -1, 110, - 111, 112, 113, 114, 115, 38, 39, 40, 41, -1, -1, -1, 95, 96, -1, 98, -1, -1, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, 15, -1, 17, -1, -1, 20, 119, 38, - 39, 40, 41, 42, 255, -1, 45, 258, 3, 260, 5, 6, -1, 8, 265, 38, 39, 268, 14, - 270, 16, 44, -1, 46, 47, -1, -1, 278, -1, 280, -1, -1, 181, 182, 183, 184, 32, 33, - 34, 35, 36, 37, -1, 14, 295, 16, -1, -1, 299, -1, 301, -1, 48, 38, 39, 40, 41, - 308, -1, 310, -1, 32, 33, 34, 35, 36, 37, -1, -1, -1, 321, -1, 323, -1, -1, -1, - -1, 48, -1, -1, 331, 22, 23, 24, 25, 26, 27, -1, 339, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, -1, 15, 16, 17, -1, 46, 47, -1, -1, 258, -1, 260, -1, -1, - 263, -1, 265, -1, -1, 268, -1, -1, -1, -1, 38, 39, -1, -1, 277, -1, 44, -1, 46, - 47, -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 295, -1, 15, -1, 17, -1, - -1, 302, -1, 304, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, 15, 16, 17, - 38, 39, -1, -1, -1, 325, 44, -1, 46, 47, -1, 331, -1, -1, 334, -1, -1, -1, -1, - -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, - 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, - -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, - 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, - -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, - 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, - -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, - 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, - -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, - -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, - 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, + 4, 22, 23, 24, 25, 26, 27, 38, 39, 40, 41, 40, 41, 40, 41, 19, 20, 48, 22, + 23, 24, 48, 0, 1, 20, 46, 47, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 19, 22, 47, 48, 49, 50, 51, 52, 19, 22, 55, 56, 57, 58, 59, 60, + 61, 16, 15, 64, 65, 66, 67, 68, 69, 15, 37, 38, 15, 74, 49, 22, 48, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 45, 22, 31, 91, 92, 93, 48, 95, 96, 97, 98, + 22, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, -1, -1, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 92, 93, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 4, 20, 15, -1, 17, 40, 41, 42, 112, 113, 45, -1, -1, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 17, -1, 38, 39, 31, 22, 48, 16, 44, -1, 46, 47, 39, 40, + 41, 42, 43, 44, 17, 28, 47, 30, 31, 22, 185, 186, 187, 188, 55, 56, -1, 192, 14, + 28, 16, 30, 31, 64, 16, 66, 67, 68, 69, 22, 23, 24, 25, 26, 27, -1, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 38, 39, 40, 41, 91, -1, 48, 46, 47, 38, 39, + 40, 41, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 16, -1, -1, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 23, 20, 3, -1, 5, 6, -1, 8, 31, 38, 39, 40, + 41, 271, -1, -1, 274, 16, 276, 38, 39, 40, 41, 281, 47, -1, 284, -1, 286, -1, -1, + -1, 55, -1, -1, -1, 294, -1, 296, 38, 39, 40, 41, 66, 67, 68, 69, 38, 39, 40, + 41, 42, -1, 311, 45, -1, -1, 315, -1, 317, -1, 185, 186, 187, 188, -1, -1, 325, 192, + 327, -1, -1, 95, 96, 3, 98, 5, 6, -1, 8, 338, -1, 340, -1, -1, -1, -1, -1, + -1, -1, 348, -1, 22, 23, 24, 25, 26, 27, 356, -1, 123, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, -1, 15, -1, 17, 46, 47, 20, 29, -1, -1, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, -1, -1, -1, -1, 38, 39, 48, -1, -1, -1, 44, -1, 46, + 47, -1, -1, -1, -1, 274, -1, 276, -1, -1, 279, -1, 281, -1, -1, 284, -1, -1, -1, + -1, -1, -1, -1, -1, 293, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, 15, + 16, 17, -1, -1, 311, -1, -1, -1, -1, -1, -1, 318, -1, 320, -1, -1, -1, -1, -1, + -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, 342, -1, -1, + -1, -1, -1, 348, -1, -1, 351, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, + 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, @@ -2306,92 +2400,119 @@ namespace SEAMS { -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, - 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, 14, 46, 47, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 32, 33, 34, 35, 36, 37, -1, - -1, -1, -1, -1, -1, 14, -1, 16, -1, 48, -1, -1, -1, 38, 39, 14, -1, 16, -1, - 44, -1, 46, 47, 32, 33, 34, 35, 36, 37, -1, -1, -1, -1, 32, 33, 34, 35, 36, - 37, 48, 14, -1, 16, -1, -1, -1, 14, -1, 16, 48, -1, 22, 23, 24, 25, 26, 27, - -1, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 14, -1, -1, -1, 48, 46, - 47, -1, 16, -1, 48, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 32, - 33, 34, 35, 36, 37, 16, -1, -1, -1, 48, -1, 16, -1, -1, -1, 48, -1, -1, -1, - -1, -1, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 16, -1, -1, -1, 48, - -1, 16, -1, -1, -1, 48, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 32, 33, - 34, 35, 36, 37, 14, -1, 16, -1, 48, -1, -1, 21, -1, -1, 48, -1, -1, -1, -1, - -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 14, -1, 45, -1, 18, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, - 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - -1, 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, + 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, + 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, + -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, + -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, -1, -1, -1, + 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, 39, -1, -1, + -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, + -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, 17, -1, -1, + -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, -1, -1, 38, + 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 15, -1, + 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, + -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, -1, -1, 15, -1, 17, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, + -1, 15, -1, 17, -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, + 14, -1, 16, -1, -1, 38, 39, -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, -1, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 14, -1, 16, -1, -1, -1, 48, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 14, + -1, 16, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 14, -1, 16, -1, -1, -1, 48, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 14, -1, + 16, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 14, -1, 16, -1, -1, -1, 48, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 14, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, -1, -1, -1, + -1, -1, -1, 48, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 16, -1, -1, -1, -1, + -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 16, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 16, -1, -1, -1, -1, -1, 48, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 16, -1, -1, + -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 16, -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 14, -1, 16, -1, -1, -1, 48, 21, + -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 14, -1, 45, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, 16, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 14, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 14, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, -1, 14, 45, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 14, -1, 45, -1, -1, + 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 14, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, - 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, + 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 16, -1, 45, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 16, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 18, -1, 45, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 18, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 18, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 18, -1, 45, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45, 22, - 23, 24, 25, 26, 27, -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, -1, -1, 22, 23, - 24, 25, 26, 27, 46, 47, 30, 31, 32, 33, 34, 35, 36, 37, 20, -1, -1, -1, -1, - -1, -1, -1, 46, 47, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 29, - -1, 45, 32, 33, 34, 35, 36, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45, 30, 31, 32, 33, 34, 35, 36, 37, - -1, -1, -1, -1, 42, -1, -1, 45, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, -1, -1, 45, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45}; + 40, 41, 42, -1, -1, 45, 22, 23, 24, 25, 26, 27, -1, -1, 30, 31, 32, 33, 34, + 35, 36, 37, -1, -1, 22, 23, 24, 25, 26, 27, 46, 47, 30, 31, 32, 33, 34, 35, + 36, 37, 20, -1, -1, -1, -1, -1, -1, -1, 46, 47, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, -1, -1, 45, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, -1, -1, 45, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, -1, -1, + -1, -1, -1, -1, 48, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, + -1, 45, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45, 30, + 31, 32, 33, 34, 35, 36, 37, -1, -1, -1, -1, 42, -1, -1, 45, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, -1, -1, 45, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, -1, -1, 45}; const signed char Parser::yystos_[] = { 0, 51, 0, 1, 19, 49, 52, 20, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 20, 38, 39, 44, 46, 47, 53, 54, 55, 56, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 46, 47, 22, 23, 24, 25, 26, 27, 46, 47, 22, 22, 23, 24, 25, 26, 27, 46, 47, 22, 17, 22, 15, 15, 15, 5, 6, 7, 10, 39, 53, 55, 56, 56, 56, 54, 56, 56, 3, 5, 6, 8, 3, 5, 6, 8, 28, - 30, 31, 20, 38, 39, 40, 41, 20, 32, 33, 34, 35, 36, 37, 48, 20, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 45, 54, 55, 56, 56, 56, 56, 56, 56, 53, 56, 53, 56, 55, 56, 55, 56, - 55, 56, 55, 56, 55, 56, 55, 56, 54, 55, 56, 56, 56, 56, 56, 56, 54, 55, 56, 55, 56, 56, 56, - 56, 56, 56, 55, 56, 56, 54, 55, 56, 16, 54, 55, 56, 16, 54, 55, 56, 54, 55, 56, 22, 22, 22, - 22, 56, 16, 16, 41, 18, 55, 56, 5, 53, 56, 5, 53, 56, 54, 56, 54, 56, 54, 56, 5, 55, 56, - 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 55, 56, 5, 53, 56, 5, 53, 56, - 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 56, 56, 56, 54, 56, - 56, 56, 14, 18, 16, 14, 16, 14, 16, 16, 14, 16, 14, 16, 16, 14, 16, 14, 16, 56, 56, 56, 56, - 56, 29, 29, 56, 22, 55, 56, 55, 56, 55, 55, 56, 55, 56, 56, 55, 56, 18, 56, 14, 16, 16, 16, - 14, 16, 21, 14, 16, 14, 16, 16, 16, 14, 16, 22, 55, 56, 56, 56, 55, 55, 56, 56, 16, 16, 14, - 16, 14, 16, 14, 16, 16, 56, 56, 55, 14, 16, 16, 14, 55, 56, 55, 16, 14, 16, 56, 16}; + 30, 31, 20, 38, 39, 40, 41, 20, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 20, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 54, 55, 56, 56, 56, 56, 56, 56, 53, 56, 53, 56, + 55, 56, 55, 56, 55, 56, 55, 56, 55, 56, 55, 56, 54, 55, 56, 56, 56, 56, 56, 56, 54, 55, 56, + 55, 56, 56, 56, 56, 56, 56, 55, 56, 56, 54, 55, 56, 16, 54, 55, 56, 16, 54, 55, 56, 54, 55, + 56, 22, 22, 22, 22, 56, 16, 16, 41, 18, 55, 56, 5, 53, 56, 5, 53, 56, 54, 56, 54, 56, 54, + 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 55, 56, 55, 56, + 55, 56, 55, 56, 55, 56, 5, 53, 56, 5, 53, 56, 5, 55, 56, 5, 55, 56, 5, 55, 56, 5, 55, + 56, 5, 55, 56, 5, 55, 56, 55, 56, 55, 56, 55, 56, 54, 55, 56, 56, 56, 14, 18, 16, 14, 16, + 14, 16, 16, 14, 16, 14, 16, 16, 14, 16, 14, 16, 56, 56, 56, 56, 56, 29, 29, 56, 22, 55, 56, + 55, 56, 55, 55, 56, 55, 56, 56, 55, 56, 18, 56, 14, 16, 16, 16, 14, 16, 21, 14, 16, 14, 16, + 16, 16, 16, 14, 16, 22, 55, 56, 56, 56, 55, 55, 56, 56, 16, 16, 14, 16, 14, 16, 14, 16, 16, + 56, 56, 55, 14, 16, 16, 14, 55, 56, 55, 16, 14, 16, 56, 16}; const signed char Parser::yyr1_[] = { - 0, 50, 51, 51, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56}; + 0, 50, 51, 51, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56}; const signed char Parser::yyr2_[] = { - 0, 2, 0, 2, 1, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 4, 6, 6, 8, - 6, 4, 4, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 4, 3, 4, 4, - 3, 6, 12, 8, 8, 6, 5, 1, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, - 2, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 6, 6, 6, 8, - 6, 8, 8, 10, 10, 12, 14, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 1, 5, 4, 6, 6, 8}; + 0, 2, 0, 2, 1, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 4, 6, 6, 8, 6, 4, 4, 3, 3, 3, + 3, 3, 2, 3, 3, 3, 3, 3, 1, 1, 1, 3, 3, 3, 3, 3, 3, 4, 3, 4, 4, 3, 3, 6, 12, 8, 6, 8, 6, + 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 6, 6, 6, + 8, 6, 8, 8, 10, 10, 12, 14, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 1, 5, 4, 6, 6, 8}; #if SEAMSDEBUG || 1 // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. @@ -2458,16 +2579,17 @@ namespace SEAMS { #if SEAMSDEBUG const short Parser::yyrline_[] = { - 0, 127, 127, 128, 131, 132, 145, 149, 150, 151, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 181, 182, 183, 184, - 185, 186, 188, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 202, 203, 204, 205, 206, - 207, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, - 230, 231, 237, 243, 249, 255, 261, 267, 273, 277, 281, 284, 286, 294, 296, 304, 305, 306, 307, - 316, 317, 318, 319, 321, 324, 328, 333, 334, 335, 341, 347, 353, 359, 360, 366, 372, 378, 384, - 390, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 403, 406, 411, 412, 413, 414, 415, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 432, 434, 437, 440, 443, 446, 448, 451, 454, - 457, 460, 467, 474, 481, 488, 495, 502, 509, 516, 523, 529, 535, 541, 547, 553, 559, 565, 566, - 567, 568, 576, 584, 585, 586, 589, 590, 593, 594, 595, 596, 597, 619}; + 0, 127, 127, 128, 131, 132, 145, 149, 150, 151, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 181, 182, + 183, 184, 185, 186, 188, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 202, 203, + 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 223, 224, + 225, 226, 227, 228, 230, 231, 237, 243, 249, 255, 261, 267, 273, 277, 281, 284, 286, 294, + 296, 304, 305, 306, 307, 316, 317, 318, 319, 321, 324, 328, 333, 334, 335, 341, 347, 353, + 359, 360, 361, 367, 373, 379, 385, 391, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 421, 424, 429, 430, 431, 432, + 433, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 450, 452, 455, 458, 461, 464, + 466, 469, 472, 475, 478, 485, 492, 499, 506, 513, 520, 527, 534, 541, 547, 553, 559, 565, + 571, 577, 583, 584, 585, 586, 594, 602, 603, 604, 607, 608, 611, 612, 613, 614, 615, 637}; void Parser::yy_stack_print_() const { diff --git a/packages/seacas/libraries/aprepro_lib/apr_scanner.cc b/packages/seacas/libraries/aprepro_lib/apr_scanner.cc index 07dcb983a6c3..04d064191d7c 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_scanner.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_scanner.cc @@ -178,7 +178,7 @@ typedef unsigned int flex_uint32_t; * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start)-1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ @@ -1020,7 +1020,7 @@ int loop_lvl = 0; std::fstream *tmp_file; const char *temp_f; -#if defined __NVCC__ +#if defined __NVCC__ #pragma diag_suppress code_is_unreachable #endif @@ -1562,10 +1562,7 @@ YY_DECL YY_BREAK case 21: /* rule 21 can match eol */ - YY_RULE_SETUP - { /* Do not increment line count */ - ; - } + YY_RULE_SETUP { /* Do not increment line count */ ; } YY_BREAK case 22: @@ -2131,6 +2128,12 @@ YY_DECL BEGIN(END_CASE_SKIP); else BEGIN(if_state[if_lvl]); + unput('}'); + unput('O'); + unput('H'); + unput('C'); + unput('E'); + unput('{'); return (token::RBRACE); } YY_BREAK @@ -2356,8 +2359,8 @@ YY_DECL default: YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ + } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* %ok-for-header */ diff --git a/packages/seacas/libraries/aprepro_lib/apr_symrec.h b/packages/seacas/libraries/aprepro_lib/apr_symrec.h index 724a825fe63e..700b6c21ab99 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_symrec.h +++ b/packages/seacas/libraries/aprepro_lib/apr_symrec.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-, 20212021, , , National Technology & Engineering Solutions +// Copyright(C) 1999-, 20212021, , , , , , , , National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -16,10 +16,10 @@ namespace SEAMS { struct array { std::vector data{}; - int rows{0}; - int cols{0}; + size_t rows{0}; + size_t cols{0}; - array(int r, int c) : rows(r), cols(c) { data.resize(r * c); } + array(size_t r, size_t c) : rows(r), cols(c) { data.resize(r * c); } }; struct symrec @@ -54,6 +54,7 @@ namespace SEAMS { const char *(*strfnct_dd)(double, double){nullptr}; const char *(*strfnct_cc)(char *, char *){nullptr}; const char *(*strfnct_ccc)(char *, char *, char *){nullptr}; + const char *(*strfnct_dc)(double, char *){nullptr}; const char *(*strfnct_dcc)(double, char *, char *){nullptr}; const char *(*strfnct_dcccc)(double, char *, char *, char *, char *){nullptr}; array *avar{nullptr}; /* Array Variable */ diff --git a/packages/seacas/libraries/aprepro_lib/apr_util.cc b/packages/seacas/libraries/aprepro_lib/apr_util.cc index b934b9395e15..2db4418a7fbd 100644 --- a/packages/seacas/libraries/aprepro_lib/apr_util.cc +++ b/packages/seacas/libraries/aprepro_lib/apr_util.cc @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions +// Copyright(C) 1999-2021, 2023, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -40,7 +40,7 @@ namespace { std::vector allocations; - void copy_string(char *dest, const char *source, long int elements) + void copy_string(char *dest, const char *source, size_t elements) { char *d; for (d = dest; d + 1 < dest + elements && *source; d++, source++) { @@ -49,15 +49,15 @@ namespace { *d = '\0'; } - void copy_string(char *dest, const std::string &source, long int elements) + void copy_string(char *dest, const std::string &source, size_t elements) { copy_string(dest, source.c_str(), elements); } void new_string_int(const char *from, char **to) { - int len = strlen(from); - *to = new char[len + 1]; + auto len = strlen(from); + *to = new char[len + 1]; copy_string(*to, from, len + 1); allocations.push_back(*to); } @@ -103,8 +103,8 @@ namespace SEAMS { { std::string tmp{from1}; tmp += from2; - int len = tmp.length(); - *to = new char[len + 1]; + auto len = tmp.length(); + *to = new char[len + 1]; copy_string(*to, tmp, len + 1); allocations.push_back(*to); } @@ -227,7 +227,7 @@ namespace SEAMS { *p = '_'; } else if (isupper(static_cast(*p)) != 0) { - *p = tolower(static_cast(*p)); + *p = static_cast(tolower(static_cast(*p))); } p++; } @@ -245,10 +245,8 @@ namespace SEAMS { bool is_directory(const std::string &filepath) { - struct stat s - { - }; - int ok = stat(filepath.c_str(), &s); + struct stat s{}; + int ok = stat(filepath.c_str(), &s); if (ok == 0) { return S_ISDIR(s.st_mode); } @@ -264,7 +262,7 @@ namespace SEAMS { * L [A-Za-z_] */ - int length = strlen(var); + auto length = strlen(var); if (length == 0) { return false; } @@ -273,7 +271,7 @@ namespace SEAMS { return false; } - for (int i = 1; i < length; i++) { + for (size_t i = 1; i < length; i++) { char c = var[i]; if ((isalnum(c) == 0) && c != ':' && c != '_') { return false; diff --git a/packages/seacas/libraries/aprepro_lib/aprepro.h b/packages/seacas/libraries/aprepro_lib/aprepro.h index ba57ff91fd4a..0017d36a7121 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro.h +++ b/packages/seacas/libraries/aprepro_lib/aprepro.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2023, National Technology & Engineering Solutions +// Copyright(C) 1999-2024, National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -222,7 +222,7 @@ namespace SEAMS { void dumpsym_json() const; void dumpsym(int type, const char *pre, bool doInternal) const; - array *make_array(int r, int c); + array *make_array(size_t r, size_t c); array *make_array(const array &from); void redefine_array(array *data); diff --git a/packages/seacas/libraries/aprepro_lib/aprepro.ll b/packages/seacas/libraries/aprepro_lib/aprepro.ll index a8fa0482c24b..4acbf23cf268 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro.ll +++ b/packages/seacas/libraries/aprepro_lib/aprepro.ll @@ -1,7 +1,7 @@ -/* -*- Mode: c++ -*- */ +s"}/* -*- Mode: c++ -*- */ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -28,7 +28,7 @@ #include "apr_tokenize.h" #include "fmt/format.h" #include "fmt/ostream.h" - + #define YY_NO_UNISTD_H /* import the parser's token type into a local typedef */ @@ -697,6 +697,12 @@ integer {D}+({E})? BEGIN(END_CASE_SKIP); else BEGIN(if_state[if_lvl]); + unput('}'); + unput('O'); + unput('H'); + unput('C'); + unput('E'); + unput('{'); return(token::RBRACE); } @@ -1081,7 +1087,7 @@ integer {D}+({E})? std::string new_string("}"); auto ins = new std::istringstream(new_string); // Declare an input string stream. yyFlexLexer::yypush_buffer_state(yyFlexLexer::yy_create_buffer(ins, new_string.size())); - + if (aprepro.ap_options.debugging) { std::cerr << "DEBUG IMPORT: " << string << "\n"; } diff --git a/packages/seacas/libraries/aprepro_lib/aprepro.yy b/packages/seacas/libraries/aprepro_lib/aprepro.yy index 4496bc2ff342..1a0c7346feb1 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro.yy +++ b/packages/seacas/libraries/aprepro_lib/aprepro.yy @@ -357,6 +357,7 @@ sexp: QSTRING { $$ = $1; } $$ = (char*)""; } | sexp CONCAT sexp { concat_string($1, $3, &$$); } + | sexp PLU sexp { concat_string($1, $3, &$$); } | SFNCT LPAR exp COMMA exp RPAR { if (arg_check($1, $1->value.strfnct_dd == NULL)) $$ = (char*)(*($1->value.strfnct_dd))($3, $5); @@ -375,6 +376,12 @@ sexp: QSTRING { $$ = $1; } else $$ = (char*)""; } + | SFNCT LPAR exp COMMA sexp RPAR { + if (arg_check($1, $1->value.strfnct_dc == NULL)) + $$ = (char*)(*($1->value.strfnct_dc))($3, $5); + else + $$ = (char*)""; + } | SFNCT LPAR sexp COMMA sexp COMMA sexp RPAR { if (arg_check($1, $1->value.strfnct_ccc == NULL)) $$ = (char*)(*($1->value.strfnct_ccc))($3, $5, $7); @@ -388,6 +395,17 @@ sexp: QSTRING { $$ = $1; } $$ = (char*)""; } | bool QUEST sexp COLON sexp { $$ = ($1) ? ($3) : ($5); } + | exp TIM sexp { $$ = (char*)""; yyerror(aprepro, "Multiplying an arithmetic with a string is not defined"); yyerrok;} + | sexp TIM exp { $$ = (char*)""; yyerror(aprepro, "Multiplying a string with an arithmetic is not defined"); yyerrok;} + | sexp TIM sexp { $$ = (char*)""; yyerror(aprepro, "Multiplying a string with a string is not defined"); yyerrok;} + | sexp DIV exp { $$ = (char*)""; yyerror(aprepro, "Dividing a string by an arithmetic is not defined"); yyerrok;} + | exp DIV sexp { $$ = (char*)""; yyerror(aprepro, "Dividing an arithmetic by a string is not defined"); yyerrok;} + | sexp DIV sexp { $$ = (char*)""; yyerror(aprepro, "Dividing a string by a string is not defined"); yyerrok;} + | exp PLU sexp { $$ = (char*)""; yyerror(aprepro, "Adding an arithmetic and a string is not defined"); yyerrok;} + | sexp PLU exp { $$ = (char*)""; yyerror(aprepro, "Adding a string and an arithmetic is not defined"); yyerrok;} + | exp SUB sexp { $$ = (char*)""; yyerror(aprepro, "Subtracting an arithmetic and a string is not defined"); yyerrok;} + | sexp SUB exp { $$ = (char*)""; yyerror(aprepro, "Subtracting a string and an arithmetic is not defined"); yyerrok;} + | sexp SUB sexp { $$ = (char*)""; yyerror(aprepro, "Subtracting a string from a string is not defined"); yyerrok;} exp: NUM { $$ = $1; } | INC NUM { $$ = $2 + 1; } @@ -573,7 +591,7 @@ exp: NUM { $$ = $1; } } else $$ = $1 / $3; } - | exp MOD exp { if ($3 == 0.) + | exp MOD exp { if ((int)$3 == 0.) { $$ = (int)$1; yyerror(aprepro, "Zero divisor"); diff --git a/packages/seacas/libraries/aprepro_lib/aprepro_parser.h b/packages/seacas/libraries/aprepro_lib/aprepro_parser.h index 6b926df66b39..1184447f75f4 100644 --- a/packages/seacas/libraries/aprepro_lib/aprepro_parser.h +++ b/packages/seacas/libraries/aprepro_lib/aprepro_parser.h @@ -564,7 +564,7 @@ namespace SEAMS { static const unsigned char yydefact_[]; // YYPGOTO[NTERM-NUM]. - static const signed char yypgoto_[]; + static const short yypgoto_[]; // YYDEFGOTO[NTERM-NUM]. static const unsigned char yydefgoto_[]; @@ -776,7 +776,7 @@ namespace SEAMS { /// Constants. enum { - yylast_ = 1841, ///< Last index in yytable_. + yylast_ = 2057, ///< Last index in yytable_. yynnts_ = 7, ///< Number of nonterminal symbols. yyfinal_ = 2 ///< Termination state number. }; diff --git a/packages/seacas/libraries/aprepro_lib/init_structs.h b/packages/seacas/libraries/aprepro_lib/init_structs.h index fa10e10af6bd..f7015d228c73 100644 --- a/packages/seacas/libraries/aprepro_lib/init_structs.h +++ b/packages/seacas/libraries/aprepro_lib/init_structs.h @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -131,6 +131,14 @@ struct str_a_init const char *description; }; +struct str_dc_init +{ + const char *fname; + const char *(*fnct)(double, char *); + const char *syntax; + const char *description; +}; + struct str_dcc_init { const char *fname; diff --git a/packages/seacas/libraries/aprepro_lib/strings.cc b/packages/seacas/libraries/aprepro_lib/strings.cc index d79ad9a6c21e..4ecb7c5ec3aa 100644 --- a/packages/seacas/libraries/aprepro_lib/strings.cc +++ b/packages/seacas/libraries/aprepro_lib/strings.cc @@ -15,10 +15,10 @@ int main(int, char **) { SEAMS::Aprepro aprepro; - aprepro.ap_options.warning_msg=false; + aprepro.ap_options.warning_msg = false; std::vector strings = build_strings(); - bool result = aprepro.parse_strings(strings, "My list of strings"); + bool result = aprepro.parse_strings(strings, "My list of strings"); if (result) { std::string res_str = aprepro.parsing_results().str(); std::cout << res_str; @@ -26,7 +26,7 @@ int main(int, char **) aprepro.clear_results(); } -std::vector build_strings() +std::vector build_strings() { std::vector strings; @@ -61,7 +61,8 @@ std::vector build_strings() strings.emplace_back(R"({pmin = min(0.5, 1.0)} {nmin = min(-0.5, -1.0)} $ Should be 0.5, -1)"); strings.emplace_back(R"({pmax = max(0.5, 1.0)} {nmax = max(-0.5, -1.0)} $ Should be 1.0, -0.5)"); strings.emplace_back(R"({zero = 0} {sign(0.5, zero) + sign(0.5, -zero)} $ Should be 0 1)"); - strings.emplace_back(R"({nonzero = 1} {sign(0.5, nonzero) + sign(0.5, -nonzero)} $ Should be 1 0)"); + strings.emplace_back( + R"({nonzero = 1} {sign(0.5, nonzero) + sign(0.5, -nonzero)} $ Should be 1 0)"); strings.emplace_back(R"({dim(5.5, 4.5)} {dim(4.5, 5.5)} $ Should be 1 0)"); strings.emplace_back(R"()"); strings.emplace_back(R"({ifyes = 1} {ifno = 0})"); @@ -109,7 +110,8 @@ std::vector build_strings() strings.emplace_back(R"($ Lines a, b, c, d, 1, 4, 6, 7 should be echoed)"); strings.emplace_back(R"($ Check line counting -- should be on line 78: )"); strings.emplace_back(R"( )"); - strings.emplace_back(R"($ ========================================================================)"); + strings.emplace_back( + R"($ ========================================================================)"); strings.emplace_back(R"($ Test string if lines)"); strings.emplace_back(R"({if("Greg")})"); strings.emplace_back(R"( This line should be echoed ("greg"))"); @@ -125,7 +127,8 @@ std::vector build_strings() strings.emplace_back(R"({endif})"); strings.emplace_back(R"()"); strings.emplace_back(R"()"); - strings.emplace_back(R"($ ========================================================================)"); + strings.emplace_back( + R"($ ========================================================================)"); strings.emplace_back(R"($ Test if lines)"); strings.emplace_back(R"({if(sqrt(4) == 2)})"); strings.emplace_back(R"( This line should be echoed. (a))"); @@ -176,7 +179,8 @@ std::vector build_strings() strings.emplace_back(R"( good)"); strings.emplace_back(R"( make sure it is still good)"); strings.emplace_back(R"({endif})"); - strings.emplace_back(R"($ ========================================================================)"); + strings.emplace_back( + R"($ ========================================================================)"); strings.emplace_back(R"($ Test switch)"); strings.emplace_back(R"({switch(PI)})"); strings.emplace_back(R"(This is in a switch, but prior to any case, it should not run)"); @@ -210,16 +214,25 @@ std::vector build_strings() strings.emplace_back(R"()"); strings.emplace_back(R"($ Test looping - print sin, cos from 0 to 90 by 5)"); strings.emplace_back(R"({Loop(19, _angle, 0, 5)})"); - strings.emplace_back(R"({_angle} {_sa=sind(_angle)} {_ca=cosd(_angle)} {hypot(_sa, _ca)} )"); + strings.emplace_back( + R"({_angle} {_sa=sind(_angle)} {_ca=cosd(_angle)} {hypot(_sa, _ca)} )"); strings.emplace_back(R"({EndLoop})"); strings.emplace_back(R"()"); strings.emplace_back(R"($$$$ Test formatting and string concatenation)"); strings.emplace_back(R"({_SAVE = _FORMAT})"); strings.emplace_back(R"({loop(20)})"); - strings.emplace_back(R"({IO(__loop_1+1)} Using the format {_FORMAT = "%." // tostring(__loop_1+1) // "g"}, PI = {PI})"); + strings.emplace_back( + R"({IO(__loop_1+1)} Using the format {_FORMAT = "%." // tostring(__loop_1+1) // "g"}, PI = {PI})"); strings.emplace_back(R"({endloop})"); strings.emplace_back(R"(Reset format to default: {_FORMAT = _SAVE})"); strings.emplace_back(R"()"); + strings.emplace_back( + R"($$$$ Test formatting using the `format` function. _FORMAT is not modified)"); + strings.emplace_back(R"({loop(20)}")"); + strings.emplace_back( + R"({__loop_1+1} Using the format {_f = "%." // tostring(__loop_1+1) // "f"}, PI = {format(PI,_f)})"); + strings.emplace_back(R"({endloop})"); + strings.emplace_back(R"()"); strings.emplace_back(R"($$$$ Test string rescanning and executing)"); strings.emplace_back(R"({ECHO(OFF)})"); strings.emplace_back(R"({Test = ' This is line 1: {a = atan2(0,-1)})"); @@ -278,9 +291,16 @@ std::vector build_strings() strings.emplace_back(R"({list1 ='51,52,53,54,61,62,63,64'})"); strings.emplace_back(R"({list2 ='71,72,73,74,81,82,83,84'})"); strings.emplace_back(R"({loop(8, _i, 1)})"); - strings.emplace_back(R"(Word {_i} of list1 and list2 are {get_word(_i,list1,',')} and {get_word(_i,list2,',')})"); + strings.emplace_back( + R"(Word {_i} of list1 and list2 are {get_word(_i,list1,',')} and {get_word(_i,list2,',')})"); strings.emplace_back(R"({endloop})"); strings.emplace_back(R"()"); + strings.emplace_back(R"($$$$ Test double brace echo off/on)"); + strings.emplace_back(R"(Nothing further on line: {{"not echoed"}})"); + strings.emplace_back( + R"(Noecho followed by non-parsing output: {{"not echoed"}}This should be echoed)"); + strings.emplace_back( + R"(Echo, noecho setting variable, then echo that variable: {e="echo"}+{{d="echo"}}+{d})"); strings.emplace_back(R"($End of test file)"); return strings; diff --git a/packages/seacas/libraries/aprepro_lib/test.inp_app b/packages/seacas/libraries/aprepro_lib/test.inp_app index ec54c83b1f96..6d5d4e7158bd 100644 --- a/packages/seacas/libraries/aprepro_lib/test.inp_app +++ b/packages/seacas/libraries/aprepro_lib/test.inp_app @@ -180,7 +180,7 @@ $ Test int and [] (shortcut for int) $ Test looping - print sin, cos from 0 to 90 by 5 {Loop(19, _angle, 0, 5)} -{_angle} {_sa=sind(_angle)} {_ca=cosd(_angle)} {hypot(_sa, _ca)} +{_angle} {_sa=sind(_angle)} {_ca=cosd(_angle)} {hypot(_sa, _ca)} {EndLoop} $$$$ Test formatting and string concatenation @@ -190,6 +190,11 @@ $$$$ Test formatting and string concatenation {endloop} Reset format to default: {_FORMAT = _SAVE} +$$$$ Test formatting using the `format` function. _FORMAT is not modified +{loop(20)} +{__loop_1+1} Using the format {_f = "%." // tostring(__loop_1+1) // "f"}, PI = {format(PI,_f)} +{endloop} + $$$$ Test string rescanning and executing {ECHO(OFF)} {Test = ' This is line 1: {a = atan2(0,-1)} @@ -200,12 +205,12 @@ $$$$ Test string rescanning and executing Original String: {Test} Rescanned String: -{rescan(Test)} +{rescan(Test)} Original String: {Test2} Print Value of variable T = {T} Rescanned String: -{rescan(Test2)} +{rescan(Test2)} Print Value of variable T = {T} Original String: {t1 = "atan2(0,-1)"} @@ -257,4 +262,8 @@ This should not be echoed {loop(undefined)} This should not be echoed {endloop} +$$$$ Test double brace echo off/on +Nothing further on line: {{"not echoed"}} +Noecho followed by non-parsing output: {{"not echoed"}}This should be echoed +Echo, noecho setting variable, then echo that variable: {e="echo"}+{{d="echo"}}+{d} $End of test file diff --git a/packages/seacas/libraries/aprepro_lib/test_standard.out b/packages/seacas/libraries/aprepro_lib/test_standard.out index 547666f429e2..ea024e83001e 100644 --- a/packages/seacas/libraries/aprepro_lib/test_standard.out +++ b/packages/seacas/libraries/aprepro_lib/test_standard.out @@ -3,7 +3,7 @@ $ Test number representations 1 1 1 1 1 1 1 1 1 1 - + Test assign statements: 5 5 $ Should print 5 5 10 10 $ Should print 10 10 @@ -38,21 +38,21 @@ correct correct $ Test ifdef lines - This line should be echoed. (a) +This line should be echoed. (a) This line should be echoed. (b) - This line should be echoed. (c) - This line should be echoed. (d) +This line should be echoed. (c) +This line should be echoed. (d) $ Test ifdef - else lines - This line should be echoed. (1) - This line should be echoed (4) +This line should be echoed. (1) +This line should be echoed (4) $ Test ifndef - else lines - This line should be echoed (6) - This line should be echoed. (7) +This line should be echoed (6) +This line should be echoed. (7) $ Lines a, b, c, d, 1, 4, 6, 7 should be echoed -$ Check line counting -- should be on line 78: - +$ Check line counting -- should be on line 78: + $ ======================================================================== $ Test string if lines This line should be echoed ("greg") @@ -89,25 +89,25 @@ $ Test int and [] (shortcut for int) 5 -5 $ Test looping - print sin, cos from 0 to 90 by 5 -0 0 1 1 -5 0.08715574275 0.9961946981 1 -10 0.1736481777 0.984807753 1 -15 0.2588190451 0.9659258263 1 -20 0.3420201433 0.9396926208 1 -25 0.4226182617 0.906307787 1 -30 0.5 0.8660254038 1 -35 0.5735764364 0.8191520443 1 -40 0.6427876097 0.7660444431 1 -45 0.7071067812 0.7071067812 1 -50 0.7660444431 0.6427876097 1 -55 0.8191520443 0.5735764364 1 -60 0.8660254038 0.5 1 -65 0.906307787 0.4226182617 1 -70 0.9396926208 0.3420201433 1 -75 0.9659258263 0.2588190451 1 -80 0.984807753 0.1736481777 1 -85 0.9961946981 0.08715574275 1 -90 1 6.123233996e-17 1 +0 0 1 1 +5 0.08715574275 0.9961946981 1 +10 0.1736481777 0.984807753 1 +15 0.2588190451 0.9659258263 1 +20 0.3420201433 0.9396926208 1 +25 0.4226182617 0.906307787 1 +30 0.5 0.8660254038 1 +35 0.5735764364 0.8191520443 1 +40 0.6427876097 0.7660444431 1 +45 0.7071067812 0.7071067812 1 +50 0.7660444431 0.6427876097 1 +55 0.8191520443 0.5735764364 1 +60 0.8660254038 0.5 1 +65 0.906307787 0.4226182617 1 +70 0.9396926208 0.3420201433 1 +75 0.9659258263 0.2588190451 1 +80 0.984807753 0.1736481777 1 +85 0.9961946981 0.08715574275 1 +90 1 6.123233996e-17 1 $$$$ Test formatting and string concatenation %.10g @@ -133,6 +133,28 @@ $$$$ Test formatting and string concatenation 20 Using the format %.20g, PI = 3.141592653589793116 Reset format to default: %.10g +$$$$ Test formatting using the `format` function. _FORMAT is not modified +1 Using the format %.1f, PI = 3.1 +2 Using the format %.2f, PI = 3.14 +3 Using the format %.3f, PI = 3.142 +4 Using the format %.4f, PI = 3.1416 +5 Using the format %.5f, PI = 3.14159 +6 Using the format %.6f, PI = 3.141593 +7 Using the format %.7f, PI = 3.1415927 +8 Using the format %.8f, PI = 3.14159265 +9 Using the format %.9f, PI = 3.141592654 +10 Using the format %.10f, PI = 3.1415926536 +11 Using the format %.11f, PI = 3.14159265359 +12 Using the format %.12f, PI = 3.141592653590 +13 Using the format %.13f, PI = 3.1415926535898 +14 Using the format %.14f, PI = 3.14159265358979 +15 Using the format %.15f, PI = 3.141592653589793 +16 Using the format %.16f, PI = 3.1415926535897931 +17 Using the format %.17f, PI = 3.14159265358979312 +18 Using the format %.18f, PI = 3.141592653589793116 +19 Using the format %.19f, PI = 3.1415926535897931160 +20 Using the format %.20f, PI = 3.14159265358979311600 + $$$$ Test string rescanning and executing Original String: @@ -142,12 +164,12 @@ Original String: Rescanned String: This is line 1: 3.141592654 This is line 2: 0.7071067812 - This is line 3: 0.7071067812 + This is line 3: 0.7071067812 Original String: This has an embedded string: {T = "This is a string"} Print Value of variable T = 0 Rescanned String: -This has an embedded string: This is a string +This has an embedded string: This is a string Print Value of variable T = This is a string Original String: atan2(0,-1) @@ -198,4 +220,8 @@ Word 6 of list1 and list2 are 62 and 82 Word 7 of list1 and list2 are 63 and 83 Word 8 of list1 and list2 are 64 and 84 +$$$$ Test double brace echo off/on +Nothing further on line: +Noecho followed by non-parsing output: This should be echoed +Echo, noecho setting variable, then echo that variable: echo++echo $End of test file diff --git a/packages/seacas/libraries/chaco/util/smalloc.c b/packages/seacas/libraries/chaco/util/smalloc.c index 9a4cca9274a7..e9fd2d172726 100644 --- a/packages/seacas/libraries/chaco/util/smalloc.c +++ b/packages/seacas/libraries/chaco/util/smalloc.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -19,7 +19,7 @@ static struct smalloc_debug_data { int order; /* which smalloc call is it? */ size_t size; /* size of malloc invocation */ - double *ptr; /* memory location returned */ + void *ptr; /* memory location returned */ struct smalloc_debug_data *next; /* pointer to next element */ } *top = NULL; diff --git a/packages/seacas/libraries/exoIIv2for32/CMakeLists.txt b/packages/seacas/libraries/exoIIv2for32/CMakeLists.txt index 0a93d767439f..1652bd6f19e2 100644 --- a/packages/seacas/libraries/exoIIv2for32/CMakeLists.txt +++ b/packages/seacas/libraries/exoIIv2for32/CMakeLists.txt @@ -29,7 +29,7 @@ if (SEACASExodus_ENABLE_STATIC) set_target_properties(exoIIv2for32_static PROPERTIES OUTPUT_NAME exoIIv2for32) # This keeps the library out of the `all_libs` targets... set_target_properties(exoIIv2for32_static PROPERTIES TRIBITS_TESTONLY_LIB TRUE) - INSTALL(TARGETS exoIIv2for32_static DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + INSTALL(TARGETS exoIIv2for32_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() TRIBITS_ADD_TEST_DIRECTORIES(test) diff --git a/packages/seacas/libraries/exoIIv2for32/test/testrd.dmp b/packages/seacas/libraries/exoIIv2for32/test/testrd.dmp index 72d596dfb534..cdb62ffcb584 100644 --- a/packages/seacas/libraries/exoIIv2for32/test/testrd.dmp +++ b/packages/seacas/libraries/exoIIv2for32/test/testrd.dmp @@ -5,7 +5,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is a test +title = This is a test num_dim = 3 num_nodes = 26 num_elem = 5 @@ -14,7 +14,7 @@ num_node_sets = 2 num_side_sets = 5 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -41,7 +41,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -68,7 +68,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -97,8 +97,8 @@ z coords = 0.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 @@ -111,40 +111,40 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = quad -block name = block_a +element type = quad +block name = block_a num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 11 -element type = quad -block name = block_b +element type = quad +block name = block_b num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 12 -element type = hex -block name = block_c +element type = hex +block name = block_c num_elem_in_block = 1 num_nodes_per_elem = 8 num_attr = 1 after exgelb, error = 0 element block id = 13 -element type = tetra -block name = block_d +element type = tetra +block name = block_d num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 14 -element type = wedge -block name = block_e +element type = wedge +block name = block_e num_elem_in_block = 1 num_nodes_per_elem = 6 num_attr = 1 @@ -209,11 +209,11 @@ connect array for elem block 14 26 after exgnams, error = 0 -element block 1 name: block_a -element block 2 name: block_b -element block 3 name: block_c -element block 4 name: block_d -element block 5 name: block_e +element block 1 name: block_a +element block 2 name: block_b +element block 3 name: block_c +element block 4 name: block_d +element block 5 name: block_e after exgeat, error = 0 @@ -249,7 +249,7 @@ after exgnsi, error = 0 after exgnp, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after exgns, error = 0 @@ -271,7 +271,7 @@ dist factors for node set 20 after exgnp, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after exgns, error = 0 @@ -288,8 +288,8 @@ dist factors for node set 21 3.10 after exgnams, error = 0 -node set 1 name: nodeset_a1 -node set 2 name: nodeset_b2 +node set 1 name: nodeset_a1 +node set 2 name: nodeset_b2 There are 3 properties for each node set after exgpn, error = 0 @@ -307,16 +307,16 @@ after EXNSDF = 8 exinq, error = 0 after exgcns, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 1 6 -node_list = +node_list = 100 101 102 @@ -325,7 +325,7 @@ node_list = 200 201 202 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -526,11 +526,11 @@ node list for side set 34 no dist factors for side set 34 after exgnams, error = 0 -side set 1 name: surf_first -side set 2 name: surf_second -side set 3 name: surf_third -side set 4 name: surf_fourth -side set 5 name: surf_fifth +side set 1 name: surf_first +side set 2 name: surf_second +side set 3 name: surf_third +side set 4 name: surf_fourth +side set 5 name: surf_fifth There are 2 properties for each side set after exgpn, error = 0 @@ -555,37 +555,37 @@ after exinq: EXSSDF = 8, error = 0 after exgcss, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 5 -num_df_per_set = +num_df_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 1 3 5 12 16 -df_ind = +df_ind = 1 5 9 9 9 -elem_list = +elem_list = 2 2 1 @@ -606,7 +606,7 @@ elem_list = 5 5 5 -side_list = +side_list = 4 2 2 @@ -627,7 +627,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -638,41 +638,41 @@ dist_fact = 31.300 after exgqa, error = 0 -QA records = -testwt -07/07/93 -15:41:33 -FASTQ -fastq -07/07/93 -16:41:33 +QA records = +testwt +07/07/93 +15:41:33 +FASTQ +fastq +07/07/93 +16:41:33 after exginf, error = 0 -info records = - This is the first information record. - This is the second information record. - This is the third information record. +info records = + This is the first information record. + This is the second information record. + This is the third information record. after exgvp, error = 0 after exgvan, error = 0 There are 1 global variables; their names are : -glo_vars +glo_vars after exgvp, error = 0 after exgvan, error = 0 There are 2 nodal variables; their names are : -nod_var0 -nod_var1 +nod_var0 +nod_var1 after exgvp, error = 0 after exgvan, error = 0 There are 3 element variables; their names are : -ele_var0 -ele_var1 -ele_var2 +ele_var0 +ele_var1 +ele_var2 after exgvtt, error = 0 This is the element variable truth table: diff --git a/packages/seacas/libraries/exoIIv2for32/test/testrdd.dmp b/packages/seacas/libraries/exoIIv2for32/test/testrdd.dmp index 72d596dfb534..cdb62ffcb584 100644 --- a/packages/seacas/libraries/exoIIv2for32/test/testrdd.dmp +++ b/packages/seacas/libraries/exoIIv2for32/test/testrdd.dmp @@ -5,7 +5,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is a test +title = This is a test num_dim = 3 num_nodes = 26 num_elem = 5 @@ -14,7 +14,7 @@ num_node_sets = 2 num_side_sets = 5 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -41,7 +41,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -68,7 +68,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -97,8 +97,8 @@ z coords = 0.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 @@ -111,40 +111,40 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = quad -block name = block_a +element type = quad +block name = block_a num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 11 -element type = quad -block name = block_b +element type = quad +block name = block_b num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 12 -element type = hex -block name = block_c +element type = hex +block name = block_c num_elem_in_block = 1 num_nodes_per_elem = 8 num_attr = 1 after exgelb, error = 0 element block id = 13 -element type = tetra -block name = block_d +element type = tetra +block name = block_d num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 14 -element type = wedge -block name = block_e +element type = wedge +block name = block_e num_elem_in_block = 1 num_nodes_per_elem = 6 num_attr = 1 @@ -209,11 +209,11 @@ connect array for elem block 14 26 after exgnams, error = 0 -element block 1 name: block_a -element block 2 name: block_b -element block 3 name: block_c -element block 4 name: block_d -element block 5 name: block_e +element block 1 name: block_a +element block 2 name: block_b +element block 3 name: block_c +element block 4 name: block_d +element block 5 name: block_e after exgeat, error = 0 @@ -249,7 +249,7 @@ after exgnsi, error = 0 after exgnp, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after exgns, error = 0 @@ -271,7 +271,7 @@ dist factors for node set 20 after exgnp, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after exgns, error = 0 @@ -288,8 +288,8 @@ dist factors for node set 21 3.10 after exgnams, error = 0 -node set 1 name: nodeset_a1 -node set 2 name: nodeset_b2 +node set 1 name: nodeset_a1 +node set 2 name: nodeset_b2 There are 3 properties for each node set after exgpn, error = 0 @@ -307,16 +307,16 @@ after EXNSDF = 8 exinq, error = 0 after exgcns, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 1 6 -node_list = +node_list = 100 101 102 @@ -325,7 +325,7 @@ node_list = 200 201 202 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -526,11 +526,11 @@ node list for side set 34 no dist factors for side set 34 after exgnams, error = 0 -side set 1 name: surf_first -side set 2 name: surf_second -side set 3 name: surf_third -side set 4 name: surf_fourth -side set 5 name: surf_fifth +side set 1 name: surf_first +side set 2 name: surf_second +side set 3 name: surf_third +side set 4 name: surf_fourth +side set 5 name: surf_fifth There are 2 properties for each side set after exgpn, error = 0 @@ -555,37 +555,37 @@ after exinq: EXSSDF = 8, error = 0 after exgcss, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 5 -num_df_per_set = +num_df_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 1 3 5 12 16 -df_ind = +df_ind = 1 5 9 9 9 -elem_list = +elem_list = 2 2 1 @@ -606,7 +606,7 @@ elem_list = 5 5 5 -side_list = +side_list = 4 2 2 @@ -627,7 +627,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -638,41 +638,41 @@ dist_fact = 31.300 after exgqa, error = 0 -QA records = -testwt -07/07/93 -15:41:33 -FASTQ -fastq -07/07/93 -16:41:33 +QA records = +testwt +07/07/93 +15:41:33 +FASTQ +fastq +07/07/93 +16:41:33 after exginf, error = 0 -info records = - This is the first information record. - This is the second information record. - This is the third information record. +info records = + This is the first information record. + This is the second information record. + This is the third information record. after exgvp, error = 0 after exgvan, error = 0 There are 1 global variables; their names are : -glo_vars +glo_vars after exgvp, error = 0 after exgvan, error = 0 There are 2 nodal variables; their names are : -nod_var0 -nod_var1 +nod_var0 +nod_var1 after exgvp, error = 0 after exgvan, error = 0 There are 3 element variables; their names are : -ele_var0 -ele_var1 -ele_var2 +ele_var0 +ele_var1 +ele_var2 after exgvtt, error = 0 This is the element variable truth table: diff --git a/packages/seacas/libraries/exoIIv2for32/test/testrddi64.dmp b/packages/seacas/libraries/exoIIv2for32/test/testrddi64.dmp index 1f99f1f0ba2a..9d1e72b94dfc 100644 --- a/packages/seacas/libraries/exoIIv2for32/test/testrddi64.dmp +++ b/packages/seacas/libraries/exoIIv2for32/test/testrddi64.dmp @@ -5,7 +5,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is a test +title = This is a test num_dim = 3 num_nodes = 26 num_elem = 5 @@ -14,7 +14,7 @@ num_node_sets = 2 num_side_sets = 5 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -41,7 +41,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -68,7 +68,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -97,8 +97,8 @@ z coords = 0.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 @@ -111,40 +111,40 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = quad -block name = block_a +element type = quad +block name = block_a num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 11 -element type = quad -block name = block_b +element type = quad +block name = block_b num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 12 -element type = hex -block name = block_c +element type = hex +block name = block_c num_elem_in_block = 1 num_nodes_per_elem = 8 num_attr = 1 after exgelb, error = 0 element block id = 13 -element type = tetra -block name = block_d +element type = tetra +block name = block_d num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 14 -element type = wedge -block name = block_e +element type = wedge +block name = block_e num_elem_in_block = 1 num_nodes_per_elem = 6 num_attr = 1 @@ -209,11 +209,11 @@ connect array for elem block 14 26 after exgnams, error = 0 -element block 1 name: block_a -element block 2 name: block_b -element block 3 name: block_c -element block 4 name: block_d -element block 5 name: block_e +element block 1 name: block_a +element block 2 name: block_b +element block 3 name: block_c +element block 4 name: block_d +element block 5 name: block_e after exgeat, error = 0 @@ -249,7 +249,7 @@ after exgnsi, error = 0 after exgnp, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after exgns, error = 0 @@ -271,7 +271,7 @@ dist factors for node set 20 after exgnp, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after exgns, error = 0 @@ -288,8 +288,8 @@ dist factors for node set 21 3.10 after exgnams, error = 0 -node set 1 name: nodeset_a1 -node set 2 name: nodeset_b2 +node set 1 name: nodeset_a1 +node set 2 name: nodeset_b2 There are 3 properties for each node set after exgpn, error = 0 @@ -307,16 +307,16 @@ after EXNSDF = 8 exinq, error = 0 after exgcns, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 1 6 -node_list = +node_list = 100 101 102 @@ -325,7 +325,7 @@ node_list = 200 201 202 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -526,11 +526,11 @@ node list for side set 34 no dist factors for side set 34 after exgnams, error = 0 -side set 1 name: surf_first -side set 2 name: surf_second -side set 3 name: surf_third -side set 4 name: surf_fourth -side set 5 name: surf_fifth +side set 1 name: surf_first +side set 2 name: surf_second +side set 3 name: surf_third +side set 4 name: surf_fourth +side set 5 name: surf_fifth There are 2 properties for each side set after exgpn, error = 0 @@ -555,37 +555,37 @@ after exinq: EXSSDF = 8, error = 0 after exgcss, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 5 -num_df_per_set = +num_df_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 1 3 5 12 16 -df_ind = +df_ind = 1 5 9 9 9 -elem_list = +elem_list = 2 2 1 @@ -606,7 +606,7 @@ elem_list = 5 5 5 -side_list = +side_list = 4 2 2 @@ -627,7 +627,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -638,41 +638,41 @@ dist_fact = 31.300 after exgqa, error = 0 -QA records = -testwt -07/07/93 -15:41:33 -FASTQ -fastq -07/07/93 -16:41:33 +QA records = +testwt +07/07/93 +15:41:33 +FASTQ +fastq +07/07/93 +16:41:33 after exginf, error = 0 -info records = - This is the first information record. - This is the second information record. - This is the third information record. +info records = + This is the first information record. + This is the second information record. + This is the third information record. after exgvp, error = 0 after exgvan, error = 0 There are 1 global variables; their names are : -glo_vars +glo_vars after exgvp, error = 0 after exgvan, error = 0 There are 2 nodal variables; their names are : -nod_var0 -nod_var1 +nod_var0 +nod_var1 after exgvp, error = 0 after exgvan, error = 0 There are 3 element variables; their names are : -ele_var0 -ele_var1 -ele_var2 +ele_var0 +ele_var1 +ele_var2 after exgvtt, error = 0 This is the element variable truth table: diff --git a/packages/seacas/libraries/exodus/CMakeLists.txt b/packages/seacas/libraries/exodus/CMakeLists.txt index d2be5f9fa810..f9d7a2d500b6 100644 --- a/packages/seacas/libraries/exodus/CMakeLists.txt +++ b/packages/seacas/libraries/exodus/CMakeLists.txt @@ -50,7 +50,7 @@ if (SEACASExodus_ENABLE_SHARED) # This keeps the library out of the `all_libs` targets... set_target_properties(exodus_shared PROPERTIES TRIBITS_TESTONLY_LIB TRUE) set_target_properties(exodus_shared PROPERTIES OUTPUT_NAME exodus) - INSTALL(TARGETS exodus_shared DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + INSTALL(TARGETS exodus_shared DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() endif() @@ -68,11 +68,11 @@ if (SEACASExodus_ENABLE_STATIC) # This keeps the library out of the `all_libs` targets... set_target_properties(exodus_static PROPERTIES TRIBITS_TESTONLY_LIB TRUE) set_target_properties(exodus_static PROPERTIES OUTPUT_NAME exodus) - INSTALL(TARGETS exodus_static DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + INSTALL(TARGETS exodus_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) # For backwards compatibility, the C exodus library was called libexoIIv2c.a # Create a symbolic link from libexodus.a to libexoIIv2c.a -- do only for static lib - InstallSymLink(libexodus.a ${CMAKE_INSTALL_PREFIX}/lib/libexoIIv2c.a) + InstallSymLink(libexodus.a ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libexoIIv2c.a) endif() if (${CMAKE_PROJECT_NAME} STREQUAL "Seacas") diff --git a/packages/seacas/libraries/exodus/include/exodusII.h b/packages/seacas/libraries/exodus/include/exodusII.h index 8c978d67aa2a..600383c79047 100644 --- a/packages/seacas/libraries/exodus/include/exodusII.h +++ b/packages/seacas/libraries/exodus/include/exodusII.h @@ -55,12 +55,12 @@ #endif /* EXODUS version number */ -#define EXODUS_VERSION "9.01" +#define EXODUS_VERSION "9.04" #define EXODUS_VERSION_MAJOR 9 -#define EXODUS_VERSION_MINOR 1 -#define EXODUS_RELEASE_DATE "July 17, 2024" +#define EXODUS_VERSION_MINOR 4 +#define EXODUS_RELEASE_DATE "November 5, 2024" -#define EX_API_VERS 9.01f +#define EX_API_VERS 9.04f #define EX_API_VERS_NODOT (100 * EXODUS_VERSION_MAJOR + EXODUS_VERSION_MINOR) #define EX_VERS EX_API_VERS @@ -215,6 +215,7 @@ enum ex_inquiry { EX_INQ_NUM_ELEM_SET_VAR = 69, /**< number of element set variables */ EX_INQ_NUM_SIDE_SET_VAR = 70, /**< number of sideset variables */ EX_INQ_NUM_GLOBAL_VAR = 71, /**< number of global variables */ + EX_INQ_FILE_FORMAT = 72, /**< netCDF file format */ EX_INQ_INVALID = -1 }; @@ -242,9 +243,11 @@ NetCDF-4.?.? and later enum ex_option_type { EX_OPT_MAX_NAME_LENGTH = 1, /**< Maximum length of names that will be returned/passed via api call. */ - EX_OPT_COMPRESSION_TYPE, /**< Not currently used; default is gzip */ - EX_OPT_COMPRESSION_LEVEL, /**< In the range [0..9]. A value of 0 indicates no compression */ + EX_OPT_COMPRESSION_TYPE, /**< Default is gzip */ + EX_OPT_COMPRESSION_LEVEL, /**< Range depends on compression type. */ EX_OPT_COMPRESSION_SHUFFLE, /**< 1 if enabled, 0 if disabled */ + EX_OPT_QUANTIZE_NSD, /**< if > 0, Number of significant digits to retain in lossy quantize + compression */ EX_OPT_INTEGER_SIZE_API, /**< 4 or 8 indicating byte size of integers used in api functions. */ EX_OPT_INTEGER_SIZE_DB, /**< Query only, returns 4 or 8 indicating byte size of integers stored on the database. */ @@ -255,6 +258,8 @@ enum ex_compression_type { EX_COMPRESS_ZLIB = 1, /**< Use ZLIB-based compression (if available) */ EX_COMPRESS_GZIP = 1, /**< Same as ZLIB, but typical alias used */ EX_COMPRESS_SZIP, /**< Use SZIP-based compression (if available) */ + EX_COMPRESS_ZSTD, /**< Use ZStandard compression (if available) */ + EX_COMPRESS_BZ2, /**< Use BZ2 / Bzip2 compression (if available) */ }; typedef enum ex_compression_type ex_compression_type; /** @}*/ @@ -341,13 +346,13 @@ typedef struct ex_basis /* clang-format off * - * subc_dim: dimension of the subcell associated with the specified DoF ordinal + * subc_dim: dimension of the subcell associated with the specified DoF ordinal * -- 0 node, 1 edge, 2 face, 3 volume [Range: 0..3] * subc_ordinal: ordinal of the subcell relative to its parent cell - * -- 0..n for each ordinal with the same subc dim [Range: <= DoF ordinal] - * subc_dof_ordinal: ordinal of the DoF relative to the subcell - * subc_num_dof: cardinality of the DoF set associated with this subcell. - * xi, eta, mu (ξ, η, ζ): Parametric coordinate location of the DoF + * -- 0..n for each ordinal with the same subc dim [Range: <= DoF ordinal] + * subc_dof_ordinal: ordinal of the DoF relative to the subcell + * subc_num_dof: cardinality of the DoF set associated with this subcell. + * xi, eta, mu (ξ, η, ζ): Parametric coordinate location of the DoF * -- (Only first ndim values are valid) * clang-format on @@ -1955,8 +1960,9 @@ enum ex_error_return_code { EX_LASTERR = -1003, /**< in ex_err, use existing err_num value */ EX_NULLENTITY = -1006, /**< null entity found */ EX_NOENTITY = -1007, /**< no entities of that type on database */ - EX_INTSIZEMISMATCH = -1008, /**< integer sizes do not match on input/output databases in ex_copy */ EX_NOTFOUND = -1008, /**< could not find requested variable on database */ + EX_INTSIZEMISMATCH = + -1009, /**< integer sizes do not match on input/output databases in ex_copy */ EX_FATAL = -1, /**< fatal error flag def */ EX_NOERR = 0, /**< no error flag def */ diff --git a/packages/seacas/libraries/exodus/include/exodusII_int.h b/packages/seacas/libraries/exodus/include/exodusII_int.h index e8bb5aca4ebc..e1fbb3432597 100644 --- a/packages/seacas/libraries/exodus/include/exodusII_int.h +++ b/packages/seacas/libraries/exodus/include/exodusII_int.h @@ -26,6 +26,18 @@ #include "netcdf_meta.h" #endif +#if NC_HAS_ZSTD == 1 || NC_HAS_BZ2 +#include "netcdf_filter.h" +#endif + +#if !defined NC_FillValue +#if defined _FillValue +#define NC_FillValue _FillValue +#else +#define NC_FillValue "_FillValue" +#endif +#endif + #if defined(_WIN32) && defined(_MSC_VER) && _MSC_VER < 1900 #define PRId64 "I64d" #else @@ -685,19 +697,22 @@ typedef enum exi_element_type exi_element_type; struct exi_file_item { - int file_id; - nc_type netcdf_type_code; /**< NC_FLOAT or NC_DOUBLE */ - int int64_status; - int maximum_name_length; - int time_varid; /* Store to avoid lookup each timestep */ + int file_id; + nc_type netcdf_type_code; + int int64_status; + int maximum_name_length; + int time_varid; /* Store to avoid lookup each timestep */ + int compression_level; /**< 0 (disabled) to 9 (maximum) compression level for + gzip, 4..32 and even for szip; -131072..22 for zstd, NetCDF-4 only */ unsigned int assembly_count; unsigned int blob_count; - unsigned int compression_level; /**< 0 (disabled) to 9 (maximum) compression level for - gzip, 4..32 and even for szip; NetCDF-4 only */ + unsigned int persist_define_mode : 10; /**< Stay in define mode until exi_persist_leavedef is called. Set by exi_persist_redef... */ unsigned int compression_algorithm : 4; /**< GZIP/ZLIB, SZIP, more may be supported by NetCDF soon */ + unsigned int quantize_nsd : 4; /**< 0 (disabled) to 15 (maximum) number of significant digits + retained for lossy quanitzation compression */ unsigned int shuffle : 1; /**< 1 true, 0 false */ unsigned int user_compute_wordsize : 1; /**< 0 for 4 byte or 1 for 8 byte reals */ unsigned int diff --git a/packages/seacas/libraries/exodus/src/deprecated/ex_get_var_param.c b/packages/seacas/libraries/exodus/src/deprecated/ex_get_var_param.c index e53efc947f19..43f5e8e6bd73 100644 --- a/packages/seacas/libraries/exodus/src/deprecated/ex_get_var_param.c +++ b/packages/seacas/libraries/exodus/src/deprecated/ex_get_var_param.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -36,5 +36,5 @@ int ex_get_var_param(int exoid, const char *var_type, int *num_vars) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); - return (ex_get_variable_param(exoid, obj_type, num_vars)); + return ex_get_variable_param(exoid, obj_type, num_vars); } diff --git a/packages/seacas/libraries/exodus/src/deprecated/ex_put_var_param.c b/packages/seacas/libraries/exodus/src/deprecated/ex_put_var_param.c index d503fc9f4a90..a942db88c287 100644 --- a/packages/seacas/libraries/exodus/src/deprecated/ex_put_var_param.c +++ b/packages/seacas/libraries/exodus/src/deprecated/ex_put_var_param.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -39,5 +39,5 @@ int ex_put_var_param(int exoid, const char *var_type, int num_vars) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); - return (ex_put_variable_param(exoid, obj_type, num_vars)); + return ex_put_variable_param(exoid, obj_type, num_vars); } diff --git a/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c b/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c index 0e16d4a9e0f8..7fad13f25826 100644 --- a/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c +++ b/packages/seacas/libraries/exodus/src/ex__put_homogenous_block_params.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -47,7 +47,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct "ERROR: Bad block type (%d) specified for all blocks file id %d", blocks[0].type, exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); - return (EX_FATAL); + return EX_FATAL; } { /* Output ids for this block */ @@ -58,7 +58,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct "array in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); - return (EX_FATAL); + return EX_FATAL; } for (size_t i = 0; i < block_count; i++) { @@ -70,7 +70,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct ex_name_of_object(blocks[0].type), exoid); ex_err_fn(exoid, __func__, errmsg, status); free(ids); - return (EX_FATAL); + return EX_FATAL; } if ((status = nc_put_var_longlong(exoid, varid, ids)) != NC_NOERR) { @@ -78,7 +78,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct ex_name_of_object(blocks[0].type), exoid); ex_err_fn(exoid, __func__, errmsg, status); free(ids); - return (EX_FATAL); + return EX_FATAL; } free(ids); } @@ -91,7 +91,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct "array in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); - return (EX_FATAL); + return EX_FATAL; } for (size_t i = 0; i < block_count; i++) { @@ -103,7 +103,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct ex_name_of_object(blocks[0].type), exoid); ex_err_fn(exoid, __func__, errmsg, status); free(stat); - return (EX_FATAL); + return EX_FATAL; } if ((status = nc_put_var_int(exoid, varid, stat)) != NC_NOERR) { @@ -111,7 +111,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct ex_name_of_object(blocks[0].type), exoid); ex_err_fn(exoid, __func__, errmsg, status); free(stat); - return (EX_FATAL); + return EX_FATAL; } free(stat); } @@ -121,7 +121,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct if ((status = exi_redef(exoid, __func__)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to place file id %d into define mode", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* inquire previously defined dimensions */ @@ -348,7 +348,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct if ((status = exi_leavedef(exoid, __func__)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to exit define mode in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* ======================================================================== */ @@ -357,7 +357,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct case EX_EDGE_BLOCK: vblkids = VAR_ID_ED_BLK; break; case EX_FACE_BLOCK: vblkids = VAR_ID_FA_BLK; break; case EX_ELEM_BLOCK: vblkids = VAR_ID_EL_BLK; break; - default: return (EX_FATAL); /* should have been handled earlier; quiet compiler here */ + default: return EX_FATAL; /* should have been handled earlier; quiet compiler here */ } int att_name_varid = -1; @@ -375,17 +375,17 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct start[1] = 0; count[1] = strlen(text) + 1; - for (size_t j = 0; j < blocks[i].num_attribute; j++) { + for (int64_t j = 0; j < blocks[i].num_attribute; j++) { start[0] = j; nc_put_vara_text(exoid, att_name_varid, start, count, text); } } } - return (EX_NOERR); + return EX_NOERR; /* Fatal error: exit definition mode and return */ error_ret: exi_leavedef(exoid, __func__); - return (EX_FATAL); + return EX_FATAL; } diff --git a/packages/seacas/libraries/exodus/src/ex__put_nodal_var_multi_time.c b/packages/seacas/libraries/exodus/src/ex__put_nodal_var_multi_time.c index 5f7afbf35c99..c2d25009542b 100644 --- a/packages/seacas/libraries/exodus/src/ex__put_nodal_var_multi_time.c +++ b/packages/seacas/libraries/exodus/src/ex__put_nodal_var_multi_time.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -88,7 +88,7 @@ int exi_put_nodal_var_time(int exoid, int nodal_var_index, int64_t num_nodes, in snprintf(errmsg, MAX_ERR_LENGTH, "Warning: could not find nodal variable %d in file id %d", nodal_var_index, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_WARN); + return EX_WARN; } start[0] = --beg_time_step; start[1] = 0; @@ -106,7 +106,7 @@ int exi_put_nodal_var_time(int exoid, int nodal_var_index, int64_t num_nodes, in if (status != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store nodal variables in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } diff --git a/packages/seacas/libraries/exodus/src/ex_conv.c b/packages/seacas/libraries/exodus/src/ex_conv.c index f053f185d37c..4b96ee7e2e21 100644 --- a/packages/seacas/libraries/exodus/src/ex_conv.c +++ b/packages/seacas/libraries/exodus/src/ex_conv.c @@ -37,7 +37,7 @@ struct exi_file_item *exi_find_file_item(int exoid) } ptr = ptr->next; } - return (ptr); + return ptr; } #define EX__MAX_PATHLEN 8192 @@ -240,6 +240,7 @@ int exi_conv_init(int exoid, int *comp_wordsize, int *io_wordsize, int file_word new_file->assembly_count = 0; new_file->blob_count = 0; new_file->compression_level = 0; + new_file->quantize_nsd = 0; new_file->shuffle = 0; new_file->file_type = filetype - 1; new_file->is_parallel = is_parallel; @@ -443,19 +444,76 @@ int ex_set_option(int exoid, ex_option_type option, int option_value) char errmsg[MAX_ERR_LENGTH]; snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: invalid value %d for SZIP Compression. Must be even and 4 <= value <= " - "32. Ignoring.", + "32. Setting value to 4.", value); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); - EX_FUNC_LEAVE(EX_FATAL); + value = 4; } } + else if (file->compression_algorithm == EX_COMPRESS_ZSTD) { +#if NC_HAS_ZSTD == 1 + if (value < -131072 || value > 22) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: invalid value %d for ZSTD Compression. Must be between -131072 and 22. " + "Setting value to 4", + value); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); + value = 4; + } +#else + char errmsg[MAX_ERR_LENGTH]; + snprintf( + errmsg, MAX_ERR_LENGTH, + "ERROR: Zstandard compression is not supported in this version of netCDF library."); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); +#endif + } + else if (file->compression_algorithm == EX_COMPRESS_BZ2) { +#if NC_HAS_BZ2 == 1 + if (value < 0 || value > 9) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: invalid value %d for BZIP2 Compression. Must be between 0 and 9 " + "inclusive. Setting value to 1.", + value); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); + value = 1; + } +#else + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: Bzip2 compression is not supported in this version of netCDF library."); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); +#endif + } file->compression_level = value; - assert(value == file->compression_level); } else { file->compression_level = 0; } break; + case EX_OPT_QUANTIZE_NSD: +#if NC_HAS_QUANTIZE == 1 + if (option_value > 15) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: invalid value %d for Quantize NSD. Must be less than or equal to 15. " + "Setting value to 15.", + option_value); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); + option_value = 15; + } + file->quantize_nsd = option_value; +#else + { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: Quanitzation is not supported in this version of netCDF library."); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); + } +#endif + break; case EX_OPT_COMPRESSION_SHUFFLE: /* 0 (disabled); 1 (enabled) */ file->shuffle = option_value != 0 ? 1 : 0; break; @@ -488,10 +546,10 @@ int exi_comp_ws(int exoid) char errmsg[MAX_ERR_LENGTH]; snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unknown file id %d", exoid); ex_err(__func__, errmsg, EX_BADFILEID); - return (EX_FATAL); + return EX_FATAL; } /* Stored as 0 for 4-byte; 1 for 8-byte */ - return ((file->user_compute_wordsize + 1) * 4); + return (file->user_compute_wordsize + 1) * 4; } /*! diff --git a/packages/seacas/libraries/exodus/src/ex_copy.c b/packages/seacas/libraries/exodus/src/ex_copy.c index 8ccb00505f2b..89462e204eb4 100644 --- a/packages/seacas/libraries/exodus/src/ex_copy.c +++ b/packages/seacas/libraries/exodus/src/ex_copy.c @@ -21,7 +21,7 @@ #define EXCHECKI(funcall) \ if ((funcall) != NC_NOERR) { \ fprintf(stderr, "Error calling %s\n", TOSTRING(funcall)); \ - return (EX_FATAL); \ + return EX_FATAL; \ } #define EXCHECKF(funcall) \ @@ -66,7 +66,7 @@ static int is_truth_table_variable(const char *var_name) /* If copying just the "mesh" or "non-transient" portion of the * input DB, these are the variables that won't be copied: */ - return (strstr(var_name, "_var_tab") != NULL); + return strstr(var_name, "_var_tab") != NULL; } static int is_non_mesh_variable(const char *var_name) @@ -176,6 +176,7 @@ int ex_copy_transient(int in_exoid, int out_exoid) static int cpy_variable_data(int in_exoid, int out_exoid, int in_large, int mesh_only) { int nvars; /* number of variables */ + /* NOTE: This is incorrect for files containing groups */ EXCHECKI(nc_inq(in_exoid, NULL, &nvars, NULL, NULL)); for (int varid = 0; varid < nvars; varid++) { bool is_filtered; @@ -216,6 +217,7 @@ static int cpy_variables(int in_exoid, int out_exoid, int in_large, int mesh_onl { int recdimid; /* id of unlimited dimension */ int nvars; /* number of variables */ + /* NOTE: This is incorrect for files containing groups */ EXCHECKI(nc_inq(in_exoid, NULL, &nvars, NULL, &recdimid)); for (int varid = 0; varid < nvars; varid++) { struct ncvar var; /* variable */ @@ -259,6 +261,7 @@ static int cpy_dimension(int in_exoid, int out_exoid, int mesh_only) int ndims; /* number of dimensions */ int recdimid; /* id of unlimited dimension */ + /* NOTE: This is incorrect for files containing groups */ EXCHECKI(nc_inq(in_exoid, &ndims, NULL, NULL, &recdimid)); for (int dimid = 0; dimid < ndims; dimid++) { @@ -344,6 +347,7 @@ static int cpy_global_att(int in_exoid, int out_exoid) struct ncatt att; /* attribute */ int ngatts; + /* NOTE: This is incorrect for files containing groups */ EXCHECKI(nc_inq(in_exoid, NULL, NULL, &ngatts, NULL)); /* copy global attributes */ @@ -413,7 +417,7 @@ static int cpy_att(int in_id, int out_id, int var_in_id, int var_out_id) nc_copy_att(in_id, var_in_id, att_nm, out_id, var_out_id); } - return (EX_NOERR); + return EX_NOERR; } /*! \endcond */ @@ -718,11 +722,11 @@ static int cpy_var_val(int in_id, int out_id, char *var_nm) /* Free the space that held the variable */ free(void_ptr); - return (EX_NOERR); + return EX_NOERR; err_ret: free(void_ptr); - return (EX_FATAL); + return EX_FATAL; } /* end cpy_var_val() */ @@ -789,7 +793,7 @@ static int cpy_coord_val(int in_id, int out_id, char *var_nm, int in_large) /* Free the space that held the variable */ free(void_ptr); - return (EX_NOERR); + return EX_NOERR; } /* end cpy_coord_val() */ diff --git a/packages/seacas/libraries/exodus/src/ex_cvt_nodes_to_sides.c b/packages/seacas/libraries/exodus/src/ex_cvt_nodes_to_sides.c index 5da57f6ce0cc..0d0a552c3ee2 100644 --- a/packages/seacas/libraries/exodus/src/ex_cvt_nodes_to_sides.c +++ b/packages/seacas/libraries/exodus/src/ex_cvt_nodes_to_sides.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -171,7 +171,6 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list) { - size_t i, j, k, n; int num_side_sets, num_elem_blks; int64_t tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0, ndim; void_int *elem_blk_ids = NULL; @@ -179,7 +178,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n void_int *ss_elem_ndx = NULL; void_int *ss_elem_node_ndx = NULL; void_int *ss_parm_ndx = NULL; - size_t elem_ctr, node_ctr, elem_num_pos; + int64_t elem_ctr, node_ctr, elem_num_pos; int num_nodes_per_elem, num_node_per_side; int *same_elem_type = NULL; @@ -255,12 +254,12 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n /* First count up # of elements in the side sets*/ if (ints_64) { - for (i = 0; i < num_side_sets; i++) { + for (int i = 0; i < num_side_sets; i++) { tot_num_ss_elem += ((int64_t *)num_elem_per_set)[i]; } } else { - for (i = 0; i < num_side_sets; i++) { + for (int i = 0; i < num_side_sets; i++) { tot_num_ss_elem += ((int *)num_elem_per_set)[i]; } } @@ -279,7 +278,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n if (int_size == sizeof(int64_t)) { /* Sort side set element list into index array - non-destructive */ int64_t *elems = (int64_t *)ss_elem_ndx; - for (i = 0; i < tot_num_ss_elem; i++) { + for (int i = 0; i < tot_num_ss_elem; i++) { elems[i] = i; /* init index array to current position */ } exi_iqsort64(side_sets_elem_list, elems, tot_num_ss_elem); @@ -287,7 +286,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n else { /* Sort side set element list into index array - non-destructive */ int *elems = (int *)ss_elem_ndx; - for (i = 0; i < tot_num_ss_elem; i++) { + for (int i = 0; i < tot_num_ss_elem; i++) { elems[i] = i; /* init index array to current position */ } exi_iqsort(side_sets_elem_list, elems, tot_num_ss_elem); @@ -325,7 +324,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n goto cleanup; } elem_ctr = 0; - for (i = 0; i < num_elem_blks; i++) { + for (int i = 0; i < num_elem_blks; i++) { ex_entity_id id; if (ints_64) { id = ((int64_t *)elem_blk_ids)[i]; @@ -383,9 +382,10 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n same_elem_type[0] = true; if (ints_64) { elem_ctr = ((int64_t *)num_elem_per_set)[0]; - for (i = 0, k = 0; i < tot_num_ss_elem; i++) { + for (int64_t i = 0, k = 0; i < tot_num_ss_elem; i++) { int64_t elem = ((int64_t *)side_sets_elem_list)[i]; - for (j = 0; j < num_elem_blks; j++) { + int j = 0; + for (; j < num_elem_blks; j++) { if (elem <= elem_blk_parms[j].elem_ctr) { break; } @@ -420,10 +420,12 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n */ node_ctr = 0; elem_ctr = ((int64_t *)num_elem_per_set)[0]; - for (i = 0, k = 0; i < tot_num_ss_elem; i++) { + int i = 0; + for (int k = 0; i < tot_num_ss_elem; i++) { int64_t elem = ((int64_t *)side_sets_elem_list)[i]; - for (j = 0; j < num_elem_blks; j++) { + int j = 0; + for (; j < num_elem_blks; j++) { if (elem <= elem_blk_parms[j].elem_ctr) { break; } @@ -460,10 +462,11 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n } else { elem_ctr = ((int *)num_elem_per_set)[0]; - for (i = 0, k = 0; i < tot_num_ss_elem; i++) { + for (int i = 0, k = 0; i < tot_num_ss_elem; i++) { int elem = ((int *)side_sets_elem_list)[i]; - for (j = 0; j < num_elem_blks; j++) { + int j = 0; + for (; j < num_elem_blks; j++) { if (elem <= elem_blk_parms[j].elem_ctr) { break; } @@ -498,10 +501,12 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n */ node_ctr = 0; elem_ctr = ((int *)num_elem_per_set)[0]; - for (i = 0, k = 0; i < tot_num_ss_elem; i++) { + int i = 0; + for (int k = 0; i < tot_num_ss_elem; i++) { int elem = ((int *)side_sets_elem_list)[i]; - for (j = 0; j < num_elem_blks; j++) { + int j = 0; + for (; j < num_elem_blks; j++) { if (elem <= elem_blk_parms[j].elem_ctr) { break; } @@ -541,7 +546,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n elem_ctr = 0; - for (j = 0; j < tot_num_ss_elem; j++) { + for (int j = 0; j < tot_num_ss_elem; j++) { int64_t elem; int64_t idx; int64_t ss_node0, ss_node1; @@ -617,7 +622,8 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n num_nodes_per_elem = elem_blk_parms[p_ndx].num_nodes_per_elem; - for (n = 0; n < num_nodes_per_elem; n++) { + int n = 0; + for (; n < num_nodes_per_elem; n++) { /* find node in connectivity array that matches first node in side set */ if (((int_size == sizeof(int64_t)) && (ss_node0 == ((int64_t *)connect)[num_nodes_per_elem * (elem_num_pos) + n])) || diff --git a/packages/seacas/libraries/exodus/src/ex_err.c b/packages/seacas/libraries/exodus/src/ex_err.c index a2400ab978c9..4fb4b08321c0 100644 --- a/packages/seacas/libraries/exodus/src/ex_err.c +++ b/packages/seacas/libraries/exodus/src/ex_err.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -225,6 +225,7 @@ void ex_err_fn(int exoid, const char *module_name, const char *message, int err_ fprintf(stderr, " exerrval = %d\n", EX_ERR_NUM); fprintf(stderr, "\t%s\n", ex_strerror(EX_ERR_NUM)); + fflush(stderr); EX_FUNC_VOID(); } @@ -239,6 +240,7 @@ void ex_err_fn(int exoid, const char *module_name, const char *message, int err_ if (err_num == EX_NULLENTITY) { if (exoptval & EX_NULLVERBOSE) { fprintf(stderr, "\nExodus Library Warning: [%s]\n\t%s\n", module_name, message); + fflush(stderr); } } @@ -262,8 +264,8 @@ void ex_err_fn(int exoid, const char *module_name, const char *message, int err_ fprintf(stderr, "\nExodus Library Warning/Error: [%s]\n\t%s\n", module_name, message); } fprintf(stderr, "\t%s\n", ex_strerror(err_num)); + fflush(stderr); } - fflush(stderr); /* with netCDF 3.4, (fatal) system error codes are > 0; so all EXODUS fatal error codes are > 0 */ @@ -345,6 +347,7 @@ const char *ex_strerror(int err_num) case EX_INTERNAL: return "Internal logic error in exodus library."; case EX_NOTROOTID: return "File id is not the root id; it is a subgroup id."; case EX_NULLENTITY: return "Null entity found."; + case EX_NOTFOUND: return "Could not find requested variable on database."; case EX_INTSIZEMISMATCH: return "Integer sizes must match for input and output file in ex_copy."; case EX_MSG: return "Message printed; no error implied."; default: return nc_strerror(err_num); diff --git a/packages/seacas/libraries/exodus/src/ex_field_utils.c b/packages/seacas/libraries/exodus/src/ex_field_utils.c index 098e3c589f26..f9e5e4ccce40 100644 --- a/packages/seacas/libraries/exodus/src/ex_field_utils.c +++ b/packages/seacas/libraries/exodus/src/ex_field_utils.c @@ -60,7 +60,7 @@ static int number_width(size_t number) static void verify_valid_component(int component, size_t cardinality, size_t suffix_size) { assert(cardinality == suffix_size); - assert(component - 1 < suffix_size); + assert(component - 1 < (int)suffix_size); } const char *ex_component_field_name(ex_field *field, int component[EX_MAX_FIELD_NESTING]) @@ -76,7 +76,7 @@ const char *ex_component_field_name(ex_field *field, int component[EX_MAX_FIELD_ } // Build up name incrementally which makes it easier to handle an empty component_separator... - sprintf(field_name, "%s", field->name); + snprintf(field_name, EX_MAX_NAME + 1, "%s", field->name); for (int i = 0; i < field->nesting; i++) { if (field->component_separator[i]) { @@ -332,8 +332,8 @@ const char *ex_field_component_suffix(ex_field *field, int nest_level, int compo static char user_suffix[32]; static char format[8]; int width = number_width(field->cardinality[nest_level]); - sprintf(format, "%c%d%dd", '%', 0, width); - sprintf(user_suffix, format, component); + snprintf(format, 8, "%c%d%dd", '%', 0, width); + snprintf(user_suffix, 32, format, component); return user_suffix; } @@ -343,8 +343,8 @@ const char *ex_field_component_suffix(ex_field *field, int nest_level, int compo static char user_suffix[32]; static char format[8]; int width = number_width(field->cardinality[nest_level]); - sprintf(format, "%c%d%dd", '%', 0, width); - sprintf(user_suffix, format, component - 1); + snprintf(format, 8, "%c%d%dd", '%', 0, width); + snprintf(user_suffix, 32, format, component - 1); return user_suffix; } diff --git a/packages/seacas/libraries/exodus/src/ex_get_assemblies.c b/packages/seacas/libraries/exodus/src/ex_get_assemblies.c index 153d51eca729..aee75c0d007b 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_assemblies.c +++ b/packages/seacas/libraries/exodus/src/ex_get_assemblies.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -26,7 +26,7 @@ int ex_get_assemblies(int exoid, ex_assembly *assembly) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to inquire ASSEMBLY count in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, num_assembly); - return (EX_FATAL); + return EX_FATAL; } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { diff --git a/packages/seacas/libraries/exodus/src/ex_get_blobs.c b/packages/seacas/libraries/exodus/src/ex_get_blobs.c index fde8ca7ab581..9b08148ebd54 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_blobs.c +++ b/packages/seacas/libraries/exodus/src/ex_get_blobs.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -23,7 +23,7 @@ int ex_get_blobs(int exoid, ex_blob *blob) char errmsg[MAX_ERR_LENGTH]; snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to inquire BLOB count in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, num_blob); - return (EX_FATAL); + return EX_FATAL; } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { diff --git a/packages/seacas/libraries/exodus/src/ex_get_block_params.c b/packages/seacas/libraries/exodus/src/ex_get_block_params.c index d7e939293ea9..9b48ad81de62 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_block_params.c +++ b/packages/seacas/libraries/exodus/src/ex_get_block_params.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -22,9 +22,8 @@ int ex_get_block_params(int exoid, size_t block_count, struct ex_block **blocks) { - size_t i; EX_FUNC_ENTER(); - for (i = 0; i < block_count; i++) { + for (size_t i = 0; i < block_count; i++) { int status = ex_get_block_param(exoid, blocks[i]); if (status != EX_NOERR) { EX_FUNC_LEAVE(status); diff --git a/packages/seacas/libraries/exodus/src/ex_get_concat_sets.c b/packages/seacas/libraries/exodus/src/ex_get_concat_sets.c index 2e99ac0ca528..417d0eb991fb 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_concat_sets.c +++ b/packages/seacas/libraries/exodus/src/ex_get_concat_sets.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -39,11 +39,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs * void *sets_dist_fact = set_specs->sets_dist_fact; - int num_sets, i; - float *flt_dist_fact; - double *dbl_dist_fact; - char errmsg[MAX_ERR_LENGTH]; - ex_inquiry ex_inq_val; + char errmsg[MAX_ERR_LENGTH]; EX_FUNC_ENTER(); if (exi_check_valid_file_id(exoid, __func__) == EX_FATAL) { @@ -53,6 +49,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs * /* setup pointers based on set_type NOTE: there is another block that sets more stuff later ... */ + ex_inquiry ex_inq_val; if (set_type == EX_NODE_SET) { ex_inq_val = EX_INQ_NODE_SETS; } @@ -91,7 +88,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs * /* inquire how many sets have been stored */ - num_sets = ex_inquire_int(exoid, ex_inq_val); + int num_sets = ex_inquire_int(exoid, ex_inq_val); if (num_sets < 0) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get number of %ss defined for file id %d", ex_name_of_object(set_type), exoid); @@ -117,7 +114,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs * ((int *)sets_dist_index)[0] = 0; } - for (i = 0; i < num_sets; i++) { + for (int i = 0; i < num_sets; i++) { int64_t set_id; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { set_id = ((int64_t *)set_specs->sets_ids)[i]; @@ -200,12 +197,12 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs * } if (num_dist > 0) { /* only get df if they exist */ if (exi_comp_ws(exoid) == sizeof(float)) { - flt_dist_fact = sets_dist_fact; - status = ex_get_set_dist_fact(exoid, set_type, set_id, &(flt_dist_fact[df_idx])); + float *flt_dist_fact = sets_dist_fact; + status = ex_get_set_dist_fact(exoid, set_type, set_id, &(flt_dist_fact[df_idx])); } else { - dbl_dist_fact = sets_dist_fact; - status = ex_get_set_dist_fact(exoid, set_type, set_id, &(dbl_dist_fact[df_idx])); + double *dbl_dist_fact = sets_dist_fact; + status = ex_get_set_dist_fact(exoid, set_type, set_id, &(dbl_dist_fact[df_idx])); } if (status != NC_NOERR) { EX_FUNC_LEAVE(EX_FATAL); /* error will be reported by subroutine */ diff --git a/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c b/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c index 1d25ed3c2956..e97b41c3eeaf 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c +++ b/packages/seacas/libraries/exodus/src/ex_get_field_metadata.c @@ -11,7 +11,7 @@ #include #include -static const char *exi_get_metadata_attribute(char *name, const char *prefix, int pre_len) +static const char *exi_get_metadata_attribute(const char *name, const char *prefix, int pre_len) { /* * Each field or basis attribute metadata attribute consists of 2 or more attributes. @@ -30,7 +30,7 @@ static const char *exi_get_metadata_attribute(char *name, const char *prefix, in return NULL; } -static const char *exi_get_attribute_metadata_name(char *attrib, int offset) +static const char *exi_get_attribute_metadata_name(const char *attrib, int offset) { /* * PRECONDITION: `attrib` is a basis or field metadata attribute of the form @@ -165,9 +165,9 @@ int ex_get_field_metadata(int exoid, ex_field *field) if (found == -1) { which = count; strcpy(field[count].name, fld_name); - /* Set default separator type... */ - field[count].component_separator[0] = '_'; - field[count].component_separator[1] = '\0'; + /* Set default separator type... */ + field[count].component_separator[0] = '_'; + field[count].component_separator[1] = '\0'; count++; } diff --git a/packages/seacas/libraries/exodus/src/ex_get_group_id.c b/packages/seacas/libraries/exodus/src/ex_get_group_id.c index c07ac1f1b7c4..d515edfdebe6 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_group_id.c +++ b/packages/seacas/libraries/exodus/src/ex_get_group_id.c @@ -40,17 +40,20 @@ int ex_get_group_id(int parent_id, const char *group_name, int *group_id) "group in file id %d", group_name, parent_id); ex_err_fn(parent_id, __func__, errmsg, status); + *group_id = 0; EX_FUNC_LEAVE(EX_FATAL); } } else { /* Full path name */ - int status = nc_inq_grp_full_ncid(parent_id, group_name, group_id); + int rootid = parent_id & EX_FILE_ID_MASK; + int status = nc_inq_grp_full_ncid(rootid, group_name, group_id); if (status != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Failed to locate group with full path name %s in file id %d", group_name, parent_id); ex_err_fn(parent_id, __func__, errmsg, status); + *group_id = 0; EX_FUNC_LEAVE(EX_FATAL); } } @@ -64,6 +67,7 @@ int ex_get_group_id(int parent_id, const char *group_name, int *group_id) "ERROR: Group capabilities are not available in this netcdf " "version--not netcdf4"); ex_err_fn(parent_id, __func__, errmsg, NC_ENOTNC4); + *group_id = 0; EX_FUNC_LEAVE(EX_FATAL); #endif } diff --git a/packages/seacas/libraries/exodus/src/ex_get_ids.c b/packages/seacas/libraries/exodus/src/ex_get_ids.c index 01365b71541f..bc2753cde4c3 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_ids.c +++ b/packages/seacas/libraries/exodus/src/ex_get_ids.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -46,6 +46,11 @@ static int ex_get_nonstandard_ids(int exoid, ex_entity_type obj_type, void_int * int num_found = 0; struct ncvar var; int nvars; + int rootid = exoid & EX_FILE_ID_MASK; + int root_var_count = 0; + if (rootid != exoid) { + nc_inq(rootid, NULL, &root_var_count, NULL, NULL); + } nc_inq(exoid, NULL, &nvars, NULL, NULL); char *type = NULL; if (obj_type == EX_ASSEMBLY) { @@ -55,7 +60,7 @@ static int ex_get_nonstandard_ids(int exoid, ex_entity_type obj_type, void_int * type = "blob_entity"; } - for (int varid = 0; varid < nvars; varid++) { + for (int varid = root_var_count; varid < nvars + root_var_count; varid++) { int status; if ((status = nc_inq_var(exoid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts)) != NC_NOERR) { diff --git a/packages/seacas/libraries/exodus/src/ex_get_init_ext.c b/packages/seacas/libraries/exodus/src/ex_get_init_ext.c index 7be588c2fcd9..cd2fa90e2165 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_init_ext.c +++ b/packages/seacas/libraries/exodus/src/ex_get_init_ext.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -26,12 +26,16 @@ static void exi_get_entity_count(int exoid, ex_init_params *info) { - int ndims; - nc_inq(exoid, &ndims, NULL, NULL, NULL); + int include_parent_group = 0; // Only want dims in current group + int ndims = 0; + nc_inq_dimids(exoid, &ndims, NULL, include_parent_group); + int *dimids = calloc(ndims, sizeof(int)); + nc_inq_dimids(exoid, &ndims, dimids, include_parent_group); + for (int dimid = 0; dimid < ndims; dimid++) { char dim_nm[NC_MAX_NAME + 1] = {'\0'}; size_t dim_sz; - nc_inq_dim(exoid, dimid, dim_nm, &dim_sz); + nc_inq_dim(exoid, dimids[dimid], dim_nm, &dim_sz); /* For assemblies, we check for a dim starting with "num_entity_assembly" */ if (strncmp(dim_nm, "num_entity_assembly", 19) == 0) { info->num_assembly++; @@ -40,6 +44,7 @@ static void exi_get_entity_count(int exoid, ex_init_params *info) info->num_blob++; } } + free(dimids); } /* Used to reduce repeated code below */ @@ -58,11 +63,11 @@ static int ex_get_dim_value(int exoid, const char *name, const char *dimension_n snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get number of %s in file id %d", name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } *value = tmp; } - return (EX_NOERR); + return EX_NOERR; } /*! @@ -176,32 +181,28 @@ int ex_get_init_ext(int exoid, ex_init_params *info) int status; size_t title_len = 0; nc_type title_type = 0; - if ((status = nc_inq_att(rootid, NC_GLOBAL, ATT_TITLE, &title_type, &title_len)) != NC_NOERR) { - char errmsg[MAX_ERR_LENGTH]; - snprintf(errmsg, MAX_ERR_LENGTH, "Warning: no title in file id %d", rootid); - ex_err_fn(exoid, __func__, errmsg, status); - } - - /* Check title length to avoid overrunning clients memory space; include - * trailing null */ - if (title_len > 0) { - if (title_len > MAX_LINE_LENGTH) { - char *title = malloc(title_len + 1); - if ((status = nc_get_att_text(rootid, NC_GLOBAL, ATT_TITLE, title)) == NC_NOERR) { - ex_copy_string(info->title, title, MAX_LINE_LENGTH + 1); - info->title[MAX_LINE_LENGTH] = '\0'; + if ((status = nc_inq_att(rootid, NC_GLOBAL, ATT_TITLE, &title_type, &title_len)) == NC_NOERR) { + /* Check title length to avoid overrunning clients memory space; include + * trailing null */ + if (title_len > 0) { + if (title_len > MAX_LINE_LENGTH) { + char *title = malloc(title_len + 1); + if ((status = nc_get_att_text(rootid, NC_GLOBAL, ATT_TITLE, title)) == NC_NOERR) { + ex_copy_string(info->title, title, MAX_LINE_LENGTH + 1); + info->title[MAX_LINE_LENGTH] = '\0'; + } + free(title); + } + else { + status = nc_get_att_text(rootid, NC_GLOBAL, ATT_TITLE, info->title); + info->title[title_len] = '\0'; + } + if (status != NC_NOERR) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get title in file id %d", rootid); + ex_err_fn(exoid, __func__, errmsg, status); + EX_FUNC_LEAVE(EX_FATAL); } - free(title); - } - else { - status = nc_get_att_text(rootid, NC_GLOBAL, ATT_TITLE, info->title); - info->title[title_len] = '\0'; - } - if (status != NC_NOERR) { - char errmsg[MAX_ERR_LENGTH]; - snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get title in file id %d", rootid); - ex_err_fn(exoid, __func__, errmsg, status); - EX_FUNC_LEAVE(EX_FATAL); } } else { diff --git a/packages/seacas/libraries/exodus/src/ex_get_init_global.c b/packages/seacas/libraries/exodus/src/ex_get_init_global.c index 518316a7e40e..67264487c87b 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_init_global.c +++ b/packages/seacas/libraries/exodus/src/ex_get_init_global.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -49,11 +49,11 @@ static int ex_get_dim_value(int exoid, const char *name, const char *dimension_n snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get number of %s in file id %d", name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } *value = tmp; } - return (EX_NOERR); + return EX_NOERR; } /*! diff --git a/packages/seacas/libraries/exodus/src/ex_get_names.c b/packages/seacas/libraries/exodus/src/ex_get_names.c index c71d7abbf650..72e239f802ba 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_names.c +++ b/packages/seacas/libraries/exodus/src/ex_get_names.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -50,7 +50,7 @@ int ex_get_names(int exoid, ex_entity_type obj_type, char **names) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to inquire ASSEMBLY count in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, num_assembly); - return (EX_FATAL); + return EX_FATAL; } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { diff --git a/packages/seacas/libraries/exodus/src/ex_get_partial_attr.c b/packages/seacas/libraries/exodus/src/ex_get_partial_attr.c index b9e637579a68..b9d3def69f85 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_partial_attr.c +++ b/packages/seacas/libraries/exodus/src/ex_get_partial_attr.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -150,7 +150,7 @@ int ex_get_partial_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, EX_FUNC_LEAVE(EX_FATAL); } - if (start_num + num_ent - 1 > num_entries_this_obj) { + if (start_num + num_ent - 1 > (int64_t)num_entries_this_obj) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start index (%" PRId64 ") + count (%" PRId64 ") is larger than total number of entities (%zu) in file id %d", diff --git a/packages/seacas/libraries/exodus/src/ex_get_partial_coord.c b/packages/seacas/libraries/exodus/src/ex_get_partial_coord.c index 44b1b1c8f7aa..5eacd75a43c8 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_partial_coord.c +++ b/packages/seacas/libraries/exodus/src/ex_get_partial_coord.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -81,7 +81,7 @@ int ex_get_partial_coord(int exoid, int64_t start_node_num, int64_t num_nodes, v } --start_node_num; - if (start_node_num + num_nodes > num_nod) { + if (start_node_num + num_nodes > (int64_t)num_nod) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start index (%" PRId64 ") + node count (%" PRId64 ") is larger than total number of nodes (%zu) in file id %d", diff --git a/packages/seacas/libraries/exodus/src/ex_get_partial_coord_component.c b/packages/seacas/libraries/exodus/src/ex_get_partial_coord_component.c index 9b12c68db3d7..2ab09b0fbe28 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_partial_coord_component.c +++ b/packages/seacas/libraries/exodus/src/ex_get_partial_coord_component.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -57,7 +57,7 @@ int ex_get_partial_coord_component(int exoid, int64_t start_node_num, int64_t nu } --start_node_num; - if (start_node_num + num_nodes > num_nod) { + if (start_node_num + num_nodes > (int64_t)num_nod) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start index (%" PRId64 ") + node count (%" PRId64 ") is larger than total number of nodes (%zu) in file id %d", @@ -71,7 +71,7 @@ int ex_get_partial_coord_component(int exoid, int64_t start_node_num, int64_t nu EX_FUNC_LEAVE(EX_FATAL); } - if (component > num_dim) { + if (component > (int64_t)num_dim) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Component (%d) is larger than number of dimensions (%zu) in file id %d", component, num_dim, exoid); diff --git a/packages/seacas/libraries/exodus/src/ex_get_partial_id_map.c b/packages/seacas/libraries/exodus/src/ex_get_partial_id_map.c index 764072bec2c0..5df3505091cc 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_partial_id_map.c +++ b/packages/seacas/libraries/exodus/src/ex_get_partial_id_map.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -90,7 +90,7 @@ int ex_get_partial_id_map(int exoid, ex_entity_type map_type, int64_t start_enti EX_FUNC_LEAVE(EX_FATAL); } - if (start_entity_num + num_entities - 1 > num_entries) { + if (start_entity_num + num_entities - 1 > (int64_t)num_entries) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start index (%" PRId64 ") + entity count (%" PRId64 ") is larger than total number of entities (%zu) in file id %d", diff --git a/packages/seacas/libraries/exodus/src/ex_get_partial_num_map.c b/packages/seacas/libraries/exodus/src/ex_get_partial_num_map.c index 6ba48bfe414e..5a6d8641106c 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_partial_num_map.c +++ b/packages/seacas/libraries/exodus/src/ex_get_partial_num_map.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -81,7 +81,7 @@ int ex_get_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_ } /* Check input parameters for a valid range of numbers */ - if (ent_start <= 0 || ent_start > num_mobj) { + if (ent_start <= 0 || ent_start > (int64_t)num_mobj) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start count is invalid in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); EX_FUNC_LEAVE(EX_FATAL); @@ -93,7 +93,7 @@ int ex_get_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_ EX_FUNC_LEAVE(EX_FATAL); } - if (ent_start + ent_count - 1 > num_mobj) { + if (ent_start + ent_count - 1 > (int64_t)num_mobj) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start+count-1 is larger than element count in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); diff --git a/packages/seacas/libraries/exodus/src/ex_get_partial_one_attr.c b/packages/seacas/libraries/exodus/src/ex_get_partial_one_attr.c index d9ef130ecd43..5da909921d50 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_partial_one_attr.c +++ b/packages/seacas/libraries/exodus/src/ex_get_partial_one_attr.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -152,7 +152,7 @@ int ex_get_partial_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj EX_FUNC_LEAVE(EX_FATAL); } - if (start_num + num_ent - 1 > num_entries_this_obj && num_ent > 0) { + if (start_num + num_ent - 1 > (int64_t)num_entries_this_obj && num_ent > 0) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start index (%" PRId64 ") + count (%" PRId64 ") is larger than total number of entities (%zu) in file id %d", diff --git a/packages/seacas/libraries/exodus/src/ex_get_prop_names.c b/packages/seacas/libraries/exodus/src/ex_get_prop_names.c index 2824e80c5f68..2476d5c46145 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_prop_names.c +++ b/packages/seacas/libraries/exodus/src/ex_get_prop_names.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -128,7 +128,7 @@ int ex_get_prop_names(int exoid, ex_entity_type obj_type, char **prop_names) EX_FUNC_LEAVE(EX_FATAL); } - int api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); + size_t api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); if (att_len - 1 <= api_name_size) { /* Client has large enough char string to hold text... */ if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, prop_names[i])) != NC_NOERR) { diff --git a/packages/seacas/libraries/exodus/src/ex_get_side_set_node_count.c b/packages/seacas/libraries/exodus/src/ex_get_side_set_node_count.c index 12236c6a0333..cf4f331441be 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_side_set_node_count.c +++ b/packages/seacas/libraries/exodus/src/ex_get_side_set_node_count.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -27,7 +27,6 @@ int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_set_node_cnt_list) { int status; - size_t ii, i, j; int num_side_sets, num_elem_blks, ndim; size_t tot_num_ss_elem = 0; int64_t side, elem; @@ -171,7 +170,7 @@ int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_se if (int_size == sizeof(int64_t)) { /* Sort side set element list into index array - non-destructive */ int64_t *elems = (int64_t *)ss_elem_ndx; - for (i = 0; i < tot_num_ss_elem; i++) { + for (size_t i = 0; i < tot_num_ss_elem; i++) { elems[i] = i; /* init index array to current position */ } exi_iqsort64(side_set_elem_list, elems, tot_num_ss_elem); @@ -179,7 +178,7 @@ int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_se else { /* Sort side set element list into index array - non-destructive */ int *elems = (int *)ss_elem_ndx; - for (i = 0; i < tot_num_ss_elem; i++) { + for (size_t i = 0; i < tot_num_ss_elem; i++) { elems[i] = i; /* init index array to current position */ } exi_iqsort(side_set_elem_list, elems, tot_num_ss_elem); @@ -224,22 +223,22 @@ int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_se } elem_ctr = 0; - for (i = 0; i < num_elem_blks; i++) { + for (int ib = 0; ib < num_elem_blks; ib++) { ex_entity_id id; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { - id = ((int64_t *)elem_blk_ids)[i]; + id = ((int64_t *)elem_blk_ids)[ib]; } else { - id = ((int *)elem_blk_ids)[i]; + id = ((int *)elem_blk_ids)[ib]; } - err_stat = exi_get_block_param(exoid, id, ndim, &elem_blk_parms[i]); + err_stat = exi_get_block_param(exoid, id, ndim, &elem_blk_parms[ib]); if (err_stat != EX_NOERR) { goto cleanup; } - elem_ctr += elem_blk_parms[i].num_elem_in_blk; - elem_blk_parms[i].elem_ctr = elem_ctr; /* save elem number max */ + elem_ctr += elem_blk_parms[ib].num_elem_in_blk; + elem_blk_parms[ib].elem_ctr = elem_ctr; /* save elem number max */ } /* Finally... Create the list of node counts for each face in the @@ -252,9 +251,10 @@ int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_se * NULL` */ if (side_set_node_cnt_list != NULL) { - j = 0; /* The current element block... */ - for (ii = 0; ii < tot_num_ss_elem; ii++) { + int jb = 0; /* The current element block... */ + for (size_t ii = 0; ii < tot_num_ss_elem; ii++) { + size_t i = 0; if (ints_64) { i = ((int64_t *)ss_elem_ndx)[ii]; elem = ((int64_t *)side_set_elem_list)[i]; @@ -272,15 +272,15 @@ int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_se * from block 0 to block[num_elem_blks-1]. Once we find an element * not in this block, find a following block that contains it... */ - for (; j < num_elem_blks; j++) { - if (elem <= elem_blk_parms[j].elem_ctr) { + for (; jb < num_elem_blks; jb++) { + if (elem <= elem_blk_parms[jb].elem_ctr) { break; } } - if (j < num_elem_blks) { - assert(side < elem_blk_parms[j].num_sides); - side_set_node_cnt_list[i] = elem_blk_parms[j].num_nodes_per_side[side]; + if (jb < num_elem_blks) { + assert(side < elem_blk_parms[jb].num_sides); + side_set_node_cnt_list[i] = elem_blk_parms[jb].num_nodes_per_side[side]; } else { snprintf(errmsg, MAX_ERR_LENGTH, diff --git a/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list.c b/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list.c index 82bb47856dbe..604ca3696c91 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list.c +++ b/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -42,7 +42,7 @@ static int check_valid_side(size_t side_num, size_t max_sides, char *topology, i ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); err_stat = EX_FATAL; } - return (err_stat); + return err_stat; } static void get_nodes(int exoid, void_int *to, size_t ito, void_int *from, size_t ifrom) @@ -58,7 +58,6 @@ static void get_nodes(int exoid, void_int *to, size_t ito, void_int *from, size_ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *side_set_node_cnt_list, void_int *side_set_node_list) { - size_t ii, i, j; int64_t elem, side; int64_t num_side_sets, num_elem_blks, num_df, ndim; int64_t tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0; @@ -70,7 +69,7 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid int64_t *ss_parm_ndx = NULL; void_int *side_set_elem_list = NULL; void_int *side_set_side_list = NULL; - size_t elem_ctr, node_ctr, elem_num_pos; + int64_t elem_ctr, node_ctr, elem_num_pos; size_t num_nodes_per_elem; int int_size, ids_size; @@ -228,7 +227,7 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid if (int_size == sizeof(int64_t)) { /* Sort side set element list into index array - non-destructive */ int64_t *elems = (int64_t *)ss_elem_ndx; - for (i = 0; i < tot_num_ss_elem; i++) { + for (int i = 0; i < tot_num_ss_elem; i++) { elems[i] = i; /* init index array to current position */ } exi_iqsort64(side_set_elem_list, ss_elem_ndx, tot_num_ss_elem); @@ -236,7 +235,7 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid else { /* Sort side set element list into index array - non-destructive */ int *elems = (int *)ss_elem_ndx; - for (i = 0; i < tot_num_ss_elem; i++) { + for (int i = 0; i < tot_num_ss_elem; i++) { elems[i] = i; /* init index array to current position */ } exi_iqsort(side_set_elem_list, ss_elem_ndx, tot_num_ss_elem); @@ -270,7 +269,7 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid } elem_ctr = 0; - for (i = 0; i < num_elem_blks; i++) { + for (int i = 0; i < num_elem_blks; i++) { ex_entity_id id; if (ids_size == sizeof(int64_t)) { id = ((int64_t *)elem_blk_ids)[i]; @@ -315,8 +314,9 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid parameter index. */ node_ctr = 0; - j = 0; /* The current element block... */ - for (ii = 0; ii < tot_num_ss_elem; ii++) { + int j = 0; /* The current element block... */ + for (int64_t ii = 0; ii < tot_num_ss_elem; ii++) { + size_t i = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { i = ((int64_t *)ss_elem_ndx)[ii]; elem = ((int64_t *)side_set_elem_list)[i]; @@ -361,7 +361,8 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid if (node_ctr != num_df) { snprintf(errmsg, MAX_ERR_LENGTH, "Warning: In side set %" PRId64 " the distribution factor count (%" PRId64 - ") does not match the side set node list length (%zu). These should match and this " + ") does not match the side set node list length (%" PRId64 + "). These should match and this " "may indicate a corrupt database in file %d", side_set_id, num_df, node_ctr, exoid); ex_err_fn(exoid, __func__, errmsg, EX_MSG); @@ -372,18 +373,18 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid * exclusive scan to determine where the nodes will be put in the list for each face */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { - for (i = 0; i < tot_num_ss_elem; i++) { + for (int64_t i = 0; i < tot_num_ss_elem; i++) { ((int64_t *)side_set_node_cnt_list)[i] = ss_elem_node_ndx[i]; } } else { - for (i = 0; i < tot_num_ss_elem; i++) { + for (int64_t i = 0; i < tot_num_ss_elem; i++) { ((int *)side_set_node_cnt_list)[i] = (int)ss_elem_node_ndx[i]; } } int64_t sum = 0; - for (i = 0; i < tot_num_ss_elem; i++) { + for (int64_t i = 0; i < tot_num_ss_elem; i++) { int64_t cnt = ss_elem_node_ndx[i]; ss_elem_node_ndx[i] = sum; sum += cnt; @@ -482,12 +483,12 @@ int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *sid case EX_EL_BEAM: { /* Note: no side-node lookup table is used for this simple case */ if (side_num == 0) { - for (i = 0; i < num_nodes_per_elem; i++) { + for (size_t i = 0; i < num_nodes_per_elem; i++) { get_nodes(exoid, side_set_node_list, node_pos + i, connect, connect_offset + i); } } else { - for (i = 0; i < num_nodes_per_elem; i++) { + for (size_t i = 0; i < num_nodes_per_elem; i++) { int nn = num_nodes_per_elem - i - 1; get_nodes(exoid, side_set_node_list, node_pos + i, connect, connect_offset + nn); } diff --git a/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list_len.c b/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list_len.c index 28e12874d271..6e0ac40f98b8 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list_len.c +++ b/packages/seacas/libraries/exodus/src/ex_get_side_set_node_list_len.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -36,9 +36,9 @@ int ex_get_side_set_node_list_len(int exoid, ex_entity_id side_set_id, void_int *side_set_node_list_len) { - size_t ii, i, j; + int64_t ii, i, j; int64_t num_side_sets, num_elem_blks, num_df, ndim; - size_t list_len = 0; + int64_t list_len = 0; int64_t tot_num_elem = 0, tot_num_ss_elem = 0; void_int *elem_blk_ids = NULL; int *ss_elem_ndx = NULL; @@ -261,8 +261,8 @@ int ex_get_side_set_node_list_len(int exoid, ex_entity_id side_set_id, list_len = 0; j = 0; /* The current element block... */ for (ii = 0; ii < tot_num_ss_elem; ii++) { - size_t elem; - size_t side; + int64_t elem; + int64_t side; if (ints_64) { i = ss_elem_ndx_64[ii]; elem = ((int64_t *)side_set_elem_list)[i]; @@ -290,8 +290,8 @@ int ex_get_side_set_node_list_len(int exoid, ex_entity_id side_set_id, if (j >= num_elem_blks) { snprintf(errmsg, MAX_ERR_LENGTH, - "ERROR: Invalid element number %zu found in side set %" PRId64 " in file %d", elem, - side_set_id, exoid); + "ERROR: Invalid element number %" PRId64 " found in side set %" PRId64 " in file %d", + elem, side_set_id, exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); err_stat = EX_FATAL; goto cleanup; @@ -310,7 +310,8 @@ int ex_get_side_set_node_list_len(int exoid, ex_entity_id side_set_id, if (list_len != num_df) { snprintf(errmsg, MAX_ERR_LENGTH, "Warning: In side set %" PRId64 " the distribution factor count (%" PRId64 - ") does not match the side set node list length (%zu). These should match and this " + ") does not match the side set node list length (%" PRId64 + "). These should match and this " "may indicate a corrupt database in file %d", side_set_id, num_df, list_len, exoid); ex_err_fn(exoid, __func__, errmsg, EX_MSG); diff --git a/packages/seacas/libraries/exodus/src/ex_get_var_time.c b/packages/seacas/libraries/exodus/src/ex_get_var_time.c index be5b685ade53..ddff7941f453 100644 --- a/packages/seacas/libraries/exodus/src/ex_get_var_time.c +++ b/packages/seacas/libraries/exodus/src/ex_get_var_time.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -47,7 +47,7 @@ int ex_get_var_time(int exoid, ex_entity_type var_type, int var_index, int64_t i int dimid, varid; int status; int *stat_vals = NULL; - size_t numel = 0; + int64_t numel = 0; size_t num_obj, i; size_t num_entries_this_obj = 0; size_t start[2], count[2]; diff --git a/packages/seacas/libraries/exodus/src/ex_inquire.c b/packages/seacas/libraries/exodus/src/ex_inquire.c index b104dbb42064..885b465cd41e 100644 --- a/packages/seacas/libraries/exodus/src/ex_inquire.c +++ b/packages/seacas/libraries/exodus/src/ex_inquire.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -975,6 +975,14 @@ static int ex_inquire_internal(int exoid, int req_info, int64_t *ret_int, float #endif break; + case EX_INQ_FILE_FORMAT: { + /* return netCDF file format. + */ + int nc_format = 0; + nc_inq_format(exoid, &nc_format); + *ret_int = nc_format; + } break; + case EX_INQ_THREADSAFE: /* Return 1 if the library was compiled in thread-safe mode. * Return 0 otherwise diff --git a/packages/seacas/libraries/exodus/src/ex_int_get_block_param.c b/packages/seacas/libraries/exodus/src/ex_int_get_block_param.c index c960e93a7ca5..647e1e2d5b7b 100644 --- a/packages/seacas/libraries/exodus/src/ex_int_get_block_param.c +++ b/packages/seacas/libraries/exodus/src/ex_int_get_block_param.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -17,7 +17,7 @@ static int el_node_count_error(int exoid, struct exi_elem_blk_parm elem_blk_parm snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: An element of type '%s' with %d nodes is not valid.", elem_blk_parms.elem_type, elem_blk_parms.num_nodes_per_elem); ex_err_fn(exoid, __func__, errmsg, EX_MSG); - return (EX_FATAL); + return EX_FATAL; } int exi_get_block_param(int exoid, ex_entity_id id, int ndim, diff --git a/packages/seacas/libraries/exodus/src/ex_ne_util.c b/packages/seacas/libraries/exodus/src/ex_ne_util.c index 1161820445f6..be897605db3d 100644 --- a/packages/seacas/libraries/exodus/src/ex_ne_util.c +++ b/packages/seacas/libraries/exodus/src/ex_ne_util.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -46,7 +46,7 @@ int nei_id_lkup(int exoid, const char *ne_var_name, int64_t *idx, ex_entity_id n snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable ID for \"%s\" in file ID %d", ne_var_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* check if I need the length for this variable */ @@ -62,7 +62,7 @@ int nei_id_lkup(int exoid, const char *ne_var_name, int64_t *idx, ex_entity_id n "in file ID %d", ne_var_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* Get the length of this variable */ @@ -73,7 +73,7 @@ int nei_id_lkup(int exoid, const char *ne_var_name, int64_t *idx, ex_entity_id n "ERROR: failed to find dimension for variable \"%s\" in file ID %d", ne_var_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } idx[1] = length; @@ -94,7 +94,7 @@ int nei_id_lkup(int exoid, const char *ne_var_name, int64_t *idx, ex_entity_id n snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable \"%s\" in file ID %d", ne_var_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } if (id_val == ne_var_id) { @@ -102,7 +102,7 @@ int nei_id_lkup(int exoid, const char *ne_var_name, int64_t *idx, ex_entity_id n break; } } - return (ret); + return ret; } /*****************************************************************************/ diff --git a/packages/seacas/libraries/exodus/src/ex_open.c b/packages/seacas/libraries/exodus/src/ex_open.c index baac050f4a14..91901eb62ba1 100644 --- a/packages/seacas/libraries/exodus/src/ex_open.c +++ b/packages/seacas/libraries/exodus/src/ex_open.c @@ -190,6 +190,8 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver "issue.\n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #else /* This is an hdf5 (netcdf4) file. If NC_HAS_HDF5 is not defined, then we either don't have hdf5 support in this netcdf version, @@ -206,6 +208,8 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver "other issue.\n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #endif } else if (type == 4) { @@ -217,6 +221,8 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver "issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #else /* This is an cdf5 (64BIT_DATA) file. If NC_64BIT_DATA is not defined, then we either don't have cdf5 support in this netcdf version, @@ -233,6 +239,8 @@ int ex_open_int(const char *path, int mode, int *comp_ws, int *io_ws, float *ver "other issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #endif } diff --git a/packages/seacas/libraries/exodus/src/ex_open_par.c b/packages/seacas/libraries/exodus/src/ex_open_par.c index 5bfad214c030..8b91169b5c43 100644 --- a/packages/seacas/libraries/exodus/src/ex_open_par.c +++ b/packages/seacas/libraries/exodus/src/ex_open_par.c @@ -222,6 +222,8 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #else /* This is an hdf5 (netcdf4) file. If NC_HAS_HDF5 is not defined, then we either don't have hdf5 support in this netcdf version, @@ -238,6 +240,8 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "other issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #endif } else if (type == 4) { @@ -249,6 +253,8 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #else /* This is an cdf5 (64BIT_DATA) file. If NC_64BIT_DATA is not defined, then we either don't have cdf5 support in this netcdf version, @@ -265,6 +271,8 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "other issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #endif } else if (type == 1 || type == 2) { @@ -277,6 +285,8 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "issue \n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #else /* This is an normal NetCDF format file, for parallel reading, the PNetCDF library is required but that is not compiled into this version. @@ -287,6 +297,8 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "built with PNetCDF support as required for parallel access to this file.\n", canon_path); ex_err(__func__, errmsg, status); + free(canon_path); + EX_FUNC_LEAVE(EX_FATAL); #endif } @@ -294,7 +306,7 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float "ERROR: failed to open %s of type %d for reading.\n\t\tThe " "file does not exist, or there is a permission or file " "format issue.", - canon_path); + canon_path, type); ex_err(__func__, errmsg, status); free(canon_path); EX_FUNC_LEAVE(EX_FATAL); @@ -384,12 +396,10 @@ int ex_open_par_int(const char *path, int mode, int *comp_ws, int *io_ws, float int ngatts; /* number of global attributes */ int recdimid; /* id of unlimited dimension */ - int varid; - /* Determine number of variables on the database... */ nc_inq(exoid, &ndims, &nvars, &ngatts, &recdimid); - for (varid = 0; varid < nvars; varid++) { + for (int varid = 0; varid < nvars; varid++) { struct ncvar var; nc_inq_var(exoid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts); diff --git a/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c b/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c index 7bcf30eb1ef9..be763293f47e 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c +++ b/packages/seacas/libraries/exodus/src/ex_put_all_var_param_ext.c @@ -356,7 +356,7 @@ static int define_dimension(int exoid, const char *DIMENSION, int count, const c ex_err_fn(exoid, __func__, errmsg, status); } } - return (status); + return status; } static int define_variable_name_variable(int exoid, const char *VARIABLE, int dimension, @@ -387,7 +387,7 @@ static int define_variable_name_variable(int exoid, const char *VARIABLE, int di int fill = NC_FILL_CHAR; nc_def_var_fill(exoid, variable, 0, &fill); #endif - return (status); + return status; } static int *get_status_array(int exoid, int var_count, const char *VARIABLE, const char *label) @@ -399,7 +399,7 @@ static int *get_status_array(int exoid, int var_count, const char *VARIABLE, con snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to allocate memory for %s status array for file id %d", label, exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); - return (NULL); + return NULL; } /* get variable id of status array */ @@ -415,7 +415,7 @@ static int *get_status_array(int exoid, int var_count, const char *VARIABLE, con snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get %s status array from file id %d", label, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (NULL); + return NULL; } } else { @@ -489,7 +489,7 @@ static int define_truth_table(ex_entity_type obj_type, int exoid, int num_ent, i "ERROR: failed to locate number of entities in %s %" PRId64 " in file id %d", label, id, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); + return status; } /* define netCDF variable to store variable values; @@ -506,7 +506,7 @@ static int define_truth_table(ex_entity_type obj_type, int exoid, int num_ent, i "ERROR: failed to define %s variable for %s %" PRId64 " in file id %d", label, label, id, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); + return status; } } exi_compress_variable(exoid, varid, 2); diff --git a/packages/seacas/libraries/exodus/src/ex_put_assemblies.c b/packages/seacas/libraries/exodus/src/ex_put_assemblies.c index a731215b546a..a8ee3e14d470 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_assemblies.c +++ b/packages/seacas/libraries/exodus/src/ex_put_assemblies.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -37,8 +37,8 @@ int ex_put_assemblies(int exoid, size_t count, const struct ex_assembly *assembl int *entlst_id = (int *)calloc(count, sizeof(int)); - int max_name_len = 0; - bool in_define = false; + size_t max_name_len = 0; + bool in_define = false; for (size_t i = 0; i < count; i++) { /* See if an assembly with this id has already been defined or exists on file... */ if (nc_inq_varid(exoid, VAR_ENTITY_ASSEMBLY(assemblies[i].id), &entlst_id[i]) != NC_NOERR) { @@ -176,7 +176,9 @@ int ex_put_assemblies(int exoid, size_t count, const struct ex_assembly *assembl } /* Update the maximum_name_length attribute on the file. */ - exi_update_max_name_length(exoid, max_name_len - 1); + if (max_name_len > 0) { + exi_update_max_name_length(exoid, max_name_len - 1); + } /* Assembly are now all defined; see if any set data needs to be output... */ for (size_t i = 0; i < count; i++) { diff --git a/packages/seacas/libraries/exodus/src/ex_put_block_params.c b/packages/seacas/libraries/exodus/src/ex_put_block_params.c index b6d16dd3ccd8..a30774b2d59e 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_block_params.c +++ b/packages/seacas/libraries/exodus/src/ex_put_block_params.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -55,7 +55,7 @@ int ex_put_block_params(int exoid, size_t block_count, const struct ex_block *bl const char *dnfpe = NULL; if (block_count == 0) { - return (EX_NOERR); + return EX_NOERR; } EX_FUNC_ENTER(); @@ -584,13 +584,12 @@ int ex_put_block_params(int exoid, size_t block_count, const struct ex_block *bl */ size_t count[2]; char *text = ""; - size_t j; count[0] = 1; start[1] = 0; count[1] = strlen(text) + 1; - for (j = 0; j < blocks[i].num_attribute; j++) { + for (int64_t j = 0; j < blocks[i].num_attribute; j++) { start[0] = j; nc_put_vara_text(exoid, att_name_varid, start, count, text); } diff --git a/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c b/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c index 92ce78b781b0..1e59fd48909d 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c +++ b/packages/seacas/libraries/exodus/src/ex_put_concat_elem_block.c @@ -80,13 +80,13 @@ int ex_put_concat_elem_block(int exoid, const void_int *elem_blk_id, char *const } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { - for (i = 0; i < num_elem_blk; i++) { - eb_array[i] = (((int64_t *)num_elem_this_blk)[i] == 0) ? 0 : 1; + for (int ib = 0; ib < num_elem_blk; ib++) { + eb_array[ib] = (((int64_t *)num_elem_this_blk)[ib] == 0) ? 0 : 1; } } else { - for (i = 0; i < num_elem_blk; i++) { - eb_array[i] = (((int *)num_elem_this_blk)[i] == 0) ? 0 : 1; + for (int ib = 0; ib < num_elem_blk; ib++) { + eb_array[ib] = (((int *)num_elem_this_blk)[ib] == 0) ? 0 : 1; } } diff --git a/packages/seacas/libraries/exodus/src/ex_put_conn.c b/packages/seacas/libraries/exodus/src/ex_put_conn.c index cc1497a82286..c0393593b888 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_conn.c +++ b/packages/seacas/libraries/exodus/src/ex_put_conn.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -26,7 +26,7 @@ int ex_int_write_conn(int exoid, ex_entity_id blk_id, const char *type, int var_ "ERROR: failed to write connectivity array for %s block %" PRId64 " in file id %d", type, blk_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); + return status; } return status; } diff --git a/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c b/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c index ff388de656db..db5fa2fe4d66 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c +++ b/packages/seacas/libraries/exodus/src/ex_put_field_metadata.c @@ -76,10 +76,10 @@ int ex_put_field_metadata(int exoid, const ex_field field) #endif exi_persist_redef(exoid, __func__); - int status = 0; - static char *field_template = "Field@%s@%s"; - char attribute_name[NC_MAX_NAME + 1]; - sprintf(attribute_name, field_template, field.name, "type"); + int status = 0; + static const char *field_template = "Field@%s@%s"; + char attribute_name[NC_MAX_NAME + 1]; + snprintf(attribute_name, NC_MAX_NAME + 1, field_template, field.name, "type"); if ((status = ex_put_integer_attribute(exoid, field.entity_type, field.entity_id, attribute_name, field.nesting, field.type)) != EX_NOERR) { exi_persist_leavedef(exoid, __func__); @@ -89,7 +89,7 @@ int ex_put_field_metadata(int exoid, const ex_field field) /* Do not write if empty... */ if (field.type_name[0] != '\0') { - sprintf(attribute_name, field_template, field.name, "type_name"); + snprintf(attribute_name, NC_MAX_NAME + 1, field_template, field.name, "type_name"); if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name, field.type_name)) != EX_NOERR) { exi_persist_leavedef(exoid, __func__); @@ -100,7 +100,7 @@ int ex_put_field_metadata(int exoid, const ex_field field) /* Default component_separator is '_'. Avoid writing if that is what it is... */ if (field.component_separator[0] != '_' || field.nesting > 1) { - sprintf(attribute_name, field_template, field.name, "separator"); + snprintf(attribute_name, NC_MAX_NAME + 1, field_template, field.name, "separator"); if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name, field.component_separator)) != EX_NOERR) { exi_persist_leavedef(exoid, __func__); @@ -117,7 +117,7 @@ int ex_put_field_metadata(int exoid, const ex_field field) } } if (needs_cardinality) { - sprintf(attribute_name, field_template, field.name, "cardinality"); + snprintf(attribute_name, NC_MAX_NAME + 1, field_template, field.name, "cardinality"); if ((status = ex_put_integer_attribute(exoid, field.entity_type, field.entity_id, attribute_name, field.nesting, field.cardinality)) != EX_NOERR) { @@ -136,9 +136,9 @@ int exi_put_type_attribute(int exoid, const char *att_root, const char *name, co { int status = EX_NOERR; if (entry != NULL) { - static char *template = "%s@%s@%s"; + static const char *template = "%s@%s@%s"; char attribute_name[NC_MAX_NAME + 1]; - sprintf(attribute_name, template, att_root, name, type); + snprintf(attribute_name, NC_MAX_NAME + 1, template, att_root, name, type); if (value_type == EX_INTEGER) { status = ex_put_integer_attribute(exoid, EX_GLOBAL, 0, attribute_name, cardinality, entry); } @@ -300,8 +300,8 @@ int ex_put_field_suffices(int exoid, const ex_field field, const char *suffices) int status; char errmsg[MAX_ERR_LENGTH]; - char attribute_name[NC_MAX_NAME + 1]; - static char *field_template = "Field@%s@%s"; + char attribute_name[NC_MAX_NAME + 1]; + static const char *field_template = "Field@%s@%s"; if (field.type[0] != EX_FIELD_TYPE_USER_DEFINED) { snprintf( @@ -329,7 +329,7 @@ int ex_put_field_suffices(int exoid, const ex_field field, const char *suffices) return EX_FATAL; } - sprintf(attribute_name, field_template, field.name, "suffices"); + snprintf(attribute_name, NC_MAX_NAME + 1, field_template, field.name, "suffices"); if ((status = ex_put_text_attribute(exoid, field.entity_type, field.entity_id, attribute_name, suffices)) != EX_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, diff --git a/packages/seacas/libraries/exodus/src/ex_put_init.c b/packages/seacas/libraries/exodus/src/ex_put_init.c index 4b7ebc07e8dd..7f8a72dc26c9 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_init.c +++ b/packages/seacas/libraries/exodus/src/ex_put_init.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -76,5 +76,5 @@ int ex_put_init(int exoid, const char *title, int64_t num_dim, int64_t num_nodes par.num_elem_maps = 0; par.num_assembly = 0; - return (ex_put_init_ext(exoid, &par)); + return ex_put_init_ext(exoid, &par); } diff --git a/packages/seacas/libraries/exodus/src/ex_put_init_ext.c b/packages/seacas/libraries/exodus/src/ex_put_init_ext.c index e07e8434444b..ccf305255517 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_init_ext.c +++ b/packages/seacas/libraries/exodus/src/ex_put_init_ext.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -55,7 +55,7 @@ static int ex_write_object_names(int exoid, const char *type, const char *dimens snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define %s name array in file id %d", type, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); /* exit define mode and return */ + return status; /* exit define mode and return */ } exi_set_compact_storage(exoid, varid); #if defined(EX_CAN_USE_NC_DEF_VAR_FILL) @@ -63,7 +63,7 @@ static int ex_write_object_names(int exoid, const char *type, const char *dimens nc_def_var_fill(exoid, varid, 0, &fill); #endif } - return (NC_NOERR); + return EX_NOERR; } static int ex_write_object_params(int exoid, const char *type, const char *dimension_name, @@ -79,7 +79,7 @@ static int ex_write_object_params(int exoid, const char *type, const char *dimen snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define number of %ss in file id %d", type, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); /* exit define mode and return */ + return status; /* exit define mode and return */ } /* ...and some variables */ /* element block id status array */ @@ -91,10 +91,10 @@ static int ex_write_object_params(int exoid, const char *type, const char *dimen snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define %s status array in file id %d", type, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); /* exit define mode and return */ + return status; /* exit define mode and return */ } - int sixty_four_kb = 64 * 1024; // Compact storage can only be used for < 64KiByte data sizes + size_t sixty_four_kb = 64 * 1024; // Compact storage can only be used for < 64KiByte data sizes if (4 * count < sixty_four_kb) { exi_set_compact_storage(exoid, varid); } @@ -112,7 +112,7 @@ static int ex_write_object_params(int exoid, const char *type, const char *dimen snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define %s id array in file id %d", type, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); /* exit define mode and return */ + return status; /* exit define mode and return */ } if (int_size * count < sixty_four_kb) { exi_set_compact_storage(exoid, varid); @@ -124,10 +124,10 @@ static int ex_write_object_params(int exoid, const char *type, const char *dimen snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store %s property name %s in file id %d", type, "ID", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); + return status; } } - return (NC_NOERR); + return EX_NOERR; } static int ex_write_map_params(int exoid, const char *map_name, const char *map_dim_name, @@ -147,7 +147,7 @@ static int ex_write_map_params(int exoid, const char *map_name, const char *map_ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define number of %ss in file id %d", map_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); /* exit define mode and return */ + return status; /* exit define mode and return */ } int dim[] = {*map_dimension}; @@ -159,7 +159,7 @@ static int ex_write_map_params(int exoid, const char *map_name, const char *map_ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define %s id array in file id %d", map_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (status); /* exit define mode and return */ + return status; /* exit define mode and return */ } /* store property name as attribute of property array variable */ @@ -168,10 +168,10 @@ static int ex_write_map_params(int exoid, const char *map_name, const char *map_ snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store %s property name %s in file id %d", map_name, "ID", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } - return (NC_NOERR); + return EX_NOERR; } static void invalidate_id_status(int exoid, const char *var_stat, const char *var_id, int count, @@ -293,10 +293,18 @@ int ex_put_init_ext(int exoid, const ex_init_params *model) ex_err_fn(exoid, __func__, errmsg, status); goto error_ret; } + { struct exi_file_item *file = exi_find_file_item(exoid); - file->time_varid = temp; + if (!file) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unknown file id %d.", exoid); + ex_err_fn(exoid, __func__, errmsg, EX_BADFILEID); + goto error_ret; + } + file->time_varid = temp; } + exi_compress_variable(exoid, temp, -2); /* Don't compress, but do set collective io */ if (model->num_dim > 0) { @@ -542,8 +550,8 @@ int ex_put_init_ext(int exoid, const ex_init_params *model) /* Fill the id and status arrays with EX_INVALID_ID */ { - int *invalid_ids = NULL; - size_t maxset = model->num_elem_blk; + int *invalid_ids = NULL; + int64_t maxset = model->num_elem_blk; if (maxset < model->num_edge_blk) { maxset = model->num_edge_blk; } diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_coord_component.c b/packages/seacas/libraries/exodus/src/ex_put_partial_coord_component.c index e2ec6aa72ce8..83e8b7f03037 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_partial_coord_component.c +++ b/packages/seacas/libraries/exodus/src/ex_put_partial_coord_component.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -79,7 +79,7 @@ int ex_put_partial_coord_component(int exoid, int64_t start_node_num, int64_t nu EX_FUNC_LEAVE(EX_FATAL); } - if (component > num_dim) { + if (component > (int)num_dim) { char errmsg[MAX_ERR_LENGTH]; snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Component (%d) is larger than number of dimensions (%zu) in file id %d", diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c b/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c index 1f111503f239..e1569edd3d9b 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c +++ b/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2022 National Technology & Engineering Solutions + * Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -163,7 +163,7 @@ int ex_put_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_ ent_start = 0; } - if (ent_start < 0 || ent_start > num_mobj) { + if (ent_start < 0 || ent_start > (int64_t)num_mobj) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start count is invalid in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); EX_FUNC_LEAVE(EX_FATAL); @@ -173,7 +173,7 @@ int ex_put_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_ ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); EX_FUNC_LEAVE(EX_FATAL); } - if (ent_count > 0 && (ent_start + ent_count - 1 > num_mobj)) { + if (ent_count > 0 && (ent_start + ent_count - 1 > (int64_t)num_mobj)) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start+count-1 is larger than mesh object count in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_one_attr.c b/packages/seacas/libraries/exodus/src/ex_put_partial_one_attr.c index 11223c3528b2..20febe548408 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_partial_one_attr.c +++ b/packages/seacas/libraries/exodus/src/ex_put_partial_one_attr.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -137,7 +137,7 @@ int ex_put_partial_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj EX_FUNC_LEAVE(EX_FATAL); } - if (start_num + num_ent - 1 > num_entries_this_obj) { + if (start_num + num_ent - 1 > (int64_t)num_entries_this_obj) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start index (%" PRId64 ") + count (%" PRId64 ") is larger than total number of entities (%zu) in file id %d", diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_var.c b/packages/seacas/libraries/exodus/src/ex_put_partial_var.c index bc62bca91732..a0b6066a02de 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_partial_var.c +++ b/packages/seacas/libraries/exodus/src/ex_put_partial_var.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -31,7 +31,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex "ERROR: failed to locate %s id %" PRId64 " in %s array in file id %d", ex_name_of_object(var_type), obj_id, VOBJID, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } obj_id_ndx = obj_id; } @@ -42,7 +42,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex "ERROR: failed to locate %s id %" PRId64 " in %s array in file id %d", ex_name_of_object(var_type), obj_id, VOBJID, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } obj_id_ndx = obj_id; } @@ -58,14 +58,14 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex "Warning: no variables allowed for NULL block %" PRId64 " in file id %d", obj_id, exoid); ex_err_fn(exoid, __func__, errmsg, EX_NULLENTITY); - return (EX_WARN); + return EX_WARN; } snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate %s id %" PRId64 " in %s array in file id %d", ex_name_of_object(var_type), obj_id, VOBJID, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } } @@ -79,13 +79,13 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex status = exi_get_dimension(exoid, DNUMOBJ, ex_name_of_object(var_type), &num_obj, &dimid, __func__); if (status != NC_NOERR) { - return (status); + return status; } status = exi_get_dimension(exoid, DNUMOBJVAR, ex_name_of_object(var_type), &num_obj_var, &dimid, __func__); if (status != NC_NOERR) { - return (status); + return status; } if (!(obj_var_truth_tab = malloc(num_obj * num_obj_var * sizeof(int)))) { @@ -94,7 +94,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex "truth table in file id %d", ex_name_of_object(var_type), exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); - return (EX_FATAL); + return EX_FATAL; } /* read in the TNAME variable truth table */ @@ -102,7 +102,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get truth table from file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } if (obj_var_truth_tab[num_obj_var * (obj_id_ndx - 1) + var_index - 1] == 0L) { @@ -111,7 +111,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex errmsg, MAX_ERR_LENGTH, "ERROR: Invalid %s variable %d, %s %" PRId64 " in file id %d", ex_name_of_object(var_type), var_index, ex_name_of_object(var_type), obj_id, exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); - return (EX_FATAL); + return EX_FATAL; } free(obj_var_truth_tab); } @@ -130,7 +130,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex if ((status = exi_redef(exoid, __func__)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* define netCDF variable to store TNAME variable values */ @@ -147,7 +147,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex /* leave define mode */ if ((status = exi_leavedef(exoid, __func__)) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } else { @@ -155,15 +155,15 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex ex_name_of_object(var_type), exi_name_var_of_object(var_type, var_index, obj_id_ndx), exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } - return (EX_NOERR); + return EX_NOERR; /* Fatal error: exit definition mode and return */ error_ret: exi_leavedef(exoid, __func__); - return (EX_FATAL); + return EX_FATAL; } /*! diff --git a/packages/seacas/libraries/exodus/src/ex_put_prop.c b/packages/seacas/libraries/exodus/src/ex_put_prop.c index 9300d2fb3026..9f6ed4b779e3 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_prop.c +++ b/packages/seacas/libraries/exodus/src/ex_put_prop.c @@ -243,7 +243,8 @@ int ex_put_prop(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const c vals[0] = 0; /* fill value */ /* create attribute to cause variable to fill with zeros per routine spec */ - if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) { + if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != + NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to create property name fill attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); diff --git a/packages/seacas/libraries/exodus/src/ex_put_prop_names.c b/packages/seacas/libraries/exodus/src/ex_put_prop_names.c index bcf063f05012..5a8816e19e8e 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_prop_names.c +++ b/packages/seacas/libraries/exodus/src/ex_put_prop_names.c @@ -172,7 +172,8 @@ int ex_put_prop_names(int exoid, ex_entity_type obj_type, int num_props, char ** /* create attribute to cause variable to fill with zeros per routine spec */ - if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) { + if ((status = nc_put_att_longlong(exoid, propid, NC_FillValue, int_type, 1, vals)) != + NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to create property name fill attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); diff --git a/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_names.c b/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_names.c index 22db5ede7985..ca17283ca875 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_names.c +++ b/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_names.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -54,9 +54,9 @@ static int ex_put_var_names_int(int exoid, ex_entity_type obj_type, int num_vars tname, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } /*! diff --git a/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c b/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c index d3d28c85685d..f4b6b26db22e 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c +++ b/packages/seacas/libraries/exodus/src/ex_put_reduction_variable_param.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -34,14 +34,14 @@ static int exi_prepare_result_var(int exoid, int num_vars, char *type_name, char "ERROR: failed to define number of %s variables in file id %d", type_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); /* exit define mode and return */ + return EX_FATAL; /* exit define mode and return */ } /* Now define type_name variable name variable */ if ((status = nc_inq_dimid(exoid, DIM_STR_NAME, &dim_str_name)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get string length in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } dims[0] = dimid; @@ -57,13 +57,13 @@ static int exi_prepare_result_var(int exoid, int num_vars, char *type_name, char type_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); /* exit define mode and return */ + return EX_FATAL; /* exit define mode and return */ } #if defined(EX_CAN_USE_NC_DEF_VAR_FILL) int fill = NC_FILL_CHAR; nc_def_var_fill(exoid, varid, 0, &fill); #endif - return (EX_NOERR); + return EX_NOERR; } /*! \endcond */ diff --git a/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c b/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c index f39948bcd026..301f032a3745 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c +++ b/packages/seacas/libraries/exodus/src/ex_put_reduction_vars.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -23,7 +23,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_ "ERROR: failed to locate %s id %" PRId64 " in %s array in file id %d", ex_name_of_object(var_type), obj_id, var_obj_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } obj_id_ndx = obj_id; } @@ -34,7 +34,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_ "ERROR: failed to locate %s id %" PRId64 " in %s array in file id %d", ex_name_of_object(var_type), obj_id, var_obj_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } obj_id_ndx = obj_id; } @@ -50,14 +50,14 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_ "Warning: no variables allowed for NULL block %" PRId64 " in file id %d", obj_id, exoid); ex_err_fn(exoid, __func__, errmsg, EX_NULLENTITY); - return (EX_WARN); + return EX_WARN; } snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate %s id %" PRId64 " in %s array in file id %d", ex_name_of_object(var_type), obj_id, var_obj_id, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } } @@ -87,7 +87,7 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_ if ((status = exi_redef(exoid, __func__)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* define NetCDF variable to store reduction variable values */ @@ -98,13 +98,13 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_ ex_name_of_object(var_type), exoid); ex_err_fn(exoid, __func__, errmsg, status); exi_leavedef(exoid, __func__); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exoid, *varid, 2); /* leave define mode */ if ((status = exi_leavedef(exoid, __func__)) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } else { @@ -112,10 +112,10 @@ static int exi_look_up_var(int exoid, ex_entity_type var_type, ex_entity_id obj_ ex_name_of_object(var_type), exi_name_red_var_of_object(var_type, obj_id_ndx), exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } - return (EX_NOERR); + return EX_NOERR; } /*! diff --git a/packages/seacas/libraries/exodus/src/ex_put_variable_names.c b/packages/seacas/libraries/exodus/src/ex_put_variable_names.c index 00303bb6326d..58248c8b998a 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_variable_names.c +++ b/packages/seacas/libraries/exodus/src/ex_put_variable_names.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -43,7 +43,7 @@ static int ex_put_var_names_int(int exoid, char *tname, char *dnumvar, char *vna "ERROR: failed to locate number of %s variables in file id %d", tname, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); + return EX_FATAL; } if ((status = nc_inq_varid(exoid, vnames, varid)) != NC_NOERR) { @@ -57,9 +57,9 @@ static int ex_put_var_names_int(int exoid, char *tname, char *dnumvar, char *vna tname, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } /*! diff --git a/packages/seacas/libraries/exodus/src/ex_put_variable_param.c b/packages/seacas/libraries/exodus/src/ex_put_variable_param.c index e19a10833f5f..3e48464c3cc9 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_variable_param.c +++ b/packages/seacas/libraries/exodus/src/ex_put_variable_param.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -34,14 +34,14 @@ static int ex_prepare_result_var(int exoid, int num_vars, char *type_name, char "ERROR: failed to define number of %s variables in file id %d", type_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); /* exit define mode and return */ + return EX_FATAL; /* exit define mode and return */ } /* Now define type_name variable name variable */ if ((status = nc_inq_dimid(exoid, DIM_STR_NAME, &dim_str_name)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get string length in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } dims[0] = dimid; @@ -57,14 +57,14 @@ static int ex_prepare_result_var(int exoid, int num_vars, char *type_name, char type_name, exoid); ex_err_fn(exoid, __func__, errmsg, status); } - return (EX_FATAL); /* exit define mode and return */ + return EX_FATAL; /* exit define mode and return */ } exi_set_compact_storage(exoid, varid); #if defined(EX_CAN_USE_NC_DEF_VAR_FILL) int fill = NC_FILL_CHAR; nc_def_var_fill(exoid, varid, 0, &fill); #endif - return (EX_NOERR); + return EX_NOERR; } /*! \endcond */ diff --git a/packages/seacas/libraries/exodus/src/ex_utils.c b/packages/seacas/libraries/exodus/src/ex_utils.c index 0c33d625a32f..ca6fe97c42c5 100644 --- a/packages/seacas/libraries/exodus/src/ex_utils.c +++ b/packages/seacas/libraries/exodus/src/ex_utils.c @@ -110,6 +110,16 @@ const char *ex_config(void) #else j += snprintf(buffer + j, buffer_size - j, "\t\tSZip Compression (read/write) NOT enabled\n"); #endif +#if NC_HAS_ZSTD == 1 + j += snprintf(buffer + j, buffer_size - j, "\t\tZstd Compression enabled\n"); +#else + j += snprintf(buffer + j, buffer_size - j, "\t\tZstd Compression NOT enabled\n"); +#endif +#if NC_HAS_QUANTIZE == 1 + j += snprintf(buffer + j, buffer_size - j, "\t\tQuanization support enabled\n"); +#else + j += snprintf(buffer + j, buffer_size - j, "\t\tQuanization support NOT enabled\n"); +#endif #endif #endif #if defined(PARALLEL_AWARE_EXODUS) @@ -193,7 +203,7 @@ int exi_check_file_type(const char *path, int *type) FILE *fp; if (!(fp = fopen(path, "r"))) { char errmsg[MAX_ERR_LENGTH]; - snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Could not open file '%s', error = %s.", path, + snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Could not open file '%s',\n\t\terror = %s.", path, strerror(errno)); ex_err(__func__, errmsg, EX_WRONGFILETYPE); EX_FUNC_LEAVE(EX_FATAL); @@ -203,8 +213,9 @@ int exi_check_file_type(const char *path, int *type) fclose(fp); if (i != MAGIC_NUMBER_LEN) { char errmsg[MAX_ERR_LENGTH]; - snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Could not read magic data from file '%s', err = %s.", - path, strerror(errno)); + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: Could not read magic data from file '%s',\n\t\terror = %s.", path, + strerror(errno)); ex_err(__func__, errmsg, EX_WRONGFILETYPE); EX_FUNC_LEAVE(EX_FATAL); } @@ -337,7 +348,7 @@ int exi_put_names(int exoid, int varid, size_t num_names, char *const *names, found_name = 1; ex_copy_string(&int_names[idx], names[i], name_length); size_t length = strlen(names[i]) + 1; - if (length > name_length) { + if (length > (size_t)name_length) { fprintf(stderr, "Warning: The %s %s name '%s' is too long.\n\tIt will " "be truncated from %d to %d characters. [Called from %s]\n", @@ -346,7 +357,7 @@ int exi_put_names(int exoid, int varid, size_t num_names, char *const *names, length = name_length; } - if (length > max_name_len) { + if (length > (size_t)max_name_len) { max_name_len = length; } } @@ -412,7 +423,7 @@ int exi_put_name(int exoid, int varid, size_t index, const char *name, ex_entity snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store %s name in file id %d", ex_name_of_object(obj_type), exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* Add the trailing null if the variable name was too long */ @@ -424,7 +435,7 @@ int exi_put_name(int exoid, int varid, size_t index, const char *name, ex_entity /* Update the maximum_name_length attribute on the file. */ exi_update_max_name_length(exoid, count[1] - 1); } - return (EX_NOERR); + return EX_NOERR; } /*! @@ -444,10 +455,10 @@ int exi_get_names(int exoid, int varid, size_t num_names, char **names, ex_entit for (size_t i = 0; i < num_names; i++) { int status = exi_get_name(exoid, varid, i, names[i], name_size, obj_type, routine); if (status != NC_NOERR) { - return (status); + return status; } } - return (EX_NOERR); + return EX_NOERR; } /*! @@ -472,14 +483,14 @@ int exi_get_name(int exoid, int varid, size_t index, char *name, int name_size, "ERROR: failed to get %s name at index %d from file id %d [Called from %s]", ex_name_of_object(obj_type), (int)index, exoid, routine); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } int api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); name[api_name_size] = '\0'; exi_trim(name); - return (EX_NOERR); + return EX_NOERR; } /*! @@ -521,7 +532,7 @@ char *exi_catstr(const char *string, int num) if (cur_string - ret_string > 9 * (MAX_VAR_NAME_LENGTH + 1)) { cur_string = ret_string; } - return (tmp_string); + return tmp_string; } /** exi_catstr2 - concatenate string1num1string2num2 */ @@ -538,7 +549,7 @@ char *exi_catstr2(const char *string1, int num1, const char *string2, int num2) if (cur_string - ret_string > 9 * (MAX_VAR_NAME_LENGTH + 1)) { cur_string = ret_string; } - return (tmp_string); + return tmp_string; } /*! @@ -640,7 +651,7 @@ char *exi_dim_num_objects(ex_entity_type obj_type) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: object type %d not supported in call to %s", obj_type, __func__); ex_err(__func__, errmsg, EX_BADPARAM); - return (NULL); + return NULL; } } } @@ -695,7 +706,7 @@ char *exi_name_var_of_object(ex_entity_type obj_type, int i, int j) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: object type %d not supported in call to %s", obj_type, __func__); ex_err(__func__, errmsg, EX_BADPARAM); - return (NULL); + return NULL; } } } @@ -722,7 +733,7 @@ char *exi_name_red_var_of_object(ex_entity_type obj_type, int id) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: object type %d not supported in call to %s", obj_type, __func__); ex_err(__func__, errmsg, EX_BADPARAM); - return (NULL); + return NULL; } } } @@ -781,8 +792,8 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) char errmsg[MAX_ERR_LENGTH]; switch (id_type) { - case EX_NODAL: return (0); - case EX_GLOBAL: return (0); + case EX_NODAL: return 0; + case EX_GLOBAL: return 0; case EX_ASSEMBLY: return num; case EX_BLOB: return num; case EX_ELEM_BLOCK: @@ -861,7 +872,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: unsupported id array type %d for file id %d", id_type, exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); - return (EX_FATAL); + return EX_FATAL; } if ((tmp_stats->id_vals == NULL) || (!(tmp_stats->valid_ids))) { @@ -875,7 +886,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate id array dimension in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* Next get value of dimension */ @@ -883,7 +894,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate %s array length in file id %d", id_table, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* get variable id of id array */ @@ -891,7 +902,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate %s array in file id %d", id_table, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* allocate space for id array and initialize to zero to ensure @@ -900,7 +911,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to allocate memory for %s array for file id %d", id_table, exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); - return (EX_FATAL); + return EX_FATAL; } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { @@ -915,12 +926,12 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); free(id_vals); - return (EX_FATAL); + return EX_FATAL; } status = nc_get_var_int(exoid, varid, id_vals_int); if (status == NC_NOERR) { - for (i = 0; i < dim_len; i++) { - id_vals[i] = (int64_t)id_vals_int[i]; + for (size_t iii = 0; iii < dim_len; iii++) { + id_vals[iii] = (int64_t)id_vals_int[iii]; } } free(id_vals_int); @@ -931,17 +942,17 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) exoid); ex_err_fn(exoid, __func__, errmsg, status); free(id_vals); - return (EX_FATAL); + return EX_FATAL; } /* check if values in stored arrays are filled with non-zeroes */ bool filled = true; sequential = true; - for (i = 0; i < dim_len; i++) { - if (id_vals[i] != i + 1) { + for (size_t iii = 0; iii < dim_len; iii++) { + if (id_vals[iii] != (int64_t)iii + 1) { sequential = false; } - if (id_vals[i] == EX_INVALID_ID || id_vals[i] == NC_FILL_INT) { + if (id_vals[iii] == EX_INVALID_ID || id_vals[iii] == NC_FILL_INT) { filled = false; sequential = false; break; /* id array hasn't been completely filled with valid ids yet */ @@ -961,19 +972,19 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) sequential = tmp_stats->sequential; } - if (sequential && num < dim_len) { + if (sequential && (size_t)num < dim_len) { i = num - 1; } else { /* Do a linear search through the id array to find the array value corresponding to the passed index number */ - for (i = 0; i < dim_len; i++) { + for (i = 0; i < (int64_t)dim_len; i++) { if (id_vals[i] == num) { break; /* found the id requested */ } } } - if (i >= dim_len) /* failed to find id number */ + if (i >= (int64_t)dim_len) /* failed to find id number */ { if (!(tmp_stats->valid_ids)) { free(id_vals); @@ -981,7 +992,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to locate id %" PRId64 " for file id %d", num, exoid); ex_set_err(__func__, errmsg, EX_LOOKUPFAIL); - return (-EX_LOOKUPFAIL); /*if we got here, the id array value doesn't exist */ + return -EX_LOOKUPFAIL; /*if we got here, the id array value doesn't exist */ } /* Now check status array to see if object is null */ @@ -993,7 +1004,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to allocate memory for %s array for file id %d", id_table, exoid); ex_err_fn(exoid, __func__, errmsg, EX_MEMFAIL); - return (EX_FATAL); + return EX_FATAL; } /* first time through or status arrays haven't been filled yet */ @@ -1008,7 +1019,7 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get %s array from file id %d", stat_table, exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } else { @@ -1036,12 +1047,12 @@ int exi_id_lkup(int exoid, ex_entity_type id_type, ex_entity_id num) if (!(tmp_stats->valid_stat)) { free(stat_vals); } - return (-((int)i + 1)); /* return index into id array (1-based) */ + return -((int)i + 1); /* return index into id array (1-based) */ } if (!(tmp_stats->valid_stat)) { free(stat_vals); } - return (i + 1); /* return index into id array (1-based) */ + return i + 1; /* return index into id array (1-based) */ } /****************************************************************************** @@ -1164,7 +1175,7 @@ struct exi_list_item **exi_get_counter_list(ex_entity_type obj_type) case EX_ELEM_SET: return &els_ctr_list; case EX_EDGE_MAP: return &edm_ctr_list; case EX_FACE_MAP: return &fam_ctr_list; - default: return (NULL); + default: return NULL; } } @@ -1214,7 +1225,7 @@ int exi_inc_file_item(int exoid, /* file id */ tlist_ptr->next = *list_ptr; /* insert into head of list */ *list_ptr = tlist_ptr; /* fix up new head of list */ } - return (tlist_ptr->value++); + return tlist_ptr->value++; } /***************************************************************************** @@ -1261,10 +1272,10 @@ int exi_get_file_item(int exoid, /* file id */ } if (!tlist_ptr) { /* ptr NULL? */ - return (-1); + return -1; } - return (tlist_ptr->value); + return tlist_ptr->value; } /***************************************************************************** @@ -1367,7 +1378,7 @@ int ex_get_num_props(int exoid, ex_entity_type obj_type) \ingroup Utilities \undoc */ -int exi_get_cpu_ws(void) { return (sizeof(float)); } +int exi_get_cpu_ws(void) { return sizeof(float); } /* swap - interchange v[i] and v[j] */ /*! @@ -1627,7 +1638,7 @@ void exi_iqsort64(int64_t v[], int64_t iv[], int64_t N) int ex_large_model(int exoid) { if (exoid < 0) { - return (EXODUS_DEFAULT_SIZE); /* Specified in exodusII_int.h */ + return EXODUS_DEFAULT_SIZE; /* Specified in exodusII_int.h */ } /* See if the ATT_FILESIZE attribute is defined in the file */ @@ -1717,6 +1728,7 @@ void exi_set_compact_storage(int exoid, int varid) \internal \undoc */ + void exi_compress_variable(int exoid, int varid, int type) { #if NC_HAS_HDF5 @@ -1730,13 +1742,14 @@ void exi_compress_variable(int exoid, int varid, int type) } else { /* Compression only supported on HDF5 (NetCDF-4) files; Do not try to compress character data */ + int status = NC_NOERR; if ((type == 1 || type == 2) && file->is_hdf5) { if (file->compression_algorithm == EX_COMPRESS_GZIP) { int deflate_level = file->compression_level; if (deflate_level > 0) { int compress = 1; int shuffle = file->shuffle; - nc_def_var_deflate(exoid, varid, shuffle, compress, deflate_level); + status = nc_def_var_deflate(exoid, varid, shuffle, compress, deflate_level); } } else if (file->compression_algorithm == EX_COMPRESS_SZIP) { @@ -1755,12 +1768,58 @@ void exi_compress_variable(int exoid, int varid, int type) /* Even and between 4 and 32; typical values are 8, 10, 16, 32 */ const int SZIP_PIXELS_PER_BLOCK = file->compression_level == 0 ? 32 : file->compression_level; - nc_def_var_szip(exoid, varid, NC_SZIP_NN, SZIP_PIXELS_PER_BLOCK); + status = nc_def_var_szip(exoid, varid, NC_SZIP_NN, SZIP_PIXELS_PER_BLOCK); #else char errmsg[MAX_ERR_LENGTH]; snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Compression algorithm SZIP is not supported yet (EXPERIMENTAL)."); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); +#endif + } + else if (file->compression_algorithm == EX_COMPRESS_ZSTD) { +#if NC_HAS_ZSTD == 1 + status = nc_def_var_zstandard(exoid, varid, file->compression_level); +#else + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: Compression algorithm ZSTANDARD is not supported in this version of the " + "netCDF library."); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); +#endif + } + else if (file->compression_algorithm == EX_COMPRESS_BZ2) { +#if NC_HAS_BZ2 == 1 + status = nc_def_var_bzip2(exoid, varid, file->compression_level); +#else + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: Compression algorithm BZIP2 / BZ2 is not supported in this version of the " + "netCDF library."); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); +#endif + } + if (status != NC_NOERR) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: failed to set compression attribute on variable in file id %d", exoid); + ex_err_fn(exoid, __func__, errmsg, status); + } + + if (type == 2 && file->quantize_nsd > 0) { +#if NC_HAS_QUANTIZE == 1 + // Lossy compression using netCDF quantize methods. + if ((status = nc_def_var_quantize(exoid, varid, NC_QUANTIZE_GRANULARBR, + file->quantize_nsd)) != NC_NOERR) { + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: failed to set quanitzation method on variable in file id %d", exoid); + ex_err_fn(exoid, __func__, errmsg, status); + } +#else + char errmsg[MAX_ERR_LENGTH]; + snprintf(errmsg, MAX_ERR_LENGTH, + "ERROR: Quanitzation is not supported in this version of netCDF library."); + ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); #endif } } @@ -1797,11 +1856,11 @@ int exi_leavedef(int exoid, const char *call_func) exoid); ex_err_fn(exoid, call_func, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } file->in_define_mode = 0; } - return (EX_NOERR); + return EX_NOERR; } int exi_redef(int exoid, const char *call_func) @@ -1881,12 +1940,12 @@ int exi_persist_leavedef(int exoid, const char *call_func) exoid); ex_err_fn(exoid, call_func, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } file->in_define_mode = 0; file->persist_define_mode = 0; } - return (EX_NOERR); + return EX_NOERR; } static int warning_output = 0; @@ -2247,7 +2306,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle if ((status = nc_set_fill(exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to set nofill mode in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* Verify that there is not an existing file_item struct for this @@ -2267,7 +2326,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle exoid, path); ex_err_fn(exoid, __func__, errmsg, EX_BADFILEID); nc_close(exoid); - return (EX_FATAL); + return EX_FATAL; } /* initialize floating point size conversion. since creating new file, @@ -2290,7 +2349,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to init conversion routines in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_LASTERR); - return (EX_FATAL); + return EX_FATAL; } /* put the EXODUS version number, and i/o floating point word size as @@ -2307,7 +2366,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store Exodus II API version attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } @@ -2321,7 +2380,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store Exodus II file version attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } @@ -2334,7 +2393,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle "attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } /* store Exodus file size (1=large, 0=normal) as an attribute */ @@ -2342,7 +2401,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to store Exodus II file size attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } { @@ -2352,7 +2411,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to add maximum_name_length attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } @@ -2363,7 +2422,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to add int64_status attribute in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } } @@ -2375,7 +2434,7 @@ int exi_populate_header(int exoid, const char *path, int my_mode, int is_paralle #endif snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to complete definition for file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, status); - return (EX_FATAL); + return EX_FATAL; } return EX_NOERR; } diff --git a/packages/seacas/libraries/exodus/test/CMakeLists.txt b/packages/seacas/libraries/exodus/test/CMakeLists.txt index 6b1641c53c77..fc3596d89435 100644 --- a/packages/seacas/libraries/exodus/test/CMakeLists.txt +++ b/packages/seacas/libraries/exodus/test/CMakeLists.txt @@ -168,15 +168,14 @@ IF ( NETCDF_NCDUMP_BINARY ) ) IF (NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - -# TRIBITS_ADD_TEST( -# testall -# NOEXEPREFIX -# NOEXESUFFIX -# NAME exodus_unit_tests -# COMM mpi serial -# NUM_MPI_PROCS 1 -# ) + TRIBITS_ADD_TEST( + testall + NOEXEPREFIX + NOEXESUFFIX + NAME exodus_unit_tests + COMM mpi serial + NUM_MPI_PROCS 1 + ) if ( TPL_Netcdf_Enables_Netcdf4 ) TRIBITS_ADD_TEST( @@ -200,15 +199,15 @@ IF ( NETCDF_NCDUMP_BINARY ) endif() # if ( TPL_Netcdf_Enables_Netcdf5 ) -# TRIBITS_ADD_TEST( -# testall -# NOEXEPREFIX -# NOEXESUFFIX -# NAME exodus_unit_tests_nc5_env -# ARGS netcdf5 -# COMM mpi serial -# NUM_MPI_PROCS 1 -# ) + TRIBITS_ADD_TEST( + testall + NOEXEPREFIX + NOEXESUFFIX + NAME exodus_unit_tests_nc5_env + ARGS netcdf5 + COMM mpi serial + NUM_MPI_PROCS 1 + ) # endif() endif() ELSE() diff --git a/packages/seacas/libraries/exodus/test/create_mesh.c b/packages/seacas/libraries/exodus/test/create_mesh.c index 3f8e56d0b95a..af606d515071 100644 --- a/packages/seacas/libraries/exodus/test/create_mesh.c +++ b/packages/seacas/libraries/exodus/test/create_mesh.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -53,7 +53,7 @@ INT StringToCount(char *size_str) else if (rc == 0) { size = -1; } - return (size); + return size; } /* StringToCount() */ void get_file_name(const char *base, const char *ext, int rank, int nprocs, const char *other, @@ -334,9 +334,9 @@ void make_mesh(realtyp *x, realtyp *y, realtyp *z, INT *connect, INT map_origin, { /* create global coordinates */ size_t k = 0; - for (size_t m = 0; m < (num_elements_1d + 1); m++) { - for (size_t i = 0; i < (num_elements_1d + 1); i++) { - for (size_t j = 0; j < (num_elements_1d + 1); j++, k++) { + for (INT m = 0; m < (num_elements_1d + 1); m++) { + for (INT i = 0; i < (num_elements_1d + 1); i++) { + for (INT j = 0; j < (num_elements_1d + 1); j++, k++) { x[k] = (realtyp)j; y[k] = (realtyp)i; z[k] = (realtyp)m; @@ -347,10 +347,10 @@ void make_mesh(realtyp *x, realtyp *y, realtyp *z, INT *connect, INT map_origin, /* build connectivity array (node list) for mesh */ size_t elp1sq = (num_elements_1d + 1) * (num_elements_1d + 1); size_t cnt = 0; - for (size_t m = 0; m < num_elements_1d; m++) { + for (INT m = 0; m < num_elements_1d; m++) { k = 0; - for (size_t i = 0; i < num_elements_1d; i++) { - for (size_t j = 0; j < num_elements_1d; j++, k++) { + for (INT i = 0; i < num_elements_1d; i++) { + for (INT j = 0; j < num_elements_1d; j++, k++) { size_t base = (m * elp1sq) + k + i + map_origin; connect[cnt++] = base; connect[cnt++] = base + 1; diff --git a/packages/seacas/libraries/exodus/test/makedmp b/packages/seacas/libraries/exodus/test/makedmp index 5f338fccfb25..02d09adc0231 100644 --- a/packages/seacas/libraries/exodus/test/makedmp +++ b/packages/seacas/libraries/exodus/test/makedmp @@ -1,8 +1,8 @@ #! /usr/bin/env bash -# Copyright(C) 1999-2021 National Technology & Engineering Solutions +# Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. -# +# # See packages/seacas/LICENSE for details # script to run all tests and compare them to saved dump files. @@ -234,19 +234,19 @@ echo "begin test_ts_nvar" >> test.output ${PREFIX} ${BINDIR}/test_ts_nvar${SUFFIX} >> test.output echo "end test_ts_nvar" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | grep -v _FillValue |grep -v "maximum_name_length" > ${SRCDIR}/test_ts_nvar.dmp - + echo "test_ts_nvar_rd - each thread reads data for a single nodal variable..." echo "begin test_ts_nvar_rd" >> test.output ${PREFIX} ${BINDIR}/test_ts_nvar_rd${SUFFIX} > ${SRCDIR}/test_ts_nvar_rd.dmp echo "end test_ts_nvar_rd" >> test.output - + echo "test_ts_partial_nvar - each thread writes data for a single nodal variable..." echo "begin test_ts_partial_nvar" >> test.output ${PREFIX} ${BINDIR}/test_ts_partial_nvar${SUFFIX} >> test.output echo "end test_ts_partial_nvar" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | grep -v _FillValue |grep -v "maximum_name_length" > ${SRCDIR}/test_ts_partial_nvar.dmp - + echo "test_ts_partial_nvar_rd - each thread reads data for a single nodal variable..." echo "begin test_ts_partial_nvar_rd" >> test.output ${PREFIX} ${BINDIR}/test_ts_partial_nvar${SUFFIX} >> test.output @@ -277,4 +277,3 @@ echo "begin test_ts_errval" >> test.output ${PREFIX} ${BINDIR}/test_ts_errval${SUFFIX} >> test.output echo "end test_ts_errval" >> test.output fi - diff --git a/packages/seacas/libraries/exodus/test/rd_wt_mesh.c b/packages/seacas/libraries/exodus/test/rd_wt_mesh.c index c7dcf632dd54..ddb3b176eedc 100644 --- a/packages/seacas/libraries/exodus/test/rd_wt_mesh.c +++ b/packages/seacas/libraries/exodus/test/rd_wt_mesh.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -250,7 +250,7 @@ int main(int argc, char **argv) #ifdef PARALLEL_AWARE_EXODUS MPI_Finalize(); #endif - return (0); + return 0; } /*********************************************************************** @@ -349,16 +349,16 @@ int parse_input(int argc, char *argv[], bool *exodus, bool *close_files, char *f fprintf(stderr, "-C minimize open files. \n"); fprintf(stderr, "-u display help/usage information \n"); fprintf(stderr, "-w time wait (sleep) specified time between timesteps.\n"); - return (1); + return 1; } else { fprintf(stderr, "Unknown option: %s\n", argv[arg]); fprintf(stderr, "Enter rd_wt_mesh -h for description of valid options.\n"); - return (1); + return 1; } } - return (0); + return 0; } /*********************************************************************** @@ -402,7 +402,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (exoid < 0) { printf("after ex_open\n"); - return (1); + return 1; } raw_read_time = 0.0; @@ -416,7 +416,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_init, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } len_connect = (size_t)NUM_NODES_PER_ELEM * (*num_elems); @@ -450,7 +450,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_coord, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } err = ex_get_block(exoid, EX_ELEM_BLOCK, EBLK_ID, type, num_elems, &num_nodes_per_elem, 0, 0, @@ -459,7 +459,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_elem_block, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } t_tmp1 = my_timer(); @@ -474,7 +474,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_elem_conn, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } /* read element and node maps */ @@ -497,7 +497,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_variable_param, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } *num_nodal_fields = num_vars; @@ -505,7 +505,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_variable_param, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } *num_global_fields = num_vars; if (*num_global_fields > 0) { @@ -520,7 +520,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (globals) { free(globals); } - return (1); + return 1; } *num_element_fields = num_vars; @@ -566,7 +566,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_nodal_var, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } } @@ -580,7 +580,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_glob_vars, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } for (i = 1; i <= *num_element_fields; i++) { @@ -594,7 +594,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (err) { printf("after ex_get_elem_var, error = %d\n", err); ex_close(exoid); - return (1); + return 1; } } } @@ -607,7 +607,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int err = ex_close(exoid); if (err) { printf("after ex_close, error = %d\n", err); - return (1); + return 1; } tend = my_timer(); @@ -645,7 +645,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (rank == 0) { fprintf(stderr, "Exodus Read: cannot get %s file size.\n", tmp_name); } - return (1); + return 1; } { file_size = file_status.st_size; @@ -689,7 +689,7 @@ int read_exo_mesh(char *file_name, int rank, int *num_dim, int num_domains, int if (*num_global_fields > 0) { free(globals); } - return (0); + return 0; } /*********************************************************************** @@ -748,7 +748,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int if (exoid[npd] < 0) { printf("after ex_create\n"); free(exoid); - return (1); + return 1; } } t_tmp2 = my_timer(); @@ -778,7 +778,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int globals = NULL; } free(exoid); - return (1); + return 1; } } err = ex_put_init(exoid[npd], "This is an EXODUSII performance test.", num_dim, num_nodes, @@ -789,7 +789,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int ex_close(exoid[npd]); free(exoid); - return (1); + return 1; } #if 0 @@ -814,7 +814,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int printf("after ex_put_elem_block, error = %d\n", err); ex_close(exoid[npd]); free(exoid); - return (1); + return 1; } t_tmp1 = my_timer(); @@ -829,7 +829,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int ex_close(exoid[npd]); free(exoid); - return (1); + return 1; } t_tmp1 = my_timer(); @@ -844,7 +844,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int ex_close(exoid[npd]); free(exoid); - return (1); + return 1; } /* write out element and node maps */ @@ -860,7 +860,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int ex_close(exoid[npd]); free(exoid); - return (1); + return 1; } t_tmp1 = my_timer(); @@ -877,7 +877,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int ex_close(exoid[npd]); free(exoid); - return (1); + return 1; } /* write out simulated results fields; @@ -1075,7 +1075,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int if (err) { printf("after ex_close, error = %d\n", err); free(exoid); - return (1); + return 1; } } if (rank == 0) { @@ -1144,7 +1144,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int } free(exoid); - return (1); + return 1; } { file_size = file_status.st_size * files_per_domain; @@ -1192,7 +1192,7 @@ int write_exo_mesh(char *file_name, int rank, int num_dim, int num_domains, int free(globals); globals = NULL; } - return (0); + return 0; } /*****************************************************************************/ diff --git a/packages/seacas/libraries/exodus/test/test_nemesis.c b/packages/seacas/libraries/exodus/test/test_nemesis.c index 71b184e4c50d..fbcff42e404a 100644 --- a/packages/seacas/libraries/exodus/test/test_nemesis.c +++ b/packages/seacas/libraries/exodus/test/test_nemesis.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2021 National Technology & Engineering Solutions + * Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -472,7 +472,7 @@ int ne_test_piinf(int fileid) ex_copy_string(ftype, "s", 3); - return (ex_put_init_info(fileid, NPROC, NPROCF, ftype)); + return ex_put_init_info(fileid, NPROC, NPROCF, ftype); } /*****************************************************************************/ @@ -480,7 +480,7 @@ int ne_test_pinig(int fileid) { int nng = NNG, neg = NEG, nebg = NEBG, nnsg = NNSG, nssg = NSSG; - return (ex_put_init_global(fileid, nng, neg, nebg, nnsg, nssg)); + return ex_put_init_global(fileid, nng, neg, nebg, nnsg, nssg); } /*****************************************************************************/ @@ -493,7 +493,7 @@ int ne_test_pelbid(int fileid) elblk_cnt[i] = NEBCG; } - return (ex_put_eb_info_global(fileid, elblk_ids, elblk_cnt)); + return ex_put_eb_info_global(fileid, elblk_ids, elblk_cnt); } /*****************************************************************************/ @@ -507,7 +507,7 @@ int ne_test_pnsp(int fileid) global_df_cnts[i] = 1; } - return (ex_put_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts)); + return ex_put_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts); } /*****************************************************************************/ @@ -521,7 +521,7 @@ int ne_test_pssp(int fileid) global_df_cnts[i] = 1; } - return (ex_put_ss_param_global(fileid, global_ids, global_el_cnts, global_df_cnts)); + return ex_put_ss_param_global(fileid, global_ids, global_el_cnts, global_df_cnts); } /*****************************************************************************/ @@ -979,8 +979,8 @@ int ne_test_plbpc(int fileid) num_elem_cmaps[iproc] = NECMAP; } - return (ex_put_loadbal_param_cc(fileid, num_int_nodes, num_bor_nodes, num_ext_nodes, - num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps)); + return ex_put_loadbal_param_cc(fileid, num_int_nodes, num_bor_nodes, num_ext_nodes, num_int_elems, + num_bor_elems, num_node_cmaps, num_elem_cmaps); } /*****************************************************************************/ @@ -1011,6 +1011,6 @@ int ne_test_pcmpc(int fileid) emap_proc_ptr[iproc + 1] = emap_proc_ptr[iproc] + NECMAP; } - return (ex_put_cmap_params_cc(fileid, nmap_ids, nmap_n_cnts, nmap_proc_ptr, emap_ids, emap_e_cnts, - emap_proc_ptr)); + return ex_put_cmap_params_cc(fileid, nmap_ids, nmap_n_cnts, nmap_proc_ptr, emap_ids, emap_e_cnts, + emap_proc_ptr); } diff --git a/packages/seacas/libraries/exodus/test/testall.in b/packages/seacas/libraries/exodus/test/testall.in index 889cf15434a0..aae1e4a0a588 100755 --- a/packages/seacas/libraries/exodus/test/testall.in +++ b/packages/seacas/libraries/exodus/test/testall.in @@ -357,7 +357,7 @@ echo "begin testwt-field-metadata" >> test.output ${PREFIX} ${BINDIR}/testwt-field-metadata${SUFFIX} >> test.output ret_status=$((ret_status+$?)) # Filter out the "maximum_name_length" attribute. Moves around in ncdump output for nc4 vs nc3 -${NCDUMP} -d5,5 test-field-metadata.exo | grep @ |sort | ${DIFF} - ${SRCDIR}/testwt-field-metadata.dmp | tee testwt-field-metadata.res +${NCDUMP} -d5,5 test-field-metadata.exo | grep @ |sort -bdf | ${DIFF} - ${SRCDIR}/testwt-field-metadata.dmp | tee testwt-field-metadata.res ret_status=$((ret_status+${PIPESTATUS[0]}+${PIPESTATUS[3]})) echo "end testwt-field-metadata, status = $ret_status" >> test.output diff --git a/packages/seacas/libraries/exodus/test/testall.in1 b/packages/seacas/libraries/exodus/test/testall.in1 index ab0b0bf69c2e..e5c7d124b4eb 100644 --- a/packages/seacas/libraries/exodus/test/testall.in1 +++ b/packages/seacas/libraries/exodus/test/testall.in1 @@ -1,7 +1,7 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. -# +# # See packages/seacas/LICENSE for details # script to run all tests and compare them to saved dump files. diff --git a/packages/seacas/libraries/exodus/test/testrd-assembly.c b/packages/seacas/libraries/exodus/test/testrd-assembly.c index f10f39a313f8..70e795ed8467 100644 --- a/packages/seacas/libraries/exodus/test/testrd-assembly.c +++ b/packages/seacas/libraries/exodus/test/testrd-assembly.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -232,7 +232,7 @@ int main(int argc, char **argv) for (int j = 0; j < att_count; j++) { printf("\tName: '%s', Type = %d, Value Count = %d\n\t", attr[j].name, attr[j].type, (int)attr[j].value_count); - for (size_t k = 0; k < attr[j].value_count; k++) { + for (int k = 0; k < attr[j].value_count; k++) { if (attr[j].type == EX_INTEGER) { int *vals = attr[j].values; printf("\t%d", vals[k]); diff --git a/packages/seacas/libraries/exodus/test/testrd-assembly.dmp b/packages/seacas/libraries/exodus/test/testrd-assembly.dmp index 3c8f9d4aad73..a1dea44f6b8e 100644 --- a/packages/seacas/libraries/exodus/test/testrd-assembly.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-assembly.dmp @@ -75,16 +75,16 @@ name = 'block_G' after ex_get_names(exoid, EX_ASSEMBLY, assembly_name2), error = 0 after ex_get_assembly(exoid, &assemblies[i]), error = 0 Assembly named 'Root' has id 100. It contains 3 entities of type 'assembly' - 200, 300, 400, + 200, 300, 400, after ex_get_assembly(exoid, &assemblies[i]), error = 0 Assembly named 'Child2' has id 200. It contains 4 entities of type 'element block' - 10, 11, 12, 13, + 10, 11, 12, 13, after ex_get_assembly(exoid, &assemblies[i]), error = 0 Assembly named 'Child3' has id 300. It contains 3 entities of type 'element block' - 14, 15, 16, + 14, 15, 16, after ex_get_assembly(exoid, &assemblies[i]), error = 0 Assembly named 'Child4' has id 400. It contains 2 entities of type 'element block' - 10, 16, + 10, 16, after ex_get_assemblies(exoid, assmbly), error = 0 Assembly named 'Root' has id 100. It contains 3 entities of type 'assembly' Assembly named 'Child2' has id 200. It contains 4 entities of type 'element block' diff --git a/packages/seacas/libraries/exodus/test/testrd-blob.c b/packages/seacas/libraries/exodus/test/testrd-blob.c index 5c65949a0d89..a7f948326b5c 100644 --- a/packages/seacas/libraries/exodus/test/testrd-blob.c +++ b/packages/seacas/libraries/exodus/test/testrd-blob.c @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -136,7 +136,7 @@ int main(int argc, char **argv) for (int j = 0; j < att_count; j++) { printf("\tName: '%s', Type = %d, Value Count = %d\n\t", attr[j].name, attr[j].type, (int)attr[j].value_count); - for (size_t k = 0; k < attr[j].value_count; k++) { + for (int k = 0; k < attr[j].value_count; k++) { if (attr[j].type == EX_INTEGER) { int *vals = attr[j].values; printf("\t%d", vals[k]); diff --git a/packages/seacas/libraries/exodus/test/testrd-blob.dmp b/packages/seacas/libraries/exodus/test/testrd-blob.dmp index 24f8ca1395ab..faddc2bf2b4a 100644 --- a/packages/seacas/libraries/exodus/test/testrd-blob.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-blob.dmp @@ -16,13 +16,13 @@ num_node_sets = 0 num_side_sets = 0 after ex_get_blob(exoid, &blobs[i]), error = 0 Blob named 'Tempus' has id 100. It contains 10 entries. - + after ex_get_blob(exoid, &blobs[i]), error = 0 Blob named 'IOSS' has id 200. It contains 20 entries. - + after ex_get_blob(exoid, &blobs[i]), error = 0 Blob named 'Solver' has id 300. It contains 15 entries. - + after ex_get_blobs(exoid, blb), error = 0 Blob named 'Tempus' has id 100. It contains 10 entries. Blob named 'IOSS' has id 200. It contains 20 entries. diff --git a/packages/seacas/libraries/exodus/test/testrd-field-metadata.c b/packages/seacas/libraries/exodus/test/testrd-field-metadata.c index 67d140e453ed..c4fa4f1c8816 100644 --- a/packages/seacas/libraries/exodus/test/testrd-field-metadata.c +++ b/packages/seacas/libraries/exodus/test/testrd-field-metadata.c @@ -54,13 +54,13 @@ static char *my_strsep(char **stringp, const char *delim) } \ } while (0) -static char *get_type_name(char *type_name, size_t which) +static char *get_type_name(const char *type_name, size_t which) { if (type_name != NULL && type_name[0] != '\0') { char *string = my_strdup(type_name); char *tofree = string; char *token = my_strsep(&string, ","); - for (int i = 0; i < which; i++) { + for (size_t i = 0; i < which; i++) { token = my_strsep(&string, ","); } if (token != NULL) { @@ -74,8 +74,8 @@ static char *get_type_name(char *type_name, size_t which) return NULL; } -static void get_field_cardinality(ex_field *field, ex_basis *basis, int bas_cnt, - ex_quadrature *quad, int quad_cnt) +static void get_field_cardinality(ex_field *field, const ex_basis *basis, int bas_cnt, + const ex_quadrature *quad, int quad_cnt) { for (int j = 0; j < field->nesting; j++) { if (field->cardinality[j] == 0) { @@ -120,7 +120,7 @@ static void get_field_cardinality(ex_field *field, ex_basis *basis, int bas_cnt, } } -static void print_basis_metadata(ex_basis *basis, size_t num_basis) +static void print_basis_metadata(const ex_basis *basis, size_t num_basis) { for (size_t j = 0; j < num_basis; j++) { printf("\nBasis Metadata: Name: `%s`, Cardinality: %d\n", basis[j].name, basis[j].cardinality); @@ -136,7 +136,7 @@ static void print_basis_metadata(ex_basis *basis, size_t num_basis) } } -static void print_quad_metadata(ex_quadrature *quad, size_t num_quad) +static void print_quad_metadata(const ex_quadrature *quad, size_t num_quad) { for (size_t j = 0; j < num_quad; j++) { printf("\nQuadrature Metadata: Name: `%s`, Cardinality: %d\n", quad[j].name, @@ -152,7 +152,7 @@ static void print_quad_metadata(ex_quadrature *quad, size_t num_quad) } } -static void print_field_metadata(ex_field *field) +static void print_field_metadata(const ex_field *field) { printf("\n"); printf("Field Metadata: Name: `%s`, Nesting: %d\n", field->name, field->nesting); diff --git a/packages/seacas/libraries/exodus/test/testrd-long-name.dmp b/packages/seacas/libraries/exodus/test/testrd-long-name.dmp index 3071eb10f4e2..3f2707b3a99c 100644 --- a/packages/seacas/libraries/exodus/test/testrd-long-name.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-long-name.dmp @@ -15,7 +15,7 @@ num_side_sets = 5 after ex_inquire, error = 0 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -49,7 +49,7 @@ x coords = 0.0 10.0 10.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -83,7 +83,7 @@ y coords = 0.0 0.0 10.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -197,13 +197,13 @@ nodal attribute 1 = 'Node_attr_2' 10.0 after ex_get_id_map, error = 0 -elem_map(0) = 1 -elem_map(1) = 2 -elem_map(2) = 3 -elem_map(3) = 4 -elem_map(4) = 5 -elem_map(5) = 6 -elem_map(6) = 7 +elem_map(0) = 1 +elem_map(1) = 2 +elem_map(2) = 3 +elem_map(3) = 4 +elem_map(4) = 5 +elem_map(5) = 6 +elem_map(6) = 7 after ex_get_elem_blk_ids, error = 0 @@ -376,7 +376,7 @@ after ex_get_names, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 name = 'nset_1' @@ -409,7 +409,7 @@ nodeset attribute 0 = 'Nodeset_attribute' after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 name = 'nset_2' @@ -448,16 +448,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -466,7 +466,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -739,37 +739,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 8 10 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 19 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -799,7 +799,7 @@ elem_list = 7 7 7 -side_list = +side_list = 4 2 2 @@ -829,7 +829,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -840,7 +840,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -853,7 +853,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrd-nfaced.dmp b/packages/seacas/libraries/exodus/test/testrd-nfaced.dmp index 933936b2d87c..1179ad6c21f2 100644 --- a/packages/seacas/libraries/exodus/test/testrd-nfaced.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-nfaced.dmp @@ -14,7 +14,7 @@ num_node_sets = 0 num_side_sets = 0 after ex_get_coord, error = 0 -x, y, z coords = +x, y, z coords = 0.0 0.0 0.0 2.0 0.0 0.0 0.0 2.0 0.0 @@ -53,9 +53,9 @@ after ex_get_entity_count_per_polyhedra, error = 0 after ex_get_conn, error = 0 face connectivity array for elem block 10 -Element 1, 5 faces: 1 2 3 4 5 -Element 2, 5 faces: 4 6 7 8 9 -Element 3, 7 faces: 8 10 11 12 13 14 15 +Element 1, 5 faces: 1 2 3 4 5 +Element 2, 5 faces: 4 6 7 8 9 +Element 3, 7 faces: 8 10 11 12 13 14 15 after ex_get_block (EX_FACE_BLOCK), error = 0 @@ -71,24 +71,24 @@ after ex_get_entity_count_per_polyhedra, error = 0 after ex_get_conn, error = 0 node connectivity array for face block 10 -Face 1, 3 nodes: 5 6 8 -Face 2, 3 nodes: 2 1 4 -Face 3, 4 nodes: 6 2 4 8 -Face 4, 4 nodes: 8 4 1 5 -Face 5, 4 nodes: 1 2 6 5 -Face 6, 3 nodes: 5 8 7 -Face 7, 3 nodes: 1 3 4 -Face 8, 4 nodes: 7 8 4 3 -Face 9, 4 nodes: 7 3 1 5 -Face 10, 5 nodes: 8 4 14 10 12 -Face 11, 5 nodes: 7 11 9 13 3 -Face 12, 4 nodes: 7 8 12 11 -Face 13, 4 nodes: 11 12 10 9 -Face 14, 4 nodes: 9 10 14 13 -Face 15, 4 nodes: 13 14 4 3 +Face 1, 3 nodes: 5 6 8 +Face 2, 3 nodes: 2 1 4 +Face 3, 4 nodes: 6 2 4 8 +Face 4, 4 nodes: 8 4 1 5 +Face 5, 4 nodes: 1 2 6 5 +Face 6, 3 nodes: 5 8 7 +Face 7, 3 nodes: 1 3 4 +Face 8, 4 nodes: 7 8 4 3 +Face 9, 4 nodes: 7 3 1 5 +Face 10, 5 nodes: 8 4 14 10 12 +Face 11, 5 nodes: 7 11 9 13 3 +Face 12, 4 nodes: 7 8 12 11 +Face 13, 4 nodes: 11 12 10 9 +Face 14, 4 nodes: 9 10 14 13 +Face 15, 4 nodes: 13 14 4 3 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT-NFACED' 'testwt-nfaced' '2010/02/15' @@ -101,7 +101,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrd-nm32.dmp b/packages/seacas/libraries/exodus/test/testrd-nm32.dmp index 84c554f7df40..70ec8a3c6ba1 100644 --- a/packages/seacas/libraries/exodus/test/testrd-nm32.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-nm32.dmp @@ -13,7 +13,7 @@ num_side_sets = 5 after ex_inquire, error = 0 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -47,7 +47,7 @@ x coords = 0.0 10.0 10.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -81,7 +81,7 @@ y coords = 0.0 0.0 10.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -195,13 +195,13 @@ nodal attribute 1 = 'Node_attr_2' 10.0 after ex_get_id_map, error = 0 -elem_id_map(0) = 1 -elem_id_map(1) = 2 -elem_id_map(2) = 3 -elem_id_map(3) = 4 -elem_id_map(4) = 5 -elem_id_map(5) = 6 -elem_id_map(6) = 7 +elem_id_map(0) = 1 +elem_id_map(1) = 2 +elem_id_map(2) = 3 +elem_id_map(3) = 4 +elem_id_map(4) = 5 +elem_id_map(5) = 6 +elem_id_map(6) = 7 after ex_get_elem_blk_ids, error = 0 @@ -374,7 +374,7 @@ after ex_get_names, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 name = 'nset_1' @@ -407,7 +407,7 @@ nodeset attribute 0 = 'Nodeset_attribute' after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 name = 'nset_2' @@ -444,16 +444,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -462,7 +462,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -733,37 +733,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 8 10 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 19 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -793,7 +793,7 @@ elem_list = 7 7 7 -side_list = +side_list = 4 2 2 @@ -823,7 +823,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -834,7 +834,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -847,7 +847,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrd-nsided.dmp b/packages/seacas/libraries/exodus/test/testrd-nsided.dmp index 20b77f3779f1..98ae3d0f9370 100644 --- a/packages/seacas/libraries/exodus/test/testrd-nsided.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-nsided.dmp @@ -12,7 +12,7 @@ num_node_sets = 2 num_side_sets = 5 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -46,7 +46,7 @@ x coords = 0.0 10.0 10.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -80,7 +80,7 @@ y coords = 0.0 0.0 10.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -193,13 +193,13 @@ nodal attribute 1 = 'Node_attr_2' 10.0 after ex_get_id_map, error = 0 -elem_map(0) = 1 -elem_map(1) = 2 -elem_map(2) = 3 -elem_map(3) = 4 -elem_map(4) = 5 -elem_map(5) = 6 -elem_map(6) = 7 +elem_map(0) = 1 +elem_map(1) = 2 +elem_map(2) = 3 +elem_map(3) = 4 +elem_map(4) = 5 +elem_map(5) = 6 +elem_map(6) = 7 after ex_get_elem_blk_ids, error = 0 @@ -222,13 +222,13 @@ after ex_get_entity_count_per_polyhedra, error = 0 after ex_get_conn, error = 0 connect array for elem block 10 -Element 1, 4 nodes: 1 2 3 4 -Element 2, 4 nodes: 5 6 7 8 -Element 3, 8 nodes: 9 10 11 12 13 14 15 16 -Element 4, 4 nodes: 17 18 19 20 -Element 5, 6 nodes: 21 22 23 24 25 26 -Element 6, 8 nodes: 17 18 19 20 27 28 30 29 -Element 7, 3 nodes: 31 32 33 +Element 1, 4 nodes: 1 2 3 4 +Element 2, 4 nodes: 5 6 7 8 +Element 3, 8 nodes: 9 10 11 12 13 14 15 16 +Element 4, 4 nodes: 17 18 19 20 +Element 5, 6 nodes: 21 22 23 24 25 26 +Element 6, 8 nodes: 17 18 19 20 27 28 30 29 +Element 7, 3 nodes: 31 32 33 after ex_get_node_set_ids, error = 0 @@ -236,7 +236,7 @@ after ex_get_names, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 name = 'nset_1' @@ -269,7 +269,7 @@ nodeset attribute 0 = 'Nodeset_attribute' after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 name = 'nset_2' @@ -308,16 +308,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -326,7 +326,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -488,37 +488,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 8 10 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 19 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -548,7 +548,7 @@ elem_list = 7 7 7 -side_list = +side_list = 4 2 2 @@ -578,7 +578,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -589,7 +589,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -602,7 +602,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrd-oned.dmp b/packages/seacas/libraries/exodus/test/testrd-oned.dmp index d0ea2e9319c2..2489a65ebb10 100644 --- a/packages/seacas/libraries/exodus/test/testrd-oned.dmp +++ b/packages/seacas/libraries/exodus/test/testrd-oned.dmp @@ -13,7 +13,7 @@ num_side_sets = 2 after ex_inquire, error = 0 after ex_get_coord, error = 0 -x coords = +x coords = 1.0 1.1 1.2 @@ -44,16 +44,16 @@ nodal attribute 0 = 'Node_attr_1' 2.5 after ex_get_id_map, error = 0 -elem_id_map(0) = 10 -elem_id_map(1) = 20 -elem_id_map(2) = 30 -elem_id_map(3) = 40 -elem_id_map(4) = 50 -elem_id_map(5) = 60 -elem_id_map(6) = 70 -elem_id_map(7) = 80 -elem_id_map(8) = 90 -elem_id_map(9) = 100 +elem_id_map(0) = 10 +elem_id_map(1) = 20 +elem_id_map(2) = 30 +elem_id_map(3) = 40 +elem_id_map(4) = 50 +elem_id_map(5) = 60 +elem_id_map(6) = 70 +elem_id_map(7) = 80 +elem_id_map(8) = 90 +elem_id_map(9) = 100 after ex_get_elem_blk_ids, error = 0 @@ -119,7 +119,7 @@ after ex_get_names, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 name = 'all_odd_nodes' @@ -152,7 +152,7 @@ nodeset attribute 0 = 'Nodeset_attribute' after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 name = 'some_even_nodes' @@ -189,16 +189,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 1 3 5 @@ -207,7 +207,7 @@ node_list = 2 4 6 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -276,33 +276,33 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 2, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 1 2 -num_elem_per_set = +num_elem_per_set = 1 1 -num_dist_per_set = +num_dist_per_set = 1 1 -elem_ind = +elem_ind = 0 1 -dist_ind = +dist_ind = 0 1 -elem_list = +elem_list = 1 9 -side_list = +side_list = 1 2 -dist_fact = +dist_fact = 2.000 3.000 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -315,7 +315,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrd.dmp b/packages/seacas/libraries/exodus/test/testrd.dmp index d44c65196bab..3f94abce4b06 100644 --- a/packages/seacas/libraries/exodus/test/testrd.dmp +++ b/packages/seacas/libraries/exodus/test/testrd.dmp @@ -13,7 +13,7 @@ num_side_sets = 5 after ex_inquire, error = 0 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -47,7 +47,7 @@ x coords = 0.0 10.0 10.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -81,7 +81,7 @@ y coords = 0.0 0.0 10.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -195,13 +195,13 @@ nodal attribute 1 = 'Node_attr_2' 10.0 after ex_get_id_map, error = 0 -elem_id_map(0) = 10 -elem_id_map(1) = 20 -elem_id_map(2) = 30 -elem_id_map(3) = 40 -elem_id_map(4) = 50 -elem_id_map(5) = 60 -elem_id_map(6) = 70 +elem_id_map(0) = 10 +elem_id_map(1) = 20 +elem_id_map(2) = 30 +elem_id_map(3) = 40 +elem_id_map(4) = 50 +elem_id_map(5) = 60 +elem_id_map(6) = 70 after ex_get_elem_blk_ids, error = 0 @@ -374,7 +374,7 @@ after ex_get_names, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 name = 'nset_1' @@ -407,7 +407,7 @@ nodeset attribute 0 = 'Nodeset_attribute' after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 name = 'nset_2' @@ -444,16 +444,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -462,7 +462,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -733,37 +733,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 8 10 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 19 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -793,7 +793,7 @@ elem_list = 7 7 7 -side_list = +side_list = 4 2 2 @@ -823,7 +823,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -834,7 +834,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -847,7 +847,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' 'This info record is exactly 80 characters long. last character should be pipe |' diff --git a/packages/seacas/libraries/exodus/test/testrd1.dmp b/packages/seacas/libraries/exodus/test/testrd1.dmp index dd4a05c55d46..135f3905c894 100644 --- a/packages/seacas/libraries/exodus/test/testrd1.dmp +++ b/packages/seacas/libraries/exodus/test/testrd1.dmp @@ -14,7 +14,7 @@ num_node_sets = 2 num_side_sets = 5 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -43,7 +43,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -72,7 +72,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -112,25 +112,25 @@ after ex_get_prop_array, error = 0 after ex_get_elem_map, error = 0 element map id = 111 -elem_map(0) = 1 -elem_map(1) = 2 -elem_map(2) = 3 -elem_map(3) = 4 -elem_map(4) = 5 -elem_map(5) = 6 -elem_map(6) = 7 -elem_map(7) = 8 +elem_map(0) = 1 +elem_map(1) = 2 +elem_map(2) = 3 +elem_map(3) = 4 +elem_map(4) = 5 +elem_map(5) = 6 +elem_map(6) = 7 +elem_map(7) = 8 after ex_get_elem_map, error = 0 element map id = 222 -elem_map(0) = 2 -elem_map(1) = 4 -elem_map(2) = 6 -elem_map(3) = 8 -elem_map(4) = 10 -elem_map(5) = 12 -elem_map(6) = 14 -elem_map(7) = 16 +elem_map(0) = 2 +elem_map(1) = 4 +elem_map(2) = 6 +elem_map(3) = 8 +elem_map(4) = 10 +elem_map(5) = 12 +elem_map(6) = 14 +elem_map(7) = 16 after ex_inquire, error = 0 @@ -150,34 +150,34 @@ after ex_get_prop_array, error = 0 after ex_get_node_map, error = 0 node map id = 333 -node_map(0) = 3 -node_map(1) = 6 -node_map(2) = 9 -node_map(3) = 12 -node_map(4) = 15 -node_map(5) = 18 -node_map(6) = 21 -node_map(7) = 24 -node_map(8) = 27 -node_map(9) = 30 -node_map(10) = 33 -node_map(11) = 36 -node_map(12) = 39 -node_map(13) = 42 -node_map(14) = 45 -node_map(15) = 48 -node_map(16) = 51 -node_map(17) = 54 -node_map(18) = 57 -node_map(19) = 60 -node_map(20) = 63 -node_map(21) = 66 -node_map(22) = 69 -node_map(23) = 72 -node_map(24) = 75 -node_map(25) = 78 -node_map(26) = 81 -node_map(27) = 84 +node_map(0) = 3 +node_map(1) = 6 +node_map(2) = 9 +node_map(3) = 12 +node_map(4) = 15 +node_map(5) = 18 +node_map(6) = 21 +node_map(7) = 24 +node_map(8) = 27 +node_map(9) = 30 +node_map(10) = 33 +node_map(11) = 36 +node_map(12) = 39 +node_map(13) = 42 +node_map(14) = 45 +node_map(15) = 48 +node_map(16) = 51 +node_map(17) = 54 +node_map(18) = 57 +node_map(19) = 60 +node_map(20) = 63 +node_map(21) = 66 +node_map(22) = 69 +node_map(23) = 72 +node_map(24) = 75 +node_map(25) = 78 +node_map(26) = 81 +node_map(27) = 84 after ex_inquire, error = 0 @@ -363,7 +363,7 @@ after ex_get_node_set_ids, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after ex_get_node_set, error = 0 @@ -385,7 +385,7 @@ dist factors for node set 20 after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after ex_get_node_set, error = 0 @@ -421,16 +421,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -439,7 +439,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -637,37 +637,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 2 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 15 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 3 3 1 @@ -685,7 +685,7 @@ elem_list = 5 6 7 -side_list = +side_list = 6 4 4 @@ -703,7 +703,7 @@ side_list = 4 1 1 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -714,7 +714,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT1' 'testwt1' '03/16/94' @@ -727,7 +727,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' 'This is the second information record.' 'This is the third information record.' diff --git a/packages/seacas/libraries/exodus/test/testrd_nc.dmp b/packages/seacas/libraries/exodus/test/testrd_nc.dmp index e50ee4c6b806..f07948061224 100644 --- a/packages/seacas/libraries/exodus/test/testrd_nc.dmp +++ b/packages/seacas/libraries/exodus/test/testrd_nc.dmp @@ -14,7 +14,7 @@ num_side_sets = 5 after ex_get_coord, error = 0 after ex_get_coord (x), error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -50,7 +50,7 @@ x coords = 10.0 after ex_get_coord (y), error = 0 -y coords = +y coords = 0.0 0.0 1.0 @@ -86,7 +86,7 @@ y coords = 10.0 after ex_get_coord (z), error = 0 -z coords = +z coords = 0.0 0.0 0.0 @@ -126,13 +126,13 @@ x coord name = 'xcoor' y coord name = 'ycoor' after ex_get_id_map, error = 0 -elem_map(0) = 10 -elem_map(1) = 20 -elem_map(2) = 30 -elem_map(3) = 40 -elem_map(4) = 50 -elem_map(5) = 60 -elem_map(6) = 70 +elem_map(0) = 10 +elem_map(1) = 20 +elem_map(2) = 30 +elem_map(3) = 40 +elem_map(4) = 50 +elem_map(5) = 60 +elem_map(6) = 70 after ex_get_elem_blk_ids, error = 0 @@ -294,7 +294,7 @@ after ex_get_node_set_ids, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after ex_get_node_set, error = 0 @@ -316,7 +316,7 @@ dist factors for node set 20 after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after ex_get_node_set, error = 0 @@ -352,16 +352,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -370,7 +370,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -636,37 +636,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 8 10 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 19 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -696,7 +696,7 @@ elem_list = 7 7 7 -side_list = +side_list = 4 2 2 @@ -726,7 +726,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -737,7 +737,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -750,7 +750,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' 'This info record is exactly 80 characters long. last character should be pipe |' diff --git a/packages/seacas/libraries/exodus/test/testrd_ss.dmp b/packages/seacas/libraries/exodus/test/testrd_ss.dmp index c40e1b94e4b4..a44a2841e821 100644 --- a/packages/seacas/libraries/exodus/test/testrd_ss.dmp +++ b/packages/seacas/libraries/exodus/test/testrd_ss.dmp @@ -411,7 +411,7 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 @@ -421,7 +421,7 @@ ids = 36 37 38 -num_elem_per_set = +num_elem_per_set = 0 0 2 @@ -431,7 +431,7 @@ num_elem_per_set = 2 4 2 -num_dist_per_set = +num_dist_per_set = 0 0 4 @@ -441,7 +441,7 @@ num_dist_per_set = 0 0 0 -elem_ind = +elem_ind = 0 0 0 @@ -451,7 +451,7 @@ elem_ind = 15 17 21 -dist_ind = +dist_ind = 0 0 0 @@ -461,7 +461,7 @@ dist_ind = 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -485,7 +485,7 @@ elem_list = 7 8 8 -side_list = +side_list = 4 2 2 @@ -509,7 +509,7 @@ side_list = 6 1 3 -dist_fact = +dist_fact = 30.000 30.100 30.200 diff --git a/packages/seacas/libraries/exodus/test/testrd_zeroe.dmp b/packages/seacas/libraries/exodus/test/testrd_zeroe.dmp index 41b5261351ab..ea6c7f41d313 100644 --- a/packages/seacas/libraries/exodus/test/testrd_zeroe.dmp +++ b/packages/seacas/libraries/exodus/test/testrd_zeroe.dmp @@ -13,7 +13,7 @@ num_side_sets = 0 after ex_inquire, error = 0 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -47,7 +47,7 @@ x coords = 0.0 10.0 10.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -81,7 +81,7 @@ y coords = 0.0 0.0 10.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -131,7 +131,7 @@ after ex_get_names, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 name = '' @@ -156,7 +156,7 @@ num nodeset attributes for nodeset 20 = 0 after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 name = '' @@ -193,16 +193,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -211,7 +211,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -222,7 +222,7 @@ dist_fact = 3.100 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -235,7 +235,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrd_zeron.dmp b/packages/seacas/libraries/exodus/test/testrd_zeron.dmp index 217fd539e4fc..2a2409974c69 100644 --- a/packages/seacas/libraries/exodus/test/testrd_zeron.dmp +++ b/packages/seacas/libraries/exodus/test/testrd_zeron.dmp @@ -13,7 +13,7 @@ num_side_sets = 0 after ex_inquire, error = 0 after ex_get_coord, error = 0 -x coords = +x coords = after ex_get_coord_names, error = 0 x coord name = 'xcoor' @@ -23,7 +23,7 @@ num nodal attributes = 0 after ex_get_id_map, error = 0 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWT' 'testwt' '07/07/93' @@ -36,7 +36,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' '' '' diff --git a/packages/seacas/libraries/exodus/test/testrdd.dmp b/packages/seacas/libraries/exodus/test/testrdd.dmp index e95e8f8cdaa7..fc5fbfcb2dff 100644 --- a/packages/seacas/libraries/exodus/test/testrdd.dmp +++ b/packages/seacas/libraries/exodus/test/testrdd.dmp @@ -13,7 +13,7 @@ num_node_sets = 2 num_side_sets = 5 after ex_get_coord, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -40,7 +40,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -67,7 +67,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -100,11 +100,11 @@ x coord name = 'xcoor' y coord name = 'ycoor' after ex_get_id_map, error = 0 -elem_map(0) = 1 -elem_map(1) = 2 -elem_map(2) = 3 -elem_map(3) = 4 -elem_map(4) = 5 +elem_map(0) = 1 +elem_map(1) = 2 +elem_map(2) = 3 +elem_map(3) = 4 +elem_map(4) = 5 after ex_get_elem_blk_ids, error = 0 @@ -223,7 +223,7 @@ after ex_get_node_set_ids, error = 0 after ex_get_node_set_param, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after ex_get_node_set, error = 0 @@ -245,7 +245,7 @@ dist factors for node set 20 after ex_get_node_set_param, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after ex_get_node_set, error = 0 @@ -281,16 +281,16 @@ after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0 after ex_get_concat_node_sets, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 0 5 -node_list = +node_list = 10 11 12 @@ -299,7 +299,7 @@ node_list = 20 21 22 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -519,37 +519,37 @@ after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0 after ex_get_concat_side_sets, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 5 -num_dist_per_set = +num_dist_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 0 2 4 11 15 -dist_ind = +dist_ind = 0 4 8 8 8 -elem_list = +elem_list = 2 2 1 @@ -570,7 +570,7 @@ elem_list = 5 5 5 -side_list = +side_list = 4 2 2 @@ -591,7 +591,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -602,7 +602,7 @@ dist_fact = 31.300 after ex_get_qa, error = 0 -QA records = +QA records = 'TESTWTD' 'testwtd' '07/07/93' @@ -615,7 +615,7 @@ QA records = after ex_inquire, error = 0 after ex_get_info, error = 0 -info records = +info records = 'This is the first information record.' 'This is the second information record.' 'This is the third information record.' diff --git a/packages/seacas/libraries/exodus/test/testwt-blob.dmp b/packages/seacas/libraries/exodus/test/testwt-blob.dmp index 6d32177ea075..4e9cf1a09b72 100644 --- a/packages/seacas/libraries/exodus/test/testwt-blob.dmp +++ b/packages/seacas/libraries/exodus/test/testwt-blob.dmp @@ -107,62 +107,62 @@ data: 0.16, 1.16, 2.16, 3.16, 4.16, 5.16, 6.16, 7.16, 8.16, 9.16 ; vals_blob_var1blob200 = - 0.03, 1.03, 2.03, 3.03, 4.03, 5.03, 6.03, 7.03, 8.03, 9.03, 10.03, 11.03, + 0.03, 1.03, 2.03, 3.03, 4.03, 5.03, 6.03, 7.03, 8.03, 9.03, 10.03, 11.03, 12.03, 13.03, 14.03, 15.03, 16.03, 17.03, 18.03, 19.03, - 0.05, 1.05, 2.05, 3.05, 4.05, 5.05, 6.05, 7.05, 8.05, 9.05, 10.05, 11.05, + 0.05, 1.05, 2.05, 3.05, 4.05, 5.05, 6.05, 7.05, 8.05, 9.05, 10.05, 11.05, 12.05, 13.05, 14.05, 15.05, 16.05, 17.05, 18.05, 19.05, - 0.07, 1.07, 2.07, 3.07, 4.07, 5.07, 6.07, 7.07, 8.07, 9.07, 10.07, 11.07, + 0.07, 1.07, 2.07, 3.07, 4.07, 5.07, 6.07, 7.07, 8.07, 9.07, 10.07, 11.07, 12.07, 13.07, 14.07, 15.07, 16.07, 17.07, 18.07, 19.07, - 0.09, 1.09, 2.09, 3.09, 4.09, 5.09, 6.09, 7.09, 8.09, 9.09, 10.09, 11.09, + 0.09, 1.09, 2.09, 3.09, 4.09, 5.09, 6.09, 7.09, 8.09, 9.09, 10.09, 11.09, 12.09, 13.09, 14.09, 15.09, 16.09, 17.09, 18.09, 19.09 ; vals_blob_var2blob200 = - 0.04, 1.04, 2.04, 3.04, 4.04, 5.04, 6.04, 7.04, 8.04, 9.04, 10.04, 11.04, + 0.04, 1.04, 2.04, 3.04, 4.04, 5.04, 6.04, 7.04, 8.04, 9.04, 10.04, 11.04, 12.04, 13.04, 14.04, 15.04, 16.04, 17.04, 18.04, 19.04, - 0.07, 1.07, 2.07, 3.07, 4.07, 5.07, 6.07, 7.07, 8.07, 9.07, 10.07, 11.07, + 0.07, 1.07, 2.07, 3.07, 4.07, 5.07, 6.07, 7.07, 8.07, 9.07, 10.07, 11.07, 12.07, 13.07, 14.07, 15.07, 16.07, 17.07, 18.07, 19.07, - 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1, + 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1, 14.1, 15.1, 16.1, 17.1, 18.1, 19.1, - 0.13, 1.13, 2.13, 3.13, 4.13, 5.13, 6.13, 7.13, 8.13, 9.13, 10.13, 11.13, + 0.13, 1.13, 2.13, 3.13, 4.13, 5.13, 6.13, 7.13, 8.13, 9.13, 10.13, 11.13, 12.13, 13.13, 14.13, 15.13, 16.13, 17.13, 18.13, 19.13 ; vals_blob_var3blob200 = - 0.05, 1.05, 2.05, 3.05, 4.05, 5.05, 6.05, 7.05, 8.05, 9.05, 10.05, 11.05, + 0.05, 1.05, 2.05, 3.05, 4.05, 5.05, 6.05, 7.05, 8.05, 9.05, 10.05, 11.05, 12.05, 13.05, 14.05, 15.05, 16.05, 17.05, 18.05, 19.05, - 0.09, 1.09, 2.09, 3.09, 4.09, 5.09, 6.09, 7.09, 8.09, 9.09, 10.09, 11.09, + 0.09, 1.09, 2.09, 3.09, 4.09, 5.09, 6.09, 7.09, 8.09, 9.09, 10.09, 11.09, 12.09, 13.09, 14.09, 15.09, 16.09, 17.09, 18.09, 19.09, - 0.13, 1.13, 2.13, 3.13, 4.13, 5.13, 6.13, 7.13, 8.13, 9.13, 10.13, 11.13, + 0.13, 1.13, 2.13, 3.13, 4.13, 5.13, 6.13, 7.13, 8.13, 9.13, 10.13, 11.13, 12.13, 13.13, 14.13, 15.13, 16.13, 17.13, 18.13, 19.13, - 0.17, 1.17, 2.17, 3.17, 4.17, 5.17, 6.17, 7.17, 8.17, 9.17, 10.17, 11.17, + 0.17, 1.17, 2.17, 3.17, 4.17, 5.17, 6.17, 7.17, 8.17, 9.17, 10.17, 11.17, 12.17, 13.17, 14.17, 15.17, 16.17, 17.17, 18.17, 19.17 ; vals_blob_var1blob300 = - 0.04, 1.04, 2.04, 3.04, 4.04, 5.04, 6.04, 7.04, 8.04, 9.04, 10.04, 11.04, + 0.04, 1.04, 2.04, 3.04, 4.04, 5.04, 6.04, 7.04, 8.04, 9.04, 10.04, 11.04, 12.04, 13.04, 14.04, - 0.06, 1.06, 2.06, 3.06, 4.06, 5.06, 6.06, 7.06, 8.06, 9.06, 10.06, 11.06, + 0.06, 1.06, 2.06, 3.06, 4.06, 5.06, 6.06, 7.06, 8.06, 9.06, 10.06, 11.06, 12.06, 13.06, 14.06, - 0.08, 1.08, 2.08, 3.08, 4.08, 5.08, 6.08, 7.08, 8.08, 9.08, 10.08, 11.08, + 0.08, 1.08, 2.08, 3.08, 4.08, 5.08, 6.08, 7.08, 8.08, 9.08, 10.08, 11.08, 12.08, 13.08, 14.08, - 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1, + 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1, 14.1 ; vals_blob_var2blob300 = - 0.05, 1.05, 2.05, 3.05, 4.05, 5.05, 6.05, 7.05, 8.05, 9.05, 10.05, 11.05, + 0.05, 1.05, 2.05, 3.05, 4.05, 5.05, 6.05, 7.05, 8.05, 9.05, 10.05, 11.05, 12.05, 13.05, 14.05, - 0.08, 1.08, 2.08, 3.08, 4.08, 5.08, 6.08, 7.08, 8.08, 9.08, 10.08, 11.08, + 0.08, 1.08, 2.08, 3.08, 4.08, 5.08, 6.08, 7.08, 8.08, 9.08, 10.08, 11.08, 12.08, 13.08, 14.08, - 0.11, 1.11, 2.11, 3.11, 4.11, 5.11, 6.11, 7.11, 8.11, 9.11, 10.11, 11.11, + 0.11, 1.11, 2.11, 3.11, 4.11, 5.11, 6.11, 7.11, 8.11, 9.11, 10.11, 11.11, 12.11, 13.11, 14.11, - 0.14, 1.14, 2.14, 3.14, 4.14, 5.14, 6.14, 7.14, 8.14, 9.14, 10.14, 11.14, + 0.14, 1.14, 2.14, 3.14, 4.14, 5.14, 6.14, 7.14, 8.14, 9.14, 10.14, 11.14, 12.14, 13.14, 14.14 ; vals_blob_var3blob300 = - 0.06, 1.06, 2.06, 3.06, 4.06, 5.06, 6.06, 7.06, 8.06, 9.06, 10.06, 11.06, + 0.06, 1.06, 2.06, 3.06, 4.06, 5.06, 6.06, 7.06, 8.06, 9.06, 10.06, 11.06, 12.06, 13.06, 14.06, - 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1, + 0.1, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1, 12.1, 13.1, 14.1, - 0.14, 1.14, 2.14, 3.14, 4.14, 5.14, 6.14, 7.14, 8.14, 9.14, 10.14, 11.14, + 0.14, 1.14, 2.14, 3.14, 4.14, 5.14, 6.14, 7.14, 8.14, 9.14, 10.14, 11.14, 12.14, 13.14, 14.14, - 0.18, 1.18, 2.18, 3.18, 4.18, 5.18, 6.18, 7.18, 8.18, 9.18, 10.18, 11.18, + 0.18, 1.18, 2.18, 3.18, 4.18, 5.18, 6.18, 7.18, 8.18, 9.18, 10.18, 11.18, 12.18, 13.18, 14.18 ; } diff --git a/packages/seacas/libraries/exodus/test/testwt-field-metadata.c b/packages/seacas/libraries/exodus/test/testwt-field-metadata.c index 642aa5ba5fb3..25ef4cd60c5e 100644 --- a/packages/seacas/libraries/exodus/test/testwt-field-metadata.c +++ b/packages/seacas/libraries/exodus/test/testwt-field-metadata.c @@ -82,7 +82,7 @@ int main(int argc, char **argv) /* Write element block names */ for (int i = 0; i < num_elem_blk; i++) { char block_names[32]; - sprintf(block_names, "block_%c", i + 'A'); + snprintf(block_names, 32, "block_%c", i + 'A'); EXCHECK(ex_put_name(exoid, EX_ELEM_BLOCK, blocks[i].id, block_names)); } @@ -131,7 +131,7 @@ int main(int argc, char **argv) int cardinality = field.cardinality[0] != 0 ? field.cardinality[0] : ex_field_cardinality(field.type[0]); for (int i = 0; i < cardinality; i++) { - const char *name = ex_component_field_name(&field, (int[]){i + 1}); + const char *name = ex_component_field_name(&field, (int[]){i + 1, 0}); assert(strcmp(var_names[vname++], name) == 0); } } @@ -152,7 +152,7 @@ int main(int argc, char **argv) int cardinality = field.cardinality[0] != 0 ? field.cardinality[0] : ex_field_cardinality(field.type[0]); for (int i = 0; i < cardinality; i++) { - const char *name = ex_component_field_name(&field, (int[]){i + 1}); + const char *name = ex_component_field_name(&field, (int[]){i + 1, 0}); assert(strcmp(var_names[vname++], name) == 0); } } diff --git a/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp b/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp index 37e75ddeb6e9..9f353a79fa87 100644 --- a/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp +++ b/packages/seacas/libraries/exodus/test/testwt-field-metadata.dmp @@ -13,16 +13,6 @@ :Basis@TESTING_SECOND_BASIS@subc_ordinal = 0, 1, 2 ; :Basis@TESTING_SECOND_BASIS@xi = -1., 1., 1. ; :Basis@TESTING_SECOND_BASIS@zeta = 1., -1., 1. ; - :Quad@1x2x1@cardinality = 2 ; - :Quad@1x2x1@eta = 0.5, -0.5 ; - :Quad@1x2x1@weight = 1., 1. ; - :Quad@1x2x1@xi = -0.5, 0.5 ; - :Quad@1x2x1@zeta = -0.5, 0.5 ; - :Quad@2x2x2@cardinality = 8 ; - :Quad@2x2x2@eta = -0.57735, -0.57735, 0.57735, 0.57735, -0.57735, -0.57735, 0.57735, 0.57735 ; - :Quad@2x2x2@weight = 1., 1., 1., 1., 1., 1., 1., 1. ; - :Quad@2x2x2@xi = -0.57735, 0.57735, -0.57735, 0.57735, -0.57735, 0.57735, -0.57735, 0.57735 ; - :Quad@2x2x2@zeta = -0.57735, -0.57735, -0.57735, -0.57735, 0.57735, 0.57735, 0.57735, 0.57735 ; connect1:Field@Disp@separator = "" ; connect1:Field@Disp@type = 8 ; connect1:Field@Velocity@separator = "%" ; @@ -50,3 +40,13 @@ "Curl@6", "Curl@7", "Curl@8", + :Quad@1x2x1@cardinality = 2 ; + :Quad@1x2x1@eta = 0.5, -0.5 ; + :Quad@1x2x1@weight = 1., 1. ; + :Quad@1x2x1@xi = -0.5, 0.5 ; + :Quad@1x2x1@zeta = -0.5, 0.5 ; + :Quad@2x2x2@cardinality = 8 ; + :Quad@2x2x2@eta = -0.57735, -0.57735, 0.57735, 0.57735, -0.57735, -0.57735, 0.57735, 0.57735 ; + :Quad@2x2x2@weight = 1., 1., 1., 1., 1., 1., 1., 1. ; + :Quad@2x2x2@xi = -0.57735, 0.57735, -0.57735, 0.57735, -0.57735, 0.57735, -0.57735, 0.57735 ; + :Quad@2x2x2@zeta = -0.57735, -0.57735, -0.57735, -0.57735, 0.57735, 0.57735, 0.57735, 0.57735 ; diff --git a/packages/seacas/libraries/exodus/test/update_all_tests b/packages/seacas/libraries/exodus/test/update_all_tests index 5a8019dd8947..dc84ef8ee70a 100644 --- a/packages/seacas/libraries/exodus/test/update_all_tests +++ b/packages/seacas/libraries/exodus/test/update_all_tests @@ -1,7 +1,7 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. -# +# # See packages/seacas/LICENSE for details # script to run all tests and compare them to saved dump files. @@ -24,7 +24,7 @@ ${NCDUMP} -d5,5 test.exo | grep -v version | grep -v int64_status| grep -v _Fill echo "testrd - single precision read test..." echo "begin testrd" >> test.output -${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd.dmp +${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd.dmp echo "end testrd" >> test.output echo "testrdv - single precision read test with varid..." @@ -54,7 +54,7 @@ echo "testcp_nl - normal_model to large_model single precision copy test..." echo "begin testcp_nl" >> test.output ${PREFIX} ${SRCDIR}/testcp_nl >> test.output echo "end testcp_nl" >> test.output -${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | grep -v int64_status| grep -v _FillValue > ${SRCDIR}/testcp_nl.dmp +${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | grep -v int64_status| grep -v _FillValue > ${SRCDIR}/testcp_nl.dmp echo "testwt_clb - single precision write test using concatenated puts..." echo "begin testwt_clb" >> test.output @@ -90,13 +90,13 @@ echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${SRCDIR}/testwt1 >> test.output echo "end testwt1" >> test.output -${NCDUMP} -d5,5 test.exo | grep -v version | grep -v int64_status| grep -v _FillValue > ${SRCDIR}/test1.dmp +${NCDUMP} -d5,5 test.exo | grep -v version | grep -v int64_status| grep -v _FillValue > ${SRCDIR}/test1.dmp echo "testrd1 - single precision read test of a file with several side sets..." echo "testrd1 ... [Expect file create failure error, NOCLOBBER]" echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]" echo "begin testrd1" >> test.output -${PREFIX} ${SRCDIR}/testrd1 | grep -v version > ${SRCDIR}/testrd1.dmp +${PREFIX} ${SRCDIR}/testrd1 | grep -v version > ${SRCDIR}/testrd1.dmp echo "end testrd1" >> test.output echo "testwt_ss - write files to test side sets..." @@ -155,7 +155,7 @@ ${NCDUMP} -d5,5 test.exo | grep -v version | grep -v int64_status| grep -v _Fill echo "testrd - read test of file with zero elements..." echo "begin testrd zero elements" >> test.output -${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd_zeroe.dmp +${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd_zeroe.dmp echo "end testrd zero elements" >> test.output echo "testwt-one-attrib - read/write test of element attributes - read one at a time..." @@ -193,7 +193,7 @@ ${NCDUMP} -d5,5 test.exo | grep -v version | grep -v int64_status| grep -v _Fill echo "testrd - read long name file truncating to 32 characters on read..." echo "begin testrd (truncate)" >> test.output -${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd-nm32.dmp +${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd-nm32.dmp echo "end testrd (truncate)" >> test.output echo "testrd-long-name - read long name file..." diff --git a/packages/seacas/libraries/exodus_for/CMakeLists.txt b/packages/seacas/libraries/exodus_for/CMakeLists.txt index 2ff709977506..7578f78ea8be 100644 --- a/packages/seacas/libraries/exodus_for/CMakeLists.txt +++ b/packages/seacas/libraries/exodus_for/CMakeLists.txt @@ -37,11 +37,11 @@ if (SEACASExodus_ENABLE_STATIC) set_target_properties(exodus_for_static PROPERTIES OUTPUT_NAME exodus_for) # This keeps the library out of the `all_libs` targets... set_target_properties(exodus_for_static PROPERTIES TRIBITS_TESTONLY_LIB TRUE) - INSTALL(TARGETS exodus_for_static DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + INSTALL(TARGETS exodus_for_static DESTINATION ${CMAKE_INSTALL_LIBDIR}) # For backwards compatibility, the Fortran exodus library was called libexoIIv2for.a # Create a symbolic link from libexodus_for.a to libexoIIv2for.a -- do only for static lib - InstallSymLink(libexodus_for.a ${CMAKE_INSTALL_PREFIX}/lib/libexoIIv2for.a) + InstallSymLink(libexodus_for.a ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libexoIIv2for.a) endif() TRIBITS_ADD_TEST_DIRECTORIES(test) diff --git a/packages/seacas/libraries/exodus_for/src/addrwrap.F b/packages/seacas/libraries/exodus_for/src/addrwrap.F index 4ba73d1376ad..d5ae5c7f3487 100644 --- a/packages/seacas/libraries/exodus_for/src/addrwrap.F +++ b/packages/seacas/libraries/exodus_for/src/addrwrap.F @@ -1,4 +1,4 @@ -C Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions +C Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C @@ -1204,7 +1204,7 @@ SUBROUTINE EXGSSC (IDEXO, IDESS, INCNT, IERR) IDEXO4 = IDEXO CALL EXGSSC4 (IDEXO4, IDESS, INCNT, IERR4) IERR = IERR4 - + END SUBROUTINE EXGCSSC (IDEXO, INCNT, IERR) diff --git a/packages/seacas/libraries/exodus_for/src/exo_jack.c b/packages/seacas/libraries/exodus_for/src/exo_jack.c index c0fea886a7b4..b08bdb143d62 100644 --- a/packages/seacas/libraries/exodus_for/src/exo_jack.c +++ b/packages/seacas/libraries/exodus_for/src/exo_jack.c @@ -79,6 +79,9 @@ static int *i8i4(int64_t size, const int64_t *i8) { int *i4 = malloc(size * sizeof(int)); + if (i4 == NULL) { + return NULL; + } for (int64_t i = 0; i < size; i++) { i4[i] = i8[i]; } @@ -245,6 +248,10 @@ void F2C(expini, EXPINI)(int *idexo, char *title, void_int *num_dim, void_int *n slen = titlelen; } char *name = malloc((slen + 1) * sizeof(char)); + if (name == NULL) { + *ierr = EX_MEMFAIL; + return; + } (void)ex_fstrncpy(name, title, slen); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { @@ -866,6 +873,10 @@ void F2C(expecpp, EXPECPP)(int *idexo, int *obj_type, entity_id *elem_blk_id, in return; } int *counts4 = i8i4(block.num_entry, counts); + if (counts4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } *ierr = ex_put_entity_count_per_polyhedra(*idexo, (ex_entity_type)*obj_type, *elem_blk_id, counts4); free(counts4); @@ -2040,7 +2051,11 @@ void F2C(exgvan, EXGVAN)(int *idexo, char *var_type, int *num_vars, char *var_na void F2C(expvtt, EXPVTT)(int *idexo, int *num_entity, int *num_var, int64_t *var_tab, int *ierr) { int *var_tab4 = i8i4((int64_t)(*num_entity) * (int64_t)(*num_var), var_tab); - *ierr = ex_put_truth_table(*idexo, EX_ELEM_BLOCK, *num_entity, *num_var, var_tab4); + if (var_tab4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } + *ierr = ex_put_truth_table(*idexo, EX_ELEM_BLOCK, *num_entity, *num_var, var_tab4); free(var_tab4); } #else @@ -2058,7 +2073,11 @@ void F2C(expvtt, EXPVTT)(int *idexo, int *num_entity, int *num_var, int *var_tab void F2C(expnstt, EXPNSTT)(int *idexo, int *num_entity, int *num_var, int64_t *var_tab, int *ierr) { int *var_tab4 = i8i4((int64_t)(*num_entity) * (int64_t)(*num_var), var_tab); - *ierr = ex_put_truth_table(*idexo, EX_NODE_SET, *num_entity, *num_var, var_tab4); + if (var_tab4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } + *ierr = ex_put_truth_table(*idexo, EX_NODE_SET, *num_entity, *num_var, var_tab4); free(var_tab4); } #else @@ -2076,7 +2095,11 @@ void F2C(expnstt, EXPNSTT)(int *idexo, int *num_entity, int *num_var, int *var_t void F2C(expsstt, EXPSSTT)(int *idexo, int *num_entity, int *num_var, int64_t *var_tab, int *ierr) { int *var_tab4 = i8i4((int64_t)(*num_entity) * (int64_t)(*num_var), var_tab); - *ierr = ex_put_truth_table(*idexo, EX_SIDE_SET, *num_entity, *num_var, var_tab4); + if (var_tab4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } + *ierr = ex_put_truth_table(*idexo, EX_SIDE_SET, *num_entity, *num_var, var_tab4); free(var_tab4); } #else @@ -2094,7 +2117,11 @@ void F2C(expsstt, EXPSSTT)(int *idexo, int *num_entity, int *num_var, int *var_t void F2C(exgvtt, EXGVTT)(int *idexo, int *num_entity, int *num_var, int64_t *var_tab, int *ierr) { int *var_tab4 = malloc(*num_entity * *num_var * sizeof(int)); - *ierr = ex_get_truth_table(*idexo, EX_ELEM_BLOCK, *num_entity, *num_var, var_tab4); + if (var_tab4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } + *ierr = ex_get_truth_table(*idexo, EX_ELEM_BLOCK, *num_entity, *num_var, var_tab4); i4i8((int64_t)(*num_entity) * (int64_t)(*num_var), var_tab4, var_tab); free(var_tab4); #else @@ -2112,7 +2139,11 @@ void F2C(exgvtt, EXGVTT)(int *idexo, int *num_entity, int *num_var, int *var_tab void F2C(exgnstt, EXGNSTT)(int *idexo, int *num_entity, int *num_var, int64_t *var_tab, int *ierr) { int *var_tab4 = malloc(*num_entity * *num_var * sizeof(int)); - *ierr = ex_get_truth_table(*idexo, EX_NODE_SET, *num_entity, *num_var, var_tab4); + if (var_tab4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } + *ierr = ex_get_truth_table(*idexo, EX_NODE_SET, *num_entity, *num_var, var_tab4); i4i8((int64_t)(*num_entity) * (int64_t)(*num_var), var_tab4, var_tab); free(var_tab4); } @@ -2131,7 +2162,11 @@ void F2C(exgnstt, EXGNSTT)(int *idexo, int *num_entity, int *num_var, int *var_t void F2C(exgsstt, EXGSSTT)(int *idexo, int *num_entity, int *num_var, int64_t *var_tab, int *ierr) { int *var_tab4 = malloc(*num_entity * *num_var * sizeof(int)); - *ierr = ex_get_truth_table(*idexo, EX_SIDE_SET, *num_entity, *num_var, var_tab4); + if (var_tab4 == NULL) { + *ierr = EX_MEMFAIL; + return; + } + *ierr = ex_get_truth_table(*idexo, EX_SIDE_SET, *num_entity, *num_var, var_tab4); i4i8((int64_t)(*num_entity) * (int64_t)(*num_var), var_tab4, var_tab); free(var_tab4); } @@ -2443,6 +2478,10 @@ void F2C(exgssc, EXGSSC)(int *idexo, entity_id *side_set_id, int64_t *side_set_n int64_t num_df_in_set = 0; ex_get_set_param(*idexo, EX_SIDE_SET, *side_set_id, &num_sides_in_set, &num_df_in_set); int *cnt_list = malloc(num_sides_in_set * sizeof(int)); + if (cnt_list == NULL) { + *ierr = EX_MEMFAIL; + return; + } *ierr = ex_get_side_set_node_count(*idexo, *side_set_id, cnt_list); @@ -2465,6 +2504,10 @@ void F2C(exgcssc, EXGCSSC)(int *idexo, int64_t *side_set_node_cnt_list, int *ier { int count = ex_inquire_int(*idexo, EX_INQ_SS_ELEM_LEN); int *cnt_list = malloc(count * sizeof(int)); + if (cnt_list == NULL) { + *ierr = EX_MEMFAIL; + return; + } *ierr = ex_get_concat_side_set_node_count(*idexo, cnt_list); @@ -2877,6 +2920,10 @@ void F2C(exgii, EXGII)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int } char *file_type = (char *)malloc((slen + 1) * sizeof(char)); + if (file_type == NULL) { + *ierr = EX_MEMFAIL; + return; + } if ((*ierr = ex_get_init_info(*idne, nproc, nproc_in_f, file_type)) != 0) { char errmsg[MAX_ERR_LENGTH]; @@ -2914,6 +2961,10 @@ void F2C(expii, EXPII)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int } char *file_type = (char *)malloc((slen + 1) * sizeof(char)); + if (file_type == NULL) { + *ierr = EX_MEMFAIL; + return; + } ex_fstrncpy(file_type, ftype, slen); @@ -3528,6 +3579,10 @@ void F2C(exgelt, EXGELT)(int *idne, entity_id *elem_blk_id, char *elem_type, int } char *etype = (char *)malloc((slen + 1) * sizeof(char)); + if (etype == NULL) { + *ierr = EX_MEMFAIL; + return; + } if ((*ierr = ex_get_elem_type(*idne, *elem_blk_id, etype)) != 0) { char errmsg[MAX_ERR_LENGTH]; diff --git a/packages/seacas/libraries/exodus_for/test/test-nsided.dmp b/packages/seacas/libraries/exodus_for/test/test-nsided.dmp index 011028907885..d2a7255b5fd0 100644 --- a/packages/seacas/libraries/exodus_for/test/test-nsided.dmp +++ b/packages/seacas/libraries/exodus_for/test/test-nsided.dmp @@ -49,13 +49,13 @@ data: eb_prop1 = 10 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ; eb_names = @@ -68,7 +68,7 @@ data: elem_map = 1, 2, 3, 4, 5, 6, 7 ; - connect1 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + connect1 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 17, 18, 19, 20, 27, 28, 30, 29, 31, 32, 33 ; ebepecnt1 = 4, 4, 8, 4, 6, 8, 3 ; @@ -87,8 +87,8 @@ data: "This is the second information record.", "This is the third information record." ; - frame_coordinates = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2, - 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, + frame_coordinates = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2, + 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9 ; frame_ids = 1, 11, 111 ; diff --git a/packages/seacas/libraries/exodus_for/test/test.dmp b/packages/seacas/libraries/exodus_for/test/test.dmp index a8fa396617fe..143456acd7dd 100644 --- a/packages/seacas/libraries/exodus_for/test/test.dmp +++ b/packages/seacas/libraries/exodus_for/test/test.dmp @@ -152,13 +152,13 @@ data: ss_prop1 = 30, 31, 32, 33, 34 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0 ; eb_names = @@ -307,55 +307,55 @@ data: "nod_var1" ; vals_nod_var1 = - 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, - 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, + 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, + 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, - 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, + 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, 1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52, - 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, - 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, + 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, + 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, 1.75, 1.78, - 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, + 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, 1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04, - 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, + 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, - 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, + 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56, - 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, - 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, + 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, + 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, 2.75, 2.82, - 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, + 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, 2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08, - 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, - 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, + 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, + 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = - 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, - 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, + 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, + 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, - 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, + 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, - 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, - 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, + 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, + 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, - 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, + 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, - 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, + 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, - 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, + 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, - 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, - 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, + 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, + 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, - 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, + 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, - 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, - 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, + 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, + 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, + 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ; name_elem_var = diff --git a/packages/seacas/libraries/exodus_for/test/test1.dmp b/packages/seacas/libraries/exodus_for/test/test1.dmp index c99fea1a4770..c800bedb274f 100644 --- a/packages/seacas/libraries/exodus_for/test/test1.dmp +++ b/packages/seacas/libraries/exodus_for/test/test1.dmp @@ -186,13 +186,13 @@ data: ss_prop1 = 30, 31, 32, 33, 34 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 100, 50, 3, 6, 0, 3, 6, 0 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 100, 50, 0, 0, 0, 2, 2, 2 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 0, 20, 6, 0, 0, 6, 2, 0 ; eb_names = @@ -225,7 +225,7 @@ data: nmap_names = "" ; - node_map1 = 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, + node_map1 = 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84 ; em_prop1 = 111, 222 ; @@ -399,65 +399,65 @@ data: "nod_var1" ; vals_nod_var1 = - 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, - 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, + 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, + 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, - 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, - 1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, + 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, + 1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52, 1.54, 1.56, - 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, - 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, + 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, + 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, 1.75, 1.78, 1.81, 1.84, - 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, - 1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04, + 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, + 1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04, 2.08, 2.12, - 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, - 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, + 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, + 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, - 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, - 1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, + 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, + 1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56, 2.62, 2.68, - 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, - 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, + 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, + 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, 2.75, 2.82, 2.89, 2.96, - 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, - 2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08, + 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, + 2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08, 3.16, 3.24, - 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, - 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, + 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, + 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 3.43, 3.52, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 ; vals_nod_var2 = - 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, - 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, + 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, + 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, - 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, - 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, + 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, + 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.54, 2.56, - 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, - 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, + 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, + 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.81, 2.84, - 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, - 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, + 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, + 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 3.08, 3.12, - 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, - 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, + 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, + 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 3.35, 3.4, - 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, - 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, + 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, + 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 3.62, 3.68, - 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, - 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, + 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, + 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 3.89, 3.96, - 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, - 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, + 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, + 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 4.16, 4.24, - 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, - 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, + 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, + 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 4.43, 4.52, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, + 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 ; name_elem_var = diff --git a/packages/seacas/libraries/exodus_for/test/test2-1.dmp b/packages/seacas/libraries/exodus_for/test/test2-1.dmp index d8bba9eac777..1f8d31729069 100644 --- a/packages/seacas/libraries/exodus_for/test/test2-1.dmp +++ b/packages/seacas/libraries/exodus_for/test/test2-1.dmp @@ -152,13 +152,13 @@ data: ss_prop1 = 30, 31, 32, 33, 34 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0 ; eb_names = @@ -307,55 +307,55 @@ data: "nod_var1" ; vals_nod_var1 = - 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, - 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, + 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, + 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, - 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, + 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, 1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52, - 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, - 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, + 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, + 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, 1.75, 1.78, - 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, + 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, 1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04, - 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, + 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, - 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, + 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56, - 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, - 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, + 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, + 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, 2.75, 2.82, - 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, + 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, 2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08, - 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, - 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, + 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, + 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = - 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, - 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, + 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, + 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, - 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, + 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, - 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, - 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, + 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, + 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, - 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, + 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, - 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, + 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, - 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, + 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, - 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, - 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, + 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, + 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, - 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, + 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, - 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, - 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, + 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, + 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, + 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ; name_elem_var = diff --git a/packages/seacas/libraries/exodus_for/test/test2-2.dmp b/packages/seacas/libraries/exodus_for/test/test2-2.dmp index c039b85015be..38720f6e54d0 100644 --- a/packages/seacas/libraries/exodus_for/test/test2-2.dmp +++ b/packages/seacas/libraries/exodus_for/test/test2-2.dmp @@ -152,13 +152,13 @@ data: ss_prop1 = 30, 31, 32, 33, 34 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0 ; eb_names = @@ -307,55 +307,55 @@ data: "nod_var1" ; vals_nod_var1 = - 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, - 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, + 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, + 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, - 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, + 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26, 1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52, - 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, - 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, + 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36, + 1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72, 1.75, 1.78, - 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, + 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52, 1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04, - 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, + 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65, 1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, - 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, + 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56, - 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, - 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, + 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84, + 1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68, 2.75, 2.82, - 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, + 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04, 2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08, - 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, - 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, + 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, + 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = - 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, - 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, + 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, + 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, - 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, + 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, - 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, - 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, + 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, + 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, - 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, + 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, - 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, + 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, - 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, + 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, - 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, - 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, + 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, + 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, - 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, + 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, - 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, - 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, + 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, + 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, + 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ; name_elem_var = diff --git a/packages/seacas/libraries/exodus_for/test/testcp_ss.dmp b/packages/seacas/libraries/exodus_for/test/testcp_ss.dmp index ed45b8d16e30..8f85a59f23fb 100644 --- a/packages/seacas/libraries/exodus_for/test/testcp_ss.dmp +++ b/packages/seacas/libraries/exodus_for/test/testcp_ss.dmp @@ -118,13 +118,13 @@ data: ss_prop1 = 30, 31, 32, 33, 34 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0 ; eb_names = diff --git a/packages/seacas/libraries/exodus_for/test/testcpnl.dmp b/packages/seacas/libraries/exodus_for/test/testcpnl.dmp index 919ba94a2ac4..e650b1f1916c 100644 --- a/packages/seacas/libraries/exodus_for/test/testcpnl.dmp +++ b/packages/seacas/libraries/exodus_for/test/testcpnl.dmp @@ -118,13 +118,13 @@ data: ss_prop1 = 30, 31, 32, 33, 34 ; - coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, + coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0 ; - coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, + coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2 ; - coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, + coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0 ; eb_names = diff --git a/packages/seacas/libraries/exodus_for/test/testpart.f90 b/packages/seacas/libraries/exodus_for/test/testpart.f90 index 3b97d761260f..39b1a937af85 100644 --- a/packages/seacas/libraries/exodus_for/test/testpart.f90 +++ b/packages/seacas/libraries/exodus_for/test/testpart.f90 @@ -40,7 +40,7 @@ Program TestExoRead_Part call exgnv (exoid, time_step, var_index, num_nodes, var_values,ierr) write (*, '("after exgnv, error = ", i3)' ) ierr write(*,*) var_values - + ! call expnv (exoid, time_step, var_index, num_nodes, var_values,ierr) DeAllocate(var_values) diff --git a/packages/seacas/libraries/exodus_for/test/testrd.dmp b/packages/seacas/libraries/exodus_for/test/testrd.dmp index e29fee84a003..53b30aec7026 100644 --- a/packages/seacas/libraries/exodus_for/test/testrd.dmp +++ b/packages/seacas/libraries/exodus_for/test/testrd.dmp @@ -6,7 +6,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is a test +title = This is a test num_dim = 3 num_nodes = 26 num_elem = 5 @@ -15,7 +15,7 @@ num_node_sets = 2 num_side_sets = 5 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -42,7 +42,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -69,7 +69,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -98,8 +98,8 @@ z coords = 0.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 @@ -112,40 +112,40 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = quad -block name = block_a +element type = quad +block name = block_a num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 11 -element type = quad -block name = block_b +element type = quad +block name = block_b num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 12 -element type = hex -block name = block_c +element type = hex +block name = block_c num_elem_in_block = 1 num_nodes_per_elem = 8 num_attr = 1 after exgelb, error = 0 element block id = 13 -element type = tetra -block name = block_d +element type = tetra +block name = block_d num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 14 -element type = wedge -block name = block_e +element type = wedge +block name = block_e num_elem_in_block = 1 num_nodes_per_elem = 6 num_attr = 1 @@ -210,11 +210,11 @@ connect array for elem block 14 26 after exgnams, error = 0 -element block 1 name: block_a -element block 2 name: block_b -element block 3 name: block_c -element block 4 name: block_d -element block 5 name: block_e +element block 1 name: block_a +element block 2 name: block_b +element block 3 name: block_c +element block 4 name: block_d +element block 5 name: block_e after exgeat, error = 0 @@ -250,7 +250,7 @@ after exgnsi, error = 0 after exgnp, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after exgns, error = 0 @@ -272,7 +272,7 @@ dist factors for node set 20 after exgnp, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after exgns, error = 0 @@ -289,8 +289,8 @@ dist factors for node set 21 3.10 after exgnams, error = 0 -node set 1 name: nodeset_a1 -node set 2 name: nodeset_b2 +node set 1 name: nodeset_a1 +node set 2 name: nodeset_b2 There are 3 properties for each node set after exgpn, error = 0 @@ -308,16 +308,16 @@ after EXNSDF = 8 exinq, error = 0 after exgcns, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 1 6 -node_list = +node_list = 100 101 102 @@ -326,7 +326,7 @@ node_list = 200 201 202 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -527,11 +527,11 @@ node list for side set 34 no dist factors for side set 34 after exgnams, error = 0 -side set 1 name: surf_first -side set 2 name: surf_second -side set 3 name: surf_third -side set 4 name: surf_fourth -side set 5 name: surf_fifth +side set 1 name: surf_first +side set 2 name: surf_second +side set 3 name: surf_third +side set 4 name: surf_fourth +side set 5 name: surf_fifth There are 2 properties for each side set after exgpn, error = 0 @@ -556,37 +556,37 @@ after exinq: EXSSDF = 8, error = 0 after exgcss, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 5 -num_df_per_set = +num_df_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 1 3 5 12 16 -df_ind = +df_ind = 1 5 9 9 9 -elem_list = +elem_list = 2 2 1 @@ -607,7 +607,7 @@ elem_list = 5 5 5 -side_list = +side_list = 4 2 2 @@ -628,7 +628,7 @@ side_list = 3 4 5 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -639,41 +639,41 @@ dist_fact = 31.300 after exgqa, error = 0 -QA records = -testwt -07/07/93 -15:41:33 -FASTQ -fastq -07/07/93 -16:41:33 +QA records = +testwt +07/07/93 +15:41:33 +FASTQ +fastq +07/07/93 +16:41:33 after exginf, error = 0 -info records = - This is the first information record. - This is the second information record. - This is the third information record. +info records = + This is the first information record. + This is the second information record. + This is the third information record. after exgvp, error = 0 after exgvan, error = 0 There are 1 global variables; their names are : -glo_vars +glo_vars after exgvp, error = 0 after exgvan, error = 0 There are 2 nodal variables; their names are : -nod_var0 -nod_var1 +nod_var0 +nod_var1 after exgvp, error = 0 after exgvan, error = 0 There are 3 element variables; their names are : -ele_var0 -ele_var1 -ele_var2 +ele_var0 +ele_var1 +ele_var2 after exgvtt, error = 0 This is the element variable truth table: diff --git a/packages/seacas/libraries/exodus_for/test/testrd1.dmp b/packages/seacas/libraries/exodus_for/test/testrd1.dmp index c3b5fcf064f5..d2c826f6c1c4 100644 --- a/packages/seacas/libraries/exodus_for/test/testrd1.dmp +++ b/packages/seacas/libraries/exodus_for/test/testrd1.dmp @@ -4,7 +4,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is testwt1 +title = This is testwt1 num_dim = 3 num_nodes = 28 num_elem = 8 @@ -13,7 +13,7 @@ num_node_sets = 2 num_side_sets = 5 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -42,7 +42,7 @@ x coords = 3.0 6.0 0.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -71,7 +71,7 @@ y coords = 2.0 2.0 2.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -102,8 +102,8 @@ z coords = 0.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmp, error = 0 @@ -185,49 +185,49 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = quad +element type = quad num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 3 after exgelb, error = 0 element block id = 11 -element type = quad +element type = quad num_elem_in_block = 2 num_nodes_per_elem = 4 num_attr = 3 after exgelb, error = 0 element block id = 12 -element type = hex +element type = hex num_elem_in_block = 1 num_nodes_per_elem = 8 num_attr = 3 after exgelb, error = 0 element block id = 13 -element type = tetra +element type = tetra num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 3 after exgelb, error = 0 element block id = 14 -element type = circle +element type = circle num_elem_in_block = 1 num_nodes_per_elem = 1 num_attr = 3 after exgelb, error = 0 element block id = 15 -element type = sphere +element type = sphere num_elem_in_block = 1 num_nodes_per_elem = 1 num_attr = 3 after exgelb, error = 0 element block id = 16 -element type = wedge +element type = wedge num_elem_in_block = 1 num_nodes_per_elem = 6 num_attr = 3 @@ -365,7 +365,7 @@ after exgnsi, error = 0 after exgnp, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after exgns, error = 0 @@ -387,7 +387,7 @@ dist factors for node set 20 after exgnp, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after exgns, error = 0 @@ -419,16 +419,16 @@ after EXNSDF = 8 exinq, error = 0 after exgcns, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 1 6 -node_list = +node_list = 100 101 102 @@ -437,7 +437,7 @@ node_list = 200 201 202 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -638,37 +638,37 @@ after exinq: EXSSDF = 8, error = 0 after exgcss, error = 0 concatenated side set info -ids = +ids = 30 31 32 33 34 -num_elem_per_set = +num_elem_per_set = 2 2 7 4 2 -num_df_per_set = +num_df_per_set = 4 4 0 0 0 -elem_ind = +elem_ind = 1 3 5 12 16 -df_ind = +df_ind = 1 5 9 9 9 -elem_list = +elem_list = 3 3 1 @@ -686,7 +686,7 @@ elem_list = 5 6 7 -side_list = +side_list = 4 2 2 @@ -704,7 +704,7 @@ side_list = 4 1 1 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -715,41 +715,41 @@ dist_fact = 31.300 after exgqa, error = 0 -QA records = -testwt1 -03/16/94 -15:41:33 -FASTQ -fastq -07/07/93 -16:41:33 +QA records = +testwt1 +03/16/94 +15:41:33 +FASTQ +fastq +07/07/93 +16:41:33 after exginf, error = 0 -info records = - This is the first information record. - This is the second information record. - This is the third information record. +info records = + This is the first information record. + This is the second information record. + This is the third information record. after exgvp, error = 0 after exgvnm, error = 0 There are 1 global variables; their names are : -glo vars +glo vars after exgvp, error = 0 after exgvan, error = 0 There are 2 nodal variables; their names are : -nod_var0 -nod_var1 +nod_var0 +nod_var1 after exgvp, error = 0 after exgvan, error = 0 There are 3 element variables; their names are : -ele_var0 -ele_var1 -ele_var2 +ele_var0 +ele_var1 +ele_var2 after exgvtt, error = 0 This is the element variable truth table: diff --git a/packages/seacas/libraries/exodus_for/test/testrd_nsid.dmp b/packages/seacas/libraries/exodus_for/test/testrd_nsid.dmp index 9f819d8567dd..fd8f5a59ea4d 100644 --- a/packages/seacas/libraries/exodus_for/test/testrd_nsid.dmp +++ b/packages/seacas/libraries/exodus_for/test/testrd_nsid.dmp @@ -5,7 +5,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is a test +title = This is a test num_dim = 3 num_nodes = 33 num_elem = 7 @@ -14,7 +14,7 @@ num_node_sets = 0 num_side_sets = 0 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -48,7 +48,7 @@ x coords = 0.0 10.0 10.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -82,7 +82,7 @@ y coords = 0.0 0.0 10.0 -z coords = +z coords = 0.0 0.0 0.0 @@ -118,8 +118,8 @@ z coords = 10.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 @@ -134,7 +134,7 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = nsided +element type = nsided num_elem_in_block = 7 num_nodes_per_elem = 37 num_attr = 0 diff --git a/packages/seacas/libraries/exodus_for/test/testrdd.dmp b/packages/seacas/libraries/exodus_for/test/testrdd.dmp index 7deca71a03c8..df1826fc8d11 100644 --- a/packages/seacas/libraries/exodus_for/test/testrdd.dmp +++ b/packages/seacas/libraries/exodus_for/test/testrdd.dmp @@ -4,7 +4,7 @@ after exopen, error = 0 after exgini, error = 0 database parameters: -title = This is a test +title = This is a test num_dim = 2 num_nodes = 8 num_elem = 2 @@ -13,7 +13,7 @@ num_node_sets = 2 num_side_sets = 2 after exgcor, error = 0 -x coords = +x coords = 0.0 1.0 1.0 @@ -22,7 +22,7 @@ x coords = 2.0 2.0 1.0 -y coords = +y coords = 0.0 0.0 1.0 @@ -33,8 +33,8 @@ y coords = 1.0 after exgcon, error = 0 -x coord name = xcoor -y coord name = ycoor +x coord name = xcoor +y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 @@ -44,14 +44,14 @@ after exgebi, error = 0 after exgelb, error = 0 element block id = 10 -element type = quad +element type = quad num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 after exgelb, error = 0 element block id = 11 -element type = quad +element type = quad num_elem_in_block = 1 num_nodes_per_elem = 4 num_attr = 1 @@ -89,7 +89,7 @@ after exgnsi, error = 0 after exgnp, error = 0 -node set 20 parameters: +node set 20 parameters: num_nodes = 5 after exgns, error = 0 @@ -111,7 +111,7 @@ dist factors for node set 20 after exgnp, error = 0 -node set 21 parameters: +node set 21 parameters: num_nodes = 3 after exgns, error = 0 @@ -143,16 +143,16 @@ after EXNSDF = 8 exinq, error = 0 after exgcns, error = 0 concatenated node set info -ids = +ids = 20 21 -num_nodes_per_set = +num_nodes_per_set = 5 3 -node_ind = +node_ind = 1 6 -node_list = +node_list = 100 101 102 @@ -161,7 +161,7 @@ node_list = 200 201 202 -dist_fact = +dist_fact = 1.000 2.000 3.000 @@ -230,32 +230,32 @@ after exinq: EXSSDF = 8, error = 0 after exgcss, error = 0 concatenated side set info -ids = +ids = 30 31 -num_elem_per_set = +num_elem_per_set = 2 2 -num_df_per_set = +num_df_per_set = 4 4 -elem_ind = +elem_ind = 1 3 -df_ind = +df_ind = 1 5 -elem_list = +elem_list = 11 12 13 14 -side_list = +side_list = 1 2 3 4 -dist_fact = +dist_fact = 30.000 30.100 30.200 @@ -266,41 +266,41 @@ dist_fact = 31.300 after exgqa, error = 0 -QA records = -testwtd -07/07/93 -15:41:33 -FASTQ -fastq -07/07/93 -16:41:33 +QA records = +testwtd +07/07/93 +15:41:33 +FASTQ +fastq +07/07/93 +16:41:33 after exginf, error = 0 -info records = - This is the first information record. - This is the second information record. - This is the third information record. +info records = + This is the first information record. + This is the second information record. + This is the third information record. after exgvp, error = 0 after exgvan, error = 0 There are 1 global variables; their names are : -glo_vars +glo_vars after exgvp, error = 0 after exgvan, error = 0 There are 2 nodal variables; their names are : -nod_var0 -nod_var1 +nod_var0 +nod_var1 after exgvp, error = 0 after exgvan, error = 0 There are 3 element variables; their names are : -ele_var0 -ele_var1 -ele_var2 +ele_var0 +ele_var1 +ele_var2 after exgvtt, error = 0 This is the element variable truth table: diff --git a/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.h b/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.h index 7a78e1cfa0ad..32b095f61fd1 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.h +++ b/packages/seacas/libraries/ioss/src/Ioss_BasisVariableType.h @@ -75,13 +75,13 @@ namespace Ioss { typedef struct ex_basis { /* - * subc_dim: dimension of the subcell associated with the specified DoF ordinal + * subc_dim: dimension of the subcell associated with the specified DoF ordinal * -- 0 node, 1 edge, 2 face, 3 volume [Range: 0..3] * subc_ordinal: ordinal of the subcell relative to its parent cell - * -- 0..n for each ordinal with the same subc dim [Range: <= DoF ordinal] - * subc_dof_ordinal: ordinal of the DoF relative to the subcell - * subc_num_dof: cardinality of the DoF set associated with this subcell. - * xi, eta, mu (ξ, η, ζ): Parametric coordinate location of the DoF + * -- 0..n for each ordinal with the same subc dim [Range: <= DoF ordinal] + * subc_dof_ordinal: ordinal of the DoF relative to the subcell + * subc_num_dof: cardinality of the DoF set associated with this subcell. + * xi, eta, mu (ξ, η, ζ): Parametric coordinate location of the DoF * -- (Only first ndim values are valid) */ char name[EX_MAX_NAME + 1]; diff --git a/packages/seacas/libraries/ioss/src/Ioss_ChangeSet.C b/packages/seacas/libraries/ioss/src/Ioss_ChangeSet.C new file mode 100644 index 000000000000..dc9a295fb49d --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_ChangeSet.C @@ -0,0 +1,391 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_ChangeSet.h" + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" + +#include "Ioss_DynamicTopology.h" +#include "Ioss_EntityBlock.h" +#include "Ioss_EntityType.h" +#include "Ioss_Field.h" +#include "Ioss_FileInfo.h" +#include "Ioss_GroupingEntity.h" +#include "Ioss_IOFactory.h" + +#include +#include +#include + +#include +#include + +namespace { + int file_exists(const Ioss::ParallelUtils &util, const std::string &filename, + std::string &message, bool filePerRank) + { + std::string filenameBase = filename; + const int par_size = util.parallel_size(); + const int par_rank = util.parallel_rank(); + + if (par_size > 1 && !filePerRank) { + filenameBase = Ioss::Utils::decode_filename(filenameBase, par_rank, par_size); + } + + Ioss::FileInfo file = Ioss::FileInfo(filenameBase); + return file.parallel_exists(util.communicator(), message); + } + + std::string get_decomposition_property(const Ioss::PropertyManager &properties, + Ioss::DatabaseUsage db_usage) + { + std::string decomp_method; + std::string decomp_property; + if (db_usage == Ioss::READ_MODEL) { + decomp_property = "MODEL_DECOMPOSITION_METHOD"; + } + else if (db_usage == Ioss::READ_RESTART || db_usage == Ioss::QUERY_TIMESTEPS_ONLY) { + decomp_property = "RESTART_DECOMPOSITION_METHOD"; + } + + // Applies to either read_model or read_restart + if (properties.exists("DECOMPOSITION_METHOD")) { + std::string method = properties.get("DECOMPOSITION_METHOD").get_string(); + return Ioss::Utils::uppercase(method); + } + + // Check for property... + if (properties.exists(decomp_property)) { + std::string method = properties.get(decomp_property).get_string(); + return Ioss::Utils::uppercase(method); + } + return decomp_method; + } + + bool internal_decomp_specified(const Ioss::PropertyManager &props, Ioss::DatabaseUsage usage) + { + bool internalDecompSpecified = false; + + std::string method = get_decomposition_property(props, usage); + if (!method.empty() && method != "EXTERNAL") { + internalDecompSpecified = true; + } + + return internalDecompSpecified; + } + +} // namespace + +namespace Ioss { + + ChangeSet::ChangeSet(Ioss::Region *region) + : m_database(region->get_database()), + m_ioDB(region->get_property("base_filename").get_string()), + m_dbType(region->get_property("database_type").get_string()), + m_fileCyclicCount(region->get_file_cyclic_count()) + { + } + + ChangeSet::ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType, + unsigned fileCyclicCount) + : m_database(db), m_ioDB(dbName), m_dbType(dbType), m_fileCyclicCount(fileCyclicCount) + { + } + + ChangeSet::~ChangeSet() { clear_change_sets(); } + + DatabaseIO *ChangeSet::get_database() const { return m_database; } + + const ParallelUtils &ChangeSet::util() const { return get_database()->util(); } + + void ChangeSet::get_cyclic_multi_file_change_sets() + { + auto db = get_database(); + + m_databaseFormat = CHANGE_SET_CYCLIC_MULTI_FILES; + + Ioss::FileNameGenerator generator = + Ioss::construct_cyclic_filename_generator(m_fileCyclicCount); + + bool found = true; + int step = 0; + int fileCyclicCount = m_fileCyclicCount; + + while (found && (step < fileCyclicCount)) { + ++step; + + std::string expanded = Ioss::expand_topology_files( + generator, util(), m_ioDB, db->get_property_manager(), db->usage(), step); + if (!expanded.empty()) { + m_changeSetNames.push_back(expanded); + } + else { + found = false; + } + } + + m_changeSetDatabases.resize(m_changeSetNames.size(), nullptr); + } + + void ChangeSet::get_linear_multi_file_change_sets() + { + auto db = get_database(); + + m_databaseFormat = CHANGE_SET_LINEAR_MULTI_FILES; + + Ioss::FileNameGenerator generator = Ioss::construct_linear_filename_generator(); + + bool found = true; + int step = 0; + + while (found) { + ++step; + + std::string expanded = Ioss::expand_topology_files( + generator, util(), m_ioDB, db->get_property_manager(), db->usage(), step); + if (!expanded.empty()) { + m_changeSetNames.push_back(expanded); + } + else { + found = false; + } + } + + m_changeSetDatabases.resize(m_changeSetNames.size(), nullptr); + } + + void ChangeSet::populate_change_sets(bool loadAllFiles) + { + clear_change_sets(); + + if (!loadAllFiles) { + // Load only the current db file + m_databaseFormat = CHANGE_SET_LINEAR_MULTI_FILES; + m_changeSetNames.push_back(get_database()->get_filename()); + m_changeSetDatabases.resize(m_changeSetNames.size(), nullptr); + return; + } + + if (get_file_cyclic_count() > 0) { + get_cyclic_multi_file_change_sets(); + } + else { + get_linear_multi_file_change_sets(); + } + } + + void ChangeSet::verify_change_set_index(unsigned index) const + { + if (index >= m_changeSetNames.size()) { + std::ostringstream errmsg; + fmt::print(errmsg, "Invalid change set index {} with a max value of {}\n", index, + m_changeSetNames.size() - 1); + IOSS_ERROR(errmsg); + } + } + + std::string ChangeSet::get_change_set_name(unsigned index) const + { + verify_change_set_index(index); + + return m_changeSetNames[index]; + } + + void ChangeSet::close_change_set(unsigned index) + { + verify_change_set_index(index); + + auto db = m_changeSetDatabases[index]; + if (nullptr != db) { + db->closeDatabase(); + delete db; + m_changeSetDatabases[index] = nullptr; + } + } + + Ioss::DatabaseIO *ChangeSet::open_change_set(unsigned index, Ioss::DatabaseUsage usage) + { + verify_change_set_index(index); + + Ioss::DatabaseIO *db = nullptr; + + auto csdb = m_changeSetDatabases[index]; + if (nullptr != csdb) { + if (csdb->usage() == usage) { + return csdb; + } + else { + csdb->closeDatabase(); + delete csdb; + m_changeSetDatabases[index] = nullptr; + } + } + + // open db + const std::string &ioDB = m_changeSetNames[index]; + const std::string dbType = m_dbType; + + db = Ioss::IOFactory::create(dbType, ioDB, usage, util().communicator(), + get_database()->get_property_manager()); + std::string error_message; + bool is_valid_file = db != nullptr && db->ok(false, &error_message, nullptr); + if (!is_valid_file) { + delete db; + std::ostringstream errmsg; + errmsg << error_message; + errmsg << __FILE__ << ", " << __FUNCTION__ << ", filename " << ioDB + << " is not a valid file\n"; + IOSS_ERROR(errmsg); + } + + m_changeSetDatabases[index] = db; + + return db; + } + + void ChangeSet::clear_change_sets() + { + m_changeSetNames.clear(); + + for (size_t i = 0; i < m_changeSetDatabases.size(); i++) { + auto db = m_changeSetDatabases[i]; + if (nullptr != db) { + db->closeDatabase(); + delete db; + m_changeSetDatabases[i] = nullptr; + } + } + + m_changeSetDatabases.clear(); + } + + std::string ChangeSet::get_cyclic_database_filename(const std::string &baseFileName, + unsigned int fileCyclicCount, + unsigned int step) + { + Ioss::FileNameGenerator generator = Ioss::construct_cyclic_filename_generator(fileCyclicCount); + return generator(baseFileName, step); + } + + std::string ChangeSet::get_linear_database_filename(const std::string &baseFileName, + unsigned int step) + { + Ioss::FileNameGenerator generator = Ioss::construct_linear_filename_generator(); + return generator(baseFileName, step); + } + + std::string expand_topology_files(FileNameGenerator generator, const Ioss::ParallelUtils &util, + const std::string &basename, + const Ioss::PropertyManager &properties, + Ioss::DatabaseUsage usage, int step) + { + // See if there are multiple topology files + + // If the file exists on all processors, return the filename. + // If the file does not exist on any processors, return ""; + // If the file exists on some, but not all, throw an exception. + + std::string filename = generator(basename, step); + + bool internalDecompSpecified = internal_decomp_specified(properties, usage); + std::string message; + int exists = ::file_exists(util, filename, message, internalDecompSpecified); + + int par_size = util.parallel_size(); + int par_rank = util.parallel_rank(); + + if (exists > 0 && exists < par_size) { + std::ostringstream errmsg; + errmsg << "ERROR: Unable to open input database"; + if (par_rank == 0) { + errmsg << " '" << filename << "'" << "\n\ton processor(s): " << message; + } + else { + errmsg << ". See processor 0 output for more details.\n"; + } + IOSS_ERROR(errmsg); + } + + if (exists == par_size) { + return filename; + } + + // Does not exist on any processors + return std::string(); + } + + std::pair + expand_topology_files(FileNameGenerator generator, const Ioss::ParallelUtils &util, + const std::string &basename, const std::string &db_type, + const Ioss::PropertyManager &properties, Ioss::DatabaseUsage usage, + int step) + { + // See if there are multiple topology files + + // If the file exists on all processors, return the filename. + // If the file does not exist on any processors, return ""; + // If the file exists on some, but not all, throw an exception. + + Ioss::DatabaseIO *db = nullptr; + std::string filename = + expand_topology_files(generator, util, basename, properties, usage, step); + + if (!filename.empty()) { + db = Ioss::IOFactory::create(db_type, filename, usage, util.communicator(), properties); + int bad_count = 0; + std::string error_message; + bool is_valid_file = db != nullptr && db->ok(false, &error_message, &bad_count); + if (is_valid_file) { + return std::make_pair(filename, db); + } + else { + delete db; + std::ostringstream errmsg; + errmsg << error_message; + errmsg << __FILE__ << ", " << __FUNCTION__ << ", filename " << filename + << " is not a valid file\n"; + IOSS_ERROR(errmsg); + } + } + + // Does not exist on any processors + return std::make_pair(filename, db); + } + + Ioss::FileNameGenerator construct_cyclic_filename_generator(unsigned cyclicCount) + { + if (cyclicCount > 26) { + cyclicCount = 26; + } + + Ioss::FileNameGenerator generator = [cyclicCount](const std::string &baseFileName, + unsigned step) { + static std::string suffix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + std::string filename = baseFileName; + if (step == 0) + step++; + filename += "-" + suffix.substr((step - 1) % cyclicCount, 1); + return filename; + }; + + return generator; + } + + Ioss::FileNameGenerator construct_linear_filename_generator() + { + Ioss::FileNameGenerator generator = [](const std::string &baseFileName, unsigned step) { + std::ostringstream filename; + filename << baseFileName; + if (step > 1) { + filename << "-s" << std::setw(4) << std::setfill('0') << step; + } + return filename.str(); + }; + + return generator; + } +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_ChangeSet.h b/packages/seacas/libraries/ioss/src/Ioss_ChangeSet.h new file mode 100644 index 000000000000..23ad17d09f16 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_ChangeSet.h @@ -0,0 +1,104 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" +#include "Ioss_ParallelUtils.h" +#include "Ioss_PropertyManager.h" +#include "Ioss_Region.h" + +#include +#include +#include +#include +#include + +namespace Ioss { + + using FileNameGenerator = + std::function; + + enum ChangeSetFormat { + CHANGE_SET_NONE = (0), + CHANGE_SET_INTERNAL_FILES = (1U << 0), + CHANGE_SET_LINEAR_MULTI_FILES = (1U << 1), + CHANGE_SET_CYCLIC_MULTI_FILES = (1U << 2) + }; + + std::pair + expand_topology_files(FileNameGenerator generator, const Ioss::ParallelUtils &util, + const std::string &basename, const std::string &db_type, + const Ioss::PropertyManager &properties, Ioss::DatabaseUsage usage, + int step); + + std::string expand_topology_files(FileNameGenerator generator, const Ioss::ParallelUtils &util, + const std::string &basename, + const Ioss::PropertyManager &properties, + Ioss::DatabaseUsage usage, int step); + + FileNameGenerator construct_cyclic_filename_generator(unsigned cyclicCount); + FileNameGenerator construct_linear_filename_generator(); + + class IOSS_EXPORT ChangeSet + { + public: + explicit ChangeSet(Ioss::Region *region); + ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType, + unsigned fileCyclicCount); + + virtual ~ChangeSet(); + ChangeSet() = delete; + ChangeSet(const ChangeSet &) = delete; + + IOSS_NODISCARD unsigned supported_formats() const { return m_supportedFormats; } + IOSS_NODISCARD unsigned database_format() const { return m_databaseFormat; } + + virtual void populate_change_sets(bool loadAllFiles = true); + + IOSS_NODISCARD virtual DatabaseIO *open_change_set(unsigned index, Ioss::DatabaseUsage usage); + virtual void close_change_set(unsigned index); + + IOSS_NODISCARD size_t size() const { return m_changeSetNames.size(); } + IOSS_NODISCARD const std::vector &names() const { return m_changeSetNames; } + IOSS_NODISCARD std::string get_change_set_name(unsigned index) const; + + IOSS_NODISCARD unsigned get_file_cyclic_count() const { return m_fileCyclicCount; } + + static std::string get_cyclic_database_filename(const std::string &baseFileName, + unsigned int fileCyclicCount, + unsigned int step); + + static std::string get_linear_database_filename(const std::string &baseFileName, + unsigned int step); + + private: + std::vector m_changeSetDatabases; + + protected: + void get_cyclic_multi_file_change_sets(); + void get_linear_multi_file_change_sets(); + + void verify_change_set_index(unsigned index) const; + + virtual void clear_change_sets(); + + DatabaseIO *get_database() const; + IOSS_NODISCARD const ParallelUtils &util() const; + + Ioss::DatabaseIO *m_database{nullptr}; + std::string m_ioDB; + std::string m_dbType; + unsigned m_fileCyclicCount{0}; + + unsigned m_supportedFormats{CHANGE_SET_LINEAR_MULTI_FILES | CHANGE_SET_CYCLIC_MULTI_FILES}; + unsigned m_databaseFormat{CHANGE_SET_NONE}; + + std::vector m_changeSetNames; + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.C b/packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.C new file mode 100644 index 000000000000..2bdc3c8273e4 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.C @@ -0,0 +1,153 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_ChangeSet.h" +#include "Ioss_ChangeSetFactory.h" +#include "Ioss_Utils.h" // for IOSS_ERROR +#include "Ioss_Version.h" +#include +#include +#include +#include // for _Rb_tree_iterator, etc +#include // for basic_ostream, etc +#include +#include // for char_traits, string, etc + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" // for DatabaseUsage +#include "Ioss_PropertyManager.h" +#include "Ioss_Region.h" + +namespace { +#if defined(IOSS_THREADSAFE) + std::mutex m_; +#endif + + int describe_nl(Ioss::ChangeSetFactoryMap *registry, Ioss::NameList *names) + { + int count = 0; + Ioss::ChangeSetFactoryMap::const_iterator I; + for (I = registry->begin(); I != registry->end(); ++I) { + names->push_back((*I).first); + ++count; + } + return count; + } +} // namespace + +namespace Ioss { + class ChangeSet; + + using ChangeSetFactoryValuePair = ChangeSetFactoryMap::value_type; +} // namespace Ioss + +const Ioss::ChangeSetFactory *Ioss::ChangeSetFactory::factory() +{ + static Ioss::ChangeSetFactory registerThis("ioss"); + return ®isterThis; +} + +std::shared_ptr Ioss::ChangeSetFactory::create(Ioss::Region *region) +{ + IOSS_FUNC_ENTER(m_); + std::string dbType = region->get_property("database_type").get_string(); + + auto iter = registry()->find(dbType); + if (iter == registry()->end()) { + if (registry()->empty()) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: No change set types have been registered.\n" + " Was Ioss::Init::Initializer() called?\n\n"); + IOSS_ERROR(errmsg); + } + else { + iter = registry()->find("ioss"); + } + } + + Ioss::ChangeSetFactory *factory = (*iter).second; + Ioss::ChangeSet *csPtr = factory->make_ChangeSet(region); + std::shared_ptr cs(csPtr); + return cs; +} + +std::shared_ptr Ioss::ChangeSetFactory::create(Ioss::DatabaseIO *db, + const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount) +{ + IOSS_FUNC_ENTER(m_); + + auto iter = registry()->find(dbType); + if (iter == registry()->end()) { + if (registry()->empty()) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: No change set types have been registered.\n" + " Was Ioss::Init::Initializer() called?\n\n"); + IOSS_ERROR(errmsg); + } + else { + iter = registry()->find("ioss"); + } + } + + Ioss::ChangeSetFactory *factory = (*iter).second; + Ioss::ChangeSet *csPtr = factory->make_ChangeSet(db, dbName, dbType, fileCyclicCount); + std::shared_ptr cs(csPtr); + return cs; +} + +Ioss::ChangeSet *Ioss::ChangeSetFactory::make_ChangeSet(Ioss::Region *region) const +{ + return new ChangeSet(region); +} + +Ioss::ChangeSet *Ioss::ChangeSetFactory::make_ChangeSet(Ioss::DatabaseIO *db, + const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount) const +{ + return new ChangeSet(db, dbName, dbType, fileCyclicCount); +} + +/** \brief Get the names of change set types known to IOSS. + * + * \param[out] names The list of known change set types. + * \returns The number of known change set types. + */ +int Ioss::ChangeSetFactory::describe(NameList *names) +{ + IOSS_FUNC_ENTER(m_); + return ::describe_nl(registry(), names); +} + +/** \brief Get the names of change set types known to IOSS. + * + * \returns The list of known change set types. + */ +Ioss::NameList Ioss::ChangeSetFactory::describe() +{ + Ioss::NameList names; + describe(&names); + return names; +} + +Ioss::ChangeSetFactory::ChangeSetFactory(const std::string &type) +{ + registry()->insert(ChangeSetFactoryValuePair(type, this)); +} + +void Ioss::ChangeSetFactory::alias(const std::string &base, const std::string &syn) +{ + Ioss::ChangeSetFactory *factory = (*registry()->find(base)).second; + registry()->insert(ChangeSetFactoryValuePair(syn, factory)); +} + +Ioss::ChangeSetFactoryMap *Ioss::ChangeSetFactory::registry() +{ + static ChangeSetFactoryMap registry_; + return ®istry_; +} diff --git a/packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.h b/packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.h new file mode 100644 index 000000000000..49def95e8edb --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.h @@ -0,0 +1,60 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "ioss_export.h" + +#include "Ioss_CodeTypes.h" +#include +#include +#include +#include + +/** \brief The main namespace for the Ioss library. + */ +namespace Ioss { + + class Region; + class DatabaseIO; + class ChangeSet; + class ChangeSetFactory; + using NameList = Ioss::NameList; + using ChangeSetFactoryMap = std::map>; + + /** \brief The main public user interface for creating Ioss::ChangeSet objects. + */ + class IOSS_EXPORT ChangeSetFactory + { + public: + virtual ~ChangeSetFactory() = default; + IOSS_NODISCARD static std::shared_ptr create(Ioss::Region *region); + IOSS_NODISCARD static std::shared_ptr create(Ioss::DatabaseIO *db, + const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount = 0); + + static int describe(NameList *names); + IOSS_NODISCARD static NameList describe(); + + static const ChangeSetFactory *factory(); + + protected: + explicit ChangeSetFactory(const std::string &type); + + IOSS_NODISCARD virtual ChangeSet *make_ChangeSet(Ioss::Region *region) const; + IOSS_NODISCARD virtual ChangeSet *make_ChangeSet(Ioss::DatabaseIO *db, + const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount) const; + + static void alias(const std::string &base, const std::string &syn); + + private: + IOSS_NODISCARD static ChangeSetFactoryMap *registry(); + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_Compare.C b/packages/seacas/libraries/ioss/src/Ioss_Compare.C index 440622159d29..37cdadba36d5 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Compare.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Compare.C @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,7 @@ #include "Ioss_SideSet.h" #include "Ioss_StructuredBlock.h" #include "Ioss_Utils.h" +#include "tokenize.h" /* These messages indicate a structural difference between the files * being compared. Use Ioss::WarnOut(). @@ -70,6 +72,8 @@ namespace { std::ostringstream &buf); bool compare_qa_info(const Ioss::Region &input_region_1, const Ioss::Region &input_region_2, std::ostringstream &buf); + bool compare_change_sets(const Ioss::Region &input_region_1, const Ioss::Region &input_region_2, + std::ostringstream &buf); bool compare_nodeblock(const Ioss::Region &input_region_1, const Ioss::Region &input_region_2); bool compare_assemblies(const Ioss::Region &input_region_1, const Ioss::Region &input_region_2); bool compare_elementblocks(const Ioss::Region &input_region_1, @@ -113,26 +117,42 @@ namespace { const Ioss::GroupingEntity *ige_2, Ioss::DataPool &in_pool, const std::string &field_name, const Ioss::MeshCopyOptions &options, std::ostringstream &buf); + + bool open_change_set(const std::string &cs_name, Ioss::Region ®ion) + { + bool success = true; + if (!cs_name.empty()) { + success = region.load_internal_change_set_mesh(cs_name); + if (!success) { + fmt::print(stderr, "ERROR: Unable to open change_set '{}' in file '{}'\n", cs_name, + region.get_database()->get_filename()); + } + } + return success; + } + + bool compare_database_internal(Ioss::Region &input_region_1, Ioss::Region &input_region_2, + const Ioss::MeshCopyOptions &options); } // namespace bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region &input_region_2, const Ioss::MeshCopyOptions &options) { - bool overall_result = true; - bool rc; - DataPool data_pool; + bool overall_result = true; rel_tolerance = options.rel_tolerance; abs_tolerance = options.abs_tolerance; tol_floor = options.tol_floor; - // COMPARE all properties of input database... - { + // COMPARE change_sets in the databases... + if (options.selected_change_sets.empty()) { std::ostringstream buf; - fmt::print(buf, "PROPERTIES mismatch ({})\n", input_region_1.name()); - if (!compare_properties(&input_region_1, &input_region_2, buf)) { + fmt::print(buf, "CHANGE SET mismatch."); + if (!compare_change_sets(input_region_1, input_region_2, buf)) { overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + fmt::print(Ioss::WarnOut(), + "{} Only the change sets that are found in both databases will be compared.\n", + buf.str()); } } @@ -145,446 +165,297 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region } } - { - std::ostringstream buf; - fmt::print(buf, "\nNODEBLOCK mismatch\n"); - if (!compare_nodeblock(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } + Ioss::NameList cs1_names; + Ioss::NameList cs2_names; - { - std::ostringstream buf; - fmt::print(buf, "\nEDGEBLOCK mismatch\n"); - if (!compare_edgeblocks(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + if (!options.selected_change_sets.empty() && options.selected_change_sets != "ALL") { + cs1_names = Ioss::tokenize(options.selected_change_sets, ","); + bool success = true; + for (const auto &cs_name : cs1_names) { + success &= Ioss::Utils::check_valid_change_set_name(cs_name, input_region_1); } - } - { - std::ostringstream buf; - fmt::print(buf, "\nFACEBLOCK mismatch\n"); - if (!compare_faceblocks(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - { - std::ostringstream buf; - fmt::print(buf, "\nELEMENTBLOCK mismatch\n"); - if (!compare_elementblocks(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, "\nSTRUCTUREDBLOCK mismatch\n"); - if (!compare_structuredblocks(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, "\nNODESET mismatch\n"); - if (!compare_nodesets(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, "\nEDGESET mismatch\n"); - if (!compare_edgesets(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, "\nFACESET mismatch\n"); - if (!compare_facesets(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, "\nELEMSET mismatch\n"); - if (!compare_elemsets(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + if (!success) { + return false; } + cs2_names = cs1_names; } - - { - std::ostringstream buf; - fmt::print(buf, "\nSIDESET mismatch\n"); - if (!compare_sidesets(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } + else { + cs1_names = input_region_1.get_database()->internal_change_set_describe(); + cs2_names = input_region_2.get_database()->internal_change_set_describe(); } - { - std::ostringstream buf; - fmt::print(buf, "\nCOMMSET mismatch\n"); - if (!compare_commsets(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + for (const auto &cs1_name : cs1_names) { + auto it = std::find(cs2_names.cbegin(), cs2_names.cend(), cs1_name); + if (it == cs2_names.cend()) { + fmt::print(Ioss::WarnOut(), "Skipping change set {}, not found in input #2.\n", cs1_name); + continue; } - } - { - std::ostringstream buf; - fmt::print(buf, "\nCOORDINATE FRAME mismatch\n"); - if (!compare_coordinate_frames(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + bool success1 = open_change_set(cs1_name, input_region_1); + bool success2 = open_change_set(cs1_name, input_region_2); + if (!success1 || !success2) { + continue; } + overall_result &= compare_database_internal(input_region_1, input_region_2, options); } + return overall_result; +} +namespace { + bool compare_database_internal(Ioss::Region &input_region_1, Ioss::Region &input_region_2, + const Ioss::MeshCopyOptions &options) { - std::ostringstream buf; - fmt::print(buf, "\nASSEMBLY mismatch\n"); - if (!compare_assemblies(input_region_1, input_region_2)) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - bool node_major = input_region_2.node_major(); + bool rc; + bool overall_result = true; + Ioss::DataPool data_pool; - if (!node_major) { + // COMPARE all properties of input database... { std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", node_major); - rc = compare_field_data(input_region_1.get_element_blocks(), - input_region_2.get_element_blocks(), data_pool, Ioss::Field::MESH, - options, buf); - if (!rc) { - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + fmt::print(buf, "PROPERTIES mismatch ({})\n", input_region_1.name()); + if (!compare_properties(&input_region_1, &input_region_2, buf)) { overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } { std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", - node_major); - - rc = compare_field_data(input_region_1.get_element_blocks(), - input_region_2.get_element_blocks(), data_pool, - Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + fmt::print(buf, "\nNODEBLOCK mismatch\n"); + if (!compare_nodeblock(input_region_1, input_region_2)) { overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - } - if (input_region_1.mesh_type() != Ioss::MeshType::STRUCTURED) { - assert(input_region_2.mesh_type() != Ioss::MeshType::STRUCTURED); { std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "node blocks"); - - rc = compare_field_data(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), - data_pool, Ioss::Field::MESH, options, buf); - if (!rc) { + fmt::print(buf, "\nEDGEBLOCK mismatch\n"); + if (!compare_edgeblocks(input_region_1, input_region_2)) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } { std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "node blocks"); - rc = compare_field_data(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), - data_pool, Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { + fmt::print(buf, "\nFACEBLOCK mismatch\n"); + if (!compare_faceblocks(input_region_1, input_region_2)) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - } - if (node_major) { { std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", node_major); - rc = compare_field_data(input_region_1.get_element_blocks(), - input_region_2.get_element_blocks(), data_pool, Ioss::Field::MESH, - options, buf); - if (!rc) { + fmt::print(buf, "\nELEMENTBLOCK mismatch\n"); + if (!compare_elementblocks(input_region_1, input_region_2)) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", - node_major); - rc = compare_field_data(input_region_1.get_element_blocks(), - input_region_2.get_element_blocks(), data_pool, - Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { + fmt::print(buf, "\nSTRUCTUREDBLOCK mismatch\n"); + if (!compare_structuredblocks(input_region_1, input_region_2)) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - } - - { - std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "structured blocks"); - rc = compare_field_data(input_region_1.get_structured_blocks(), - input_region_2.get_structured_blocks(), data_pool, Ioss::Field::MESH, - options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - { - std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "structured blocks"); - rc = compare_field_data(input_region_1.get_structured_blocks(), - input_region_2.get_structured_blocks(), data_pool, - Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "edge blocks"); - rc = compare_field_data(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), - data_pool, Ioss::Field::MESH, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "edge blocks"); - rc = compare_field_data(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), - data_pool, Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nNODESET mismatch\n"); + if (!compare_nodesets(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "face blocks"); - rc = compare_field_data(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), - data_pool, Ioss::Field::MESH, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nEDGESET mismatch\n"); + if (!compare_edgesets(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "face blocks"); - rc = compare_field_data(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), - data_pool, Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nFACESET mismatch\n"); + if (!compare_facesets(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "element sets"); - rc = compare_field_data(input_region_1.get_elementsets(), input_region_2.get_elementsets(), - data_pool, Ioss::Field::MESH, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nELEMSET mismatch\n"); + if (!compare_elemsets(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "element sets"); - rc = compare_field_data(input_region_1.get_elementsets(), input_region_2.get_elementsets(), - data_pool, Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nSIDESET mismatch\n"); + if (!compare_sidesets(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "comm sets"); - rc = compare_field_data(input_region_1.get_commsets(), input_region_2.get_commsets(), data_pool, - Ioss::Field::MESH, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nCOMMSET mismatch\n"); + if (!compare_commsets(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "comm sets"); - rc = compare_field_data(input_region_1.get_commsets(), input_region_2.get_commsets(), data_pool, - Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nCOORDINATE FRAME mismatch\n"); + if (!compare_coordinate_frames(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - { - std::ostringstream buf; - fmt::print(buf, COMMUNICATION_FIELD_VALUE_MISMATCH, "comm sets"); - rc = compare_field_data(input_region_1.get_commsets(), input_region_2.get_commsets(), data_pool, - Ioss::Field::COMMUNICATION, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + { + std::ostringstream buf; + fmt::print(buf, "\nASSEMBLY mismatch\n"); + if (!compare_assemblies(input_region_1, input_region_2)) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } } - } - // Side Sets - if (input_region_1.mesh_type() == Ioss::MeshType::UNSTRUCTURED) { - // This should have already been checked. - assert(input_region_2.mesh_type() == Ioss::MeshType::UNSTRUCTURED); - - const auto &in_fss_1 = input_region_1.get_sidesets(); - const auto &in_fss_2 = input_region_2.get_sidesets(); - - // This should have already been checked. - assert(in_fss_1.size() == in_fss_2.size()); - for (const auto &ifs : in_fss_1) { - const std::string &name = ifs->name(); + bool node_major = input_region_2.node_major(); - // Find matching output sideset - typename std::vector::const_iterator it; - for (it = in_fss_2.begin(); it != in_fss_2.end(); ++it) { - if (name == (*it)->name()) { - break; + if (!node_major) { + { + std::ostringstream buf; + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", + node_major); + rc = compare_field_data(input_region_1.get_element_blocks(), + input_region_2.get_element_blocks(), data_pool, Ioss::Field::MESH, + options, buf); + if (!rc) { + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + overall_result = false; } } - if (it == in_fss_2.end()) { - fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); - continue; + { + std::ostringstream buf; + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", + node_major); + + rc = compare_field_data(input_region_1.get_element_blocks(), + input_region_2.get_element_blocks(), data_pool, + Ioss::Field::ATTRIBUTE, options, buf); + if (!rc) { + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + overall_result = false; + } } + } + if (input_region_1.mesh_type() != Ioss::MeshType::STRUCTURED) { + assert(input_region_2.mesh_type() != Ioss::MeshType::STRUCTURED); { std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "side sets"); - rc = compare_field_data(ifs, (*it), data_pool, Ioss::Field::MESH, options, buf); + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "node blocks"); + + rc = compare_field_data(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), + data_pool, Ioss::Field::MESH, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - { std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "side sets"); - rc = compare_field_data(ifs, (*it), data_pool, Ioss::Field::ATTRIBUTE, options, buf); + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "node blocks"); + rc = compare_field_data(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), + data_pool, Ioss::Field::ATTRIBUTE, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - const auto &in_sbs_1 = ifs->get_side_blocks(); - const auto &in_sbs_2 = (*it)->get_side_blocks(); - - // This should have already been checked. - assert(in_sbs_1.size() == in_sbs_2.size()); - - for (const auto &isb : in_sbs_1) { - const std::string &sbname = isb->name(); - - // Find matching output sideblock - typename std::vector::const_iterator iter; - for (iter = in_sbs_2.begin(); iter != in_sbs_2.end(); ++iter) { - if (sbname == (*iter)->name()) { - break; - } - } - if (iter == in_sbs_2.end()) { - fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDEBLOCK", name); - continue; - } - - { - std::ostringstream buf; - fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "side blocks"); - rc = compare_field_data(isb, (*iter), data_pool, Ioss::Field::MESH, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } - } - - { - std::ostringstream buf; - fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "side blocks"); - rc = compare_field_data(isb, (*iter), data_pool, Ioss::Field::ATTRIBUTE, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } + } + if (node_major) { + { + std::ostringstream buf; + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", + node_major); + rc = compare_field_data(input_region_1.get_element_blocks(), + input_region_2.get_element_blocks(), data_pool, Ioss::Field::MESH, + options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH " (node_major = {})", "element blocks", + node_major); + rc = compare_field_data(input_region_1.get_element_blocks(), + input_region_2.get_element_blocks(), data_pool, + Ioss::Field::ATTRIBUTE, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } } - } - // This should have already been checked - assert(input_region_1.property_exists("state_count") == - input_region_2.property_exists("state_count")); - - if (input_region_1.property_exists("state_count") && - input_region_1.get_property("state_count").get_int() > 0) { + { + std::ostringstream buf; + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "structured blocks"); + rc = compare_field_data(input_region_1.get_structured_blocks(), + input_region_2.get_structured_blocks(), data_pool, Ioss::Field::MESH, + options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } - // For each 'TRANSIENT' field in the node blocks and element - // blocks, transfer to the output node and element blocks. { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "region"); - rc = compare_fields(&input_region_1, &input_region_2, Ioss::Field::REDUCTION, buf); + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "structured blocks"); + rc = compare_field_data(input_region_1.get_structured_blocks(), + input_region_2.get_structured_blocks(), data_pool, + Ioss::Field::ATTRIBUTE, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "node blocks"); - rc = compare_fields(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "edge blocks"); + rc = compare_field_data(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), + data_pool, Ioss::Field::MESH, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "edge blocks"); - rc = compare_fields(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "edge blocks"); + rc = compare_field_data(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), + data_pool, Ioss::Field::ATTRIBUTE, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -593,9 +464,9 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "face blocks"); - rc = compare_fields(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "face blocks"); + rc = compare_field_data(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), + data_pool, Ioss::Field::MESH, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -604,9 +475,9 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "element blocks"); - rc = compare_fields(input_region_1.get_element_blocks(), input_region_2.get_element_blocks(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "face blocks"); + rc = compare_field_data(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), + data_pool, Ioss::Field::ATTRIBUTE, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -615,9 +486,9 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "structured blocks"); - rc = compare_fields(input_region_1.get_structured_blocks(), - input_region_2.get_structured_blocks(), Ioss::Field::TRANSIENT, buf); + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "element sets"); + rc = compare_field_data(input_region_1.get_elementsets(), input_region_2.get_elementsets(), + data_pool, Ioss::Field::MESH, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -626,9 +497,9 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "node sets"); - rc = compare_fields(input_region_1.get_nodesets(), input_region_2.get_nodesets(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "element sets"); + rc = compare_field_data(input_region_1.get_elementsets(), input_region_2.get_elementsets(), + data_pool, Ioss::Field::ATTRIBUTE, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -637,9 +508,9 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "edge sets"); - rc = compare_fields(input_region_1.get_edgesets(), input_region_2.get_edgesets(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "comm sets"); + rc = compare_field_data(input_region_1.get_commsets(), input_region_2.get_commsets(), + data_pool, Ioss::Field::MESH, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -648,9 +519,9 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "face sets"); - rc = compare_fields(input_region_1.get_facesets(), input_region_2.get_facesets(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "comm sets"); + rc = compare_field_data(input_region_1.get_commsets(), input_region_2.get_commsets(), + data_pool, Ioss::Field::ATTRIBUTE, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); @@ -659,286 +530,493 @@ bool Ioss::Compare::compare_database(Ioss::Region &input_region_1, Ioss::Region { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "element sets"); - rc = compare_fields(input_region_1.get_elementsets(), input_region_2.get_elementsets(), - Ioss::Field::TRANSIENT, buf); + fmt::print(buf, COMMUNICATION_FIELD_VALUE_MISMATCH, "comm sets"); + rc = compare_field_data(input_region_1.get_commsets(), input_region_2.get_commsets(), + data_pool, Ioss::Field::COMMUNICATION, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } // Side Sets - { - const auto &in_sss_1 = input_region_1.get_sidesets(); - const auto &in_sss_2 = input_region_2.get_sidesets(); - for (const auto &iss : in_sss_1) { - const std::string &name = iss->name(); + if (input_region_1.mesh_type() == Ioss::MeshType::UNSTRUCTURED) { + // This should have already been checked. + assert(input_region_2.mesh_type() == Ioss::MeshType::UNSTRUCTURED); + + const auto &in_fss_1 = input_region_1.get_sidesets(); + const auto &in_fss_2 = input_region_2.get_sidesets(); + + // This should have already been checked. + assert(in_fss_1.size() == in_fss_2.size()); + + for (const auto &ifs : in_fss_1) { + const std::string &name = ifs->name(); // Find matching output sideset typename std::vector::const_iterator it; - for (it = in_sss_2.begin(); it != in_sss_2.end(); ++it) { + for (it = in_fss_2.begin(); it != in_fss_2.end(); ++it) { if (name == (*it)->name()) { break; } } - if (it == in_sss_2.end()) { - // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); + + if (it == in_fss_2.end()) { + fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); continue; } { + std::ostringstream buf; + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "side sets"); + rc = compare_field_data(ifs, (*it), data_pool, Ioss::Field::MESH, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + + { + std::ostringstream buf; + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "side sets"); + rc = compare_field_data(ifs, (*it), data_pool, Ioss::Field::ATTRIBUTE, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + const auto &in_sbs_1 = ifs->get_side_blocks(); + const auto &in_sbs_2 = (*it)->get_side_blocks(); + + // This should have already been checked. + assert(in_sbs_1.size() == in_sbs_2.size()); + + for (const auto &isb : in_sbs_1) { + const std::string &sbname = isb->name(); + + // Find matching output sideblock + typename std::vector::const_iterator iter; + for (iter = in_sbs_2.begin(); iter != in_sbs_2.end(); ++iter) { + if (sbname == (*iter)->name()) { + break; + } + } + if (iter == in_sbs_2.end()) { + fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDEBLOCK", name); + continue; + } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side sets"); - rc = compare_fields(iss, (*it), Ioss::Field::TRANSIENT, buf); + fmt::print(buf, MESH_FIELD_VALUE_MISMATCH, "side blocks"); + rc = compare_field_data(isb, (*iter), data_pool, Ioss::Field::MESH, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - const auto &in_sbs_1 = iss->get_side_blocks(); - const auto &in_sbs_2 = (*it)->get_side_blocks(); - if (in_sbs_1.size() != in_sbs_2.size()) { - fmt::print(Ioss::WarnOut(), COUNT_MISMATCH, "SIDEBLOCK", in_sbs_1.size(), - in_sbs_2.size()); - continue; - } - - for (const auto &isb : in_sbs_1) { - // Find matching output sideblock - const std::string &sbname = isb->name(); - - typename std::vector::const_iterator iter; - for (iter = in_sbs_2.begin(); iter != in_sbs_2.end(); ++iter) { - if (sbname == (*iter)->name()) { - break; - } - } - if (iter == in_sbs_2.end()) { - // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDEBLOCK", sbname); - continue; - } - { - std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side blocks"); - rc = compare_fields(isb, (*iter), Ioss::Field::TRANSIENT, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } + { + std::ostringstream buf; + fmt::print(buf, ATTRIBUTE_FIELD_VALUE_MISMATCH, "side blocks"); + rc = compare_field_data(isb, (*iter), data_pool, Ioss::Field::ATTRIBUTE, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } } } } - int in_step_count_1 = input_region_1.get_property("state_count").get_int(); - int in_step_count_2 = input_region_2.get_property("state_count").get_int(); - - for (int istep = 1; istep <= in_step_count_1; istep++) { - double in_time_1 = input_region_1.get_state_time(istep); + // This should have already been checked + assert(input_region_1.property_exists("state_count") == + input_region_2.property_exists("state_count")); - if (in_time_1 < options.minimum_time) { - continue; - } - if (in_time_1 > options.maximum_time) { - break; - } - - if (istep > in_step_count_2) { - break; - } - - input_region_1.begin_state(istep); - input_region_2.begin_state(istep); + if (input_region_1.property_exists("state_count") && + input_region_1.get_property("state_count").get_int() > 0) { + // For each 'TRANSIENT' field in the node blocks and element + // blocks, transfer to the output node and element blocks. { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "region", istep); - rc = compare_field_data(&input_region_1, &input_region_2, data_pool, Ioss::Field::REDUCTION, - options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "region"); + rc = compare_fields(&input_region_1, &input_region_2, Ioss::Field::REDUCTION, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - // This should have already been checked - assert(input_region_1.mesh_type() == input_region_2.mesh_type()); - - if (input_region_1.mesh_type() != Ioss::MeshType::STRUCTURED) { - { - std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "node blocks", istep); - rc = - compare_field_data(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), - data_pool, Ioss::Field::TRANSIENT, options, buf); - if (!rc) { - overall_result = false; - fmt::print(Ioss::OUTPUT(), "{}", buf.str()); - } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "node blocks"); + rc = compare_fields(input_region_1.get_node_blocks(), input_region_2.get_node_blocks(), + Ioss::Field::TRANSIENT, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "edge blocks", istep); - rc = compare_field_data(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), - data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "edge blocks"); + rc = compare_fields(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), + Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "face blocks", istep); - rc = compare_field_data(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), - data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "face blocks"); + rc = compare_fields(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), + Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "element blocks", istep); - rc = compare_field_data(input_region_1.get_element_blocks(), - input_region_2.get_element_blocks(), data_pool, - Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "element blocks"); + rc = compare_fields(input_region_1.get_element_blocks(), + input_region_2.get_element_blocks(), Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "structured blocks", istep); - rc = compare_field_data(input_region_1.get_structured_blocks(), - input_region_2.get_structured_blocks(), data_pool, - Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "structured blocks"); + rc = compare_fields(input_region_1.get_structured_blocks(), + input_region_2.get_structured_blocks(), Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "node sets", istep); - rc = compare_field_data(input_region_1.get_nodesets(), input_region_2.get_nodesets(), - data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "node sets"); + rc = compare_fields(input_region_1.get_nodesets(), input_region_2.get_nodesets(), + Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "edge sets", istep); - rc = compare_field_data(input_region_1.get_edgesets(), input_region_2.get_edgesets(), - data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "edge sets"); + rc = compare_fields(input_region_1.get_edgesets(), input_region_2.get_edgesets(), + Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "face sets", istep); - rc = compare_field_data(input_region_1.get_facesets(), input_region_2.get_facesets(), - data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "face sets"); + rc = compare_fields(input_region_1.get_facesets(), input_region_2.get_facesets(), + Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "element sets", istep); - rc = compare_field_data(input_region_1.get_elementsets(), input_region_2.get_elementsets(), - data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "element sets"); + rc = compare_fields(input_region_1.get_elementsets(), input_region_2.get_elementsets(), + Ioss::Field::TRANSIENT, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } // Side Sets - const auto &in_sss_1 = input_region_1.get_sidesets(); - const auto &in_sss_2 = input_region_2.get_sidesets(); + { + const auto &in_sss_1 = input_region_1.get_sidesets(); + const auto &in_sss_2 = input_region_2.get_sidesets(); + for (const auto &iss : in_sss_1) { + const std::string &name = iss->name(); + + // Find matching output sideset + typename std::vector::const_iterator it; + for (it = in_sss_2.begin(); it != in_sss_2.end(); ++it) { + if (name == (*it)->name()) { + break; + } + } + if (it == in_sss_2.end()) { + // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); + continue; + } - // This should have already been checked - assert(in_sss_1.size() == in_sss_2.size()); + { + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side sets"); + rc = compare_fields(iss, (*it), Ioss::Field::TRANSIENT, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + const auto &in_sbs_1 = iss->get_side_blocks(); + const auto &in_sbs_2 = (*it)->get_side_blocks(); + if (in_sbs_1.size() != in_sbs_2.size()) { + fmt::print(Ioss::WarnOut(), COUNT_MISMATCH, "SIDEBLOCK", in_sbs_1.size(), + in_sbs_2.size()); + continue; + } - for (const auto &iss : in_sss_1) { - const std::string &name = iss->name(); + for (const auto &isb : in_sbs_1) { + // Find matching output sideblock + const std::string &sbname = isb->name(); - // Find matching output sideset - typename std::vector::const_iterator it; - for (it = in_sss_2.begin(); it != in_sss_2.end(); ++it) { - if (name == (*it)->name()) { - break; + typename std::vector::const_iterator iter; + for (iter = in_sbs_2.begin(); iter != in_sbs_2.end(); ++iter) { + if (sbname == (*iter)->name()) { + break; + } + } + if (iter == in_sbs_2.end()) { + // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDEBLOCK", sbname); + continue; + } + + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side blocks"); + rc = compare_fields(isb, (*iter), Ioss::Field::TRANSIENT, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + } } } + } + + int in_step_count_1 = input_region_1.get_property("state_count").get_int(); + int in_step_count_2 = input_region_2.get_property("state_count").get_int(); - if (it == in_sss_2.end()) { - // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); + for (int istep = 1; istep <= in_step_count_1; istep++) { + double in_time_1 = input_region_1.get_state_time(istep); + + if (in_time_1 < options.minimum_time) { continue; } + if (in_time_1 > options.maximum_time) { + break; + } + + if (istep > in_step_count_2) { + break; + } + + input_region_1.begin_state(istep); + input_region_2.begin_state(istep); { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "region", istep); + rc = compare_field_data(&input_region_1, &input_region_2, data_pool, + Ioss::Field::REDUCTION, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + // This should have already been checked + assert(input_region_1.mesh_type() == input_region_2.mesh_type()); + + if (input_region_1.mesh_type() != Ioss::MeshType::STRUCTURED) { { std::ostringstream buf; - fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side sets"); - rc = compare_field_data(iss, (*it), data_pool, Ioss::Field::TRANSIENT, options, buf); + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "node blocks", istep); + rc = compare_field_data(input_region_1.get_node_blocks(), + input_region_2.get_node_blocks(), data_pool, + Ioss::Field::TRANSIENT, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } - const auto &in_sbs_1 = iss->get_side_blocks(); - const auto &in_sbs_2 = (*it)->get_side_blocks(); - if (in_sbs_1.size() != in_sbs_2.size()) { - fmt::print(Ioss::WarnOut(), COUNT_MISMATCH, "SIDEBLOCK", in_sbs_1.size(), - in_sbs_2.size()); - continue; + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "edge blocks", istep); + rc = + compare_field_data(input_region_1.get_edge_blocks(), input_region_2.get_edge_blocks(), + data_pool, Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "face blocks", istep); + rc = + compare_field_data(input_region_1.get_face_blocks(), input_region_2.get_face_blocks(), + data_pool, Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "element blocks", istep); + rc = compare_field_data(input_region_1.get_element_blocks(), + input_region_2.get_element_blocks(), data_pool, + Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "structured blocks", istep); + rc = compare_field_data(input_region_1.get_structured_blocks(), + input_region_2.get_structured_blocks(), data_pool, + Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "node sets", istep); + rc = compare_field_data(input_region_1.get_nodesets(), input_region_2.get_nodesets(), + data_pool, Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "edge sets", istep); + rc = compare_field_data(input_region_1.get_edgesets(), input_region_2.get_edgesets(), + data_pool, Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "face sets", istep); + rc = compare_field_data(input_region_1.get_facesets(), input_region_2.get_facesets(), + data_pool, Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_STEP_VALUE_MISMATCH, "element sets", istep); + rc = + compare_field_data(input_region_1.get_elementsets(), input_region_2.get_elementsets(), + data_pool, Ioss::Field::TRANSIENT, options, buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } + } + // Side Sets + const auto &in_sss_1 = input_region_1.get_sidesets(); + const auto &in_sss_2 = input_region_2.get_sidesets(); - for (const auto &isb : in_sbs_1) { - // Find matching output sideblock - const std::string &sbname = isb->name(); + // This should have already been checked + assert(in_sss_1.size() == in_sss_2.size()); - typename std::vector::const_iterator iter; - for (iter = in_sbs_2.begin(); iter != in_sbs_2.end(); ++iter) { - if (sbname == (*iter)->name()) { - break; - } - } - if (iter == in_sbs_2.end()) { - // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); - continue; + for (const auto &iss : in_sss_1) { + const std::string &name = iss->name(); + + // Find matching output sideset + typename std::vector::const_iterator it; + for (it = in_sss_2.begin(); it != in_sss_2.end(); ++it) { + if (name == (*it)->name()) { + break; } + } + + if (it == in_sss_2.end()) { + // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); + continue; + } + { { std::ostringstream buf; fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side sets"); - rc = - compare_field_data(isb, (*iter), data_pool, Ioss::Field::TRANSIENT, options, buf); + rc = compare_field_data(iss, (*it), data_pool, Ioss::Field::TRANSIENT, options, buf); if (!rc) { overall_result = false; fmt::print(Ioss::OUTPUT(), "{}", buf.str()); } } + const auto &in_sbs_1 = iss->get_side_blocks(); + const auto &in_sbs_2 = (*it)->get_side_blocks(); + if (in_sbs_1.size() != in_sbs_2.size()) { + fmt::print(Ioss::WarnOut(), COUNT_MISMATCH, "SIDEBLOCK", in_sbs_1.size(), + in_sbs_2.size()); + continue; + } + + for (const auto &isb : in_sbs_1) { + // Find matching output sideblock + const std::string &sbname = isb->name(); + + typename std::vector::const_iterator iter; + for (iter = in_sbs_2.begin(); iter != in_sbs_2.end(); ++iter) { + if (sbname == (*iter)->name()) { + break; + } + } + if (iter == in_sbs_2.end()) { + // fmt::print(Ioss::WarnOut(), NOTFOUND_2, "SIDESET", name); + continue; + } + + { + std::ostringstream buf; + fmt::print(buf, TRANSIENT_FIELD_VALUE_MISMATCH, "side sets"); + rc = compare_field_data(isb, (*iter), data_pool, Ioss::Field::TRANSIENT, options, + buf); + if (!rc) { + overall_result = false; + fmt::print(Ioss::OUTPUT(), "{}", buf.str()); + } + } + } } } } } - } - Ioss::Utils::clear(data_pool.data); + Ioss::Utils::clear(data_pool.data); - return overall_result; -} + return overall_result; + } -namespace { bool compare_properties(const Ioss::GroupingEntity *ige_1, const Ioss::GroupingEntity *ige_2, std::ostringstream &buf) { @@ -995,6 +1073,40 @@ namespace { return overall_result; } + bool compare_change_sets(const Ioss::Region &input_region_1, const Ioss::Region &input_region_2, + IOSS_MAYBE_UNUSED std::ostringstream &buf) + { + bool overall_result = true; + auto cs1_count = input_region_1.get_database()->num_internal_change_set(); + auto cs2_count = input_region_2.get_database()->num_internal_change_set(); + if (cs1_count != cs2_count) { + fmt::print(Ioss::WarnOut(), COUNT_MISMATCH, "CHANGE SETS", cs1_count, cs2_count); + overall_result = false; + } + + auto cs1_names = input_region_1.get_database()->internal_change_set_describe(); + auto cs2_names = input_region_2.get_database()->internal_change_set_describe(); + + for (const auto &cs1_name : cs1_names) { + auto it = std::find(cs2_names.cbegin(), cs2_names.cend(), cs1_name); + if (it == cs2_names.cend()) { + // CHANGE_SET was not found + fmt::print(Ioss::WarnOut(), NOTFOUND_2, "CHANGE SET", cs1_name); + overall_result = false; + } + } + + for (const auto &cs2_name : cs2_names) { + auto it = std::find(cs1_names.cbegin(), cs1_names.cend(), cs2_name); + if (it == cs1_names.cend()) { + // CHANGE_SET was not found + fmt::print(Ioss::WarnOut(), NOTFOUND_1, "CHANGE SET", cs2_name); + overall_result = false; + } + } + return overall_result; + } + bool compare_qa_info(const Ioss::Region &input_region_1, const Ioss::Region &input_region_2, std::ostringstream &buf) { diff --git a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C index e9f61a7e1268..a198921bdbc8 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C +++ b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C @@ -447,7 +447,9 @@ namespace { // Get all properties of input database... transfer_properties(®ion, &output_region); - transfer_qa_info(region, output_region); + if (!options.ignore_qa_info) { + transfer_qa_info(region, output_region); + } if (rank == 0 && options.output_summary) { fmt::print(std::cout, "\n\n Input Region summary for rank 0:\n"); diff --git a/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C b/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C index f16b426753cd..1fb9559f266f 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.C @@ -1596,6 +1596,25 @@ namespace Ioss { return zero_copy_not_enabled(sb, field, this); } + void DatabaseIO::release_memory_nl() + { + nodeMap.release_memory(); + edgeMap.release_memory(); + faceMap.release_memory(); + elemMap.release_memory(); + } + + void DatabaseIO::reset_database_nl() + { + release_memory_nl(); + dbState = STATE_INVALID; + nodeCount = 0; + elementCount = 0; + sideTopology.clear(); + blockAdjacency.clear(); + blockAdjacenciesCalculated = false; + elementBlockBoundingBoxes.clear(); + } } // namespace Ioss namespace { diff --git a/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.h b/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.h index 44db7cfe0778..dbef70da8104 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.h @@ -246,63 +246,82 @@ namespace Ioss { flush_database_nl(); } - /** \brief If a database type supports groups and if the database - * contains groups, open the specified group. - * - * If the group_name begins with '/', it specifies the absolute path - * name from the root with '/' separating groups. Otherwise, the - * group_name specifies a child group of the currently active group. - * If group_name == "/" then the root group is opened. + void reset_database() + { + IOSS_FUNC_ENTER(m_); + progress(__func__); + reset_database_nl(); + } + + /** \brief If a database type supports internal change sets and if the database + * contains internal change sets, open the specified set. * - * \param[in] group_name The name of the group to open. + * \param[in] set_name The name of the set to open. * \returns True if successful. */ - bool open_group(const std::string &group_name) + bool open_internal_change_set(const std::string &set_name) { IOSS_FUNC_ENTER(m_); - return open_group_nl(group_name); + return open_internal_change_set_nl(set_name); } - /** \brief If a database type supports groups, create the specified - * group as a child of the current group. + /** \brief If a database type supports internal change sets, create the + * specified set. * - * The name of the group must not contain a '/' character. - * If the command is successful, then the group will be the - * active group for all subsequent writes to the database. - * - * \param[in] group_name The name of the subgroup to create. + * \param[in] set_name The name of the set to create. * \returns True if successful. */ - bool create_subgroup(const std::string &group_name) + bool create_internal_change_set(const std::string &set_name) { IOSS_FUNC_ENTER(m_); - return create_subgroup_nl(group_name); + return create_internal_change_set_nl(set_name); } - bool open_root_group() + /** \brief If a database type supports internal change sets, and if the database + * contains internal change sets, return the number of change sets. + */ + int num_internal_change_set() { IOSS_FUNC_ENTER(m_); - return open_root_group_nl(); + return num_internal_change_set_nl(); } - int num_child_group() + /** \brief If a database type supports internal change sets, open the change set + * specified [zero-based] index + * + * \param[in] child_index The [zero-based] index of the internal change set to open. + * \returns True if successful. + */ + bool open_internal_change_set(int set_index) { IOSS_FUNC_ENTER(m_); - return num_child_group_nl(); + return open_internal_change_set_nl(set_index); } - bool open_child_group(int index) + /** \brief If a database type supports internal change sets, return a list of set names + * + * \param[in] return_full_names Flag to control return of relative + * or full set name paths. + * \returns True if successful. + */ + Ioss::NameList internal_change_set_describe(bool return_full_names = false) { IOSS_FUNC_ENTER(m_); - return open_child_group_nl(index); + return internal_change_set_describe_nl(return_full_names); } - Ioss::NameList groups_describe(bool return_full_names = false) + /** \brief Checks if a database type supports internal change sets + * + * \returns True if successful. + */ + bool supports_internal_change_set() { IOSS_FUNC_ENTER(m_); - return groups_describe_nl(return_full_names); + return supports_internal_change_set_nl(); } + IOSS_NODISCARD virtual std::string get_internal_change_set_name() const { return ""; } + /** \brief Set the database to the given State. * * All transitions must begin from the 'STATE_CLOSED' state or be to @@ -356,7 +375,23 @@ namespace Ioss { void get_step_times() { IOSS_FUNC_ENTER(m_); - return get_step_times_nl(); + get_step_times_nl(); + } + + /** \brief Return the list of timesteps in the database contingent on certain + * controlling properties. + * + * This is different from get_step_times() in that it does not set timestep + * data on the region. If the database supports change sets, it will return the + * timestep data for the current change set + * + * \returns timesteps. + * + */ + std::vector get_db_step_times() + { + IOSS_FUNC_ENTER(m_); + return get_db_step_times_nl(); } IOSS_NODISCARD virtual bool internal_edges_available() const { return false; } @@ -762,13 +797,9 @@ namespace Ioss { virtual void closeDatabase_nl() const; virtual void flush_database_nl() const {} - virtual void release_memory_nl() - { - nodeMap.release_memory(); - edgeMap.release_memory(); - faceMap.release_memory(); - elemMap.release_memory(); - } + virtual void release_memory_nl(); + + virtual void reset_database_nl(); private: virtual bool ok_nl(bool /* write_message */, std::string * /* error_message */, @@ -790,12 +821,12 @@ namespace Ioss { return elemMap.global_to_local(global); } - virtual int num_child_group_nl() { return 0; } - virtual bool open_child_group_nl(int /* index */) { return false; } - virtual bool open_root_group_nl() { return false; } - virtual bool open_group_nl(const std::string & /* group_name */) { return false; } - virtual bool create_subgroup_nl(const std::string & /* group_name */) { return false; } - virtual Ioss::NameList groups_describe_nl(bool /* return_full_names */) + virtual bool supports_internal_change_set_nl() { return false; } + virtual bool open_internal_change_set_nl(const std::string & /* set_name */) { return false; } + virtual bool open_internal_change_set_nl(int /* index */) { return false; } + virtual bool create_internal_change_set_nl(const std::string & /* set_name */) { return false; } + virtual int num_internal_change_set_nl() { return 0; } + virtual Ioss::NameList internal_change_set_describe_nl(bool /* return_full_names */) { return Ioss::NameList(); } @@ -803,8 +834,9 @@ namespace Ioss { virtual bool begin_nl(Ioss::State state) = 0; virtual bool end_nl(Ioss::State state) = 0; - virtual void read_meta_data_nl() = 0; - virtual void get_step_times_nl() {} + virtual void read_meta_data_nl() = 0; + virtual void get_step_times_nl() {} + virtual std::vector get_db_step_times_nl() { return std::vector(); } virtual bool begin_state_nl(int state, double time); virtual bool end_state_nl(int state, double time); diff --git a/packages/seacas/libraries/ioss/src/Ioss_Decomposition.h b/packages/seacas/libraries/ioss/src/Ioss_Decomposition.h index 14ca00bd4e3c..57972f90d861 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Decomposition.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Decomposition.h @@ -258,7 +258,7 @@ namespace Ioss { return I->second; } - void show_progress(const std::string &message) const + void show_progress(std::string_view message) const { if (m_showProgress) { Ioss::ParallelUtils pu(m_comm); diff --git a/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.C b/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.C index f3c1e051ca34..f30b18f46067 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.C +++ b/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.C @@ -20,12 +20,10 @@ #include "Ioss_Region.h" #include "Ioss_SmartAssert.h" +#include #include #include #include -#if !defined __NVCC__ -#include -#endif #if !defined(NO_ZOLTAN_SUPPORT) #include // for Zoltan_Initialize @@ -128,10 +126,13 @@ namespace { } return chains; } +} // namespace - void output_histogram(const std::vector &proc_work, size_t avg_work, size_t median) +namespace Ioss { + void DecompUtils::output_histogram(const std::vector &proc_work, double avg_work, + size_t median) { - fmt::print("Work-per-processor Histogram\n"); + fmt::print("Work-per-processor Histogram:\n"); std::array histogram{}; auto wmin = *std::min_element(proc_work.begin(), proc_work.end()); @@ -186,9 +187,7 @@ namespace { } fmt::print("\n"); } -} // namespace -namespace Ioss { template IOSS_EXPORT void DecompUtils::decompose_zoltan(const Ioss::Region ®ion, int ranks, const std::string &method, std::vector &elem_to_proc, const std::vector &weights, @@ -463,27 +462,33 @@ namespace Ioss { DecompUtils::line_decomp_modify(const Ioss::chain_t &element_chains, std::vector &elem_to_proc, int proc_count); - void DecompUtils::output_decomposition_statistics(const std::vector &elem_to_proc, - int proc_count) + std::vector DecompUtils::get_work_per_rank(const std::vector &elem_to_proc, + int proc_count) { - // Output histogram of elements / rank... - std::vector elem_per_rank(proc_count); + std::vector work_per_rank(proc_count); for (int proc : elem_to_proc) { - elem_per_rank[proc]++; + work_per_rank[proc]++; } + return work_per_rank; + } - size_t number_elements = elem_to_proc.size(); - size_t proc_width = Ioss::Utils::number_width(proc_count, false); - size_t work_width = Ioss::Utils::number_width(number_elements, true); - - auto min_work = *std::min_element(elem_per_rank.begin(), elem_per_rank.end()); - auto max_work = *std::max_element(elem_per_rank.begin(), elem_per_rank.end()); + std::pair + DecompUtils::output_decomposition_statistics(const std::vector work_per_rank) + { + size_t total_work = std::accumulate(work_per_rank.begin(), work_per_rank.end(), size_t(0)); + size_t proc_count = work_per_rank.size(); + size_t proc_width = Ioss::Utils::number_width(proc_count, false); + size_t work_width = Ioss::Utils::number_width(total_work, true); + + auto min_work = *std::min_element(work_per_rank.begin(), work_per_rank.end()); + auto max_work = *std::max_element(work_per_rank.begin(), work_per_rank.end()); + double avg_work = 0.0; size_t median = 0; { - auto pw_copy(elem_per_rank); + auto pw_copy(work_per_rank); std::nth_element(pw_copy.begin(), pw_copy.begin() + pw_copy.size() / 2, pw_copy.end()); median = pw_copy[pw_copy.size() / 2]; - fmt::print("\nElements per processor:\n\tMinimum = {}, Maximum = {}, Median = {}, Ratio = " + fmt::print("\nWork per processor:\n\tMinimum = {}, Maximum = {}, Median = {}, Ratio = " "{:.3}\n\n", fmt::group_digits(min_work), fmt::group_digits(max_work), fmt::group_digits(median), (double)(max_work) / min_work); @@ -497,37 +502,40 @@ namespace Ioss { min_star = std::max(1, min_star); int delta = max_star - min_star; - double avg_work = (double)number_elements / (double)proc_count; - for (size_t i = 0; i < elem_per_rank.size(); i++) { + avg_work = (double)total_work / (double)proc_count; + for (size_t i = 0; i < work_per_rank.size(); i++) { int star_cnt = - (double)(elem_per_rank[i] - min_work) / (max_work - min_work) * delta + min_star; - std::string stars(star_cnt, '*'); - const std::string format = "\tProcessor {:{}}, work = {:{}} ({:.2f})\t{}\n"; - if (elem_per_rank[i] == max_work) { - fmt::print( + (double)(work_per_rank[i] - min_work) / (max_work - min_work) * delta + min_star; + std::string stars(star_cnt, '*'); + auto tmp = fmt::format(fmt::runtime("\tProcessor {:{}}, work = {:{}} ({:.2f})\t{}\n"), i, + proc_width, fmt::group_digits(work_per_rank[i]), work_width, + work_per_rank[i] / avg_work, stars); + #if !defined __NVCC__ - fg(fmt::color::red), -#endif - fmt::runtime(format), i, proc_width, fmt::group_digits(elem_per_rank[i]), work_width, - (double)elem_per_rank[i] / avg_work, stars); + if (work_per_rank[i] == max_work) { + fmt::print("{}", fmt::styled(tmp, fmt::fg(fmt::color::red))); } - else if (elem_per_rank[i] == min_work) { - fmt::print( -#if !defined __NVCC__ - fg(fmt::color::green), -#endif - fmt::runtime(format), i, proc_width, fmt::group_digits(elem_per_rank[i]), work_width, - elem_per_rank[i] / avg_work, stars); + else if (work_per_rank[i] == min_work) { + fmt::print("{}", fmt::styled(tmp, fmt::fg(fmt::color::green))); } else { - fmt::print(fmt::runtime(format), i, proc_width, fmt::group_digits(elem_per_rank[i]), - work_width, elem_per_rank[i] / avg_work, stars); + fmt::print("{}", tmp); } +#else + fmt::print("{}", tmp); +#endif } - - // Output Histogram... - output_histogram(elem_per_rank, (size_t)avg_work, median); } + + // Imbalance penalty -- max work / avg work. If perfect balance, then all processors would have + // "avg_work" work to do. With current decomposition, every processor has to wait until + // "max_work" is done. Penalty = max_work / avg_work. + fmt::print("\nImbalance Penalty:\n\tMaximum Work = {}, Average Work = {}, Penalty (max/avg) " + "= {:.2f}\n\n", + fmt::group_digits(max_work), fmt::group_digits((size_t)avg_work), + (double)max_work / avg_work); + + return std::make_pair(avg_work, median); } template diff --git a/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.h b/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.h index 728f40f4ed47..79c907276c16 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.h +++ b/packages/seacas/libraries/ioss/src/Ioss_DecompositionUtils.h @@ -19,12 +19,17 @@ namespace Ioss { class IOSS_EXPORT DecompUtils { public: + static void output_histogram(const std::vector &proc_work, double avg_work, + size_t median); + template static void line_decomp_modify(const Ioss::chain_t &element_chains, std::vector &element_to_proc, int proc_count); - static void output_decomposition_statistics(const std::vector &element_to_proc, - int proc_count); + static std::vector get_work_per_rank(const std::vector &elem_to_proc, + int proc_count); + static std::pair + output_decomposition_statistics(const std::vector work_per_rank); template static std::vector line_decomp_weights(const Ioss::chain_t &element_chains, diff --git a/packages/seacas/libraries/ioss/src/Ioss_Doxygen.h b/packages/seacas/libraries/ioss/src/Ioss_Doxygen.h index 6206f622dd9a..f989a3796677 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Doxygen.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Doxygen.h @@ -38,7 +38,7 @@ adios | Input/Output | Adaptable Input/Output system, (https://adios faodel | Input/Output | (https://github.com/faodel/faodel) exodusii | Input/Output | alias for exodus genesis | Input/Output | alias for exodus -par_cgns | Input/Output | alias for parallel CGNS +par_cgns | Input/Output | alias for parallel CGNS \section properties Properties @@ -137,7 +137,7 @@ PARALLEL_IO_MODE | netcdf4, hdf5, pnetcdf, (mpiio and mpiposix are deprecated) The `overlay` specifies the number of output steps which will be overlaid on top of the currently written step before advancing to the next step on the database. - + For example, if output every 0.1 seconds and the overlay count is specified as 2, then IOSS will write time 0.1 to step 1 of the database. It will then write 0.2 and 0.3 also to step 1. It will @@ -146,7 +146,7 @@ then increment the database step and write 0.4 to step 2 and overlay to completion), the database would have times 0.3, 0.6, 0.9, ... However, if there were a problem during the analysis, the last step on the database would contain an intermediate step. - + The `cycle_count` specifies the number of restart steps which will be written to the restart database before previously written steps are overwritten. For example, if the `cycle` count is 5 and output is @@ -156,16 +156,16 @@ with data from time 0.6, the second with time 0.7. At time 0.8, the database would contain data at times 0.6, 0.7, 0.8, 0.4, 0.5. Note that time will not necessarily be monotonically increasing on a database that specifies the cycle count. - + The cycle count and overlay count can both be used at the same time also. The basic formula is: -``` +``` db_step = (((output_step - 1) / overlay) % cycle) + 1 -``` +``` where `output_step` is the step that this would have been on the database in a normal write (1,2,3,....) and `db_step` is the step number that this will be written to. - + If you only want the last step available on the database, use `set_cycle_count(1)`. @@ -177,7 +177,7 @@ timesteps will be written to each file. If we have `cycle=2` and file. Then, the first file will be reopened and steps 0.7, 0.8, and 0.9 will be written to the first file. - + ## Properties for the heartbeat output Property | Value | Description -----------------------|:------:|----------------------------------------------------------- diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.C deleted file mode 100644 index 16b73da0a4ee..000000000000 --- a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.C +++ /dev/null @@ -1,728 +0,0 @@ -// Copyright(C) 2024 National Technology & Engineering Solutions -// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with -// NTESS, the U.S. Government retains certain rights in this software. -// -// See packages/seacas/LICENSE for details - -#include "Ioss_Assembly.h" -#include "Ioss_Blob.h" -#include "Ioss_CodeTypes.h" -#include "Ioss_CommSet.h" -#include "Ioss_DBUsage.h" -#include "Ioss_DatabaseIO.h" -#include "Ioss_DynamicTopology.h" -#include "Ioss_EdgeBlock.h" -#include "Ioss_EdgeSet.h" -#include "Ioss_ElementBlock.h" -#include "Ioss_ElementSet.h" -#include "Ioss_EntityBlock.h" -#include "Ioss_EntityType.h" -#include "Ioss_FaceBlock.h" -#include "Ioss_FaceSet.h" -#include "Ioss_Field.h" -#include "Ioss_FileInfo.h" -#include "Ioss_GroupingEntity.h" -#include "Ioss_IOFactory.h" -#include "Ioss_NodeBlock.h" -#include "Ioss_NodeSet.h" -#include "Ioss_Region.h" -#include "Ioss_SideBlock.h" -#include "Ioss_SideSet.h" -#include "Ioss_StructuredBlock.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Ioss_ParallelUtils.h" - -namespace Ioss { - -void DynamicTopologyObserver::check_region() const -{ - if(nullptr == m_region) { - std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: A region has not been registered with the " - "Dynamic Topology Observer.\n\n"); - IOSS_ERROR(errmsg); - } -} - -void DynamicTopologyObserver::register_region(Region *region) -{ - if(nullptr != region && nullptr != m_region && region != m_region) { - std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: Attempt to re-register different region on " - "Dynamic Topology Observer.\n\n"); - IOSS_ERROR(errmsg); - } - - m_region = region; -} - -void DynamicTopologyObserver::register_notifier(DynamicTopologyNotifier *notifier) -{ - if(nullptr != notifier && nullptr != m_notifier && notifier != m_notifier) { - std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: Attempt to re-register different notifier on " - "Dynamic Topology Observer.\n\n"); - IOSS_ERROR(errmsg); - } - - m_notifier = notifier; -} - -void DynamicTopologyObserver::set_cumulative_topology_modification(unsigned int type) -{ m_cumulativeTopologyModification = type; } - -unsigned int DynamicTopologyObserver::get_cumulative_topology_modification() const -{ return m_cumulativeTopologyModification; } - -unsigned int DynamicTopologyObserver::get_topology_modification() const -{ return m_topologyModification; } - -void DynamicTopologyObserver::set_topology_modification_nl(unsigned int type) -{ - m_topologyModification |= type; - m_cumulativeTopologyModification |= type; -} - -void DynamicTopologyObserver::set_topology_modification(unsigned int type) -{ - if(!(m_topologyModification & type)) { - set_topology_modification_nl(type); - - if(nullptr != m_notifier) { - for(auto observer : m_notifier->get_observers()) { - observer->set_topology_modification_nl(type); - } - } - } -} - -void DynamicTopologyObserver::reset_topology_modification() -{ - m_topologyModification = TOPOLOGY_SAME; -} - -void DynamicTopologyObserver::reset_topology_modification_all() -{ - if(m_topologyModification != TOPOLOGY_SAME) { - reset_topology_modification(); - - if(nullptr != m_notifier) { - for(auto observer : m_notifier->get_observers()) { - observer->reset_topology_modification(); - } - } - } -} - -bool DynamicTopologyObserver::is_topology_modified() const -{ return m_topologyModification != TOPOLOGY_SAME; } - -const ParallelUtils &DynamicTopologyObserver::util() const -{ - check_region(); - return m_region->get_database()->util(); -} - -void DynamicTopologyObserver::synchronize_topology_modified_flags() -{ - check_region(); - int num_processors = m_region->get_database()->parallel_size(); - // Synchronize the topology flags between all processors in case - // it has not been set consistently. - if (num_processors > 1) { - static unsigned int buffer[2]; - buffer[0] = m_cumulativeTopologyModification; - buffer[1] = m_topologyModification; - - util().attribute_reduction(2*sizeof(unsigned int), reinterpret_cast(buffer)); - - m_cumulativeTopologyModification = buffer[0]; - m_topologyModification = buffer[1]; - } -} - -int DynamicTopologyObserver::get_cumulative_topology_modification_field() -{ - check_region(); - const std::string variable_name = topology_modification_change_name(); - - int ivalue = 0; - - if (m_region->field_exists(variable_name)) { - Field topo_field = m_region->get_field(variable_name); - if (topo_field.get_type() == Field::INTEGER) { - m_region->get_field_data(variable_name, &ivalue, sizeof(int)); - } else { - double value; - m_region->get_field_data(variable_name, &value, sizeof(double)); - ivalue = (int)value; - } - } - - int num_processors = m_region->get_database()->parallel_size(); - // Synchronize the value between all processors in case - // it has not been set consistently. - if (num_processors > 1) { - unsigned int buffer[1]; - buffer[0] = ivalue; - - util().attribute_reduction(sizeof(unsigned int), reinterpret_cast(buffer)); - - ivalue = (int)buffer[0]; - } - - m_cumulativeTopologyModification = ivalue; - - return ivalue; -} - -void DynamicTopologyObserver::define_model() -{ - -} - -void DynamicTopologyObserver::write_model() -{ - -} - -void DynamicTopologyObserver::define_transient() -{ - -} - - -DynamicTopologyBroker* DynamicTopologyBroker::broker() -{ - static DynamicTopologyBroker broker_; - return &broker_; -} - -void DynamicTopologyBroker::register_model(const std::string& model_name) -{ - auto iter = m_notifiers.find(model_name); - if(iter != m_notifiers.end()) { - return; - } - - m_notifiers[model_name] = std::make_shared(model_name); -} - -std::shared_ptr DynamicTopologyBroker::get_notifier(const std::string& model_name) const -{ - auto iter = m_notifiers.find(model_name); - if(iter != m_notifiers.end()) { - return iter->second; - } - - return {}; -} - -std::vector> DynamicTopologyBroker::get_observers(const std::string& model_name) const -{ - std::vector> observers; - - auto notifier = get_notifier(model_name); - - if(notifier) { - return notifier->get_observers(); - } - - return observers; -} - -void DynamicTopologyBroker::remove_model(const std::string& model_name) -{ - auto iter = m_notifiers.find(model_name); - if(iter != m_notifiers.end()) { - m_notifiers.erase(iter); - } -} - -void DynamicTopologyBroker::clear_models() -{ - m_notifiers.clear(); -} - -void DynamicTopologyBroker::register_observer(const std::string& model_name, - std::shared_ptr observer) -{ - auto notifier = get_notifier(model_name); - - if(!notifier) { - register_model(model_name); - notifier = get_notifier(model_name); - } - - notifier->register_observer(observer); -} - -void DynamicTopologyBroker::register_observer(const std::string& model_name, - std::shared_ptr observer, - Region& region) -{ - region.register_mesh_modification_observer(observer); - register_observer(model_name, observer); -} - -void DynamicTopologyBroker::reset_topology_modification(const std::string& model_name) -{ - auto notifier = get_notifier(model_name); - - if(!notifier) return; - - notifier->reset_topology_modification(); -} - -void DynamicTopologyBroker::set_topology_modification(const std::string& model_name, unsigned int type) -{ - auto notifier = get_notifier(model_name); - - if(!notifier) return; - - notifier->set_topology_modification(type); -} - - -struct DynamicTopologyObserverCompare { - bool operator()(const std::shared_ptr & lhs, - const std::shared_ptr & rhs) const { - assert(lhs && (lhs->get_region() != nullptr)); - assert(rhs && (rhs->get_region() != nullptr)); - return (lhs->get_region() < rhs->get_region()); - } -}; - -void DynamicTopologyNotifier::register_observer(std::shared_ptr observer) -{ - observer->register_notifier(this); - m_observers.push_back(observer); - std::sort(m_observers.begin(), m_observers.end(), DynamicTopologyObserverCompare()); -} - -void DynamicTopologyNotifier::unregister_observer(std::shared_ptr observer) -{ - auto iter = std::find(m_observers.begin(), m_observers.end(), observer); - if (iter != m_observers.end()) { - (*iter)->register_notifier(nullptr); - m_observers.erase(iter); - } -} - -void DynamicTopologyNotifier::reset_topology_modification() -{ - for(std::shared_ptr& observer : m_observers) { - observer->reset_topology_modification(); - } -} - -void DynamicTopologyNotifier::set_topology_modification(unsigned int type) -{ - for(std::shared_ptr& observer : m_observers) { - observer->set_topology_modification(type); - } -} - - -DynamicTopologyFileControl::DynamicTopologyFileControl(Region *region, unsigned int fileCyclicCount, - IfDatabaseExistsBehavior &ifDatabaseExists, - unsigned int &dbChangeCount) - : m_region(region) - , m_fileCyclicCount(fileCyclicCount) - , m_ifDatabaseExists(ifDatabaseExists) - , m_dbChangeCount(dbChangeCount) -{ - if(nullptr == region) { - std::ostringstream errmsg; - fmt::print(errmsg, "ERROR: null region passed in as argument to DynamicTopologyFileControl"); - IOSS_ERROR(errmsg); - } - - m_ioDB = region->get_property("base_filename").get_string(); - m_dbType = region->get_property("database_type").get_string(); -} - -const ParallelUtils &DynamicTopologyFileControl::util() const -{ - return m_region->get_database()->util(); -} - -bool DynamicTopologyFileControl::file_exists(const std::string &filename, - const std::string &db_type, - Ioss::DatabaseUsage db_usage) -{ - bool exists = false; - int par_size = m_region->get_database()->parallel_size(); - int par_rank = m_region->get_database()->parallel_rank(); - bool is_parallel = par_size > 1; - std::string full_filename = filename; - if (is_parallel && db_type == "exodusII" && db_usage != Ioss::WRITE_HISTORY) { - full_filename = Ioss::Utils::decode_filename(filename, par_rank, par_size); - } - - if (!is_parallel || par_rank == 0) { - // Now, see if this file exists... - // Don't want to do a system call on all processors since it can take minutes - // on some of the larger machines, filesystems, and processor counts... - Ioss::FileInfo file = Ioss::FileInfo(full_filename); - exists = file.exists(); - } - - if (is_parallel) { - int iexists = exists ? 1 : 0; - util().broadcast(iexists, 0); - exists = iexists == 1; - } - return exists; -} - -std::string DynamicTopologyFileControl::get_unique_filename(Ioss::DatabaseUsage db_usage) -{ - std::string filename = m_ioDB; - - do { - // Run this loop at least once for all files. If this is an automatic - // restart, then make sure that the generated file does not already exist, - // so keep running the loop until we generate a filename that doesn't exist... - std::ostringstream tmp_filename; - tmp_filename << m_ioDB; - - // Don't append the "-s000X" the first time in case the base filename doesn't - // exist -- we want write to the name specified by the user if at all possible and - // once that exists, then start adding on the suffix... - if (m_dbChangeCount > 1) { - tmp_filename << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount; - } - filename = tmp_filename.str(); - ++m_dbChangeCount; - } while(file_exists(filename, m_dbType, db_usage)); - --m_dbChangeCount; - return filename; -} - -std::string DynamicTopologyFileControl::construct_database_filename(int& step, Ioss::DatabaseUsage db_usage) -{ - // Filename will be of the form -- ioDB-sxxxx where xxxx is step - // number. Assume maximum of 9999 steps (will do more, but won't have - // good lineup of step numbers. - // Check database for validity (filename and a type) - if(m_ioDB.empty() || m_dbType.empty()) - { - std::string error_message; - if(m_dbType.empty()) - error_message += "The database TYPE has not been defined\n"; - - if(m_ioDB.empty()) - { - error_message += "The database FILENAME has not been defined\n"; - } - std::ostringstream errmsg; - fmt::print(errmsg, fmt::runtime(error_message)); - IOSS_ERROR(errmsg); - } - assert(!m_ioDB.empty()); - assert(!m_dbType.empty()); - std::string filename = m_ioDB; - if(m_fileCyclicCount > 0) - { - // In this mode, we close the old file and open a new file - // every time this is called. The file suffix cycles through - // the first fileCyclicCount'th entries in A,B,C,D,E,F,... - if(step == 0) - step++; - - static std::string suffix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - std::string tmp = "-" + suffix.substr((step - 1) % m_fileCyclicCount, 1); - filename += tmp; - m_properties.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_OVERWRITE)); - } - else - { - if(m_region->model_is_written()) - { - // After the initial open, we want to add suffix if the topology changes - // during the run - m_ifDatabaseExists = Ioss::DB_ADD_SUFFIX_OVERWRITE; - } - - // Handle complications of DB_APPEND mode... - // If in DB_APPEND mode, then we don't output metadata - // information, so some knowledge is needed at this level if - // we are appending. If user specified APPEND, but the file - // doesn't yet exist OR it does exist and we are not - // restarting, change the mode to OVERWRITE. - // 0. Must be restarting; either manual or automatic. - std::shared_ptr observer = m_region->get_mesh_modification_observer(); - - if(m_ifDatabaseExists == Ioss::DB_APPEND) - { - if(!observer->is_restart_requested()) - { - // Not restarting - m_ifDatabaseExists = Ioss::DB_OVERWRITE; - } - else if(!file_exists(m_ioDB, m_dbType, db_usage)) - { - m_ifDatabaseExists = Ioss::DB_OVERWRITE; - } - } - if(step > 1 || (m_dbChangeCount > 1)) - { - // Use the !is_input_event test since restart input files already have the - // -s000x extension... - if(m_ifDatabaseExists == Ioss::DB_APPEND) - { - std::ostringstream tmp_filename; - tmp_filename << m_ioDB; - filename = m_ioDB; - if(m_dbChangeCount > 1) - { - tmp_filename << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount; - } - size_t inc = 0; - while(file_exists(tmp_filename.str(), m_dbType, db_usage)) - { - filename = tmp_filename.str(); - tmp_filename.clear(); - tmp_filename.str(""); - tmp_filename << m_ioDB << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount + (++inc); - } - if(inc > 0) - { - m_dbChangeCount += (inc - 1); - } - else - { - m_ifDatabaseExists = Ioss::DB_OVERWRITE; - } - } - else if(m_ifDatabaseExists == Ioss::DB_ADD_SUFFIX) - { - filename = get_unique_filename(db_usage); - } - else if(m_ifDatabaseExists == Ioss::DB_ADD_SUFFIX_OVERWRITE) - { - if(m_dbChangeCount > 0) - { - std::ostringstream tmp_filename; - tmp_filename << m_ioDB << "-s" << std::setw(4) << std::setfill('0') << ++m_dbChangeCount; - filename = tmp_filename.str(); - } - else - { - filename = m_ioDB; - } - } - else - { - filename = m_ioDB; - } - } - else if(m_ifDatabaseExists == Ioss::DB_ADD_SUFFIX) - { - filename = get_unique_filename(db_usage); - } - else - { - filename = m_ioDB; - } - - m_properties.add(Ioss::Property("APPEND_OUTPUT", m_ifDatabaseExists)); - // A little complicated on deciding whether we are actually - // overwriting the database. The 'validate' routine for Results and - // History will call create_database once the parser block is - // ended. This routine will then create the database and the - // ioRegion_. However, the database will not really be opened or - // written to at this time. If the code is auto-restarting, then it will - // detect that the database exists and create a database with the - // -s000x extension. - // At this point, we need to skip the 'abort_if_exists' test if we - // are in this routine from the 'validate' and we are restarting - // since we won't really write to the file. So, the cases where we - // *don't* check are: - // -- is_input_event(db_usage) - // -- ifExists_ == DB_OVERWRITE || DB_ADD_SUFFIX_OVERWRITE || DB_APPEND - // -- is_automatic_restart() && step == 0 (coming from validate) - if(m_ifDatabaseExists != DB_OVERWRITE && - m_ifDatabaseExists != DB_APPEND && - m_ifDatabaseExists != DB_ADD_SUFFIX_OVERWRITE && - !(step == 0 && observer->is_automatic_restart())) - { - abort_if_exists(filename, m_dbType, db_usage); - } - } - return filename; -} - -bool DynamicTopologyFileControl::abort_if_exists(const std::string &filename, - const std::string &db_type, - Ioss::DatabaseUsage db_usage) -{ - // Check whether file with same name as database already exists. If so, - // print error message and stop... - // At the current time, only check on processor 0 and assume if it doesn't exist - // there, then it doesn't exist on other processors. Or, if it doesn't exist on - // processor 0, then it doesn't matter if it doesn't exist on other processors - // since we don't have all pieces... - - bool exists = file_exists(filename, db_type, db_usage); - if (exists) { - std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: The database file named '{} exists" - "and would be overwritten if the code continued.\n\n" - "Input options specified that this file *not* be overwritten,\n" - "\tso you must rename or remove this file and restart the code.\n", - filename); - IOSS_ERROR(errmsg); - } - return exists; -} - -Ioss::DatabaseIO * DynamicTopologyFileControl::clone_output_database(int steps) -{ - auto current_db = m_region->get_database(); - - if (current_db->is_input()) - return nullptr; - - const Ioss::PropertyManager& current_properties = current_db->get_property_manager(); - Ioss::NameList names; - current_properties.describe(&names); - - // Iterate through properties and transfer to new output database... - Ioss::NameList::const_iterator I; - for (I = names.begin(); I != names.end(); ++I) { - if (!current_properties.exists(*I)) - m_properties.add(current_properties.get(*I)); - } - - auto db_usage = current_db->usage(); - - std::string filename = construct_database_filename(steps, db_usage); - - Ioss::DatabaseIO *db = Ioss::IOFactory::create(m_dbType, filename, db_usage, - current_db->util().communicator(), - m_properties); - - if (nullptr == db) { - std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: unable to create output database named '{}'" - " of type '{}'", filename, m_dbType); - IOSS_ERROR(errmsg); - } - - assert(db != nullptr); - if(!db->ok(true)) { - std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: unable to validate output database named '{}'" - " of type '{}'", filename, m_dbType); - IOSS_ERROR(errmsg); - } - - db->set_field_separator(current_db->get_field_separator()); - db->set_surface_split_type(current_db->get_surface_split_type()); - db->set_maximum_symbol_length(current_db->maximum_symbol_length()); - db->set_int_byte_size_api(current_db->int_byte_size_data_size()); - - return db; -} - -template -void update_database_for_grouping_entities(const T& container, Ioss::DatabaseIO *db) -{ - for(auto * entity : container) { - Ioss::GroupingEntity* ge = dynamic_cast(entity); - assert(ge != nullptr); - - if(ge->type() == Ioss::SIDESET) { - Ioss::SideSet *sset = dynamic_cast(ge); - assert(sset != nullptr); - - sset->reset_database(db); - const auto &sblocks = sset->get_side_blocks(); - for (const auto &sblock : sblocks) { - sblock->reset_database(db); - } - } else { - ge->reset_database(db); - } - } -} - -bool DynamicTopologyFileControl::replace_output_database(Ioss::DatabaseIO *db) -{ - auto current_db = m_region->get_database(); - - if (current_db->is_input()) - return false; - - current_db->finalize_database(); - current_db->closeDatabase(); - delete current_db; - - m_region->reset_database(db); - db->set_region(m_region); - - update_database_for_grouping_entities(m_region->get_node_blocks(), db); - update_database_for_grouping_entities(m_region->get_edge_blocks(), db); - update_database_for_grouping_entities(m_region->get_face_blocks(), db); - update_database_for_grouping_entities(m_region->get_element_blocks(), db); - update_database_for_grouping_entities(m_region->get_sidesets(), db); - update_database_for_grouping_entities(m_region->get_nodesets(), db); - update_database_for_grouping_entities(m_region->get_edgesets(), db); - update_database_for_grouping_entities(m_region->get_facesets(), db); - update_database_for_grouping_entities(m_region->get_elementsets(), db); - update_database_for_grouping_entities(m_region->get_commsets(), db); - update_database_for_grouping_entities(m_region->get_structured_blocks(), db); - update_database_for_grouping_entities(m_region->get_assemblies(), db); - update_database_for_grouping_entities(m_region->get_blobs(), db); - - return true; -} - -void DynamicTopologyFileControl::clone_and_replace_output_database(int steps) -{ - auto db = clone_output_database(steps); - - if(nullptr != db) - replace_output_database(db); -} - -void DynamicTopologyFileControl::add_output_database_group(int steps) -{ - auto current_db = m_region->get_database(); - - std::ostringstream oss; - oss << group_prefix(); - oss << m_dbChangeCount; - - current_db->release_memory(); - current_db->open_root_group(); - current_db->create_subgroup(oss.str()); - - m_dbChangeCount++; -} - -} - - - - diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.h index 76de048fd491..3e4ab7f55acf 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.h +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopology.h @@ -6,26 +6,7 @@ #pragma once -#include "Ioss_DBUsage.h" -#include "Ioss_DatabaseIO.h" // for DatabaseIO -#include "Ioss_ParallelUtils.h" // for ParallelUtils -#include "Ioss_PropertyManager.h" // for PropertyManager -#include -#include // for size_t, nullptr -#include // for int64_t - -#include "Ioss_CodeTypes.h" -#include "Ioss_Utils.h" -#include "ioss_export.h" - -#include // for ostream -#include -#include // for string, operator< -#include - namespace Ioss { - class Region; - class DynamicTopologyNotifier; /*! The TopologyModified enumeration is used as an argument to the * topology_modified() functions in io to @@ -44,195 +25,24 @@ namespace Ioss { * - TOPOLOGY_UNKNOWN: Something else, catchall option. */ enum TopologyModified { - TOPOLOGY_SAME = ( 0), //!< No change, also used for initialization - TOPOLOGY_REORDER = (1U << 0), //!< Data structures reordered on processor, no change between procs. - TOPOLOGY_SHUFFLE = (1U << 1), //!< Globally the same, data moved among processors. - TOPOLOGY_HADAPT = (1U << 2), //!< Elements split/combined; not moved cross-proc - TOPOLOGY_GEOMETRY = (1U << 3), //!< Geometry (mesh coordinates) modified. Restart needs to know this. - TOPOLOGY_CREATEFACE = (1U << 4), //!< Face/Edge are created/deleted. - TOPOLOGY_CREATEELEM = (1U << 5), //!< Elements are created/deleted. - TOPOLOGY_CREATENODE = (1U << 6), //!< Nodes are created/deleted. - TOPOLOGY_CREATEASSEMBLY = (1U << 7), //!< Assemblies are created/deleted. - TOPOLOGY_UNKNOWN = (1U << 8), //!< Unknown change, recreate from scratch. - }; - - enum class FileControlOption { CONTROL_NONE, CONTROL_AUTO_MULTI_FILE, CONTROL_AUTO_GROUP_FILE }; - - class IOSS_EXPORT DynamicTopologyObserver - { - public: - DynamicTopologyObserver(Region *region) - : m_region(region) {} - - virtual ~DynamicTopologyObserver() {} - - virtual void reset_topology_modification_all(); - virtual void reset_topology_modification(); - virtual void set_topology_modification(unsigned int type); - virtual unsigned int get_topology_modification() const; - - virtual unsigned int get_cumulative_topology_modification() const; - virtual void set_cumulative_topology_modification(unsigned int type); - - int get_cumulative_topology_modification_field(); - - virtual bool is_topology_modified() const; - virtual bool is_automatic_restart() const { return false; } - virtual bool is_restart_requested() const { return false; } - - static const std::string topology_modification_change_name() - { - return std::string("CUMULATIVE_TOPOLOGY_MODIFICATION"); - } - - void register_region(Region *region); - Region *get_region() const { return m_region; } - - void register_notifier(DynamicTopologyNotifier *notifier); - DynamicTopologyNotifier* get_notifier() const { return m_notifier; } - - virtual void define_model(); - virtual void write_model(); - virtual void define_transient(); - - virtual FileControlOption get_control_option() const { return FileControlOption::CONTROL_NONE; } - - protected: - Region *m_region{nullptr}; - unsigned int m_topologyModification{TOPOLOGY_SAME}; - unsigned int m_cumulativeTopologyModification{TOPOLOGY_SAME}; - - bool m_automaticRestart{false}; - bool m_restartRequested{false}; - - DynamicTopologyNotifier *m_notifier{nullptr}; - - void check_region() const; - IOSS_NODISCARD const ParallelUtils &util() const; - void synchronize_topology_modified_flags(); - - void set_topology_modification_nl(unsigned int type); - - private: - DynamicTopologyObserver(); - }; - - - class IOSS_EXPORT DynamicTopologyNotifier - { - public: - DynamicTopologyNotifier(const std::string& model_name) - : m_modelName(model_name) {} - - virtual ~DynamicTopologyNotifier() = default; - - std::string name() const { return m_modelName; } - - std::vector> get_observers() const { return m_observers; } + TOPOLOGY_SAME = (0), //!< No change, also used for initialization + TOPOLOGY_REORDER = + (1U << 0), //!< Data structures reordered on processor, no change between procs. + TOPOLOGY_SHUFFLE = (1U << 1), //!< Globally the same, data moved among processors. + TOPOLOGY_HADAPT = (1U << 2), //!< Elements split/combined; not moved cross-proc + TOPOLOGY_GHOST = (1U << 3), //!< Ghost entities created/destroyed + TOPOLOGY_GEOMETRY = + (1U << 4), //!< Geometry (mesh coordinates) modified. Restart needs to know this. + TOPOLOGY_CREATEFACE = (1U << 5), //!< Face/Edge are created/deleted. + TOPOLOGY_CREATEELEM = (1U << 6), //!< Elements are created/deleted. + TOPOLOGY_CREATENODE = (1U << 7), //!< Nodes are created/deleted. + TOPOLOGY_CREATEASSEMBLY = (1U << 8), //!< Assemblies are created/deleted. + TOPOLOGY_UNKNOWN = (1U << 9), //!< Unknown change, recreate from scratch. + TOPOLOGY_AUXILIARY = (1U << 10), //!< An AUXILIARY relation was created/modified. + TOPOLOGY_CONSTRAINT = (1U << 11) //!< Contact constraints - void register_observer(std::shared_ptr observer); - - void unregister_observer(std::shared_ptr observer); - - void reset_topology_modification(); - - void set_topology_modification(unsigned int type); - - template - bool has_observer_type() const - { - bool found = false; - - for(const std::shared_ptr& observer : m_observers) { - if (dynamic_cast(observer.get()) != nullptr) { - found = true; - break; - } - } - return found; - } - - template - std::vector> get_observer_type() const - { - std::vector> typed_observers; - - for(const std::shared_ptr &observer : m_observers) { - ObserverType* typed_observer = dynamic_cast(observer.get()); - if (typed_observer != nullptr) { - typed_observers.push_back(std::dynamic_pointer_cast(observer)); - } - } - - return typed_observers; - } - - private: - const std::string m_modelName; - std::vector> m_observers; }; - - class IOSS_EXPORT DynamicTopologyBroker - { - public: - static DynamicTopologyBroker *broker(); - - void register_model(const std::string& model_name); - void remove_model(const std::string& model_name); - void clear_models(); - - std::shared_ptr get_notifier(const std::string& model_name) const; - std::vector> get_observers(const std::string& model_name) const; - - void register_observer(const std::string& model_name, std::shared_ptr observer); - void register_observer(const std::string& model_name, std::shared_ptr observer, Region& region); - - void reset_topology_modification(const std::string& model_name); - void set_topology_modification(const std::string& model_name, unsigned int type); - - private: - DynamicTopologyBroker() {}; - DynamicTopologyBroker(DynamicTopologyBroker&); - - std::map> m_notifiers; - }; - - - class IOSS_EXPORT DynamicTopologyFileControl - { - public: - DynamicTopologyFileControl(Region *region, unsigned int fileCyclicCount, - IfDatabaseExistsBehavior &ifDatabaseExists, - unsigned int &dbChangeCount); - - void clone_and_replace_output_database(int steps = 0); - void add_output_database_group(int steps = 0); - - static std::string group_prefix() { return "IOSS_FILE_GROUP-"; } - - private: - Region *m_region{nullptr}; - std::string m_ioDB; - std::string m_dbType; - - PropertyManager m_properties; - - unsigned int m_fileCyclicCount; - IfDatabaseExistsBehavior &m_ifDatabaseExists; - unsigned int &m_dbChangeCount; - - IOSS_NODISCARD const ParallelUtils &util() const; - - std::string get_unique_filename(DatabaseUsage db_usage); - std::string construct_database_filename(int &step, DatabaseUsage db_usage); - bool file_exists(const std::string &filename, const std::string &db_type, - DatabaseUsage db_usage); - bool abort_if_exists(const std::string &filename, const std::string &db_type, - DatabaseUsage db_usage); - - DatabaseIO *clone_output_database(int steps); - bool replace_output_database(DatabaseIO *db); - }; + enum class FileControlOption { CONTROL_NONE, CONTROL_AUTO_MULTI_FILE, CONTROL_AUTO_GROUP_FILE }; } // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.C new file mode 100644 index 000000000000..a6652d4e6bf0 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.C @@ -0,0 +1,111 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_DynamicTopologyBroker.h" +#include "Ioss_Region.h" + +#include +#include +#include +#include +#include + +namespace Ioss { + + DynamicTopologyBroker *DynamicTopologyBroker::broker() + { + static DynamicTopologyBroker broker_; + return &broker_; + } + + void DynamicTopologyBroker::register_model(const std::string &model_name) + { + auto iter = m_notifiers.find(model_name); + if (iter != m_notifiers.end()) { + return; + } + + m_notifiers[model_name] = std::make_shared(model_name); + } + + std::shared_ptr + DynamicTopologyBroker::get_notifier(const std::string &model_name) const + { + auto iter = m_notifiers.find(model_name); + if (iter != m_notifiers.end()) { + return iter->second; + } + + return {}; + } + + std::vector> + DynamicTopologyBroker::get_observers(const std::string &model_name) const + { + std::vector> observers; + + auto notifier = get_notifier(model_name); + + if (notifier) { + return notifier->get_observers(); + } + + return observers; + } + + void DynamicTopologyBroker::remove_model(const std::string &model_name) + { + auto iter = m_notifiers.find(model_name); + if (iter != m_notifiers.end()) { + m_notifiers.erase(iter); + } + } + + void DynamicTopologyBroker::clear_models() { m_notifiers.clear(); } + + void DynamicTopologyBroker::register_observer(const std::string &model_name, + std::shared_ptr observer) + { + auto notifier = get_notifier(model_name); + + if (!notifier) { + register_model(model_name); + notifier = get_notifier(model_name); + } + + notifier->register_observer(observer); + } + + void DynamicTopologyBroker::register_observer(const std::string &model_name, + std::shared_ptr observer, + Region ®ion) + { + region.register_mesh_modification_observer(observer); + register_observer(model_name, observer); + } + + void DynamicTopologyBroker::reset_topology_modification(const std::string &model_name) + { + auto notifier = get_notifier(model_name); + + if (!notifier) + return; + + notifier->reset_topology_modification(); + } + + void DynamicTopologyBroker::set_topology_modification(const std::string &model_name, + unsigned int type) + { + auto notifier = get_notifier(model_name); + + if (!notifier) + return; + + notifier->set_topology_modification(type); + } + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.h new file mode 100644 index 000000000000..662454632a1a --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyBroker.h @@ -0,0 +1,58 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_DynamicTopology.h" +#include "Ioss_DynamicTopologyNotifier.h" +#include "Ioss_DynamicTopologyObserver.h" + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_ParallelUtils.h" // for ParallelUtils +#include "Ioss_PropertyManager.h" // for PropertyManager +#include "Ioss_Utils.h" +#include "ioss_export.h" + +#include // for size_t, nullptr +#include // for int64_t +#include +#include +#include // for string, operator< + +namespace Ioss { + class Region; + + class IOSS_EXPORT DynamicTopologyBroker + { + public: + static DynamicTopologyBroker *broker(); + + void register_model(const std::string &model_name); + void remove_model(const std::string &model_name); + void clear_models(); + + std::shared_ptr get_notifier(const std::string &model_name) const; + std::vector> + get_observers(const std::string &model_name) const; + + void register_observer(const std::string &model_name, + std::shared_ptr observer); + void register_observer(const std::string &model_name, + std::shared_ptr observer, Region ®ion); + + void reset_topology_modification(const std::string &model_name); + void set_topology_modification(const std::string &model_name, unsigned int type); + + private: + DynamicTopologyBroker() = default; + DynamicTopologyBroker(DynamicTopologyBroker &) = delete; + + std::map> m_notifiers; + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.C new file mode 100644 index 000000000000..c9d2bf08e78e --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.C @@ -0,0 +1,433 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_Assembly.h" +#include "Ioss_Blob.h" +#include "Ioss_ChangeSet.h" +#include "Ioss_ChangeSetFactory.h" +#include "Ioss_CodeTypes.h" +#include "Ioss_CommSet.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" +#include "Ioss_DynamicTopology.h" +#include "Ioss_DynamicTopologyFileControl.h" +#include "Ioss_EdgeBlock.h" +#include "Ioss_EdgeSet.h" +#include "Ioss_ElementBlock.h" +#include "Ioss_ElementSet.h" +#include "Ioss_EntityBlock.h" +#include "Ioss_EntityType.h" +#include "Ioss_FaceBlock.h" +#include "Ioss_FaceSet.h" +#include "Ioss_Field.h" +#include "Ioss_FileInfo.h" +#include "Ioss_GroupingEntity.h" +#include "Ioss_IOFactory.h" +#include "Ioss_NodeBlock.h" +#include "Ioss_NodeSet.h" +#include "Ioss_ParallelUtils.h" +#include "Ioss_Region.h" +#include "Ioss_SideBlock.h" +#include "Ioss_SideSet.h" +#include "Ioss_StructuredBlock.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace { + + bool file_exists(const Ioss::ParallelUtils &util, const std::string &filename, + const std::string &db_type, Ioss::DatabaseUsage db_usage) + { + int par_size = util.parallel_size(); + int par_rank = util.parallel_rank(); + bool is_parallel = par_size > 1; + std::string full_filename = filename; + if (is_parallel && (db_type == "exodusII" || db_type == "cgns") && + (db_usage != Ioss::WRITE_HISTORY)) { + full_filename = Ioss::Utils::decode_filename(filename, par_rank, par_size); + } + + std::string message; + Ioss::FileInfo file = Ioss::FileInfo(full_filename); + return file.parallel_exists(util.communicator(), message); + } + + template + void update_database_for_grouping_entities(const T &container, Ioss::DatabaseIO *db) + { + for (auto *entity : container) { + Ioss::GroupingEntity *ge = dynamic_cast(entity); + assert(ge != nullptr); + + if (ge->type() == Ioss::SIDESET) { + Ioss::SideSet *sset = dynamic_cast(ge); + assert(sset != nullptr); + + sset->reset_database(db); + const auto &sblocks = sset->get_side_blocks(); + for (const auto &sblock : sblocks) { + sblock->reset_database(db); + } + } + else { + ge->reset_database(db); + } + } + } + +} // namespace + +namespace Ioss { + + DynamicTopologyFileControl::DynamicTopologyFileControl(Region *region) + : m_region(region), m_fileCyclicCount(region->get_file_cyclic_count()), + m_ifDatabaseExists(region->get_if_database_exists_behavior()), + m_dbChangeCount(region->get_topology_change_count()) + { + if (nullptr == region) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: null region passed in as argument to DynamicTopologyFileControl"); + IOSS_ERROR(errmsg); + } + + m_ioDB = region->get_property("base_filename").get_string(); + m_dbType = region->get_property("database_type").get_string(); + } + + const ParallelUtils &DynamicTopologyFileControl::util() const + { + return m_region->get_database()->util(); + } + + bool DynamicTopologyFileControl::file_exists(const std::string &filename, + const std::string &db_type, + Ioss::DatabaseUsage db_usage) + { + return ::file_exists(util(), filename, db_type, db_usage); + } + + std::string DynamicTopologyFileControl::get_unique_linear_filename(Ioss::DatabaseUsage db_usage) + { + std::string filename = m_ioDB; + + do { + // Run this loop at least once for all files. If this is an automatic + // restart, then make sure that the generated file does not already exist, + // so keep running the loop until we generate a filename that doesn't exist... + std::ostringstream tmp_filename; + tmp_filename << m_ioDB; + + // Don't append the "-s000X" the first time in case the base filename doesn't + // exist -- we want write to the name specified by the user if at all possible and + // once that exists, then start adding on the suffix... + if (m_dbChangeCount > 1) { + tmp_filename << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount; + } + filename = tmp_filename.str(); + ++m_dbChangeCount; + } while (file_exists(filename, m_dbType, db_usage)); + --m_dbChangeCount; + return filename; + } + + std::string DynamicTopologyFileControl::get_internal_file_change_set_name(unsigned int step) + { + std::ostringstream change_setname; + change_setname << change_set_prefix(); + change_setname << step; + return change_setname.str(); + } + + std::string DynamicTopologyFileControl::get_cyclic_database_filename( + const std::string &baseFileName, unsigned int fileCyclicCount, unsigned int step) + { + return ChangeSet::get_cyclic_database_filename(baseFileName, fileCyclicCount, step); + } + + std::string + DynamicTopologyFileControl::get_linear_database_filename(const std::string &baseFileName, + unsigned int step) + { + return ChangeSet::get_linear_database_filename(baseFileName, step); + } + + std::string DynamicTopologyFileControl::construct_database_filename(int &step, + Ioss::DatabaseUsage db_usage) + { + // Filename will be of the form -- ioDB-sxxxx where xxxx is step + // number. Assume maximum of 9999 steps (will do more, but won't have + // good lineup of step numbers. + // Check database for validity (filename and a type) + if (m_ioDB.empty() || m_dbType.empty()) { + std::string error_message; + if (m_dbType.empty()) + error_message += "The database TYPE has not been defined\n"; + + if (m_ioDB.empty()) { + error_message += "The database FILENAME has not been defined\n"; + } + std::ostringstream errmsg; + errmsg << error_message; + IOSS_ERROR(errmsg); + } + assert(!m_ioDB.empty()); + assert(!m_dbType.empty()); + std::string filename = m_ioDB; + if (m_fileCyclicCount > 0) { + // In this mode, we close the old file and open a new file + // every time this is called. The file suffix cycles through + // the first fileCyclicCount'th entries in A,B,C,D,E,F,... + + // filename = get_cyclic_database_filename(m_ioDB, m_fileCyclicCount, step); + if (step == 0) + step++; + + static std::string suffix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + std::string tmp = "-" + suffix.substr((step - 1) % m_fileCyclicCount, 1); + filename += tmp; + m_properties.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_OVERWRITE)); + } + else { + if (m_region->model_is_written()) { + // After the initial open, we want to add suffix if the topology changes + // during the run + m_ifDatabaseExists = Ioss::DB_ADD_SUFFIX_OVERWRITE; + } + + // Handle complications of DB_APPEND mode... + // If in DB_APPEND mode, then we don't output metadata + // information, so some knowledge is needed at this level if + // we are appending. If user specified APPEND, but the file + // doesn't yet exist OR it does exist and we are not + // restarting, change the mode to OVERWRITE. + // 0. Must be restarting; either manual or automatic. + std::shared_ptr observer = + m_region->get_mesh_modification_observer(); + + if (m_ifDatabaseExists == Ioss::DB_APPEND) { + if (!observer->is_restart_requested()) { + // Not restarting + m_ifDatabaseExists = Ioss::DB_OVERWRITE; + } + else if (!file_exists(m_ioDB, m_dbType, db_usage)) { + m_ifDatabaseExists = Ioss::DB_OVERWRITE; + } + } + if (step > 1 || (m_dbChangeCount > 1)) { + // Use the !is_input_event test since restart input files already have the + // -s000x extension... + if (m_ifDatabaseExists == Ioss::DB_APPEND) { + std::ostringstream tmp_filename; + tmp_filename << m_ioDB; + filename = m_ioDB; + if (m_dbChangeCount > 1) { + tmp_filename << "-s" << std::setw(4) << std::setfill('0') << m_dbChangeCount; + } + size_t inc = 0; + while (file_exists(tmp_filename.str(), m_dbType, db_usage)) { + filename = tmp_filename.str(); + tmp_filename.clear(); + tmp_filename.str(""); + tmp_filename << m_ioDB << "-s" << std::setw(4) << std::setfill('0') + << m_dbChangeCount + (++inc); + } + if (inc > 0) { + m_dbChangeCount += (inc - 1); + } + else { + m_ifDatabaseExists = Ioss::DB_OVERWRITE; + } + } + else if (m_ifDatabaseExists == Ioss::DB_ADD_SUFFIX) { + filename = get_unique_linear_filename(db_usage); + } + else if (m_ifDatabaseExists == Ioss::DB_ADD_SUFFIX_OVERWRITE) { + if (m_dbChangeCount > 0) { + std::ostringstream tmp_filename; + tmp_filename << m_ioDB << "-s" << std::setw(4) << std::setfill('0') + << ++m_dbChangeCount; + filename = tmp_filename.str(); + } + else { + filename = m_ioDB; + } + } + else { + filename = m_ioDB; + } + } + else if (m_ifDatabaseExists == Ioss::DB_ADD_SUFFIX) { + filename = get_unique_linear_filename(db_usage); + } + else { + filename = m_ioDB; + } + + m_properties.add(Ioss::Property("APPEND_OUTPUT", m_ifDatabaseExists)); + // A little complicated on deciding whether we are actually + // overwriting the database. The 'validate' routine for Results and + // History will call create_database once the parser block is + // ended. This routine will then create the database and the + // ioRegion_. However, the database will not really be opened or + // written to at this time. If the code is auto-restarting, then it will + // detect that the database exists and create a database with the + // -s000x extension. + // At this point, we need to skip the 'abort_if_exists' test if we + // are in this routine from the 'validate' and we are restarting + // since we won't really write to the file. So, the cases where we + // *don't* check are: + // -- is_input_event(db_usage) + // -- ifExists_ == DB_OVERWRITE || DB_ADD_SUFFIX_OVERWRITE || DB_APPEND + // -- is_automatic_restart() && step == 0 (coming from validate) + if (m_ifDatabaseExists != DB_OVERWRITE && m_ifDatabaseExists != DB_APPEND && + m_ifDatabaseExists != DB_ADD_SUFFIX_OVERWRITE && + !(step == 0 && observer->is_automatic_restart())) { + abort_if_exists(filename, m_dbType, db_usage); + } + } + return filename; + } + + bool DynamicTopologyFileControl::abort_if_exists(const std::string &filename, + const std::string &db_type, + Ioss::DatabaseUsage db_usage) + { + // Check whether file with same name as database already exists. If so, + // print error message and stop... + // At the current time, only check on processor 0 and assume if it doesn't exist + // there, then it doesn't exist on other processors. Or, if it doesn't exist on + // processor 0, then it doesn't matter if it doesn't exist on other processors + // since we don't have all pieces... + + bool exists = file_exists(filename, db_type, db_usage); + if (exists) { + std::ostringstream errmsg; + fmt::print(errmsg, + "ERROR: The database file named '{} exists" + "and would be overwritten if the code continued.\n\n" + "Input options specified that this file *not* be overwritten,\n" + "\tso you must rename or remove this file and restart the code.\n", + filename); + IOSS_ERROR(errmsg); + } + return exists; + } + + Ioss::DatabaseIO *DynamicTopologyFileControl::clone_output_database(int steps) + { + auto current_db = m_region->get_database(); + + if (current_db->is_input()) + return nullptr; + + const Ioss::PropertyManager ¤t_properties = current_db->get_property_manager(); + Ioss::NameList names = current_properties.describe(); + + // Iterate through properties and transfer to new output database... + for (const auto &name : names) { + if (!m_properties.exists(name)) + m_properties.add(current_properties.get(name)); + } + + auto db_usage = current_db->usage(); + + std::string filename = construct_database_filename(steps, db_usage); + + Ioss::DatabaseIO *db = Ioss::IOFactory::create(m_dbType, filename, db_usage, + current_db->util().communicator(), m_properties); + + if (nullptr == db) { + std::ostringstream errmsg; + fmt::print(errmsg, + "ERROR: unable to create output database named '{}'" + " of type '{}'", + filename, m_dbType); + IOSS_ERROR(errmsg); + } + + assert(db != nullptr); + if (!db->ok(true)) { + std::ostringstream errmsg; + fmt::print(errmsg, + "ERROR: unable to validate output database named '{}'" + " of type '{}'", + filename, m_dbType); + IOSS_ERROR(errmsg); + } + + db->set_field_separator(current_db->get_field_separator()); + db->set_surface_split_type(current_db->get_surface_split_type()); + db->set_maximum_symbol_length(current_db->maximum_symbol_length()); + db->set_int_byte_size_api(current_db->int_byte_size_data_size()); + + return db; + } + + bool DynamicTopologyFileControl::replace_output_database(Ioss::DatabaseIO *db) + { + auto current_db = m_region->get_database(); + + if (current_db->is_input()) + return false; + + current_db->finalize_database(); + current_db->closeDatabase(); + delete current_db; + + m_region->reset_database(db); + db->set_region(m_region); + + update_database_for_grouping_entities(m_region->get_node_blocks(), db); + update_database_for_grouping_entities(m_region->get_edge_blocks(), db); + update_database_for_grouping_entities(m_region->get_face_blocks(), db); + update_database_for_grouping_entities(m_region->get_element_blocks(), db); + update_database_for_grouping_entities(m_region->get_sidesets(), db); + update_database_for_grouping_entities(m_region->get_nodesets(), db); + update_database_for_grouping_entities(m_region->get_edgesets(), db); + update_database_for_grouping_entities(m_region->get_facesets(), db); + update_database_for_grouping_entities(m_region->get_elementsets(), db); + update_database_for_grouping_entities(m_region->get_commsets(), db); + update_database_for_grouping_entities(m_region->get_structured_blocks(), db); + update_database_for_grouping_entities(m_region->get_assemblies(), db); + update_database_for_grouping_entities(m_region->get_blobs(), db); + + return true; + } + + void DynamicTopologyFileControl::clone_and_replace_output_database(int steps) + { + auto db = clone_output_database(steps); + + if (nullptr != db) + replace_output_database(db); + } + + void DynamicTopologyFileControl::add_output_database_change_set(IOSS_MAYBE_UNUSED int steps) + { + auto current_db = get_database(); + + std::ostringstream oss; + oss << change_set_prefix(); + oss << m_dbChangeCount; + + current_db->release_memory(); + current_db->create_internal_change_set(oss.str()); + + m_dbChangeCount++; + } + + DatabaseIO *DynamicTopologyFileControl::get_database() const { return m_region->get_database(); } + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.h new file mode 100644 index 000000000000..044c1036df1a --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyFileControl.h @@ -0,0 +1,77 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_DynamicTopology.h" + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_ParallelUtils.h" // for ParallelUtils +#include "Ioss_PropertyManager.h" // for PropertyManager +#include "Ioss_Utils.h" +#include "ioss_export.h" + +#include // for size_t, nullptr +#include // for int64_t +#include +#include +#include // for string, operator< + +namespace Ioss { + class Region; + + class IOSS_EXPORT DynamicTopologyFileControl + { + public: + explicit DynamicTopologyFileControl(Region *region); + + void clone_and_replace_output_database(int steps = 0); + void add_output_database_change_set(int steps = 0); + + static std::string change_set_prefix() { return "IOSS_FILE_GROUP-"; } + + DatabaseIO *get_database() const; + + static std::string get_cyclic_database_filename(const std::string &baseFileName, + unsigned int fileCyclicCount, + unsigned int step); + + static std::string get_linear_database_filename(const std::string &baseFileName, + unsigned int step); + + static std::string get_internal_file_change_set_name(unsigned int step); + + unsigned int get_topology_change_count() const { return m_dbChangeCount; } + unsigned int get_file_cyclic_count() const { return m_fileCyclicCount; } + IfDatabaseExistsBehavior get_if_database_exists_behavior() const { return m_ifDatabaseExists; } + + private: + Region *m_region{nullptr}; + std::string m_ioDB; + std::string m_dbType; + + PropertyManager m_properties; + + unsigned int m_fileCyclicCount; + IfDatabaseExistsBehavior m_ifDatabaseExists; + unsigned int m_dbChangeCount; + + IOSS_NODISCARD const ParallelUtils &util() const; + + std::string get_unique_linear_filename(DatabaseUsage db_usage); + std::string construct_database_filename(int &step, DatabaseUsage db_usage); + bool file_exists(const std::string &filename, const std::string &db_type, + DatabaseUsage db_usage); + bool abort_if_exists(const std::string &filename, const std::string &db_type, + DatabaseUsage db_usage); + + DatabaseIO *clone_output_database(int steps); + bool replace_output_database(DatabaseIO *db); + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.C new file mode 100644 index 000000000000..294d04cde11a --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.C @@ -0,0 +1,59 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_DynamicTopologyNotifier.h" + +#include +#include +#include +#include +#include + +namespace Ioss { + + struct DynamicTopologyObserverCompare + { + bool operator()(const std::shared_ptr &lhs, + const std::shared_ptr &rhs) const + { + assert(lhs && (lhs->get_region() != nullptr)); + assert(rhs && (rhs->get_region() != nullptr)); + return (lhs->get_region() < rhs->get_region()); + } + }; + + void DynamicTopologyNotifier::register_observer(std::shared_ptr observer) + { + observer->register_notifier(this); + m_observers.push_back(observer); + std::sort(m_observers.begin(), m_observers.end(), DynamicTopologyObserverCompare()); + } + + void + DynamicTopologyNotifier::unregister_observer(std::shared_ptr observer) + { + auto iter = std::find(m_observers.begin(), m_observers.end(), observer); + if (iter != m_observers.end()) { + (*iter)->register_notifier(nullptr); + m_observers.erase(iter); + } + } + + void DynamicTopologyNotifier::reset_topology_modification() + { + for (std::shared_ptr &observer : m_observers) { + observer->reset_topology_modification(); + } + } + + void DynamicTopologyNotifier::set_topology_modification(unsigned int type) + { + for (std::shared_ptr &observer : m_observers) { + observer->set_topology_modification(type); + } + } + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.h new file mode 100644 index 000000000000..a90d36a37bc3 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.h @@ -0,0 +1,85 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_DynamicTopology.h" +#include "Ioss_DynamicTopologyObserver.h" + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_ParallelUtils.h" // for ParallelUtils +#include "Ioss_PropertyManager.h" // for PropertyManager +#include "Ioss_Utils.h" +#include "ioss_export.h" + +#include // for size_t, nullptr +#include // for int64_t +#include +#include +#include // for string, operator< + +namespace Ioss { + + class IOSS_EXPORT DynamicTopologyNotifier + { + public: + explicit DynamicTopologyNotifier(const std::string &model_name) : m_modelName(model_name) {} + + virtual ~DynamicTopologyNotifier() = default; + + std::string name() const { return m_modelName; } + + const std::vector> &get_observers() const + { + return m_observers; + } + + std::vector> &get_observers() { return m_observers; } + + void register_observer(std::shared_ptr observer); + + void unregister_observer(std::shared_ptr observer); + + void reset_topology_modification(); + + void set_topology_modification(unsigned int type); + + template bool has_observer_type() const + { + bool found = false; + + for (const std::shared_ptr &observer : m_observers) { + if (dynamic_cast(observer.get()) != nullptr) { + found = true; + break; + } + } + return found; + } + + template + std::vector> get_observer_type() const + { + std::vector> typed_observers; + + for (const std::shared_ptr &observer : m_observers) { + ObserverType *typed_observer = dynamic_cast(observer.get()); + if (typed_observer != nullptr) { + typed_observers.push_back(std::dynamic_pointer_cast(observer)); + } + } + + return typed_observers; + } + + private: + const std::string m_modelName; + std::vector> m_observers; + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C new file mode 100644 index 000000000000..9e3bf5393631 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.C @@ -0,0 +1,222 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_ChangeSetFactory.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" +#include "Ioss_DynamicTopology.h" +#include "Ioss_DynamicTopologyNotifier.h" +#include "Ioss_DynamicTopologyObserver.h" +#include "Ioss_FileInfo.h" +#include "Ioss_IOFactory.h" +#include "Ioss_ParallelUtils.h" +#include "Ioss_Region.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace Ioss { + + bool DynamicTopologyObserver::needs_new_output_file() const + { + // See what type of topology modification has occurred. If a + // simple REORDER, then we don't need a new file, just have to + // inform database of new order; otherwise, need a new file (for + // ExodusII). Baseline implementation + + if ((get_topology_modification() & Ioss::TOPOLOGY_HADAPT) || + (get_topology_modification() & Ioss::TOPOLOGY_CREATEFACE) || + (get_topology_modification() & Ioss::TOPOLOGY_CREATEELEM) || + (get_topology_modification() & Ioss::TOPOLOGY_CREATENODE) || + (get_topology_modification() & Ioss::TOPOLOGY_UNKNOWN) || + (get_topology_modification() & Ioss::TOPOLOGY_SHUFFLE)) { + // See if database has been written to since being opened... + if (get_cumulative_topology_modification() != 0) { + return true; + } + } + return false; + } + + void DynamicTopologyObserver::verify_region_is_registered() const + { + if (nullptr == m_region) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: A region has not been registered with the " + "Dynamic Topology Observer.\n\n"); + IOSS_ERROR(errmsg); + } + } + + void DynamicTopologyObserver::register_region(Region *region) + { + if (nullptr != region && nullptr != m_region && region != m_region) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: Attempt to re-register different region on " + "Dynamic Topology Observer.\n\n"); + IOSS_ERROR(errmsg); + } + + m_region = region; + } + + void DynamicTopologyObserver::register_notifier(DynamicTopologyNotifier *notifier) + { + if (nullptr != notifier && nullptr != m_notifier && notifier != m_notifier) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: Attempt to re-register different notifier on " + "Dynamic Topology Observer.\n\n"); + IOSS_ERROR(errmsg); + } + + m_notifier = notifier; + } + + void DynamicTopologyObserver::set_cumulative_topology_modification(unsigned int type) + { + m_cumulativeTopologyModification = type; + } + + unsigned int DynamicTopologyObserver::get_cumulative_topology_modification() const + { + return m_cumulativeTopologyModification; + } + + unsigned int DynamicTopologyObserver::get_topology_modification() const + { + return m_topologyModification; + } + + void DynamicTopologyObserver::set_topology_modification_nl(unsigned int type) + { + m_topologyModification |= type; + m_cumulativeTopologyModification |= type; + } + + void DynamicTopologyObserver::sync_topology_modification(unsigned int modFlag, + unsigned int cumulativeModFlag) + { + m_topologyModification = modFlag; + m_cumulativeTopologyModification = cumulativeModFlag; + } + + void DynamicTopologyObserver::set_topology_modification(unsigned int type) + { + if (!(m_topologyModification & type)) { + set_topology_modification_nl(type); + + if (nullptr != m_notifier) { + for (auto &observer : m_notifier->get_observers()) { + observer->set_topology_modification_nl(type); + } + } + } + } + + void DynamicTopologyObserver::reset_topology_modification() + { + m_topologyModification = TOPOLOGY_SAME; + } + + void DynamicTopologyObserver::reset_topology_modification_all() + { + if (m_topologyModification != TOPOLOGY_SAME) { + reset_topology_modification(); + + if (nullptr != m_notifier) { + for (auto &observer : m_notifier->get_observers()) { + observer->reset_topology_modification(); + } + } + } + } + + bool DynamicTopologyObserver::is_topology_modified() const + { + return m_topologyModification != TOPOLOGY_SAME; + } + + const ParallelUtils &DynamicTopologyObserver::util() const + { + verify_region_is_registered(); + return m_region->get_database()->util(); + } + + void DynamicTopologyObserver::synchronize_topology_modified_flags() + { + verify_region_is_registered(); + int num_processors = m_region->get_database()->parallel_size(); + // Synchronize the topology flags between all processors in case + // it has not been set consistently. + if (num_processors > 1) { + static unsigned int buffer[2]; + buffer[0] = m_cumulativeTopologyModification; + buffer[1] = m_topologyModification; + + util().attribute_reduction(2 * sizeof(unsigned int), reinterpret_cast(buffer)); + + m_cumulativeTopologyModification = buffer[0]; + m_topologyModification = buffer[1]; + } + } + + int DynamicTopologyObserver::get_cumulative_topology_modification_field() + { + verify_region_is_registered(); + const std::string variable_name = topology_modification_change_name(); + + int ivalue = 0; + + if (m_region->field_exists(variable_name)) { + Field topo_field = m_region->get_field(variable_name); + if (topo_field.get_type() == Field::INTEGER) { + m_region->get_field_data(variable_name, &ivalue, sizeof(int)); + } + else { + double value; + m_region->get_field_data(variable_name, &value, sizeof(double)); + ivalue = (int)value; + } + } + + int num_processors = m_region->get_database()->parallel_size(); + // Synchronize the value between all processors in case + // it has not been set consistently. + if (num_processors > 1) { + unsigned int buffer[1]; + buffer[0] = ivalue; + + util().attribute_reduction(sizeof(unsigned int), reinterpret_cast(buffer)); + + ivalue = (int)buffer[0]; + } + + m_cumulativeTopologyModification = ivalue; + + return ivalue; + } + + void DynamicTopologyObserver::define_model() {} + + void DynamicTopologyObserver::write_model() {} + + void DynamicTopologyObserver::define_transient() {} + + void DynamicTopologyObserver::initialize_region() + { + if (nullptr != m_region) { + m_region->reset_region(); + } + } + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h new file mode 100644 index 000000000000..90e4f12d936c --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyObserver.h @@ -0,0 +1,95 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_DynamicTopology.h" + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_ParallelUtils.h" // for ParallelUtils +#include "Ioss_PropertyManager.h" // for PropertyManager +#include "Ioss_Utils.h" +#include "ioss_export.h" + +#include // for size_t, nullptr +#include // for int64_t +#include +#include +#include // for string, operator< + +namespace Ioss { + class Region; + class DynamicTopologyNotifier; + + class IOSS_EXPORT DynamicTopologyObserver + { + public: + explicit DynamicTopologyObserver(Region *region) : m_region(region) {} + + virtual ~DynamicTopologyObserver() = default; + + virtual void reset_topology_modification_all(); + virtual void reset_topology_modification(); + virtual void set_topology_modification(unsigned int type); + virtual void sync_topology_modification(unsigned int modFlag, unsigned int cumulativeModFlag); + virtual unsigned int get_topology_modification() const; + + virtual unsigned int get_cumulative_topology_modification() const; + virtual void set_cumulative_topology_modification(unsigned int type); + + int get_cumulative_topology_modification_field(); + + virtual bool is_topology_modified() const; + virtual bool is_automatic_restart() const { return m_automaticRestart; } + virtual bool is_restart_requested() const { return m_restartRequested; } + + void set_automatic_restart(bool flag) { m_automaticRestart = flag; } + void set_restart_requested(bool flag) { m_restartRequested = flag; } + + static std::string topology_modification_change_name() + { + return std::string("CUMULATIVE_TOPOLOGY_MODIFICATION"); + } + + void register_region(Region *region); + Region *get_region() const { return m_region; } + + void register_notifier(DynamicTopologyNotifier *notifier); + DynamicTopologyNotifier *get_notifier() const { return m_notifier; } + + virtual void define_model(); + virtual void write_model(); + virtual void define_transient(); + + virtual FileControlOption get_control_option() const { return FileControlOption::CONTROL_NONE; } + + virtual bool needs_new_output_file() const; + + virtual void initialize_region(); + + protected: + Region *m_region{nullptr}; + unsigned int m_topologyModification{TOPOLOGY_SAME}; + unsigned int m_cumulativeTopologyModification{TOPOLOGY_SAME}; + + bool m_automaticRestart{false}; + bool m_restartRequested{false}; + + DynamicTopologyNotifier *m_notifier{nullptr}; + + void verify_region_is_registered() const; + IOSS_NODISCARD const ParallelUtils &util() const; + void synchronize_topology_modified_flags(); + + void set_topology_modification_nl(unsigned int type); + + private: + DynamicTopologyObserver(); + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyStateLocator.C b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyStateLocator.C new file mode 100644 index 000000000000..e4c54bcea4fa --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyStateLocator.C @@ -0,0 +1,177 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioss_DynamicTopologyStateLocator.h" + +#include "Ioss_ChangeSet.h" +#include "Ioss_ChangeSetFactory.h" +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" +#include "Ioss_ParallelUtils.h" +#include "Ioss_Region.h" + +#include +#include +#include +#include +#include + +namespace Ioss { + + DynamicTopologyStateLocator::DynamicTopologyStateLocator(Region *region, bool loadAllFiles) + : m_database(region->get_database()), + m_ioDB(region->get_property("base_filename").get_string()), + m_dbType(region->get_property("database_type").get_string()), + m_fileCyclicCount(region->get_file_cyclic_count()), m_loadAllFiles(loadAllFiles) + { + } + + DynamicTopologyStateLocator::DynamicTopologyStateLocator(Ioss::DatabaseIO *db, + const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount, + bool loadAllFiles) + : m_database(db), m_ioDB(dbName), m_dbType(dbType), m_fileCyclicCount(fileCyclicCount), + m_loadAllFiles(loadAllFiles) + { + } + + DynamicTopologyStateLocator::DynamicTopologyStateLocator(Ioss::DatabaseIO *db, + unsigned fileCyclicCount, + bool loadAllFiles) + : m_database(db), + m_ioDB(db->get_property_manager().get_optional("base_filename", db->get_filename())), + m_dbType(db->get_property_manager().get_optional("database_type", "")), + m_fileCyclicCount(fileCyclicCount), m_loadAllFiles(loadAllFiles) + { + } + + DynamicTopologyStateLocator::~DynamicTopologyStateLocator() {} + + const ParallelUtils &DynamicTopologyStateLocator::util() const { return get_database()->util(); } + + DatabaseIO *DynamicTopologyStateLocator::get_database() const { return m_database; } + + std::tuple + DynamicTopologyStateLocator::locate_db_state(double targetTime) const + { + auto db = get_database(); + DatabaseState loc(db); + + locate_db_state_impl(targetTime, loc); + + return std::make_tuple(loc.changeSet, loc.state, loc.time); + } + + std::tuple DynamicTopologyStateLocator::get_db_max_time() const + { + auto db = get_database(); + DatabaseState loc(db); + + double init_time = -std::numeric_limits::max(); + StateLocatorCompare compare = [](double a, double b) { return (a > b); }; + + get_db_time_impl(init_time, compare, loc); + + return std::make_tuple(loc.changeSet, loc.state, loc.time); + } + + std::tuple DynamicTopologyStateLocator::get_db_min_time() const + { + auto db = get_database(); + DatabaseState loc(db); + + double init_time = std::numeric_limits::max(); + StateLocatorCompare compare = [](double a, double b) { return (a < b); }; + + get_db_time_impl(init_time, compare, loc); + + return std::make_tuple(loc.changeSet, loc.state, loc.time); + } + + void DynamicTopologyStateLocator::locate_state_impl(Ioss::DatabaseIO *db, double targetTime, + StateLocatorCompare comparator, + DatabaseState &loc) const + { + std::vector timesteps = db->get_db_step_times(); + size_t stepCount = timesteps.size(); + + double minTimeDiff = + loc.state < 0 ? std::numeric_limits::max() : std::fabs(loc.time - targetTime); + + for (size_t istep = 1; istep <= stepCount; istep++) { + double stateTime = timesteps[istep - 1]; + double stepTimeDiff = std::fabs(stateTime - targetTime); + if (comparator(stepTimeDiff, minTimeDiff)) { + minTimeDiff = stepTimeDiff; + loc.time = stateTime; + loc.state = static_cast(istep); + loc.changeSet = db->supports_internal_change_set() ? db->get_internal_change_set_name() + : db->get_filename(); + } + } + } + + void DynamicTopologyStateLocator::locate_state(Ioss::DatabaseIO *db, double targetTime, + DatabaseState &loc) const + { + if (targetTime < 0.0) { + // Round towards 0 + StateLocatorCompare compare = [](double a, double b) { return (a <= b); }; + locate_state_impl(db, targetTime, compare, loc); + } + else { + // Round towards 0 + StateLocatorCompare compare = [](double a, double b) { return (a < b); }; + locate_state_impl(db, targetTime, compare, loc); + } + } + + void DynamicTopologyStateLocator::locate_db_state_impl(double targetTime, + DatabaseState &loc) const + { + auto changeSet = + Ioss::ChangeSetFactory::create(m_database, m_ioDB, m_dbType, m_fileCyclicCount); + changeSet->populate_change_sets(m_loadAllFiles); + + for (size_t csIndex = 0; csIndex < changeSet->size(); csIndex++) { + auto csdb = changeSet->open_change_set(csIndex, Ioss::QUERY_TIMESTEPS_ONLY); + locate_state(csdb, targetTime, loc); + changeSet->close_change_set(csIndex); + } + } + + void DynamicTopologyStateLocator::get_db_time_impl(double init_time, + StateLocatorCompare comparator, + DatabaseState &loc) const + { + auto changeSet = + Ioss::ChangeSetFactory::create(m_database, m_ioDB, m_dbType, m_fileCyclicCount); + changeSet->populate_change_sets(m_loadAllFiles); + + double best_time = init_time; + + for (size_t csIndex = 0; csIndex < changeSet->size(); csIndex++) { + auto csdb = changeSet->open_change_set(csIndex, Ioss::QUERY_TIMESTEPS_ONLY); + + std::vector timesteps = csdb->get_db_step_times(); + int stepCount = static_cast(timesteps.size()); + + for (int i = 1; i <= stepCount; i++) { + if (comparator(timesteps[i - 1], best_time)) { + loc.time = timesteps[i - 1]; + loc.state = i; + loc.changeSet = changeSet->get_change_set_name(csIndex); + best_time = timesteps[i - 1]; + } + } + + changeSet->close_change_set(csIndex); + } + } + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyStateLocator.h b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyStateLocator.h new file mode 100644 index 000000000000..f62f79cddce5 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyStateLocator.h @@ -0,0 +1,84 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_DynamicTopology.h" + +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_ParallelUtils.h" // for ParallelUtils +#include "Ioss_PropertyManager.h" // for PropertyManager +#include "Ioss_Utils.h" +#include "ioss_export.h" + +#include // for size_t, nullptr +#include // for int64_t +#include +#include +#include // for string, operator< + +namespace Ioss { + class Region; + + class IOSS_EXPORT DynamicTopologyStateLocator + { + public: + DynamicTopologyStateLocator(Region *region, bool loadAllFiles = true); + DynamicTopologyStateLocator(Ioss::DatabaseIO *db, const std::string &dbName, + const std::string &dbType, unsigned fileCyclicCount = 0, + bool loadAllFiles = true); + DynamicTopologyStateLocator(Ioss::DatabaseIO *db, unsigned fileCyclicCount = 0, + bool loadAllFiles = true); + + virtual ~DynamicTopologyStateLocator(); + DynamicTopologyStateLocator() = delete; + DynamicTopologyStateLocator(const DynamicTopologyStateLocator &) = delete; + + DatabaseIO *get_database() const; + + std::tuple locate_db_state(double targetTime) const; + std::tuple get_db_min_time() const; + std::tuple get_db_max_time() const; + + private: + struct DatabaseState + { + explicit DatabaseState(Ioss::DatabaseIO *db) + { + if (!db->supports_internal_change_set()) { + changeSet = db->get_filename(); + } + } + + std::string changeSet{"/"}; + int state{-1}; + double time{-std::numeric_limits::max()}; + }; + + using StateLocatorCompare = std::function; + + void locate_state_impl(Ioss::DatabaseIO *db, double targetTime, StateLocatorCompare comparator, + DatabaseState &loc) const; + + void locate_state(Ioss::DatabaseIO *db, double targetTime, DatabaseState &loc) const; + + void locate_db_state_impl(double targetTime, DatabaseState &loc) const; + + void get_db_time_impl(double init_time, StateLocatorCompare comparator, + DatabaseState &loc) const; + + IOSS_NODISCARD const ParallelUtils &util() const; + + Ioss::DatabaseIO *m_database{nullptr}; + std::string m_ioDB; + std::string m_dbType; + unsigned m_fileCyclicCount{0}; + bool m_loadAllFiles{true}; + }; + +} // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_Field.C b/packages/seacas/libraries/ioss/src/Ioss_Field.C index 0e0b33a8bee4..2eb5b797c29d 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Field.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Field.C @@ -10,6 +10,7 @@ #include "Ioss_VariableType.h" #include #include +#include #include #include #include diff --git a/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h b/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h index e6123be18c85..d8fa459f6af2 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h +++ b/packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h @@ -161,20 +161,19 @@ namespace Ioss { // ======================================================================== // Property-related information.... // Just forward it through to the property manager... - inline void property_add(const Property &new_prop); - inline void property_erase(const std::string &property_name); - IOSS_NODISCARD inline bool property_exists(const std::string &property_name) const; - IOSS_NODISCARD inline Property get_property(const std::string &property_name) const; - IOSS_NODISCARD inline int64_t get_optional_property(const std::string &property, - int64_t optional_value) const; - IOSS_NODISCARD inline std::string - get_optional_property(const std::string &property_name, - const std::string &optional_value) const; - IOSS_NODISCARD inline NameList property_describe() const; - inline int property_describe(NameList *names) const; - IOSS_NODISCARD inline NameList property_describe(Ioss::Property::Origin origin) const; - inline int property_describe(Ioss::Property::Origin origin, NameList *names) const; - IOSS_NODISCARD inline size_t property_count() const; + void property_add(const Property &new_prop); + void property_erase(const std::string &property_name); + IOSS_NODISCARD bool property_exists(const std::string &property_name) const; + IOSS_NODISCARD Property get_property(const std::string &property_name) const; + IOSS_NODISCARD int64_t get_optional_property(const std::string &property, + int64_t optional_value) const; + IOSS_NODISCARD std::string get_optional_property(const std::string &property_name, + const std::string &optional_value) const; + IOSS_NODISCARD NameList property_describe() const; + int property_describe(NameList *names) const; + IOSS_NODISCARD NameList property_describe(Ioss::Property::Origin origin) const; + int property_describe(Ioss::Property::Origin origin, NameList *names) const; + IOSS_NODISCARD size_t property_count() const; /** Add a property, or change its value if it already exists with a different value */ void property_update(const std::string &property, int64_t value) const; @@ -184,18 +183,18 @@ namespace Ioss { // FIELDS // ======================================================================== // Just forward these through to the field manager... - void field_add(Field new_field); - inline void field_erase(const std::string &field_name); - inline void field_erase(Field::RoleType role); - IOSS_NODISCARD inline bool field_exists(const std::string &field_name) const; - IOSS_NODISCARD inline Field get_field(const std::string &field_name) const; - IOSS_NODISCARD inline const Field &get_fieldref(const std::string &field_name) const; - inline int field_describe(NameList *names) const; - IOSS_NODISCARD inline NameList field_describe() const; - inline int field_describe(Field::RoleType role, NameList *names) const; - IOSS_NODISCARD inline NameList field_describe(Field::RoleType role) const; - IOSS_NODISCARD inline size_t field_count() const; - IOSS_NODISCARD size_t field_count(Field::RoleType role) const; + void field_add(Field new_field); + void field_erase(const std::string &field_name); + void field_erase(Field::RoleType role); + IOSS_NODISCARD bool field_exists(const std::string &field_name) const; + IOSS_NODISCARD Field get_field(const std::string &field_name) const; + IOSS_NODISCARD const Field &get_fieldref(const std::string &field_name) const; + int field_describe(NameList *names) const; + IOSS_NODISCARD NameList field_describe() const; + int field_describe(Field::RoleType role, NameList *names) const; + IOSS_NODISCARD NameList field_describe(Field::RoleType role) const; + IOSS_NODISCARD size_t field_count() const; + IOSS_NODISCARD size_t field_count(Field::RoleType role) const; IOSS_NODISCARD bool check_for_duplicate(const Ioss::Field &new_field) const; diff --git a/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h b/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h index 8130a4aedb05..25681acc321f 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h +++ b/packages/seacas/libraries/ioss/src/Ioss_MeshCopyOptions.h @@ -15,6 +15,7 @@ namespace Ioss { { std::vector selected_times{}; std::vector omitted_sets{}; + std::string selected_change_sets{}; double minimum_time{0.0}; double maximum_time{0.0}; double delay{0.0}; diff --git a/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.C b/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.C index 47938091e241..02fe4dd06a42 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.C +++ b/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.C @@ -598,7 +598,7 @@ void Ioss::ParallelUtils::all_gather(std::vector &my_values, std::vector & #endif } -void Ioss::ParallelUtils::progress(const std::string &output) const +void Ioss::ParallelUtils::progress(std::string_view output) const { static double begin = Utils::timer(); diff --git a/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.h b/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.h index 24cc545535bd..916e4214d0ae 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.h +++ b/packages/seacas/libraries/ioss/src/Ioss_ParallelUtils.h @@ -143,7 +143,7 @@ namespace Ioss { template void broadcast(T &my_value, int root = 0) const; template void broadcast(std::vector &my_value, int root = 0) const; - void progress(const std::string &output) const; + void progress(std::string_view output) const; private: Ioss_MPI_Comm communicator_{comm_world()}; diff --git a/packages/seacas/libraries/ioss/src/Ioss_Region.C b/packages/seacas/libraries/ioss/src/Ioss_Region.C index 9c9c60607f9a..ef185f566bd0 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Region.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Region.C @@ -11,6 +11,8 @@ #include "Ioss_CoordinateFrame.h" #include "Ioss_DBUsage.h" #include "Ioss_DatabaseIO.h" +#include "Ioss_DynamicTopologyFileControl.h" +#include "Ioss_DynamicTopologyStateLocator.h" #include "Ioss_EdgeBlock.h" #include "Ioss_EdgeSet.h" #include "Ioss_ElementBlock.h" @@ -308,6 +310,7 @@ namespace { entity->field_erase(role); } } + } // namespace namespace Ioss { @@ -366,7 +369,8 @@ namespace Ioss { properties.add(Property(this, "current_state", Property::INTEGER)); properties.add(Property(this, "database_name", Property::STRING)); - property_add(Property("base_filename", iodatabase->get_filename())); + property_add(Property("base_filename", iodatabase->get_property_manager().get_optional( + "base_filename", iodatabase->get_filename()))); property_add(Property("database_type", iodatabase->get_property_manager().get_optional("database_type", ""))); } @@ -383,13 +387,13 @@ namespace Ioss { // Region owns the database pointer even though other entities use it. GroupingEntity::really_delete_database(); + + if (topologyObserver) { + topologyObserver->register_region(nullptr); + } } catch (...) { } - - if(topologyObserver) { - topologyObserver->register_region(nullptr); - } } void Region::reset_region() @@ -469,6 +473,8 @@ namespace Ioss { // Ioex:DatabaseIO::read_communication_metadata() adds comm fields that need to be cleared erase_fields(Field::COMMUNICATION); + + aliases_.clear(); } void Region::delete_database() { GroupingEntity::really_delete_database(); } @@ -588,11 +594,20 @@ namespace Ioss { int num_width = Ioss::Utils::number_width(max_entity, true) + 2; int sb_width = Ioss::Utils::number_width(max_sb, true) + 2; + int change_set_count = get_database()->num_internal_change_set(); + auto change_set_name = get_internal_change_set_name(); + if (!change_set_name.empty() && change_set_name != "/") { + change_set_name = ",\t[CS: " + change_set_name + "]"; + } + else { + change_set_name.clear(); + } + // clang-format off fmt::print( strm, - "\n Database: {0}\n" - " Mesh Type = {1}, {39}\n" + "\n Database: {0}{56}\n" + " Mesh Type = {1}, {39}. Change Sets = {57}\n" " {38:{24}s}\t {38:{23}s}\t Variables : Transient / Reduction\n" " Spatial dimensions = {2:{24}}\t {38:{23}s}\t Global = {26:{25}}\t{44:{25}}\n" " Node blocks = {7:{24}}\t Nodes = {3:{23}}\t Nodal = {27:{25}}\t{45:{25}}\n" @@ -608,7 +623,7 @@ namespace Ioss { " Assemblies = {40:{24}}\t {38:{23}s}\t Assembly = {41:{25}}\t{54:{25}}\n" " Blobs = {42:{24}}\t {38:{23}s}\t Blob = {43:{25}}\t{55:{25}}\n\n" " Time steps = {32:{24}}\n", - get_database()->get_filename(), mesh_type_string(), + get_database()->get_filename(), mesh_type_string(), /* 0, 1 */ fmt::group_digits(get_property("spatial_dimension").get_int()), fmt::group_digits(get_property("node_count").get_int()), fmt::group_digits(get_property("edge_count").get_int()), @@ -617,7 +632,7 @@ namespace Ioss { fmt::group_digits(get_property("node_block_count").get_int()), fmt::group_digits(get_property("edge_block_count").get_int()), fmt::group_digits(get_property("face_block_count").get_int()), - fmt::group_digits(get_property("element_block_count").get_int()), + fmt::group_digits(get_property("element_block_count").get_int()), /* 10 */ fmt::group_digits(get_property("structured_block_count").get_int()), fmt::group_digits(get_property("node_set_count").get_int()), fmt::group_digits(get_property("edge_set_count").get_int()), @@ -627,7 +642,7 @@ namespace Ioss { fmt::group_digits(total_cells), fmt::group_digits(total_ns_nodes), fmt::group_digits(total_es_edges), - fmt::group_digits(total_fs_faces), + fmt::group_digits(total_fs_faces), /* 20 */ fmt::group_digits(total_es_elements), fmt::group_digits(total_sides), num_width, @@ -637,7 +652,7 @@ namespace Ioss { fmt::group_digits(num_nod_vars), fmt::group_digits(num_ele_vars), fmt::group_digits(num_str_vars), - fmt::group_digits(num_ns_vars), + fmt::group_digits(num_ns_vars), /* 30 */ fmt::group_digits(num_ss_vars), fmt::group_digits(num_ts), fmt::group_digits(num_edg_vars), @@ -647,8 +662,8 @@ namespace Ioss { fmt::group_digits(num_els_vars), " ", get_database()->get_format(), - fmt::group_digits(get_property("assembly_count").get_int()), - fmt::group_digits(num_asm_vars) , + fmt::group_digits(get_property("assembly_count").get_int()), /* 40 */ + fmt::group_digits(num_asm_vars), fmt::group_digits(get_property("blob_count").get_int()), fmt::group_digits(num_blob_vars), fmt::group_digits(num_glo_red_vars), @@ -657,12 +672,13 @@ namespace Ioss { fmt::group_digits(num_fac_red_vars), fmt::group_digits(num_ele_red_vars), fmt::group_digits(num_str_red_vars), - fmt::group_digits(num_ns_red_vars), + fmt::group_digits(num_ns_red_vars), /* 50 */ fmt::group_digits(num_es_red_vars), fmt::group_digits(num_fs_red_vars), fmt::group_digits(num_els_red_vars), fmt::group_digits(num_asm_red_vars), - fmt::group_digits(num_blob_red_vars)); + fmt::group_digits(num_blob_red_vars), + change_set_name, change_set_count); // clang-format on } @@ -709,12 +725,12 @@ namespace Ioss { bool has_output_observer = topologyObserver && !get_database()->is_input(); if (new_state == STATE_DEFINE_MODEL) { - if (has_output_observer && - (topologyObserver->get_control_option() == FileControlOption::CONTROL_AUTO_GROUP_FILE)) { + if (has_output_observer && (topologyObserver->get_control_option() == + FileControlOption::CONTROL_AUTO_GROUP_FILE)) { if (!fileGroupsStarted) { int steps = get_property("state_count").get_int(); bool force_addition = true; - add_output_database_group(steps, force_addition); + add_output_database_change_set(steps, force_addition); fileGroupsStarted = true; } @@ -893,6 +909,11 @@ namespace Ioss { } } + if (get_state() == STATE_TRANSIENT) { + // Makes sure we return proper stateCount in case of dynamic topology changes + update_dynamic_topology(); + } + if (get_database()->is_input() || get_database()->usage() == WRITE_RESULTS || get_database()->usage() == WRITE_RESTART) { stateTimes.push_back(time); @@ -2072,7 +2093,6 @@ namespace Ioss { */ NodeBlock *Region::get_node_block(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, NODEBLOCK); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2093,7 +2113,6 @@ namespace Ioss { */ EdgeBlock *Region::get_edge_block(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, EDGEBLOCK); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2114,7 +2133,6 @@ namespace Ioss { */ FaceBlock *Region::get_face_block(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, FACEBLOCK); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2135,7 +2153,6 @@ namespace Ioss { */ ElementBlock *Region::get_element_block(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, ELEMENTBLOCK); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2156,7 +2173,6 @@ namespace Ioss { */ StructuredBlock *Region::get_structured_block(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, STRUCTUREDBLOCK); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2177,7 +2193,6 @@ namespace Ioss { */ SideSet *Region::get_sideset(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, SIDESET); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2198,7 +2213,6 @@ namespace Ioss { */ SideBlock *Region::get_sideblock(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); SideBlock *ge = nullptr; for (const auto &ss : sideSets) { ge = ss->get_side_block(my_name); @@ -2216,7 +2230,6 @@ namespace Ioss { */ NodeSet *Region::get_nodeset(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, NODESET); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2237,7 +2250,6 @@ namespace Ioss { */ EdgeSet *Region::get_edgeset(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, EDGESET); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2258,7 +2270,6 @@ namespace Ioss { */ FaceSet *Region::get_faceset(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, FACESET); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2279,7 +2290,6 @@ namespace Ioss { */ ElementSet *Region::get_elementset(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, ELEMENTSET); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2300,7 +2310,6 @@ namespace Ioss { */ CommSet *Region::get_commset(const std::string &my_name) const { - IOSS_FUNC_ENTER(m_); const std::string db_name = get_alias_nl(my_name, COMMSET); unsigned int db_hash = Ioss::Utils::hash(db_name); @@ -2321,7 +2330,6 @@ namespace Ioss { */ const CoordinateFrame &Region::get_coordinate_frame(int64_t id) const { - IOSS_FUNC_ENTER(m_); for (const auto &coor_frame : coordinateFrames) { if (coor_frame.id() == id) { return coor_frame; @@ -2852,13 +2860,13 @@ namespace Ioss { case FileControlOption::CONTROL_AUTO_MULTI_FILE: clone_and_replace_output_database(steps); break; - case FileControlOption::CONTROL_AUTO_GROUP_FILE: add_output_database_group(steps); break; + case FileControlOption::CONTROL_AUTO_GROUP_FILE: add_output_database_change_set(steps); break; case FileControlOption::CONTROL_NONE: default: return; break; } } - void Region::add_output_database_group(int steps, bool force_addition) + void Region::add_output_database_change_set(int steps, bool force_addition) { if (get_database()->is_input()) return; @@ -2894,10 +2902,14 @@ namespace Ioss { state++; // For the state we are going to write. - reset_region(); - DynamicTopologyFileControl fileControl(this, fileCyclicCount, ifDatabaseExists, - dbChangeCount); - fileControl.add_output_database_group(state); + topologyObserver->initialize_region(); + + DynamicTopologyFileControl fileControl(this); + fileControl.add_output_database_change_set(state); + + // Reset based on fileControl values + dbChangeCount = fileControl.get_topology_change_count(); + ifDatabaseExists = fileControl.get_if_database_exists_behavior(); } } @@ -2933,59 +2945,57 @@ namespace Ioss { state++; // For the state we are going to write. - reset_region(); - DynamicTopologyFileControl fileControl(this, fileCyclicCount, ifDatabaseExists, - dbChangeCount); + topologyObserver->initialize_region(); + + DynamicTopologyFileControl fileControl(this); fileControl.clone_and_replace_output_database(state); + + // Reset based on fileControl values + dbChangeCount = fileControl.get_topology_change_count(); + ifDatabaseExists = fileControl.get_if_database_exists_behavior(); } } void Region::reset_topology_modification() { - if(topologyObserver) { + if (topologyObserver) { topologyObserver->reset_topology_modification(); } } void Region::set_topology_modification(unsigned int type) { - if(topologyObserver) { + if (topologyObserver) { topologyObserver->set_topology_modification(type); } } unsigned int Region::get_topology_modification() const { - if(topologyObserver) { + if (topologyObserver) { return topologyObserver->get_topology_modification(); } return TOPOLOGY_SAME; } - bool Region::load_group_mesh(const std::string &child_group_name) + bool Region::load_internal_change_set_mesh(const std::string &set_name) { - // Check name for '/' which is not allowed since it is the - // separator character in a full group path - if (child_group_name.find('/') != std::string::npos) { - std::ostringstream errmsg; - fmt::print(errmsg, "ERROR: Invalid group name '{}' contains a '/' which is not allowed.\n", - child_group_name); - IOSS_ERROR(errmsg); - } - DatabaseIO *iodatabase = get_database(); if (!iodatabase->is_input()) return false; - if (!iodatabase->open_root_group()) + if (!iodatabase->open_internal_change_set(set_name)) return false; - if (!iodatabase->open_group(child_group_name)) - return false; + if (topologyObserver) { + topologyObserver->initialize_region(); + } + else { + reset_region(); + } - reset_region(); iodatabase->release_memory(); Region::set_state(STATE_CLOSED); @@ -3005,20 +3015,23 @@ namespace Ioss { return true; } - bool Region::load_group_mesh(const int child_group_index) + bool Region::load_internal_change_set_mesh(const int child_group_index) { DatabaseIO *iodatabase = get_database(); if (!iodatabase->is_input()) return false; - if (!iodatabase->open_root_group()) + if (!iodatabase->open_internal_change_set(child_group_index)) return false; - if (!iodatabase->open_child_group(child_group_index)) - return false; + if (topologyObserver) { + topologyObserver->initialize_region(); + } + else { + reset_region(); + } - reset_region(); iodatabase->release_memory(); Region::set_state(STATE_CLOSED); @@ -3040,19 +3053,59 @@ namespace Ioss { void Region::update_dynamic_topology() { - auto topology_observer = get_mesh_modification_observer(); - - bool has_output_observer = topology_observer && !get_database()->is_input(); - if (has_output_observer && topology_observer->is_topology_modified()) { - if(topology_observer->get_control_option() != FileControlOption::CONTROL_NONE) { + bool has_output_observer = topologyObserver && !get_database()->is_input(); + if (has_output_observer && topologyObserver->needs_new_output_file()) { + if (topologyObserver->get_control_option() != FileControlOption::CONTROL_NONE) { int steps = get_property("state_count").get_int(); start_new_output_database_entry(steps); - topology_observer->define_model(); - topology_observer->write_model(); - topology_observer->define_transient(); + topologyObserver->define_model(); + topologyObserver->write_model(); + topologyObserver->define_transient(); } topologyObserver->reset_topology_modification(); } } + + std::string Region::get_internal_change_set_name() const + { + return get_database()->get_internal_change_set_name(); + } + + std::tuple Region::locate_db_state(double targetTime) const + { + auto *cregion = const_cast(this); + DynamicTopologyStateLocator locator(cregion); + + return locator.locate_db_state(targetTime); + } + + std::tuple Region::get_db_max_time() const + { + IOSS_FUNC_ENTER(m_); + auto db = get_database(); + if (!db->is_input() && db->usage() != WRITE_RESULTS && db->usage() != WRITE_RESTART) { + return std::make_tuple(get_internal_change_set_name(), currentState, stateTimes[0]); + } + + auto *cregion = const_cast(this); + DynamicTopologyStateLocator locator(cregion); + + return locator.get_db_max_time(); + } + + std::tuple Region::get_db_min_time() const + { + IOSS_FUNC_ENTER(m_); + auto db = get_database(); + if (!db->is_input() && db->usage() != WRITE_RESULTS && db->usage() != WRITE_RESTART) { + return std::make_tuple(get_internal_change_set_name(), currentState, stateTimes[0]); + } + + auto *cregion = const_cast(this); + DynamicTopologyStateLocator locator(cregion); + + return locator.get_db_min_time(); + } + } // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_Region.h b/packages/seacas/libraries/ioss/src/Ioss_Region.h index be488194309d..c924ec1f9373 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Region.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Region.h @@ -10,6 +10,7 @@ #include "Ioss_DBUsage.h" #include "Ioss_DatabaseIO.h" // for DatabaseIO #include "Ioss_DynamicTopology.h" +#include "Ioss_DynamicTopologyObserver.h" #include "Ioss_EntityType.h" // for EntityType, etc #include "Ioss_Field.h" #include "Ioss_GroupingEntity.h" // for GroupingEntity @@ -29,7 +30,8 @@ #include // for map, map<>::value_compare #include #include -#include // for string, operator< +#include // for string, operator< +#include #include // for pair #include // for vector @@ -152,12 +154,22 @@ namespace Ioss { // on the database if cycle and overlay are being used. IOSS_NODISCARD std::pair get_max_time() const; + // Return a tuple consisting of the step (1-based) corresponding to + // the maximum time across all change sets on the database, the corresponding + // maximum time value and the corresponding set. + IOSS_NODISCARD std::tuple get_db_max_time() const; + // Return a pair consisting of the step (1-based) corresponding to // the minimum time on the database and the corresponding minimum // time value. Note that this may not necessarily be the first step // on the database if cycle and overlay are being used. IOSS_NODISCARD std::pair get_min_time() const; + // Return a tuple consisting of the step (1-based) corresponding to + // the minimum time across all change sets on the database, the corresponding + // minimum time value and the corresponding set. + IOSS_NODISCARD std::tuple get_db_min_time() const; + // Functions for an output region... bool add(NodeBlock *node_block); bool add(EdgeBlock *edge_block); @@ -282,38 +294,48 @@ namespace Ioss { std::vector &field_data) const; void register_mesh_modification_observer(std::shared_ptr observer); - std::shared_ptr get_mesh_modification_observer() const + IOSS_NODISCARD std::shared_ptr get_mesh_modification_observer() const { return topologyObserver; } - void reset_topology_modification(); - void set_topology_modification(unsigned int type); - unsigned int get_topology_modification() const; + void reset_topology_modification(); + void set_topology_modification(unsigned int type); + IOSS_NODISCARD unsigned int get_topology_modification() const; void start_new_output_database_entry(int steps = 0); - void set_topology_change_count(unsigned int new_count) { dbChangeCount = new_count; } - unsigned int get_topology_change_count() { return dbChangeCount; } + void set_topology_change_count(unsigned int new_count) { dbChangeCount = new_count; } + IOSS_NODISCARD unsigned int get_topology_change_count() const { return dbChangeCount; } - void set_file_cyclic_count(unsigned int new_count) { fileCyclicCount = new_count; } - unsigned int get_file_cyclic_count() { return fileCyclicCount; } + void set_file_cyclic_count(unsigned int new_count) { fileCyclicCount = new_count; } + IOSS_NODISCARD unsigned int get_file_cyclic_count() const { return fileCyclicCount; } void set_if_database_exists_behavior(IfDatabaseExistsBehavior if_exists) { ifDatabaseExists = if_exists; } + IOSS_NODISCARD IfDatabaseExistsBehavior get_if_database_exists_behavior() const + { + return ifDatabaseExists; + } + + IOSS_NODISCARD bool model_is_written() const { return modelWritten; } + IOSS_NODISCARD bool transient_is_written() const { return transientWritten; } - bool model_is_written() const { return modelWritten; } - bool transient_is_written() const { return transientWritten; } + IOSS_NODISCARD bool load_internal_change_set_mesh(const std::string &set_name); + IOSS_NODISCARD bool load_internal_change_set_mesh(const int set_index); - bool load_group_mesh(const std::string &child_group_name); - bool load_group_mesh(const int child_group_index); + IOSS_NODISCARD std::tuple locate_db_state(double targetTime) const; + + // Reinitialize region data structures + void reset_region(); protected: - void update_dynamic_topology(); - void clone_and_replace_output_database(int steps = 0); - void add_output_database_group(int steps = 0, bool force_addition = false); + std::string get_internal_change_set_name() const; + void update_dynamic_topology(); + void clone_and_replace_output_database(int steps = 0); + void add_output_database_change_set(int steps = 0, bool force_addition = false); int64_t internal_get_field_data(const Field &field, void *data, size_t data_size = 0) const override; @@ -340,7 +362,6 @@ namespace Ioss { bool end_mode_nl(State current_state); void delete_database() override; - void reset_region(); mutable std::map aliases_; ///< Stores alias mappings @@ -378,7 +399,6 @@ namespace Ioss { bool modelWritten{false}; bool transientWritten{false}; bool fileGroupsStarted{false}; - }; } // namespace Ioss @@ -481,10 +501,12 @@ namespace Ioss { if (found && field.get_role() != role) { std::ostringstream errmsg; + // Would be nice to use fmt:: here, but we need to avoid using fmt includes in public + // headers... errmsg << "ERROR: Field " << field.get_name() << " with role " << field.role_string() << " on entity " << entity->name() << " does not match previously found role " - << Ioss::Field::role_string(role) << ".\n", - IOSS_ERROR(errmsg); + << Ioss::Field::role_string(role) << ".\n"; + IOSS_ERROR(errmsg); } found = true; diff --git a/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.C b/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.C index 7c8891124a27..de43f983ca8f 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.C +++ b/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.C @@ -540,14 +540,18 @@ namespace Ioss { { auto lhzc = this->m_zoneConnectivity; auto rhzc = rhs.m_zoneConnectivity; - Ioss::sort(lhzc.begin(), lhzc.end(), [](const ZoneConnectivity &l, const ZoneConnectivity &r) { - return l.m_connectionName < r.m_connectionName;}); - Ioss::sort(rhzc.begin(), rhzc.end(), [](const ZoneConnectivity &l, const ZoneConnectivity &r) { - return l.m_connectionName < r.m_connectionName;}); + Ioss::sort(lhzc.begin(), lhzc.end(), + [](const ZoneConnectivity &l, const ZoneConnectivity &r) { + return l.m_connectionName < r.m_connectionName; + }); + Ioss::sort(rhzc.begin(), rhzc.end(), + [](const ZoneConnectivity &l, const ZoneConnectivity &r) { + return l.m_connectionName < r.m_connectionName; + }); if (!vec_equal(lhzc, rhzc)) { - fmt::print(Ioss::OUTPUT(), "StructuredBlock: Zone Connectivity mismatch (size {} vs {})\n", - this->m_zoneConnectivity.size(), rhs.m_zoneConnectivity.size()); - same = false; + fmt::print(Ioss::OUTPUT(), "StructuredBlock: Zone Connectivity mismatch (size {} vs {})\n", + this->m_zoneConnectivity.size(), rhs.m_zoneConnectivity.size()); + same = false; } } @@ -558,13 +562,17 @@ namespace Ioss { { auto lhbc = this->m_boundaryConditions; auto rhbc = rhs.m_boundaryConditions; - Ioss::sort(lhbc.begin(), lhbc.end(), [](const BoundaryCondition &l, const BoundaryCondition &r) { - return l.m_bcName < r.m_bcName;}); - Ioss::sort(rhbc.begin(), rhbc.end(), [](const BoundaryCondition &l, const BoundaryCondition &r) { - return l.m_bcName < r.m_bcName;}); + Ioss::sort(lhbc.begin(), lhbc.end(), + [](const BoundaryCondition &l, const BoundaryCondition &r) { + return l.m_bcName < r.m_bcName; + }); + Ioss::sort(rhbc.begin(), rhbc.end(), + [](const BoundaryCondition &l, const BoundaryCondition &r) { + return l.m_bcName < r.m_bcName; + }); if (!vec_equal(lhbc, rhbc)) { - fmt::print(Ioss::OUTPUT(), "StructuredBlock: Boundary Conditions mismatch\n"); - same = false; + fmt::print(Ioss::OUTPUT(), "StructuredBlock: Boundary Conditions mismatch\n"); + same = false; } } diff --git a/packages/seacas/libraries/ioss/src/Ioss_Utils.C b/packages/seacas/libraries/ioss/src/Ioss_Utils.C index 6c3dc62d5623..54c7e3f92c16 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Utils.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Utils.C @@ -49,6 +49,7 @@ #include "Ioss_State.h" #include "Ioss_Utils.h" #include "Ioss_VariableType.h" +#include "Ioss_use_fmt.h" #if defined(__IOSS_WINDOWS__) #include @@ -172,6 +173,23 @@ void Ioss::Utils::time_and_date(char *time_string, char *date_string, size_t len copy_string(date_string, date, length + 1); } +bool Ioss::Utils::check_valid_change_set_name(const std::string &cs_name, + const Ioss::Region ®ion, int rank) +{ + auto cs_names = region.get_database()->internal_change_set_describe(); + auto it = std::find(cs_names.cbegin(), cs_names.cend(), cs_name); + if (it == cs_names.cend()) { + if (rank == 0) { + fmt::print(stderr, + "ERROR: Change set {}, not found in database {}. Valid change sets are:\n" + " {}\n", + cs_name, region.get_database()->get_filename(), fmt::join(cs_names, ", ")); + } + return false; + } + return true; +} + void Ioss::Utils::check_non_null(void *ptr, const char *type, const std::string &name, const std::string &func) { @@ -366,7 +384,7 @@ std::string Ioss::Utils::local_filename(const std::string &relative_filename, } int Ioss::Utils::field_warning(const Ioss::GroupingEntity *ge, const Ioss::Field &field, - const std::string &inout) + std::string_view inout) { if (field.get_name() != "ids") { fmt::print(Ioss::WarnOut(), "{} '{}'. Unknown {} field '{}'\n", ge->type_string(), ge->name(), @@ -939,12 +957,10 @@ void Ioss::Utils::calculate_sideblock_membership(IntVector &face_is_ } } -int64_t Ioss::Utils::get_side_offset(const Ioss::SideBlock *sb) +int64_t Ioss::Utils::get_side_offset(const Ioss::ElementTopology *parent_topo, + const Ioss::ElementTopology *side_topo) { - - const Ioss::ElementTopology *side_topo = sb->topology(); - const Ioss::ElementTopology *parent_topo = sb->parent_element_topology(); - int64_t side_offset = 0; + int64_t side_offset = 0; if ((side_topo != nullptr) && (parent_topo != nullptr)) { int side_topo_dim = side_topo->parametric_dimension(); int elem_topo_dim = parent_topo->parametric_dimension(); @@ -957,6 +973,13 @@ int64_t Ioss::Utils::get_side_offset(const Ioss::SideBlock *sb) return side_offset; } +int64_t Ioss::Utils::get_side_offset(const Ioss::SideBlock *sb) +{ + const Ioss::ElementTopology *side_topo = sb->topology(); + const Ioss::ElementTopology *parent_topo = sb->parent_element_topology(); + return get_side_offset(parent_topo, side_topo); +} + std::string Ioss::Utils::shape_to_string(const Ioss::ElementShape &shape) { switch (shape) { @@ -1358,7 +1381,7 @@ void Ioss::Utils::info_fields(const Ioss::GroupingEntity *ige, Ioss::Field::Role // Iterate through results fields. Get max width of a name... size_t max_width = 0; for (const auto &field_name : fields) { - max_width = max_width > field_name.length() ? max_width : field_name.length(); + max_width = std::max(max_width, field_name.length()); } size_t width = Ioss::Utils::term_width(); @@ -1366,10 +1389,15 @@ void Ioss::Utils::info_fields(const Ioss::GroupingEntity *ige, Ioss::Field::Role if (!header.empty()) { cur_out = header.size() + suffix.size() + 16; // Assume 2 tabs... } + for (const auto &field_name : fields) { if (detail) { const auto &field_ref = ige->get_fieldref(field_name); +#if defined(__NVCC__) std::cout << field_ref << suffix; +#else + fmt::print("{}{}", field_ref, suffix); +#endif } else { const Ioss::VariableType *var_type = ige->get_field(field_name).raw_storage(); diff --git a/packages/seacas/libraries/ioss/src/Ioss_Utils.h b/packages/seacas/libraries/ioss/src/Ioss_Utils.h index cb623ce1c16c..e13b43dc2566 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Utils.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Utils.h @@ -135,6 +135,10 @@ namespace Ioss { static void copyright(std::ostream &out, const std::string &year_range); + IOSS_NODISCARD static bool check_valid_change_set_name(const std::string &cs_name, + const Ioss::Region ®ion, + int rank = 0); + static void check_dynamic_cast(const void *ptr) { if (ptr == nullptr) { @@ -478,7 +482,7 @@ namespace Ioss { std::vector &fields); static int field_warning(const Ioss::GroupingEntity *ge, const Ioss::Field &field, - const std::string &inout); + std::string_view inout); static void calculate_sideblock_membership(IntVector &face_is_member, const SideBlock *sb, size_t int_byte_size, const void *element, @@ -500,6 +504,9 @@ namespace Ioss { * \param[in] sb Compute the offset for element sides in this SideBlock * \returns The offset. */ + IOSS_NODISCARD static int64_t get_side_offset(const Ioss::ElementTopology *parent_topo, + const Ioss::ElementTopology *side_topo); + IOSS_NODISCARD static int64_t get_side_offset(const Ioss::SideBlock *sb); IOSS_NODISCARD static unsigned int hash(const std::string &name); diff --git a/packages/seacas/libraries/ioss/src/Ioss_VariableType.h b/packages/seacas/libraries/ioss/src/Ioss_VariableType.h index 4c19e0aff989..40d0ab5495e0 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_VariableType.h +++ b/packages/seacas/libraries/ioss/src/Ioss_VariableType.h @@ -143,8 +143,8 @@ namespace Ioss { VariableType(const std::string &type, int comp_count, bool delete_me = false); private: - const std::string name_; - int componentCount; + const std::string name_{}; + int componentCount{}; static bool build_variable_type(const std::string &raw_type); }; diff --git a/packages/seacas/libraries/ioss/src/Ioss_Version.h b/packages/seacas/libraries/ioss/src/Ioss_Version.h index 5139be467445..d6c11b110e7b 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Version.h +++ b/packages/seacas/libraries/ioss/src/Ioss_Version.h @@ -6,5 +6,5 @@ #pragma once namespace Ioss { - inline const char *Version() { return "2024-03-19"; } + inline const char *Version() { return "2024-10-09"; } } // namespace Ioss diff --git a/packages/seacas/libraries/ioss/src/Ioss_use_fmt.h b/packages/seacas/libraries/ioss/src/Ioss_use_fmt.h new file mode 100644 index 000000000000..a8bf8c610896 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/Ioss_use_fmt.h @@ -0,0 +1,33 @@ +// Copyright(C) 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +// This class should be included if you want to use the lib::fmt +// output for any of the classes shown below: +// * ZoneConnectivity +// * Field +// * BoundaryCondition +#pragma once +#include + +#if FMT_VERSION >= 90000 +#include "Ioss_Field.h" +#include "Ioss_StructuredBlock.h" +#include "Ioss_ZoneConnectivity.h" + +namespace fmt { + template <> struct formatter : ostream_formatter + { + }; + + template <> struct formatter : ostream_formatter + { + }; + + template <> struct formatter : ostream_formatter + { + }; +} // namespace fmt +#endif diff --git a/packages/seacas/libraries/ioss/src/adios/AdiosWrapper.C b/packages/seacas/libraries/ioss/src/adios/AdiosWrapper.C index 6efb3353dfd2..aace3d30a646 100644 --- a/packages/seacas/libraries/ioss/src/adios/AdiosWrapper.C +++ b/packages/seacas/libraries/ioss/src/adios/AdiosWrapper.C @@ -13,13 +13,12 @@ namespace Ioad { AdiosWrapper::AdiosWrapper(Ioss_MPI_Comm comm, const std::string &filename, bool is_input, unsigned long rank, const Ioss::PropertyManager &properties) #if ADIOS2_USE_MPI - : adios2::ADIOS(comm), + : adios2::ADIOS(comm), #else - : adios2::ADIOS(), + : adios2::ADIOS(), #endif - adios2::IO(IOInit(properties, is_input)), - adios2::Engine(EngineInit(filename, is_input)), m_Rank(rank), m_Communicator(comm), - m_OpenStep(false) + adios2::IO(IOInit(properties, is_input)), adios2::Engine(EngineInit(filename, is_input)), + m_Rank(rank), m_Communicator(comm), m_OpenStep(false) { } diff --git a/packages/seacas/libraries/ioss/src/adios/Ioad_DatabaseIO.h b/packages/seacas/libraries/ioss/src/adios/Ioad_DatabaseIO.h index 54b0caef8b36..b21c65d3b32b 100644 --- a/packages/seacas/libraries/ioss/src/adios/Ioad_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/adios/Ioad_DatabaseIO.h @@ -60,18 +60,19 @@ namespace Ioad { size_t data_size) const override; int64_t get_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void *data, size_t data_size) const override; - int64_t get_field_internal(const Ioss::StructuredBlock */* sb */, const Ioss::Field &/*field*/, - void */*data*/, size_t /*data_size*/) const override + int64_t get_field_internal(const Ioss::StructuredBlock * /* sb */, + const Ioss::Field & /*field*/, void * /*data*/, + size_t /*data_size*/) const override { return -1; } - int64_t get_field_internal(const Ioss::Assembly */*sb*/, const Ioss::Field &/*field*/, void */*data*/, - size_t /*data_size*/) const override + int64_t get_field_internal(const Ioss::Assembly * /*sb*/, const Ioss::Field & /*field*/, + void * /*data*/, size_t /*data_size*/) const override { return -1; } - int64_t get_field_internal(const Ioss::Blob */*sb*/, const Ioss::Field &/*field*/, void */*data*/, - size_t /*data_size*/) const override + int64_t get_field_internal(const Ioss::Blob * /*sb*/, const Ioss::Field & /*field*/, + void * /*data*/, size_t /*data_size*/) const override { return -1; } @@ -120,18 +121,18 @@ namespace Ioad { size_t data_size) const override; int64_t put_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void *data, size_t data_size) const override; - int64_t put_field_internal(const Ioss::StructuredBlock */*sb*/, const Ioss::Field &/*field*/, - void */*data*/, size_t /*data_size*/) const override + int64_t put_field_internal(const Ioss::StructuredBlock * /*sb*/, const Ioss::Field & /*field*/, + void * /*data*/, size_t /*data_size*/) const override { return -1; } - int64_t put_field_internal(const Ioss::Assembly */*sb*/, const Ioss::Field &/*field*/, void */*data*/, - size_t /*data_size*/) const override + int64_t put_field_internal(const Ioss::Assembly * /*sb*/, const Ioss::Field & /*field*/, + void * /*data*/, size_t /*data_size*/) const override { return -1; } - int64_t put_field_internal(const Ioss::Blob */*sb*/, const Ioss::Field &/*field*/, void */*data*/, - size_t /*data_size*/) const override + int64_t put_field_internal(const Ioss::Blob * /*sb*/, const Ioss::Field & /*field*/, + void * /*data*/, size_t /*data_size*/) const override { return -1; } diff --git a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_CatalystLogging.C b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_CatalystLogging.C index a426ffe4c8d3..f2dd02216f7a 100644 --- a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_CatalystLogging.C +++ b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_CatalystLogging.C @@ -5,10 +5,10 @@ // See packages/seacas/LICENSE for details #include +#include #include #include #include -#include namespace Iocatalyst { diff --git a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C index 379fc673a5bf..3df77fe13960 100644 --- a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.C @@ -357,6 +357,16 @@ namespace Iocatalyst { return true; } + std::vector getTime() + { + std::vector times; + auto &node = this->DBNode; + if (node.has_path(getTimePath())) { + times.push_back(node[getTimePath()].as_float64()); + } + return times; + } + int64_t putField(const std::string &containerName, const Ioss::GroupingEntity *entityGroup, const Ioss::Field &field, void *data, size_t data_size, bool deep_copy) { @@ -1426,6 +1436,12 @@ namespace Iocatalyst { impl.readTime(region); } + std::vector DatabaseIO::get_db_step_times_nl() + { + auto &impl = (*this->Impl.get()); + return impl.getTime(); + } + void *DatabaseIO::get_catalyst_conduit_node() { auto &impl = (*this->Impl.get()); diff --git a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h index 743cebe6fa3d..5954d596f071 100644 --- a/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/catalyst/Iocatalyst_DatabaseIO.h @@ -14,8 +14,8 @@ #include "Ioss_Region.h" // for Region, SideSetContainer, etc #include "Ioss_SideSet.h" // for SideBlockContainer, SideSet -#include "Ioss_Field.h" // for Field, etc #include "Iocatalyst_CatalystManager.h" +#include "Ioss_Field.h" // for Field, etc #include // for std::unique_ptr @@ -89,14 +89,12 @@ namespace Iocatalyst { IOSS_NODISCARD bool split_type_changed() const { return split_type_c; } private: - bool open_group_nl(const std::string & /* group_name */) override { return false; } - bool create_subgroup_nl(const std::string & /* group_name */) override { return false; } - bool begin_nl(Ioss::State state) override; bool end_nl(Ioss::State state) override; - void read_meta_data_nl() override; - void get_step_times_nl() override; + void read_meta_data_nl() override; + void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; bool begin_state_nl(int state, double time) override; bool end_state_nl(int state, double time) override; @@ -135,8 +133,8 @@ namespace Iocatalyst { size_t data_size) const override; int64_t get_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void *data, size_t data_size) const override; - int64_t get_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, - void *data, size_t data_size) const override; + int64_t get_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void *data, + size_t data_size) const override; int64_t get_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field, void *data, size_t data_size) const override; @@ -144,30 +142,30 @@ namespace Iocatalyst { size_t *data_size) const override; int64_t get_zc_field_internal(const Ioss::NodeBlock *nb, const Ioss::Field &field, void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::EdgeBlock *eb, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::FaceBlock *fb, const Ioss::Field &field, - void **data, size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::EdgeBlock *eb, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::FaceBlock *fb, const Ioss::Field &field, void **data, + size_t *data_size) const override; int64_t get_zc_field_internal(const Ioss::ElementBlock *eb, const Ioss::Field &field, void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::EdgeSet *es, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::FaceSet *fs, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::ElementSet *es, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::SideSet *ss, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, - void **data, size_t *data_size) const override; - int64_t get_zc_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, - void **data, size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::SideBlock *sb, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::NodeSet *ns, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::EdgeSet *es, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::FaceSet *fs, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::ElementSet *es, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::SideSet *ss, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::CommSet *cs, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void **data, + size_t *data_size) const override; + int64_t get_zc_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void **data, + size_t *data_size) const override; int64_t get_zc_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field, void **data, size_t *data_size) const override; @@ -197,8 +195,8 @@ namespace Iocatalyst { size_t data_size) const override; int64_t put_field_internal(const Ioss::Assembly *as, const Ioss::Field &field, void *data, size_t data_size) const override; - int64_t put_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, - void *data, size_t data_size) const override; + int64_t put_field_internal(const Ioss::Blob *bl, const Ioss::Field &field, void *data, + size_t data_size) const override; int64_t put_field_internal(const Ioss::StructuredBlock *sb, const Ioss::Field &field, void *data, size_t data_size) const override; diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.C index b5c5ab8bbbe5..b705a791ea29 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.C @@ -291,24 +291,24 @@ namespace Iocatalyst { return (extents.i + offset) * (extents.j + offset) * (extents.k + offset); } - std::map* BlockMesh::getTransientCellFieldMap() + std::map *BlockMesh::getTransientCellFieldMap() { return &(this->transientCellFields); } - std::map* BlockMesh::getTransientPointFieldMap() + std::map *BlockMesh::getTransientPointFieldMap() { return &(this->transientPointFields); } void BlockMesh::addTransientCellField(std::string f_name, double f_value) { - this->transientCellFields.insert({ f_name, f_value }); + this->transientCellFields.insert({f_name, f_value}); } void BlockMesh::addTransientPointField(std::string f_name, double f_value) { - this->transientPointFields.insert({ f_name, f_value }); + this->transientPointFields.insert({f_name, f_value}); } } // namespace Iocatalyst diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.h b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.h index ba5c4caa21ab..f2ff3ce0f1a8 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.h +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMesh.h @@ -82,11 +82,11 @@ namespace Iocatalyst { static Extent getCoordsForID(ID id, Extent bounds); static ID getIDfromCoords(Extent coords, Extent bounds); - void addTransientCellField(std::string f_name, double f_value); - void addTransientPointField(std::string f_name, double f_value); + void addTransientCellField(std::string f_name, double f_value); + void addTransientPointField(std::string f_name, double f_value); - std::map* getTransientCellFieldMap(); - std::map* getTransientPointFieldMap(); + std::map *getTransientCellFieldMap(); + std::map *getTransientPointFieldMap(); private: Partition partition; diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.C index 9a7d87085199..11073606381e 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.C @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include #include #include @@ -41,12 +41,12 @@ namespace Iocatalyst { CatalystManager::getInstance().reset(); iop.isCatalyst = true; - //Cat Writes + // Cat Writes writeIOSSFile(iop); Ioss::PropertyManager cdbProps = Ioss::PropertyManager(iop.dbProps); cdbProps.add(Ioss::Property("CATALYST_CONDUIT_NODE", iop.getCatalystConduitNode())); - //Cat Reads here + // Cat Reads here Ioss::DatabaseIO *cdbi = Ioss::IOFactory::create(CATALYST_DATABASE_TYPE, CATALYST_DUMMY_DATABASE, Ioss::READ_RESTART, Ioss::ParallelUtils::comm_world(), cdbProps); @@ -70,20 +70,20 @@ namespace Iocatalyst { Ioss::copy_database(cir, cor, options); } - Ioss::DatabaseIO* BlockMeshSet::getCatalystDatabase(IOSSparams &iop) + Ioss::DatabaseIO *BlockMeshSet::getCatalystDatabase(IOSSparams &iop) { CatalystManager::getInstance().reset(); iop.isCatalyst = true; - - //Write to Cat database + + // Write to Cat database writeIOSSFile(iop); Ioss::PropertyManager cdbProps = Ioss::PropertyManager(iop.dbProps); - //Get Conduit + // Get Conduit cdbProps.add(Ioss::Property("CATALYST_CONDUIT_NODE", iop.getCatalystConduitNode())); - //Read to Cat Database + // Read to Cat Database Ioss::DatabaseIO *cdbi = Ioss::IOFactory::create(CATALYST_DATABASE_TYPE, CATALYST_DUMMY_DATABASE, Ioss::READ_RESTART, Ioss::ParallelUtils::comm_world(), cdbProps); @@ -107,7 +107,7 @@ namespace Iocatalyst { void BlockMeshSet::openIOSSDatabase(IOSSparams &iop) { Ioss::PropertyManager properties = Ioss::PropertyManager(iop.dbProps); - std::string dbType = iop.dbType; + std::string dbType = iop.dbType; if (iop.isCatalyst) { dbType = CATALYST_DATABASE_TYPE; } @@ -258,7 +258,8 @@ namespace Iocatalyst { void BlockMeshSet::writeStructuredTransientFieldDefinitions(IOSSparams &iop) { for (auto bm : bms) { - //Modify this to access field dict in "bm" and populate ioss block with those fields (as well). + // Modify this to access field dict in "bm" and populate ioss block with those fields (as + // well). auto iossBlock = iop.region->get_structured_block(getStructuredBlockName(bm.getID())); iossBlock->field_add(Ioss::Field(IOSS_CELL_FIELD, Ioss::Field::REAL, IOSS_SCALAR_STORAGE, Ioss::Field::TRANSIENT)); @@ -359,7 +360,7 @@ namespace Iocatalyst { auto nodeBlock = iop.region->get_node_block("nodeblock"); nodeBlock->field_add(Ioss::Field(IOSS_POINT_FIELD, Ioss::Field::REAL, IOSS_SCALAR_STORAGE, Ioss::Field::TRANSIENT)); - + writeUnstructuredAddedTransientFields(bm, iop); } } @@ -373,23 +374,21 @@ namespace Iocatalyst { void BlockMeshSet::writeUnstructuredAddedCellTransientFields(BlockMesh bm, IOSSparams &iop) { auto cell_fields = bm.getTransientCellFieldMap(); - auto elemBlock = iop.region->get_element_block(getUnstructuredBlockName(bm.getID())); - for (auto itr = cell_fields->begin(); itr != cell_fields->end(); ++itr) - { - elemBlock->field_add(Ioss::Field(itr->first, Ioss::Field::REAL, IOSS_SCALAR_STORAGE, - Ioss::Field::TRANSIENT)); - } + auto elemBlock = iop.region->get_element_block(getUnstructuredBlockName(bm.getID())); + for (auto itr = cell_fields->begin(); itr != cell_fields->end(); ++itr) { + elemBlock->field_add( + Ioss::Field(itr->first, Ioss::Field::REAL, IOSS_SCALAR_STORAGE, Ioss::Field::TRANSIENT)); + } } void BlockMeshSet::writeUnstructuredAddedPointTransientFields(BlockMesh bm, IOSSparams &iop) { auto point_fields = bm.getTransientPointFieldMap(); - auto nodeBlock = iop.region->get_node_block("nodeblock"); - for (auto itr = point_fields->begin(); itr != point_fields->end(); ++itr) - { - nodeBlock->field_add(Ioss::Field(itr->first, Ioss::Field::REAL, IOSS_SCALAR_STORAGE, - Ioss::Field::TRANSIENT)); - } + auto nodeBlock = iop.region->get_node_block("nodeblock"); + for (auto itr = point_fields->begin(); itr != point_fields->end(); ++itr) { + nodeBlock->field_add( + Ioss::Field(itr->first, Ioss::Field::REAL, IOSS_SCALAR_STORAGE, Ioss::Field::TRANSIENT)); + } } void BlockMeshSet::writeUnstructuredTransientBulkData(IOSSparams &iop) @@ -422,36 +421,36 @@ namespace Iocatalyst { writeUnstructuredAddedPointTransientFieldsBulkData(bm, iop); } - void BlockMeshSet::writeUnstructuredAddedCellTransientFieldsBulkData(BlockMesh bm, IOSSparams &iop) + void BlockMeshSet::writeUnstructuredAddedCellTransientFieldsBulkData(BlockMesh bm, + IOSSparams &iop) { auto cell_fields = bm.getTransientCellFieldMap(); - auto elemBlock = iop.region->get_element_block(getUnstructuredBlockName(bm.getID())); + auto elemBlock = iop.region->get_element_block(getUnstructuredBlockName(bm.getID())); std::vector values; - for (auto itr = cell_fields->begin(); itr != cell_fields->end(); ++itr) - { + for (auto itr = cell_fields->begin(); itr != cell_fields->end(); ++itr) { int num_elements = elemBlock->get_field(itr->first).raw_count(); for (int j = 0; j < num_elements; j++) { - values.push_back(itr->second + j*0.1); + values.push_back(itr->second + j * 0.1); } elemBlock->put_field_data(itr->first, values); values.clear(); - } + } } - void BlockMeshSet::writeUnstructuredAddedPointTransientFieldsBulkData(BlockMesh bm, IOSSparams &iop) + void BlockMeshSet::writeUnstructuredAddedPointTransientFieldsBulkData(BlockMesh bm, + IOSSparams &iop) { - auto point_fields = bm.getTransientPointFieldMap(); - auto nodeBlock = iop.region->get_node_block("nodeblock"); + auto point_fields = bm.getTransientPointFieldMap(); + auto nodeBlock = iop.region->get_node_block("nodeblock"); std::vector values; - for (auto itr = point_fields->begin(); itr != point_fields->end(); ++itr) - { + for (auto itr = point_fields->begin(); itr != point_fields->end(); ++itr) { int num_nodes = nodeBlock->get_field(itr->first).raw_count(); for (int j = 0; j < num_nodes; j++) { - values.push_back(itr->second + j*0.1); + values.push_back(itr->second + j * 0.1); } nodeBlock->put_field_data(itr->first, values); values.clear(); - } + } } std::string BlockMeshSet::getStructuredBlockName(int index) diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.h b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.h index bc98721fe390..6e84a0fe5531 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.h +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSet.h @@ -26,8 +26,10 @@ namespace Iocatalyst { class IOSSparams { public: - IOSSparams(const std::string &fileName, const std::string &dbType, Ioss::PropertyManager dbProps = {}) - : fileName(fileName), dbType(dbType), databaseIO(nullptr), isCatalyst(false), dbProps(dbProps) + IOSSparams(const std::string &fileName, const std::string &dbType, + Ioss::PropertyManager dbProps = {}) + : fileName(fileName), dbType(dbType), databaseIO(nullptr), isCatalyst(false), + dbProps(dbProps) { } bool isStructured() { return dbType == CGNS_DATABASE_TYPE; } @@ -45,12 +47,12 @@ namespace Iocatalyst { IOSSparams(); }; - void addBlockMesh(const BlockMesh &blockMesh); - void writeIOSSFile(IOSSparams &iop); - void writeCatalystIOSSFile(IOSSparams &iop); - Ioss::DatabaseIO* getCatalystDatabase(IOSSparams &iop); - - int getNumLocalPointsInMeshSet(); + void addBlockMesh(const BlockMesh &blockMesh); + void writeIOSSFile(IOSSparams &iop); + void writeCatalystIOSSFile(IOSSparams &iop); + Ioss::DatabaseIO *getCatalystDatabase(IOSSparams &iop); + + int getNumLocalPointsInMeshSet(); std::string getStructuredBlockName(int index); std::string getStructuredNodeBlockName(int index); diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSetTest.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSetTest.C index 98b155b03842..89accb1eb414 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSetTest.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_BlockMeshSetTest.C @@ -43,8 +43,8 @@ TEST_F(Iocatalyst_DatabaseIOTest, AddTransientFieldToBlockMesh) addBlockMesh(bmOne); - std::string exodusFileName = - "AddTransientFieldToBlockMesh" + CATALYST_TEST_FILE_NP + std::to_string(part.size) + EXODUS_FILE_EXTENSION; + std::string exodusFileName = "AddTransientFieldToBlockMesh" + CATALYST_TEST_FILE_NP + + std::to_string(part.size) + EXODUS_FILE_EXTENSION; Iocatalyst::BlockMeshSet::IOSSparams iop(exodusFileName, EXODUS_DATABASE_TYPE); bmSet.writeIOSSFile(iop); } \ No newline at end of file diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ConduitReadTest.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ConduitReadTest.C index 48bc67470448..bd730d7a65ef 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ConduitReadTest.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ConduitReadTest.C @@ -122,7 +122,6 @@ TEST_F(Iocatalyst_DatabaseIOTest, CellIdsAndCellNodeIds) EXPECT_EQ(cidBuff[0], 1); EXPECT_EQ(cidBuff[cids.raw_count() - 1], 256); - auto cnids = sb->get_fieldref("cell_node_ids"); EXPECT_TRUE(cnids.get_type() == Ioss::Field::INTEGER); std::vector cnidsBuff(cnids.raw_count()); @@ -131,4 +130,4 @@ TEST_F(Iocatalyst_DatabaseIOTest, CellIdsAndCellNodeIds) cnids.raw_count()); EXPECT_EQ(cnidsBuff[0], 1); EXPECT_EQ(cnidsBuff[cnids.raw_count() - 1], 594); -} \ No newline at end of file +} diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_DatabaseIOTest.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_DatabaseIOTest.C index ac2bafb855aa..d1efac0b9f49 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_DatabaseIOTest.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_DatabaseIOTest.C @@ -196,11 +196,11 @@ Iocatalyst_DatabaseIOTest::getCatalystDatabaseFromConduit(conduit_cpp::Node & Ioss::DatabaseIO *Iocatalyst_DatabaseIOTest::getDatabaseOnReadFromFileName( const std::string &fileName, const std::string &iossDatabaseType, Ioss::PropertyManager dbProps) { - Ioss::PropertyManager dbaseProps = Ioss::PropertyManager(dbProps); - auto inputFileName = fileName; - Ioss::ParallelUtils pu; - int numRanks = pu.parallel_size(); - int rank = pu.parallel_rank(); + Ioss::PropertyManager dbaseProps = Ioss::PropertyManager(dbProps); + auto inputFileName = fileName; + Ioss::ParallelUtils pu; + int numRanks = pu.parallel_size(); + int rank = pu.parallel_rank(); if (iossDatabaseType == EXODUS_DATABASE_TYPE && numRanks > 1) { inputFileName += "." + std::to_string(numRanks) + "." + std::to_string(rank); } diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ElementBlockTest.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ElementBlockTest.C index 9c8fec4c2d88..e4f6fd8ebea3 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ElementBlockTest.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_ElementBlockTest.C @@ -12,11 +12,9 @@ #include #include #include +#include #include #include -#include - - TEST_F(Iocatalyst_DatabaseIOTest, WriteThreeElementBlocksWith24Cells) { @@ -81,22 +79,24 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_ENABLE_FIELD_RECOGNITION_ON) bm.addTransientCellField("foo_y", 3); bm.addTransientCellField("foo_z", 4); - addBlockMesh(bm); Ioss::PropertyManager iossProp; iossProp.add(Ioss::Property("ENABLE_FIELD_RECOGNITION", "ON")); - Ioss::DatabaseIO *exo_d = writeAndGetExodusDatabaseOnRead("test_eb_1_enable_field_recog", iossProp); + Ioss::DatabaseIO *exo_d = + writeAndGetExodusDatabaseOnRead("test_eb_1_enable_field_recog", iossProp); Iocatalyst::BlockMeshSet::IOSSparams iop("cat", EXODUS_DATABASE_TYPE, iossProp); Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; + } Ioss::Region cat_reg(cat_d); - + Ioss::Region exo_reg(exo_d); - + auto cat_elemBlock = cat_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); auto exo_elemBlock = exo_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); @@ -106,28 +106,28 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_ENABLE_FIELD_RECOGNITION_ON) bool cat_foo_exists = cat_elemBlock->field_exists("foo"); EXPECT_TRUE(exo_foo_exists); EXPECT_TRUE(cat_foo_exists); - if(exo_foo_exists && cat_foo_exists) + if (exo_foo_exists && cat_foo_exists) EXPECT_TRUE(exo_elemBlock->get_field("foo") == cat_elemBlock->get_field("foo")); - - //Check field data for equality - auto cat_field = cat_elemBlock->get_fieldref("foo"); + + // Check field data for equality + auto cat_field = cat_elemBlock->get_fieldref("foo"); std::vector dcBuffer(cat_field.get_size()); cat_elemBlock->get_field_data("foo", Data(dcBuffer), dcBuffer.size()); exo_reg.begin_state(1); - auto exo_field = exo_elemBlock->get_fieldref("foo"); + auto exo_field = exo_elemBlock->get_fieldref("foo"); std::vector deBuffer(exo_field.get_size()); exo_elemBlock->get_field_data("foo", Data(deBuffer), deBuffer.size()); EXPECT_EQ(dcBuffer, deBuffer); - //Check foo_x doesn't exist + // Check foo_x doesn't exist bool exo_foo_x_exists = exo_elemBlock->field_exists("foo_x"); bool cat_foo_x_exists = cat_elemBlock->field_exists("foo_x"); EXPECT_FALSE(exo_foo_x_exists); EXPECT_FALSE(cat_foo_x_exists); } -//Sanity Test +// Sanity Test TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_ENABLE_FIELD_RECOGNITION_OFF) { Iocatalyst::BlockMesh bm; @@ -137,22 +137,24 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_ENABLE_FIELD_RECOGNITION_OFF) bm.addTransientCellField("foo_y", 3); bm.addTransientCellField("foo_z", 4); - addBlockMesh(bm); Ioss::PropertyManager iossProp; iossProp.add(Ioss::Property("ENABLE_FIELD_RECOGNITION", "OFF")); - Ioss::DatabaseIO *exo_d = writeAndGetExodusDatabaseOnRead("test_eb_1_enable_field_recog", iossProp); - + Ioss::DatabaseIO *exo_d = + writeAndGetExodusDatabaseOnRead("test_eb_1_enable_field_recog", iossProp); + Iocatalyst::BlockMeshSet::IOSSparams iop("cat", EXODUS_DATABASE_TYPE, iossProp); Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; + } Ioss::Region cat_reg(cat_d); - + Ioss::Region exo_reg(exo_d); - + auto cat_elemBlock = cat_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); auto exo_elemBlock = exo_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); @@ -162,12 +164,10 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_ENABLE_FIELD_RECOGNITION_OFF) bool cat_foo_x_exists = cat_elemBlock->field_exists("foo_x"); EXPECT_TRUE(exo_foo_x_exists); EXPECT_TRUE(cat_foo_x_exists); - if(exo_foo_x_exists && cat_foo_x_exists) + if (exo_foo_x_exists && cat_foo_x_exists) EXPECT_TRUE(exo_elemBlock->get_field("foo_x") == cat_elemBlock->get_field("foo_x")); - } - TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_IGNORE_REALN_FIELDS_ON) { Iocatalyst::BlockMesh bm; @@ -177,22 +177,24 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_IGNORE_REALN_FIELDS_ON) bm.addTransientCellField("foo_2", 3); bm.addTransientCellField("foo_3", 4); - addBlockMesh(bm); Ioss::PropertyManager iossProp; iossProp.add(Ioss::Property("IGNORE_REALN_FIELDS", "ON")); - Ioss::DatabaseIO *exo_d = writeAndGetExodusDatabaseOnRead("test_eb_1_ignore_realn_fields", iossProp); + Ioss::DatabaseIO *exo_d = + writeAndGetExodusDatabaseOnRead("test_eb_1_ignore_realn_fields", iossProp); Iocatalyst::BlockMeshSet::IOSSparams iop("cat", EXODUS_DATABASE_TYPE, iossProp); Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; + } Ioss::Region cat_reg(cat_d); - + Ioss::Region exo_reg(exo_d); - + auto cat_elemBlock = cat_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); auto exo_elemBlock = exo_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); @@ -202,9 +204,8 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_IGNORE_REALN_FIELDS_ON) bool cat_foo_1_exists = cat_elemBlock->field_exists("foo_1"); EXPECT_TRUE(exo_foo_1_exists); EXPECT_TRUE(cat_foo_1_exists); - if(exo_foo_1_exists && cat_foo_1_exists) + if (exo_foo_1_exists && cat_foo_1_exists) EXPECT_TRUE(exo_elemBlock->get_field("foo_1") == cat_elemBlock->get_field("foo_1")); - } TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_IGNORE_REALN_FIELDS_OFF) @@ -216,22 +217,24 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_IGNORE_REALN_FIELDS_OFF) bm.addTransientCellField("foo_2", 2); bm.addTransientCellField("foo_3", 4); - addBlockMesh(bm); Ioss::PropertyManager iossProp; iossProp.add(Ioss::Property("IGNORE_REALN_FIELDS", "OFF")); - Ioss::DatabaseIO *exo_d = writeAndGetExodusDatabaseOnRead("test_eb_1_ignore_realn_fields_off", iossProp); + Ioss::DatabaseIO *exo_d = + writeAndGetExodusDatabaseOnRead("test_eb_1_ignore_realn_fields_off", iossProp); Iocatalyst::BlockMeshSet::IOSSparams iop("cat", EXODUS_DATABASE_TYPE, iossProp); Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; + } Ioss::Region cat_reg(cat_d); - + Ioss::Region exo_reg(exo_d); - + auto cat_elemBlock = cat_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); auto exo_elemBlock = exo_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); @@ -241,20 +244,19 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_IGNORE_REALN_FIELDS_OFF) bool cat_foo_exists = cat_elemBlock->field_exists("foo"); EXPECT_TRUE(exo_foo_exists); EXPECT_TRUE(cat_foo_exists); - if(exo_foo_exists && cat_foo_exists) + if (exo_foo_exists && cat_foo_exists) EXPECT_TRUE(exo_elemBlock->get_field("foo") == cat_elemBlock->get_field("foo")); - - //Check field data for equality - auto cat_field = cat_elemBlock->get_fieldref("foo"); + + // Check field data for equality + auto cat_field = cat_elemBlock->get_fieldref("foo"); std::vector dcBuffer(cat_field.get_size()); cat_elemBlock->get_field_data("foo", Data(dcBuffer), dcBuffer.size()); exo_reg.begin_state(1); - auto exo_field = exo_elemBlock->get_fieldref("foo"); + auto exo_field = exo_elemBlock->get_fieldref("foo"); std::vector deBuffer(exo_field.get_size()); exo_elemBlock->get_field_data("foo", Data(deBuffer), deBuffer.size()); EXPECT_EQ(dcBuffer, deBuffer); - } TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_FIELD_SUFFIX_SEPARATOR) @@ -269,23 +271,23 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_FIELD_SUFFIX_SEPARATOR) bm.addTransientCellField("bar:y", 6); bm.addTransientCellField("bar:z", 7); - addBlockMesh(bm); Ioss::PropertyManager iossProp; iossProp.add(Ioss::Property("FIELD_SUFFIX_SEPARATOR", ":")); - + Ioss::DatabaseIO *exo_d = writeAndGetExodusDatabaseOnRead("test_eb_1_field_suf_sep", iossProp); Iocatalyst::BlockMeshSet::IOSSparams iop("cat", EXODUS_DATABASE_TYPE, iossProp); - Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); + Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); - - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; + } Ioss::Region cat_reg(cat_d); - + Ioss::Region exo_reg(exo_d); - + auto cat_elemBlock = cat_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); auto exo_elemBlock = exo_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); @@ -295,27 +297,26 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_FIELD_SUFFIX_SEPARATOR) bool cat_foo_x_exists = cat_elemBlock->field_exists("foo_x"); EXPECT_TRUE(exo_foo_x_exists); EXPECT_TRUE(cat_foo_x_exists); - if(exo_foo_x_exists && cat_foo_x_exists) + if (exo_foo_x_exists && cat_foo_x_exists) EXPECT_TRUE(exo_elemBlock->get_field("foo_x") == cat_elemBlock->get_field("foo_x")); - + bool exo_bar_exists = exo_elemBlock->field_exists("bar"); bool cat_bar_exists = cat_elemBlock->field_exists("bar"); EXPECT_TRUE(exo_bar_exists); EXPECT_TRUE(cat_bar_exists); - if(exo_bar_exists && cat_bar_exists) + if (exo_bar_exists && cat_bar_exists) EXPECT_TRUE(exo_elemBlock->get_field("bar") == cat_elemBlock->get_field("bar")); - - //Check bar field data for equality - auto cat_field = cat_elemBlock->get_fieldref("bar"); + + // Check bar field data for equality + auto cat_field = cat_elemBlock->get_fieldref("bar"); std::vector dcBuffer(cat_field.get_size()); cat_elemBlock->get_field_data("bar", Data(dcBuffer), dcBuffer.size()); exo_reg.begin_state(1); - auto exo_field = exo_elemBlock->get_fieldref("bar"); + auto exo_field = exo_elemBlock->get_fieldref("bar"); std::vector deBuffer(exo_field.get_size()); exo_elemBlock->get_field_data("bar", Data(deBuffer), deBuffer.size()); EXPECT_EQ(dcBuffer, deBuffer); - } TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_FIELD_STRIP_TRAILING_UNDERSCORE) @@ -333,17 +334,20 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_FIELD_STRIP_TRAILING_UNDERSCORE) iossProp.add(Ioss::Property("FIELD_STRIP_TRAILING_UNDERSCORE", "ON")); iossProp.add(Ioss::Property("FIELD_SUFFIX_SEPARATOR", "")); - Ioss::DatabaseIO *exo_d = writeAndGetExodusDatabaseOnRead("test_eb_1_field_strip_tr_unders", iossProp); + Ioss::DatabaseIO *exo_d = + writeAndGetExodusDatabaseOnRead("test_eb_1_field_strip_tr_unders", iossProp); Iocatalyst::BlockMeshSet::IOSSparams iop("cat", EXODUS_DATABASE_TYPE, iossProp); Ioss::DatabaseIO *cat_d = bmSet.getCatalystDatabase(iop); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize on read"; + } Ioss::Region cat_reg(cat_d); - + Ioss::Region exo_reg(exo_d); - + auto cat_elemBlock = cat_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); auto exo_elemBlock = exo_reg.get_element_block(bmSet.getUnstructuredBlockName(bm.getID())); @@ -353,23 +357,22 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_FIELD_STRIP_TRAILING_UNDERSCORE) bool cat_foo_exists = cat_elemBlock->field_exists("foo"); EXPECT_TRUE(exo_foo_exists); EXPECT_TRUE(cat_foo_exists); - if(exo_foo_exists && cat_foo_exists) + if (exo_foo_exists && cat_foo_exists) EXPECT_TRUE(exo_elemBlock->get_field("foo") == cat_elemBlock->get_field("foo")); - - //Check field data for equality - auto cat_field = cat_elemBlock->get_fieldref("foo"); + + // Check field data for equality + auto cat_field = cat_elemBlock->get_fieldref("foo"); std::vector dcBuffer(cat_field.get_size()); cat_elemBlock->get_field_data("foo", Data(dcBuffer), dcBuffer.size()); exo_reg.begin_state(1); - auto exo_field = exo_elemBlock->get_fieldref("foo"); + auto exo_field = exo_elemBlock->get_fieldref("foo"); std::vector deBuffer(exo_field.get_size()); exo_elemBlock->get_field_data("foo", Data(deBuffer), deBuffer.size()); EXPECT_EQ(dcBuffer, deBuffer); - } -//Read from file. Can. Or available exodus file in test suite. +// Read from file. Can. Or available exodus file in test suite. TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_SURFACE_SPLIT_TYPE) { Iocatalyst::BlockMesh bm; @@ -377,34 +380,37 @@ TEST_F(Iocatalyst_DatabaseIOTest, Exodus_Prop_SURFACE_SPLIT_TYPE) addBlockMesh(bm); - //If write and read have same split type, we can handle. Else no. + // If write and read have same split type, we can handle. Else no. Ioss::PropertyManager iossProp; iossProp.add(Ioss::Property("SURFACE_SPLIT_TYPE", "BLOCK")); std::string exoFile = "can.ex2"; - + conduit_cpp::Node c_node = getConduitFromExodusFile(exoFile, iossProp); Ioss::DatabaseIO *cat_d = getCatalystDatabaseFromConduit(c_node, iossProp); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize"; } - + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize"; + } + Ioss::Region cat_reg(cat_d); - + Ioss::SideSetContainer cat_sideSets = cat_reg.get_sidesets(); checkEntityContainerZeroCopyFields(cat_sideSets); - - EXPECT_TRUE(cat_sideSets.empty())<<"Cat sidesets not empty when different SURFACE_SPLIT_TYPE"; + + EXPECT_TRUE(cat_sideSets.empty()) << "Cat sidesets not empty when different SURFACE_SPLIT_TYPE"; Ioss::PropertyManager iossProp_s; iossProp_s.add(Ioss::Property("SURFACE_SPLIT_TYPE", "TOPOLOGY")); cat_d = getCatalystDatabaseFromConduit(c_node, iossProp_s); - if(cat_d == nullptr){ EXPECT_TRUE(false) << "Catalyst db unable to initialize"; } + if (cat_d == nullptr) { + EXPECT_TRUE(false) << "Catalyst db unable to initialize"; + } Ioss::Region cat_reg_same(cat_d); - - cat_sideSets = cat_reg_same.get_sidesets(); - EXPECT_TRUE(!cat_sideSets.empty())<<"Cat sidesets empty when identical SURFACE_SPLIT_TYPE"; + cat_sideSets = cat_reg_same.get_sidesets(); + EXPECT_TRUE(!cat_sideSets.empty()) << "Cat sidesets empty when identical SURFACE_SPLIT_TYPE"; } diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_LoggingTest.h b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_LoggingTest.h index fd00c6308339..e90e761c700a 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_LoggingTest.h +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_LoggingTest.h @@ -29,4 +29,4 @@ class LoggingTest : public ::testing::Test } return outputFileExists; } -}; +}; \ No newline at end of file diff --git a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_TestDriverMain.C b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_TestDriverMain.C index 7d0e88549f40..33c32ac8b6de 100644 --- a/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_TestDriverMain.C +++ b/packages/seacas/libraries/ioss/src/catalyst_tests/Iocatalyst_TestDriverMain.C @@ -5,9 +5,9 @@ // See packages/seacas/LICENSE for details #include "iocatalyst_export.h" -#include -#include #include +#include +#include #ifdef SEACAS_HAVE_MPI #include diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C b/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C index e0b17839a32b..edbf32ad2479 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C @@ -1640,6 +1640,15 @@ namespace Iocgns { myProcessor); } + std::vector DatabaseIO::get_db_step_times_nl() + { + std::vector timesteps; + + Utils::get_step_times(get_file_pointer(), timesteps, nullptr, timeScaleFactor, myProcessor); + + return timesteps; + } + void DatabaseIO::write_adjacency_data() { // Determine adjacency information between unstructured blocks. diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.h b/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.h index 718edc8b9d28..1477cf6817ee 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.h @@ -102,12 +102,13 @@ namespace Iocgns { IOSS_NODISCARD bool end_state_nl(int state, double time) override; void flush_database_nl() const override; - bool check_valid_file_open(int status) const; - void create_structured_block(int base, int zone, size_t &num_node); - void create_structured_block_fpp(int base, int num_zones, size_t &num_node); - size_t finalize_structured_blocks(); - void finalize_database() const override; - void get_step_times_nl() override; + bool check_valid_file_open(int status) const; + void create_structured_block(int base, int zone, size_t &num_node); + void create_structured_block_fpp(int base, int num_zones, size_t &num_node); + size_t finalize_structured_blocks(); + void finalize_database() const override; + void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; void create_unstructured_block(int base, int zone, size_t &num_node); void write_adjacency_data(); diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.C b/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.C index 3ba956c99364..b09ff5756a6c 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.C @@ -806,6 +806,15 @@ namespace Iocgns { myProcessor); } + std::vector ParallelDatabaseIO::get_db_step_times_nl() + { + std::vector timesteps; + + Utils::get_step_times(get_file_pointer(), timesteps, nullptr, timeScaleFactor, myProcessor); + + return timesteps; + } + void ParallelDatabaseIO::write_adjacency_data() { // Determine adjacency information between unstructured blocks. @@ -2263,7 +2272,8 @@ namespace Iocgns { // ======================================================================== // Repetitive code for each coordinate direction; use a lambda to consolidate... - auto coord_lambda = [=, &coord](const char *ordinate, int ordinal) { + auto coord_lambda = [&coord, phys_dimension, rmax, rmin, base, zone, &rdata, num_to_get, + this](const char *ordinate, int ordinal) { // Data required by upper classes store x0, y0, z0, ... xn, // yn, zn. Data stored in cgns file is x0, ..., xn, y0, // ..., yn, z0, ..., zn so we have to allocate some scratch diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.h b/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.h index e51ec3f11c49..5ad814938b3a 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_ParallelDatabaseIO.h @@ -107,13 +107,14 @@ namespace Iocgns { bool end_state_nl(int state, double time) override; void flush_database_nl() const override; - void handle_structured_blocks(); - void handle_unstructured_blocks(); - size_t finalize_structured_blocks(); - int64_t handle_node_ids(void *ids, int64_t num_to_get) const; - void finalize_database() const override; - void get_step_times_nl() override; - void write_adjacency_data(); + void handle_structured_blocks(); + void handle_unstructured_blocks(); + size_t finalize_structured_blocks(); + int64_t handle_node_ids(void *ids, int64_t num_to_get) const; + void finalize_database() const override; + void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; + void write_adjacency_data(); int64_t get_field_internal(const Ioss::Region *reg, const Ioss::Field &field, void *data, size_t data_size) const override; diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_StructuredZoneData.C b/packages/seacas/libraries/ioss/src/cgns/Iocgns_StructuredZoneData.C index da349a3b61f6..222bfe91f1e1 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_StructuredZoneData.C +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_StructuredZoneData.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2024 National Technology & Engineering Solutions +// Copyright(C) 1999-2025 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -263,13 +263,13 @@ namespace Iocgns { size_t work2 = ord2 * m_ordinal[0] * m_ordinal[1]; // Don't decompose along m_lineOrdinal direction and Avoid decompositions 1-cell thick. - if (m_lineOrdinal & Ordinal::I || m_ordinal[0] == 1 || ord0 == 1 || m_ordinal[0] - ord0 == 1) { + if (m_lineOrdinal & Ordinal::I || m_ordinal[0] == 1 || ord0 <= 1 || m_ordinal[0] - ord0 <= 1) { work0 = 0; } - if (m_lineOrdinal & Ordinal::J || m_ordinal[1] == 1 || ord1 == 1 || m_ordinal[1] - ord1 == 1) { + if (m_lineOrdinal & Ordinal::J || m_ordinal[1] == 1 || ord1 <= 1 || m_ordinal[1] - ord1 <= 1) { work1 = 0; } - if (m_lineOrdinal & Ordinal::K || m_ordinal[2] == 1 || ord2 == 1 || m_ordinal[2] - ord2 == 1) { + if (m_lineOrdinal & Ordinal::K || m_ordinal[2] == 1 || ord2 <= 1 || m_ordinal[2] - ord2 <= 1) { work2 = 0; } diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C index 84bbd54c37e1..2af15c79ba15 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.C @@ -428,11 +428,9 @@ namespace { size_t max_face = std::string("Face Count").length(); for (auto &eb : ebs) { const std::string &name = eb->name(); - if (name.length() > max_name) { - max_name = name.length(); - } - size_t face_width = Ioss::Utils::number_width(boundary_faces[name].size()); - max_face = face_width > max_face ? face_width : max_face; + max_name = std::max(name.length(), max_name); + size_t face_width = Ioss::Utils::number_width(boundary_faces[name].size()); + max_face = std::max(face_width, max_face); } max_name += 4; // Padding max_face += 4; @@ -1938,7 +1936,7 @@ Iocgns::Utils::resolve_processor_shared_nodes(Ioss::Region ®ion, int my_proce std::vector>> shared_nodes(blocks.size() + 1); for (auto &owner_block : blocks) { - int owner_zone = owner_block->get_property("zone").get_int(); + int owner_zone = owner_block->get_property("zone").get_int(); for (const auto &zgc : owner_block->m_zoneConnectivity) { assert(zgc.m_donorProcessor >= 0); assert(zgc.m_ownerProcessor >= 0); @@ -1950,10 +1948,10 @@ Iocgns::Utils::resolve_processor_shared_nodes(Ioss::Region ®ion, int my_proce // don't store or access any "bulk" data on it. auto donor_block = region.get_structured_block(zgc.m_donorName); assert(donor_block != nullptr); - int donor_zone = donor_block->get_property("zone").get_int(); - std::vector i_range = zgc.get_range(1); - std::vector j_range = zgc.get_range(2); - std::vector k_range = zgc.get_range(3); + int donor_zone = donor_block->get_property("zone").get_int(); + std::vector i_range = zgc.get_range(1); + std::vector j_range = zgc.get_range(2); + std::vector k_range = zgc.get_range(3); for (auto &k : k_range) { for (auto &j : j_range) { for (auto &i : i_range) { @@ -2392,7 +2390,9 @@ int Iocgns::Utils::get_step_times(int cgns_file_ptr, std::vector ×t timesteps.reserve(num_timesteps); for (int i = 0; i < num_timesteps; i++) { - region->add_state(times[i] * timeScaleFactor); + if (nullptr != region) { + region->add_state(times[i] * timeScaleFactor); + } timesteps.push_back(times[i]); } return num_timesteps; diff --git a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h index 874f0dd79fa9..e8438dc1eca0 100644 --- a/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h +++ b/packages/seacas/libraries/ioss/src/cgns/Iocgns_Utils.h @@ -301,7 +301,7 @@ namespace Iocgns { static void write_state_meta_data(int file_ptr, const Ioss::Region ®ion, bool is_parallel_io); static size_t common_write_metadata(int file_ptr, const Ioss::Region ®ion, - std::vector &zone_offset, bool is_parallel); + std::vector &zone_offset, bool is_parallel); static size_t resolve_nodes(Ioss::Region ®ion, int my_processor, bool is_parallel); IOSS_NODISCARD static std::vector>> resolve_processor_shared_nodes(Ioss::Region ®ion, int my_processor); diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C index 8ce14bbfd072..de8af659d188 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.C @@ -4,6 +4,7 @@ // // See packages/seacas/LICENSE for details +#include #include #include #include @@ -18,7 +19,6 @@ #include #include #include -#include #include "Ioex_Utils.h" #include "Ioss_Assembly.h" @@ -88,7 +88,7 @@ namespace { template void write_attribute_names(int exoid, ex_entity_type type, const std::vector &entities); - void query_groups(int exoid, Ioss::NameList& names, bool return_full_names); + void query_groups(int exoid, Ioss::NameList &names, bool return_full_names); class AssemblyTreeFilter { @@ -231,6 +231,12 @@ namespace Ioex { "IOEX: Setting EX_VERBOSE|EX_DEBUG because EX_DEBUG environment variable is set.\n"); ex_opts(EX_VERBOSE | EX_DEBUG); } + // This is also done down in the exodus library, but helps logic to do it here... + if (util().get_environment("EXODUS_VERBOSE", isParallel)) { + fmt::print(Ioss::DebugOut(), "IOEX: Exodus error reporting set to VERBOSE because " + "EXODUS_VERBOSE environment variable is set.\n"); + ex_opts(EX_VERBOSE); + } if (!is_input()) { if (util().get_environment("EX_MODE", exodusMode, isParallel)) { @@ -261,40 +267,57 @@ namespace Ioex { // See if there are any properties that need to (or can) be // handled prior to opening/creating database... -#if NC_HAS_HDF5 - bool compress = ((properties.exists("COMPRESSION_LEVEL") && - properties.get("COMPRESSION_LEVEL").get_int() > 0) || - (properties.exists("COMPRESSION_SHUFFLE") && - properties.get("COMPRESSION_SHUFFLE").get_int() > 0)); - - if (compress) { - exodusMode |= EX_NETCDF4; - } -#endif - if (properties.exists("FILE_TYPE")) { std::string type = properties.get("FILE_TYPE").get_string(); + type = Ioss::Utils::lowercase(type); if (type == "netcdf3" || type == "netcdf-3") { exodusMode = EX_CLOBBER; // Reset back to default... } -#if NC_HAS_HDF5 if (type == "netcdf4" || type == "netcdf-4" || type == "hdf5") { +#if NC_HAS_HDF5 exodusMode |= EX_NETCDF4; - } +#else + fmt::print(Ioss::OUTPUT(), "IOEX: HDF5/netcdf-4 is not supported in this build. FILE_TYPE " + "setting will be ignored.\n"); #endif -#if NC_HAS_CDF5 + } else if (type == "netcdf5" || type == "netcdf-5" || type == "cdf5") { +#if NC_HAS_CDF5 exodusMode |= EX_64BIT_DATA; - } +#else + fmt::print(Ioss::OUTPUT(), "IOEX: CDF5/netcdf-5 is not supported in this build. FILE_TYPE " + "setting will be ignored.\n"); #endif + } } -#if NC_HAS_HDF5 if (properties.exists("ENABLE_FILE_GROUPS")) { +#if NC_HAS_HDF5 exodusMode |= EX_NETCDF4; exodusMode |= EX_NOCLASSIC; +#else + fmt::print(Ioss::OUTPUT(), "IOEX: HDF5/netcdf-4 is not supported in this build. " + "ENABLE_FILE_GROUPS setting will be ignored.\n"); +#endif } + + bool compress = ((properties.exists("COMPRESSION_LEVEL") && + properties.get("COMPRESSION_LEVEL").get_int() > 0) || + (properties.exists("COMPRESSION_SHUFFLE") && + properties.get("COMPRESSION_SHUFFLE").get_int() > 0)); + + if (compress) { +#if NC_HAS_HDF5 + if (!(exodusMode & EX_NETCDF4)) { + fmt::print(Ioss::OUTPUT(), "IOEX: Compression requires netcdf-4/HDF5-based file. Setting " + "file type to netcdf-4.\n"); + exodusMode |= EX_NETCDF4; + } +#else + fmt::print(Ioss::OUTPUT(), "IOEX: HDF5/netcdf-4 is not supported in this build. Compression " + "setting will be ignored.\n"); #endif + } if (properties.exists("MAXIMUM_NAME_LENGTH")) { maximumNameLength = properties.get("MAXIMUM_NAME_LENGTH").get_int(); @@ -406,10 +429,6 @@ namespace Ioex { bool overwrite = true; handle_output_file(write_message, nullptr, nullptr, overwrite, abort_if_error); } - - if (!m_groupName.empty()) { - ex_get_group_id(m_exodusFilePtr, m_groupName.c_str(), &m_exodusFilePtr); - } } assert(m_exodusFilePtr >= 0); fileExists = true; @@ -500,31 +519,52 @@ namespace Ioex { } ex_set_max_name_length(m_exodusFilePtr, maximumNameLength); + + open_root_group_nl(); + open_child_group_nl(0); } - bool BaseDatabaseIO::open_root_group_nl() + bool BaseDatabaseIO::supports_internal_change_set_nl() { return supports_group(); } + + bool BaseDatabaseIO::supports_group() const + { + Ioss::SerializeIO serializeIO_(this); + int exoid = get_file_pointer(); + + int64_t format = ex_inquire_int(exoid, EX_INQ_FILE_FORMAT); + + if (format < 0) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: Could not query file format for file '{}'.\n", get_filename()); + IOSS_ERROR(errmsg); + } + + return (NC_FORMAT_NETCDF4 == format); + } + + bool BaseDatabaseIO::open_root_group_nl() const { // Get existing file pointer... bool success = false; Ioss::SerializeIO serializeIO_(this); - int exoid = get_file_pointer(); + int exoid = get_file_pointer(); - int group_name_length = ex_inquire_int(exoid, EX_INQ_GROUP_NAME_LEN); - std::vector group_name(group_name_length+1, '\0'); + int group_name_length = ex_inquire_int(exoid, EX_INQ_GROUP_NAME_LEN); + std::vector group_name(group_name_length + 1, '\0'); // Get name of this group... int idum; float rdum; - int ierr = ex_inquire(exoid, EX_INQ_GROUP_NAME, &idum, &rdum, group_name.data()); + int ierr = ex_inquire(exoid, EX_INQ_GROUP_NAME, &idum, &rdum, group_name.data()); if (ierr < 0) { std::ostringstream errmsg; - fmt::print(errmsg, "ERROR: Could not open root group of group named '{}' in file '{}'.\n", m_groupName, - get_filename()); + fmt::print(errmsg, "ERROR: Could not open root group of group named '{}' in file '{}'.\n", + m_groupName, get_filename()); IOSS_ERROR(errmsg); } - m_groupName = std::string(group_name.data()); + m_groupName = std::string(group_name.data()); m_exodusFilePtr = ex_inquire_int(exoid, EX_INQ_GROUP_ROOT); if (m_exodusFilePtr < 0) { @@ -537,13 +577,34 @@ namespace Ioex { return success; } - bool BaseDatabaseIO::open_group_nl(const std::string &group_name) + bool BaseDatabaseIO::open_internal_change_set_nl(const std::string &set_name) + { + if (set_name == m_groupName) { + return true; + } + + // Check name for '/' which is not allowed since it is the + // separator character in a full group path + if (set_name.find('/') != std::string::npos) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: Invalid group name '{}' contains a '/' which is not allowed.\n", + set_name); + IOSS_ERROR(errmsg); + } + + if (!open_root_group_nl()) + return false; + + return open_group_nl(set_name); + } + + bool BaseDatabaseIO::open_group_nl(const std::string &group_name) const { // Get existing file pointer... bool success = false; Ioss::SerializeIO serializeIO_(this); - int exoid = get_file_pointer(); + int exoid = get_file_pointer(); m_groupName = group_name; ex_get_group_id(exoid, m_groupName.c_str(), &m_exodusFilePtr); @@ -558,13 +619,21 @@ namespace Ioex { return success; } + bool BaseDatabaseIO::create_internal_change_set_nl(const std::string &set_name) + { + if (!open_root_group_nl()) + return false; + + return create_subgroup_nl(set_name); + } + bool BaseDatabaseIO::create_subgroup_nl(const std::string &group_name) { bool success = false; if (!is_input()) { // Get existing file pointer... Ioss::SerializeIO serializeIO_(this); - int exoid = get_file_pointer(); + int exoid = get_file_pointer(); // Check name for '/' which is not allowed since it is the // separator character in a full group path @@ -2040,7 +2109,7 @@ namespace Ioex { } // Output field metadata - bool do_metadata = false; + bool do_metadata = true; Ioss::Utils::check_set_bool_property(properties, "OUTPUT_FIELD_METADATA", do_metadata); if (do_metadata) { output_field_metadata(); @@ -3221,13 +3290,29 @@ namespace Ioex { write_coordinate_frames(get_file_pointer(), get_region()->get_coordinate_frames()); } + Ioss::NameList BaseDatabaseIO::internal_change_set_describe_nl(bool return_full_names) + { + Ioss::NameList names = groups_describe(return_full_names); + + // Downshift by 1 since the first is the root group "/" + int numNames = static_cast(names.size()); + for (int i = 0; i < numNames - 1; i++) { + names[i] = names[i + 1]; + } + + if (numNames > 0) { + names.resize(numNames - 1); + } + + return names; + } - Ioss::NameList BaseDatabaseIO::groups_describe_nl(bool return_full_names) + Ioss::NameList BaseDatabaseIO::groups_describe(bool return_full_names) const { Ioss::SerializeIO serializeIO_(this); Ioss::NameList names; - int group_root = ex_inquire_int(get_file_pointer(), EX_INQ_GROUP_ROOT); + int group_root = ex_inquire_int(get_file_pointer(), EX_INQ_GROUP_ROOT); query_groups(group_root, names, return_full_names); return names; @@ -3256,24 +3341,58 @@ namespace Ioex { activeNodeSetNodesIndex.clear(); } - int BaseDatabaseIO::num_child_group_nl() + int BaseDatabaseIO::num_internal_change_set_nl() + { + // Save and reset state + int currentExodusFilePtr = m_exodusFilePtr; + std::string currentGroupName = m_groupName; + + if (!open_root_group_nl()) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: Could not open root group.\n", m_groupName); + IOSS_ERROR(errmsg); + } + + int numChildGroup = num_child_group(); + + m_exodusFilePtr = currentExodusFilePtr; + m_groupName = currentGroupName; + + return numChildGroup; + } + + int BaseDatabaseIO::num_child_group() const { Ioss::SerializeIO serializeIO_(this); - int exoid = get_file_pointer(); - exoid = ex_inquire_int(exoid, EX_INQ_GROUP_ROOT); - int num_children = ex_inquire_int(exoid, EX_INQ_NUM_CHILD_GROUPS); + int exoid = get_file_pointer(); + exoid = ex_inquire_int(exoid, EX_INQ_GROUP_ROOT); + int num_children = ex_inquire_int(exoid, EX_INQ_NUM_CHILD_GROUPS); return num_children; } - bool BaseDatabaseIO::open_child_group_nl(int index) + bool BaseDatabaseIO::open_internal_change_set_nl(int index) + { + if (!open_root_group_nl()) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: Could not open root group.\n", m_groupName); + IOSS_ERROR(errmsg); + } + + return open_child_group_nl(index); + } + + bool BaseDatabaseIO::open_child_group_nl(int index) const { - if(index < 0) return false; + if (index < 0) + return false; Ioss::SerializeIO serializeIO_(this); - int exoid = get_file_pointer(); - int num_children = ex_inquire_int(exoid, EX_INQ_NUM_CHILD_GROUPS); - if(num_children == 0) return true; + int exoid = get_file_pointer(); + int num_children = ex_inquire_int(exoid, EX_INQ_NUM_CHILD_GROUPS); + if (num_children == 0) + return true; - if(index >= num_children) return false; + if (index >= num_children) + return false; std::vector children(num_children); @@ -3284,8 +3403,8 @@ namespace Ioex { exoid = children[index]; - int group_name_length = ex_inquire_int(exoid, EX_INQ_GROUP_NAME_LEN); - std::vector group_name(group_name_length+1, '\0'); + int group_name_length = ex_inquire_int(exoid, EX_INQ_GROUP_NAME_LEN); + std::vector group_name(group_name_length + 1, '\0'); // Get name of this group... int idum; @@ -3296,7 +3415,7 @@ namespace Ioex { } m_exodusFilePtr = exoid; - m_groupName = std::string(group_name.data()); + m_groupName = std::string(group_name.data()); return true; } @@ -3603,13 +3722,13 @@ namespace { #endif } - void query_groups(int exoid, Ioss::NameList& names, bool return_full_names) + void query_groups(int exoid, Ioss::NameList &names, bool return_full_names) { int idum; float rdum; - int group_name_length = ex_inquire_int(exoid, EX_INQ_GROUP_NAME_LEN); - std::vector group_name(group_name_length+1, '\0'); + int group_name_length = ex_inquire_int(exoid, EX_INQ_GROUP_NAME_LEN); + std::vector group_name(group_name_length + 1, '\0'); // Get name of this group... int ierr = ex_inquire(exoid, EX_INQ_GROUP_NAME, &idum, &rdum, group_name.data()); @@ -3617,14 +3736,15 @@ namespace { Ioex::exodus_error(exoid, __LINE__, __func__, __FILE__); } - if(return_full_names) { + if (return_full_names) { std::fill(group_name.begin(), group_name.end(), '\0'); ierr = ex_inquire(exoid, EX_INQ_FULL_GROUP_NAME, &idum, &rdum, group_name.data()); if (ierr < 0) { Ioex::exodus_error(exoid, __LINE__, __func__, __FILE__); } names.push_back(std::string(group_name.data())); - } else { + } + else { names.push_back(std::string(group_name.data())); } diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h index b6f18fc75653..f2a0758ebff2 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_BaseDatabaseIO.h @@ -90,6 +90,82 @@ namespace Ioex { // database supports that type (e.g. return_value & Ioss::FACESET) IOSS_NODISCARD unsigned entity_field_support() const override; + IOSS_NODISCARD std::string get_internal_change_set_name() const override { return m_groupName; } + + /** \brief Checks if a database type supports groups + * + * \returns True if successful. + */ + bool supports_group() const; + + /** \brief If a database type supports groups and if the database + * contains groups, open the specified group. + * + * If the group_name begins with '/', it specifies the absolute path + * name from the root with '/' separating groups. Otherwise, the + * group_name specifies a child group of the currently active group. + * If group_name == "/" then the root group is opened. + * + * \param[in] group_name The name of the group to open. + * \returns True if successful. + */ + bool open_group(const std::string &group_name) + { + IOSS_FUNC_ENTER(m_); + return open_group_nl(group_name); + } + + /** \brief If a database type supports groups, create the specified + * group as a child of the current group. + * + * The name of the group must not contain a '/' character. + * If the command is successful, then the group will be the + * active group for all subsequent writes to the database. + * + * \param[in] group_name The name of the subgroup to create. + * \returns True if successful. + */ + bool create_subgroup(const std::string &group_name) + { + IOSS_FUNC_ENTER(m_); + return create_subgroup_nl(group_name); + } + + /** \brief If a database type supports groups, and if the database + * contains groups, open the root group for the current group. + */ + bool open_root_group() + { + IOSS_FUNC_ENTER(m_); + return open_root_group_nl(); + } + + /** \brief If a database type supports groups, and if the database + * contains groups, return the number of child groups for + * the current group. + */ + int num_child_group() const; + + /** \brief If a database type supports groups, open the child group + * of the current group at the specified [zero-based] index + * + * \param[in] child_index The [zero-based] index of the subgroup to open. + * \returns True if successful. + */ + bool open_child_group(int child_index) + { + IOSS_FUNC_ENTER(m_); + return open_child_group_nl(child_index); + } + + /** \brief If a database type supports groups, return a list of group names + * + * \param[in] return_full_names Flag to control return of relative + * or full group name paths. + * \returns True if successful. + */ + Ioss::NameList groups_describe(bool return_full_names = false) const; + protected: // Check to see if database state is ok... // If 'write_message' true, then output a warning message indicating the problem. @@ -101,12 +177,17 @@ namespace Ioex { void release_memory_nl() override; - int num_child_group_nl() override; - bool open_child_group_nl(int index) override; - bool open_root_group_nl() override; - bool open_group_nl(const std::string &group_name) override; - bool create_subgroup_nl(const std::string &group_name) override; - Ioss::NameList groups_describe_nl(bool return_full_names) override; + bool supports_internal_change_set_nl() override; + bool open_internal_change_set_nl(const std::string &set_name) override; + bool open_internal_change_set_nl(int index) override; + bool create_internal_change_set_nl(const std::string &set_name) override; + int num_internal_change_set_nl() override; + Ioss::NameList internal_change_set_describe_nl(bool return_full_names) override; + + bool open_root_group_nl() const; + bool open_group_nl(const std::string &group_name) const; + bool open_child_group_nl(int index) const; + bool create_subgroup_nl(const std::string &group_name); bool begin_nl(Ioss::State state) override; bool end_nl(Ioss::State state) override; diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.C new file mode 100644 index 000000000000..b71bb5d151ee --- /dev/null +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.C @@ -0,0 +1,162 @@ +// Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#include "Ioex_ChangeSet.h" +#include "Ioex_DatabaseIO.h" + +#include "Ioss_CodeTypes.h" // for Int64Vector, IntVector +#include "Ioss_SmartAssert.h" +#include // for assert +#include // for sqrt +#include +#include +#include // for ostringstream +#include +#include // for string, operator==, etc +#include + +#include "Ioss_ChangeSetFactory.h" // for ChangeSetFactory +#include "Ioss_Property.h" // for Property +#include "Ioss_PropertyManager.h" // for PropertyManager +#include "Ioss_Region.h" // for Region + +namespace Ioex { + // ======================================================================== + const ChangeSetFactory *ChangeSetFactory::factory() + { + static ChangeSetFactory registerThis; + return ®isterThis; + } + + ChangeSetFactory::ChangeSetFactory() : Ioss::ChangeSetFactory("exodus") + { + Ioss::ChangeSetFactory::alias("exodus", "exodusii"); + Ioss::ChangeSetFactory::alias("exodus", "exodusII"); + Ioss::ChangeSetFactory::alias("exodus", "genesis"); +#if defined(PARALLEL_AWARE_EXODUS) + Ioss::ChangeSetFactory::alias("exodus", "dof_exodus"); + Ioss::ChangeSetFactory::alias("exodus", "dof"); +#endif + } + + Ioss::ChangeSet *ChangeSetFactory::make_ChangeSet(Ioss::Region *region) const + { + return new ChangeSet(region); + } + + Ioss::ChangeSet *ChangeSetFactory::make_ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount) const + { + return new ChangeSet(db, dbName, dbType, fileCyclicCount); + } + + // ======================================================================== + ChangeSet::ChangeSet(Ioss::Region *region) : Ioss::ChangeSet(region) + { + Ioss::ChangeSet::m_supportedFormats = + (Ioss::CHANGE_SET_INTERNAL_FILES | Ioss::CHANGE_SET_LINEAR_MULTI_FILES | + Ioss::CHANGE_SET_CYCLIC_MULTI_FILES); + } + + ChangeSet::ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType, + unsigned fileCyclicCount) + : Ioss::ChangeSet(db, dbName, dbType, fileCyclicCount) + { + Ioss::ChangeSet::m_supportedFormats = + (Ioss::CHANGE_SET_INTERNAL_FILES | Ioss::CHANGE_SET_LINEAR_MULTI_FILES | + Ioss::CHANGE_SET_CYCLIC_MULTI_FILES); + } + + ChangeSet::~ChangeSet() {} + + void ChangeSet::get_group_change_sets() + { + auto iossDB = get_database(); + Ioex::BaseDatabaseIO *ioexDB = dynamic_cast(iossDB); + + if (nullptr == ioexDB) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: The database file named '{}' is not Exodus format\n", + iossDB->get_filename()); + IOSS_ERROR(errmsg); + } + + m_databaseFormat = Ioss::CHANGE_SET_INTERNAL_FILES; + m_currentChangeSet = ioexDB->get_internal_change_set_name(); + + Ioss::NameList names = ioexDB->groups_describe(false); + + // Downshift by 1 since the first is the root group "/" + int numNames = static_cast(names.size()); + for (int i = 0; i < numNames - 1; i++) { + m_changeSetNames.push_back(names[i + 1]); + } + } + + bool ChangeSet::supports_group() + { + auto iossDB = get_database(); + Ioex::BaseDatabaseIO *ioexDB = dynamic_cast(iossDB); + + if (nullptr == ioexDB) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: The database file named '{}' is not Exodus format\n", + iossDB->get_filename()); + IOSS_ERROR(errmsg); + } + + return ioexDB->supports_group() && (ioexDB->num_child_group() > 0); + } + + void ChangeSet::populate_change_sets(bool loadAllFiles) + { + if (supports_group()) { + get_group_change_sets(); + } + else { + Ioss::ChangeSet::populate_change_sets(loadAllFiles); + } + } + + void ChangeSet::clear_change_sets() + { + m_changeSetNames.clear(); + m_currentChangeSet = ""; + } + + void ChangeSet::close_change_set(unsigned index) + { + if (Ioss::CHANGE_SET_INTERNAL_FILES != m_databaseFormat) { + Ioss::ChangeSet::close_change_set(index); + return; + } + + verify_change_set_index(index); + + auto iossDB = get_database(); + if (!iossDB->open_internal_change_set(m_currentChangeSet)) { + std::ostringstream errmsg; + fmt::print(errmsg, "ERROR: The database file named '{}' could not open group '{}\n", + iossDB->get_filename(), m_currentChangeSet); + IOSS_ERROR(errmsg); + } + } + + Ioss::DatabaseIO *ChangeSet::open_change_set(unsigned index, Ioss::DatabaseUsage usage) + { + if (Ioss::CHANGE_SET_INTERNAL_FILES != m_databaseFormat) { + return Ioss::ChangeSet::open_change_set(index, usage); + } + + verify_change_set_index(index); + + auto db = get_database(); + db->open_internal_change_set(index); + + return db; + } +} // namespace Ioex diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.h b/packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.h new file mode 100644 index 000000000000..cc0431390171 --- /dev/null +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.h @@ -0,0 +1,69 @@ +// Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions +// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with +// NTESS, the U.S. Government retains certain rights in this software. +// +// See packages/seacas/LICENSE for details + +#pragma once + +#include "Ioss_ChangeSet.h" // for ChangeSet +#include "Ioss_ChangeSetFactory.h" // for ChangeSetFactory +#include "Ioss_CodeTypes.h" +#include "Ioss_DBUsage.h" // for DatabaseUsage +#include "Ioss_Map.h" // for Map +#include // for size_t +#include // for int64_t +#include // for string +#include // for vector + +#include "Ioss_State.h" // for State +#include "ioex_export.h" + +namespace Ioss { + class Region; +} // namespace Ioss + +/** \brief A namespace for the exodus change set type. + */ +namespace Ioex { + class IOEX_EXPORT ChangeSetFactory : public Ioss::ChangeSetFactory + { + public: + static const ChangeSetFactory *factory(); + + private: + ChangeSetFactory(); + Ioss::ChangeSet *make_ChangeSet(Ioss::Region *region) const override; + Ioss::ChangeSet *make_ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, + const std::string &dbType, + unsigned fileCyclicCount) const override; + }; + + class IOEX_EXPORT ChangeSet : public Ioss::ChangeSet + { + public: + explicit ChangeSet(Ioss::Region *region); + ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType, + unsigned fileCyclicCount); + + ~ChangeSet() override; + + void populate_change_sets(bool loadAllFiles = true) override; + + IOSS_NODISCARD Ioss::DatabaseIO *open_change_set(unsigned index, + Ioss::DatabaseUsage usage) override; + void close_change_set(unsigned index) override; + + private: + ChangeSet() = delete; + ChangeSet(const ChangeSet &) = delete; + + std::string m_currentChangeSet; + + protected: + void get_group_change_sets(); + void clear_change_sets() override; + bool supports_group(); + }; + +} // namespace Ioex diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C index d84be0925268..0d49fa766328 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.C @@ -171,9 +171,6 @@ namespace Ioex { IOSS_ERROR(errmsg); } } - - open_root_group_nl(); - open_child_group_nl(0); } bool DatabaseIO::check_valid_file_ptr(bool write_message, std::string *error_msg, int *bad_count, @@ -376,6 +373,11 @@ namespace Ioex { if (is_ok) { ex_set_max_name_length(m_exodusFilePtr, maximumNameLength); + if (fileExists) { + open_root_group_nl(); + open_child_group_nl(0); + } + // Check properties handled post-create/open... if (properties.exists("COMPRESSION_METHOD")) { auto method = properties.get("COMPRESSION_METHOD").get_string(); @@ -391,19 +393,50 @@ namespace Ioex { #if NC_HAS_SZIP_WRITE exo_method = EX_COMPRESS_SZIP; #else - fmt::print(Ioss::WarnOut(), "The NetCDF library does not have SZip compression enabled." - " 'zlib' will be used instead.\n\n"); + if (myProcessor == 0) { + fmt::print(Ioss::WarnOut(), "The NetCDF library does not have SZip compression enabled." + " 'zlib' will be used instead.\n\n"); + } +#endif + } + else if (method == "zstd") { +#if NC_HAS_ZSTD == 1 + exo_method = EX_COMPRESS_ZSTD; +#else + if (myProcessor == 0) { + fmt::print(Ioss::WarnOut(), + "The NetCDF library does not have ZStandard compression enabled." + " 'zlib' will be used instead.\n\n"); + } +#endif + } + else if (method == "bzip2") { +#if NC_HAS_BZ2 == 1 + exo_method = EX_COMPRESS_BZ2; +#else + if (myProcessor == 0) { + fmt::print(Ioss::WarnOut(), + "The NetCDF library does not have Bzip2 / BZ2 compression enabled." + " 'zlib' will be used instead.\n\n"); + } #endif } else { - fmt::print(Ioss::WarnOut(), - "Unrecognized compression method specified: '{}'." - " 'zlib' will be used instead.\n\n", - method); + if (myProcessor == 0) { + fmt::print(Ioss::WarnOut(), + "Unrecognized compression method specified: '{}'." + " 'zlib' will be used instead.\n\n", + method); + } } ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_TYPE, exo_method); } + if (properties.exists("COMPRESSION_QUANTIZE_NSD")) { + int quant_level = properties.get("COMPRESSION_QUANTIZE_NSD").get_int(); + ex_set_option(m_exodusFilePtr, EX_OPT_QUANTIZE_NSD, quant_level); + } + if (properties.exists("COMPRESSION_LEVEL")) { int comp_level = properties.get("COMPRESSION_LEVEL").get_int(); ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_LEVEL, comp_level); @@ -641,17 +674,24 @@ namespace Ioex { } } - void DatabaseIO::get_step_times_nl() + std::vector DatabaseIO::internal_get_step_times_nl(bool setRegionTimeSteps) { - bool exists = false; - double last_time = DBL_MAX; + bool exists = false; + double last_time = DBL_MAX; + int tstepCount = 0; std::vector tsteps(0); + // Use reference to make sure that no Region modifications occur based on the input flag + // setRegionTimeSteps flag determines whether we are actually populating the region + // timesteps or just querying the timesteps that are on a specific database without + // populating the regions timesteps data and setting the number of timesteps on the region + int ×tepCount = setRegionTimeSteps ? m_timestepCount : tstepCount; + if (dbUsage == Ioss::WRITE_HISTORY) { if (myProcessor == 0) { - m_timestepCount = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); - if (m_timestepCount <= 0) { - return; + timestepCount = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); + if (timestepCount <= 0) { + return tsteps; } // For an exodus file, timesteps are global and are stored in the region. @@ -659,57 +699,66 @@ namespace Ioex { // Read the timesteps and add them to the region. // Since we can't access the Region's stateCount directly, we just add // all of the steps and assume the Region is dealing with them directly... - tsteps.resize(m_timestepCount); + tsteps.resize(timestepCount); int error = ex_get_all_times(get_file_pointer(), Data(tsteps)); if (error < 0) { Ioex::exodus_error(get_file_pointer(), __LINE__, __func__, __FILE__); } - int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", m_timestepCount); - max_step = std::min(max_step, m_timestepCount); + int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", timestepCount); + max_step = std::min(max_step, timestepCount); double max_time = properties.get_optional("APPEND_OUTPUT_AFTER_TIME", std::numeric_limits::max()); Ioss::Region *this_region = get_region(); + int numSteps = 0; for (int i = 0; i < max_step; i++) { if (tsteps[i] <= max_time) { - this_region->add_state_nl(tsteps[i] * timeScaleFactor); + if (setRegionTimeSteps) { + this_region->add_state_nl(tsteps[i] * timeScaleFactor); + } + + tsteps[i] *= timeScaleFactor; + numSteps++; } } + tsteps.resize(numSteps); } } else { { Ioss::SerializeIO serializeIO_(this); - m_timestepCount = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); - } - // Need to sync timestep count across ranks if parallel... - if (isParallel) { - auto min_timestep_count = util().global_minmax(m_timestepCount, Ioss::ParallelUtils::DO_MIN); - if (min_timestep_count == 0) { - auto max_timestep_count = util().global_minmax(m_timestepCount, Ioss::ParallelUtils::DO_MAX); - if (max_timestep_count != 0) { - if (myProcessor == 0) { - // NOTE: Don't want to warn on all processors if the - // timestep count is zero on some, but not all ranks. - fmt::print(Ioss::WarnOut(), - "At least one database has no timesteps. No times will be read on ANY" - " database for consistency.\n"); - } - } - } - m_timestepCount = min_timestep_count; - } - - if (m_timestepCount <= 0) { - return; + timestepCount = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); + int exTimestepCount = timestepCount; + // Need to sync timestep count across ranks if parallel... + if (isParallel) { + auto min_timestep_count = + util().global_minmax(timestepCount, Ioss::ParallelUtils::DO_MIN); + if (min_timestep_count == 0) { + auto max_timestep_count = + util().global_minmax(timestepCount, Ioss::ParallelUtils::DO_MAX); + if (max_timestep_count != 0) { + if (myProcessor == 0) { + // NOTE: Don't want to warn on all processors if the + // timestep count is zero on some, but not all ranks. + fmt::print(Ioss::WarnOut(), + "At least one database has no timesteps. No times will be read on ANY" + " database for consistency.\n"); + } + } + } + timestepCount = min_timestep_count; + } + + if (timestepCount <= 0) { + return tsteps; } // For an exodus file, timesteps are global and are stored in the region. // Read the timesteps and add to the region - tsteps.resize(m_timestepCount, -std::numeric_limits::max()); + tsteps.resize(exTimestepCount, -std::numeric_limits::max()); // The `EXODUS_CALL_GET_ALL_TIMES=NO` is typically only used in // isSerialParallel mode and the client is responsible for @@ -726,7 +775,6 @@ namespace Ioex { Ioss::Utils::check_set_bool_property(properties, "EXODUS_CALL_GET_ALL_TIMES", call_ex_get_all_times); if (call_ex_get_all_times) { - Ioss::SerializeIO serializeIO_(this); int error = ex_get_all_times(get_file_pointer(), Data(tsteps)); if (error < 0) { Ioex::exodus_error(get_file_pointer(), __LINE__, __func__, __FILE__); @@ -735,11 +783,8 @@ namespace Ioex { // See if the "last_written_time" attribute exists and if it // does, check that it matches the largest time in 'tsteps'. - { - Ioss::SerializeIO serializeIO_(this); - exists = Ioex::read_last_time_attribute(get_file_pointer(), &last_time); - } - + exists = Ioex::read_last_time_attribute(get_file_pointer(), &last_time); + } if (exists && isParallel) { // Assume that if it exists on 1 processor, it exists on // all... Sync value among processors since could have a @@ -759,17 +804,23 @@ namespace Ioex { // One use case is that job is restarting at a time prior to what has been // written to the results file, so want to start appending after // restart time instead of at end time on database. - int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", m_timestepCount); - max_step = std::min(max_step, m_timestepCount); + int max_step = properties.get_optional("APPEND_OUTPUT_AFTER_STEP", timestepCount); + max_step = std::min(max_step, timestepCount); double max_time = properties.get_optional("APPEND_OUTPUT_AFTER_TIME", std::numeric_limits::max()); last_time = std::min(last_time, max_time); Ioss::Region *this_region = get_region(); + int numSteps = 0; for (int i = 0; i < max_step; i++) { if (tsteps[i] <= last_time) { - this_region->add_state_nl(tsteps[i] * timeScaleFactor); + if (setRegionTimeSteps) { + this_region->add_state_nl(tsteps[i] * timeScaleFactor); + } + + tsteps[i] *= timeScaleFactor; + numSteps++; } else { if (myProcessor == 0 && max_time == std::numeric_limits::max()) { @@ -786,9 +837,20 @@ namespace Ioex { } } } + + tsteps.resize(numSteps); } + + return tsteps; } + std::vector DatabaseIO::get_db_step_times_nl() + { + return internal_get_step_times_nl(false); + } + + void DatabaseIO::get_step_times_nl() { internal_get_step_times_nl(true); } + void DatabaseIO::read_communication_metadata() { // Check that file is nemesis. diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.h b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.h index 66c87690ad22..bb3699227c99 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_DatabaseIO.h @@ -68,7 +68,9 @@ namespace Ioex { IOSS_NODISCARD int get_file_pointer() const override; // Open file and set exodusFilePtr. private: - void get_step_times_nl() override; + void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; + std::vector internal_get_step_times_nl(bool setRegionTimeSteps); bool open_input_file(bool write_message, std::string *error_msg, int *bad_count, bool abort_if_error) const override; diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_DecompositionData.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_DecompositionData.C index 9097acbe20c8..cb186f8b4e60 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_DecompositionData.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_DecompositionData.C @@ -300,13 +300,15 @@ namespace Ioex { Ioss::Region region(dbi, "line_decomp_region"); - Ioss::DecompUtils::line_decompose( - region, m_processorCount, m_decomposition.m_method, m_decomposition.m_decompExtra, - element_to_proc_global, INT(0)); - - if (m_decomposition.m_showHWM || m_decomposition.m_showProgress) { - Ioss::DecompUtils::output_decomposition_statistics(element_to_proc_global, m_processorCount); - } + Ioss::DecompUtils::line_decompose(region, m_processorCount, m_decomposition.m_method, + m_decomposition.m_decompExtra, element_to_proc_global, + INT(0)); + + if (m_decomposition.m_showHWM || m_decomposition.m_showProgress) { + auto work_per_rank = + Ioss::DecompUtils::get_work_per_rank(element_to_proc_global, m_processorCount); + Ioss::DecompUtils::output_decomposition_statistics(work_per_rank); + } } // Now broadcast the parts of the `element_to_proc_global` // vector to the owning ranks in the initial linear @@ -336,7 +338,7 @@ namespace Ioex { } if (m_decomposition.m_lineDecomp) { - // Do not combine into previous if block since we want to release memory for + // Do not combine into previous if block since we want to release memory for // the local vectors in that block before allocating the large adjacency vector. generate_adjacency_list(filePtr, m_decomposition); } diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_Internals.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_Internals.C index 6644599d1f6a..d938a861906b 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_Internals.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_Internals.C @@ -386,7 +386,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params int status = nc_set_fill(exodusFilePtr, NC_NOFILL, &old_fill); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } status = nc_put_att_text(exodusFilePtr, NC_GLOBAL, "base_database", @@ -397,7 +397,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format( "Error: failed to define 'base_database' attribute to file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Time Dimension... @@ -406,7 +406,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format("Error: failed to define time dimension in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Name String Length... @@ -417,7 +417,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format("Error: failed to define 'name string length' in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Nodes (Node Block) ... @@ -429,7 +429,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format("Error: failed to define number of nodes in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -448,11 +448,11 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format("Error: failed to define number of elements in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "element block", mesh.elemblocks.size(), DIM_NUM_EL_BLK, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, VAR_NAME_EL_BLK) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -469,11 +469,11 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format("Error: failed to define number of faces in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "face block", mesh.faceblocks.size(), DIM_NUM_FA_BLK, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, VAR_NAME_FA_BLK) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -490,11 +490,11 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format("Error: failed to define number of edges in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "edge block", mesh.edgeblocks.size(), DIM_NUM_ED_BLK, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, VAR_NAME_ED_BLK) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -503,28 +503,28 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params if (var_params.num_nset > 0) { if (define_netcdf_vars(exodusFilePtr, "node set", mesh.nodesets.size(), DIM_NUM_NS, VAR_NS_STAT, VAR_NS_IDS, VAR_NAME_NS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } if (var_params.num_eset > 0) { if (define_netcdf_vars(exodusFilePtr, "edge set", mesh.edgesets.size(), DIM_NUM_ES, VAR_ES_STAT, VAR_ES_IDS, VAR_NAME_ES) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } if (var_params.num_fset > 0) { if (define_netcdf_vars(exodusFilePtr, "face set", mesh.facesets.size(), DIM_NUM_FS, VAR_FS_STAT, VAR_FS_IDS, VAR_NAME_FS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } if (var_params.num_elset > 0) { if (define_netcdf_vars(exodusFilePtr, "element set", mesh.elemsets.size(), DIM_NUM_ELS, VAR_ELS_STAT, VAR_ELS_IDS, VAR_NAME_ELS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -533,7 +533,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params if (var_params.num_sset > 0) { if (define_netcdf_vars(exodusFilePtr, "side set", mesh.sidesets.size(), DIM_NUM_SS, VAR_SS_STAT, VAR_SS_IDS, VAR_NAME_SS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -592,7 +592,7 @@ int Internals::initialize_state_file(Mesh &mesh, const ex_var_params &var_params std::string errmsg = fmt::format( "Error: failed to define whole time step variable in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } struct exi_file_item *file = exi_find_file_item(exodusFilePtr); @@ -1063,7 +1063,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: initialization already done for file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), EX_MSG); - return (EX_FATAL); + return EX_FATAL; } if (rootid == exodusFilePtr) { @@ -1078,7 +1078,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define title attribute to file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // For use later as a consistency check, define the number of processors and @@ -1091,7 +1091,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format( "Error: failed to define processor info attribute to file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1105,7 +1105,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format( "Error: failed to define 'last_written_time' attribute to file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1120,7 +1120,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format( "Error: failed to define ATT_MAX_NAME_LENGTH attribute to file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } } @@ -1136,7 +1136,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define name string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1146,14 +1146,14 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define number of dimensions in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if ((status = nc_def_dim(exodusFilePtr, DIM_TIME, NC_UNLIMITED, &timedim)) != NC_NOERR) { std::string errmsg = fmt::format("Error: failed to define time dimension in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } std::array dim{timedim}; @@ -1162,7 +1162,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format( "Error: failed to define whole time step variable in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { struct exi_file_item *file = exi_find_file_item(exodusFilePtr); @@ -1179,7 +1179,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define number of nodes in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Define the node map here to avoid a later redefine call @@ -1198,7 +1198,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) "Error: failed to create node numbering map array in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); } @@ -1215,7 +1215,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) " in file id {}", static_cast(mesh.nodeblocks[0].id), exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } std::array dims{numnoddim, numattrdim}; @@ -1227,7 +1227,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) fmt::format("Error: failed to define attributes for node block {} in file id {}", mesh.nodeblocks[0].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); @@ -1243,7 +1243,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) " in file id {}", mesh.nodeblocks[0].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } @@ -1261,7 +1261,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define number of elements in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Define the element map here to avoid a later redefine call @@ -1281,7 +1281,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) "Error: failed to create element numbering map in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); } @@ -1300,7 +1300,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define number of faces in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Define the face map here to avoid a later redefine call @@ -1320,7 +1320,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) "Error: failed to create face numbering map in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); } @@ -1339,7 +1339,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define number of edges in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // Define the edge map here to avoid a later redefine call @@ -1359,7 +1359,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) "Error: failed to create edge numbering map in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); } @@ -1369,53 +1369,53 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) // Blocks... if (define_netcdf_vars(exodusFilePtr, "edge block", mesh.edgeblocks.size(), DIM_NUM_ED_BLK, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, VAR_NAME_ED_BLK) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "face block", mesh.faceblocks.size(), DIM_NUM_FA_BLK, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, VAR_NAME_FA_BLK) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "element block", mesh.elemblocks.size(), DIM_NUM_EL_BLK, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, VAR_NAME_EL_BLK) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // ======================================================================== // Sets... if (define_netcdf_vars(exodusFilePtr, "node set", mesh.nodesets.size(), DIM_NUM_NS, VAR_NS_STAT, VAR_NS_IDS, VAR_NAME_NS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "edge set", mesh.edgesets.size(), DIM_NUM_ES, VAR_ES_STAT, VAR_ES_IDS, VAR_NAME_ES) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "face set", mesh.facesets.size(), DIM_NUM_FS, VAR_FS_STAT, VAR_FS_IDS, VAR_NAME_FS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (define_netcdf_vars(exodusFilePtr, "element set", mesh.elemsets.size(), DIM_NUM_ELS, VAR_ELS_STAT, VAR_ELS_IDS, VAR_NAME_ELS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // ======================================================================== // side sets... if (define_netcdf_vars(exodusFilePtr, "side set", mesh.sidesets.size(), DIM_NUM_SS, VAR_SS_STAT, VAR_SS_IDS, VAR_NAME_SS) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // ======================================================================== if (!mesh.nodeblocks.empty()) { if (define_coordinate_vars(exodusFilePtr, mesh.nodeblocks[0].entityCount, numnoddim, mesh.dimensionality, numdimdim, namestrdim) != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -1432,7 +1432,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to dimension \"{}\" in file ID {}", DIM_NUM_PROCS, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } } @@ -1448,7 +1448,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to dimension \"{}\" in file ID {}", DIM_NUM_PROCS_F, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1461,7 +1461,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to define file type in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } exi_set_compact_storage(exodusFilePtr, varid); @@ -1482,7 +1482,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to dimension \"{}\" in file ID {}", DIM_NUM_NODES_GLOBAL, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1496,7 +1496,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) std::string errmsg = fmt::format("Error: failed to dimension \"{}\" in file ID {}", DIM_NUM_ELEMS_GLOBAL, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1510,7 +1510,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = define_variables(exodusFilePtr, static_cast(comm.globalElementBlocks), DIM_NUM_ELBLK_GLOBAL, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -1525,7 +1525,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = define_variables(exodusFilePtr, static_cast(comm.globalNodeSets), DIM_NUM_NS_GLOBAL, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -1540,7 +1540,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = define_variables(exodusFilePtr, static_cast(comm.globalSideSets), DIM_NUM_SS_GLOBAL, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -1549,21 +1549,21 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = conditional_define_variable(exodusFilePtr, VAR_INT_N_STAT, dimid_npf, &nodeMapVarID[0], NC_INT); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Border node status status = conditional_define_variable(exodusFilePtr, VAR_BOR_N_STAT, dimid_npf, &nodeMapVarID[1], NC_INT); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // External Node status status = conditional_define_variable(exodusFilePtr, VAR_EXT_N_STAT, dimid_npf, &nodeMapVarID[2], NC_INT); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Define the variable IDs for the elemental status vectors @@ -1571,49 +1571,49 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = conditional_define_variable(exodusFilePtr, VAR_INT_E_STAT, dimid_npf, &elementMapVarID[0], NC_INT); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Border elements status = conditional_define_variable(exodusFilePtr, VAR_BOR_E_STAT, dimid_npf, &elementMapVarID[1], NC_INT); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Define variable for the internal element information status = define_variable(exodusFilePtr, comm.elementsInternal, DIM_NUM_INT_ELEMS, VAR_ELEM_MAP_INT, bulk_type); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Define variable for the border element information status = define_variable(exodusFilePtr, comm.elementsBorder, DIM_NUM_BOR_ELEMS, VAR_ELEM_MAP_BOR, bulk_type); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Define variable for vector of internal FEM node IDs status = define_variable(exodusFilePtr, comm.nodesInternal, DIM_NUM_INT_NODES, VAR_NODE_MAP_INT, bulk_type); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Define variable for vector of border FEM node IDs status = define_variable(exodusFilePtr, comm.nodesBorder, DIM_NUM_BOR_NODES, VAR_NODE_MAP_BOR, bulk_type); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Define dimension for vector of external FEM node IDs status = define_variable(exodusFilePtr, comm.nodesExternal, DIM_NUM_EXT_NODES, VAR_NODE_MAP_EXT, bulk_type); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -1632,7 +1632,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = define_variables(exodusFilePtr, static_cast(comm.nodeMap.size()), DIM_NUM_N_CMAPS, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } { @@ -1642,7 +1642,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) // Add dimensions for all of the nodal communication maps status = define_variables(exodusFilePtr, ncnt_cmap, DIM_NCNT_CMAP, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -1661,7 +1661,7 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) status = define_variables(exodusFilePtr, static_cast(comm.elementMap.size()), DIM_NUM_E_CMAPS, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } { @@ -1670,12 +1670,12 @@ int Internals::put_metadata(const Mesh &mesh, const CommunicationMetaData &comm) const std::array types{ids_type, NC_INT, bulk_type}; status = define_variables(exodusFilePtr, ecnt_cmap, DIM_ECNT_CMAP, Data(vars), Data(types)); if (status != EX_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_metadata(const std::vector &assemblies) @@ -1687,7 +1687,7 @@ int Internals::put_metadata(const std::vector &assemblies) if ((status = exi_check_valid_file_id(exodusFilePtr, __func__)) != EX_NOERR) { std::string errmsg = fmt::format("Error: Invalid exodus file handle: {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int int_type = NC_INT; @@ -1706,7 +1706,7 @@ int Internals::put_metadata(const std::vector &assemblies) std::string errmsg = fmt::format( "Error: failed to define number of entities in assembly in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } /* create variable array in which to store the entry lists */ @@ -1717,7 +1717,7 @@ int Internals::put_metadata(const std::vector &assemblies) std::string errmsg = fmt::format( "Error: failed to define entity assembly variable in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, entlst_id, 1); @@ -1734,7 +1734,7 @@ int Internals::put_metadata(const std::vector &assemblies) std::string errmsg = fmt::format("Error: failed to define '{}' attribute to file id {}", EX_ATTRIBUTE_ID, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int type = assembly.type; @@ -1744,7 +1744,7 @@ int Internals::put_metadata(const std::vector &assemblies) std::string errmsg = fmt::format("Error: failed to define '{}' attribute to file id {}", EX_ATTRIBUTE_TYPE, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_put_att_text(exodusFilePtr, entlst_id, EX_ATTRIBUTE_NAME, assembly.name.size() + 1, @@ -1754,7 +1754,7 @@ int Internals::put_metadata(const std::vector &assemblies) std::string errmsg = fmt::format("Error: failed to define '{}' attribute to file id {}", EX_ATTRIBUTE_NAME, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -1766,7 +1766,7 @@ int Internals::put_metadata(const std::vector &assemblies) std::string errmsg = fmt::format("Error: failed to define '{}' attribute to file id {}", EX_ATTRIBUTE_TYPENAME, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1793,7 +1793,7 @@ int Internals::put_metadata(const std::vector &blobs) std::string errmsg = fmt::format("Error: failed to define number \"1\" dimension in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (const auto &blob : blobs) { @@ -1807,7 +1807,7 @@ int Internals::put_metadata(const std::vector &blobs) fmt::format("Error: failed to define number of entries in blob {} in file id {}", blob.id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // create a variable just as a way to have a blob and its attributes; values not used for @@ -1819,7 +1819,7 @@ int Internals::put_metadata(const std::vector &blobs) std::string errmsg = fmt::format("Error: failed to create entity for blob {} in file id {}", blob.id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, entlst); @@ -1835,7 +1835,7 @@ int Internals::put_metadata(const std::vector &blobs) std::string errmsg = fmt::format("Error: failed to store blob id {} in file id {}", blob.id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if ((status = nc_put_att_text(exodusFilePtr, entlst, EX_ATTRIBUTE_NAME, blob.name.length() + 1, @@ -1843,10 +1843,10 @@ int Internals::put_metadata(const std::vector &blobs) std::string errmsg = fmt::format("Error: failed to store blob name {} in file id {}", blob.name, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_metadata(const std::vector &blocks, bool count_only) @@ -1854,7 +1854,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl int status = 0; // clear error code if (blocks.empty()) { - return (EX_NOERR); + return EX_NOERR; } int bulk_type = get_type(exodusFilePtr, EX_BULK_INT64_DB); @@ -1868,7 +1868,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: no element blocks defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int namestrdim; @@ -1878,7 +1878,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_inq_dimlen(exodusFilePtr, dimid, &num_elem_blk); @@ -1887,7 +1887,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to get number of element blocks in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } SMART_ASSERT(blocks.size() == num_elem_blk); @@ -1919,7 +1919,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -1935,7 +1935,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // element connectivity array @@ -1949,7 +1949,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, connid, 1); @@ -1963,7 +1963,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl fmt::format("Error: failed to store element type name {} in file id {}", blocks[iblk].elType, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -1978,7 +1978,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // element->edge connectivity array @@ -1993,7 +1993,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, connid, 1); } @@ -2009,7 +2009,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // element->face connectivity array @@ -2024,7 +2024,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, connid, 1); } @@ -2040,7 +2040,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -2055,7 +2055,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); @@ -2086,13 +2086,13 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_metadata(const std::vector &blocks, bool count_only) @@ -2102,7 +2102,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl int bulk_type = get_type(exodusFilePtr, EX_BULK_INT64_DB); if (blocks.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Get number of face blocks defined for this file @@ -2113,7 +2113,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl ex_opts(EX_VERBOSE); std::string errmsg = fmt::format("Error: no face blocks defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int namestrdim; @@ -2123,7 +2123,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_inq_dimlen(exodusFilePtr, dimid, &num_face_blk); @@ -2132,7 +2132,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to get number of face blocks in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } SMART_ASSERT(blocks.size() == num_face_blk); @@ -2164,7 +2164,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -2179,7 +2179,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // face attribute array @@ -2193,7 +2193,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -2207,7 +2207,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl fmt::format("Error: failed to define attributes for face block {} in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -2225,7 +2225,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } @@ -2242,7 +2242,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl fmt::format("Error: failed to create connectivity array for block {} in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, connid, 1); @@ -2256,17 +2256,17 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl fmt::format("Error: failed to store element type name {} in file id {}", blocks[iblk].elType, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_metadata(const std::vector &blocks, bool count_only) { if (blocks.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Get number of edge blocks defined for this file @@ -2277,7 +2277,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl ex_opts(EX_VERBOSE); std::string errmsg = fmt::format("Error: no edge blocks defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int namestrdim; @@ -2287,7 +2287,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_inq_dimlen(exodusFilePtr, dimid, &num_edge_blk); @@ -2296,7 +2296,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to get number of edge blocks in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } SMART_ASSERT(blocks.size() == num_edge_blk); @@ -2328,7 +2328,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -2344,7 +2344,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].nodesPerEntity, blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // edge attribute array @@ -2358,7 +2358,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } std::array dims{numelbdim, numattrdim}; @@ -2371,7 +2371,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl fmt::format("Error: failed to define attributes for edge block {} in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); @@ -2388,7 +2388,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl " in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } @@ -2405,7 +2405,7 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl fmt::format("Error: failed to create connectivity array for block {} in file id {}", blocks[iblk].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, connid, 1); @@ -2418,10 +2418,10 @@ int Internals::put_metadata(const std::vector &blocks, bool count_onl std::string errmsg = fmt::format("Error: failed to store element type name {} in file id {}", blocks[iblk].elType, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_nemesis_data) @@ -2438,7 +2438,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format("Error: failed to locate file type in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int lftype = 0; // Parallel file... @@ -2448,7 +2448,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format("Error: unable to output file type variable in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (full_nemesis_data) { @@ -2459,7 +2459,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output status for internal node map in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } nmstat = comm.nodesBorder == 0 ? 0 : 1; @@ -2469,7 +2469,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output status for border node map in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } nmstat = comm.nodesExternal == 0 ? 0 : 1; @@ -2479,7 +2479,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output status for external node map in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } nmstat = comm.elementsInternal == 0 ? 0 : 1; @@ -2489,7 +2489,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output status for internal elem map in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } nmstat = comm.elementsBorder == 0 ? 0 : 1; @@ -2499,7 +2499,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output status for border elem map in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } @@ -2517,7 +2517,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ fmt::format("Error: failed to find variable ID for \"{}\" in file ID {}", VAR_N_COMM_STAT, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } long long nl_ncnt_cmap = 0; @@ -2531,7 +2531,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format("Error: unable to output variable in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // increment to the next starting position @@ -2544,7 +2544,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to locate node communication map in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_put_var1_longlong(exodusFilePtr, commIndexVar, Data(start), &nl_ncnt_cmap); @@ -2553,7 +2553,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output node communication map index in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } // End "for(icm=0; icm < num_n_comm_maps; icm++)" @@ -2563,7 +2563,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ node_cmap_ids[i] = comm.nodeMap[i].id; } if (put_id_array(exodusFilePtr, VAR_N_COMM_IDS, node_cmap_ids) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } // Set the status of the elemental communication maps @@ -2583,7 +2583,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ fmt::format("Error: failed to find variable ID for \"{}\" in file ID {}", VAR_E_COMM_STAT, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } long long nl_ecnt_cmap = 0; // reset this for index @@ -2598,7 +2598,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format("Error: unable to output variable in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // increment to the next starting position @@ -2611,7 +2611,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to locate element communication map in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_put_var1_longlong(exodusFilePtr, elemCommIndexVar, Data(start), &nl_ecnt_cmap); if (status != NC_NOERR) { @@ -2619,7 +2619,7 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ std::string errmsg = fmt::format( "Error: failed to output int elem map index in file ID {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } // End "for(icm=0; icm < num_e_comm_maps; icm++)" @@ -2629,11 +2629,11 @@ int Internals::put_non_define_data(const CommunicationMetaData &comm, bool full_ elem_cmap_ids[i] = comm.elementMap[i].id; } if (put_id_array(exodusFilePtr, VAR_E_COMM_IDS, elem_cmap_ids) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &blobs) @@ -2649,7 +2649,7 @@ int Internals::put_non_define_data(const std::vector &blobs) fmt::format("Error: failed to locate entity list array for blob {} in file id {}", blob.id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } long dummy = 0; @@ -2657,7 +2657,7 @@ int Internals::put_non_define_data(const std::vector &blobs) std::string errmsg = fmt::format( "Error: failed to output dummy value for blob {} in file id {}", blob.id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } exi_update_max_name_length(exodusFilePtr, name_length); @@ -2679,7 +2679,7 @@ int Internals::put_non_define_data(const std::vector &assemblies) fmt::format("Error: failed to locate entity list for assembly {} in file id {}", assembly.id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if ((status = nc_put_var_longlong(exodusFilePtr, entlst_id, (long long int *)Data(assembly.memberIdList))) != @@ -2708,12 +2708,12 @@ int Internals::put_non_define_data(const std::vector &blocks, bool ou } if (put_id_array(exodusFilePtr, VAR_ID_EL_BLK, elem_blk_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (output_global_data) { if (put_id_array(exodusFilePtr, VAR_ELBLK_IDS_GLOBAL, elem_blk_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } std::vector counts(num_elem_blk); @@ -2721,7 +2721,7 @@ int Internals::put_non_define_data(const std::vector &blocks, bool ou counts[iblk] = blocks[iblk].globalEntityCount; } if (put_int_array(exodusFilePtr, VAR_ELBLK_CNT_GLOBAL, counts) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -2732,7 +2732,7 @@ int Internals::put_non_define_data(const std::vector &blocks, bool ou } if (put_int_array(exodusFilePtr, VAR_STAT_EL_BLK, elem_blk_status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // TODO: Is this code correct? `text` is never set... @@ -2749,7 +2749,7 @@ int Internals::put_non_define_data(const std::vector &blocks, bool ou std::string errmsg = fmt::format( "Error: failed to locate variable name attribute in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (int i = 0; i < blocks[iblk].attributeCount; i++) { @@ -2759,7 +2759,7 @@ int Internals::put_non_define_data(const std::vector &blocks, bool ou } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &blocks) @@ -2774,7 +2774,7 @@ int Internals::put_non_define_data(const std::vector &blocks) } if (put_id_array(exodusFilePtr, VAR_ID_FA_BLK, face_blk_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Now, write the face block status array @@ -2784,7 +2784,7 @@ int Internals::put_non_define_data(const std::vector &blocks) } if (put_int_array(exodusFilePtr, VAR_STAT_FA_BLK, face_blk_status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // TODO: Is this code correct? `text` is never set... @@ -2801,7 +2801,7 @@ int Internals::put_non_define_data(const std::vector &blocks) std::string errmsg = fmt::format( "Error: failed to locate face variable name attribute in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (int i = 0; i < blocks[iblk].attributeCount; i++) { @@ -2811,7 +2811,7 @@ int Internals::put_non_define_data(const std::vector &blocks) } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &blocks) @@ -2826,7 +2826,7 @@ int Internals::put_non_define_data(const std::vector &blocks) } if (put_id_array(exodusFilePtr, VAR_ID_ED_BLK, edge_blk_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Now, write the edge block status array @@ -2836,7 +2836,7 @@ int Internals::put_non_define_data(const std::vector &blocks) } if (put_int_array(exodusFilePtr, VAR_STAT_ED_BLK, edge_blk_status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // TODO: Is this code correct? `text` is never set... @@ -2853,7 +2853,7 @@ int Internals::put_non_define_data(const std::vector &blocks) fmt::format("Error: failed to locate element variable name attribute in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (int i = 0; i < blocks[iblk].attributeCount; i++) { @@ -2863,14 +2863,14 @@ int Internals::put_non_define_data(const std::vector &blocks) } } } - return (EX_NOERR); + return EX_NOERR; } // ======================================================================== int Internals::put_metadata(const std::vector &nodesets, bool count_only) { if (nodesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } int bulk_type = get_type(exodusFilePtr, EX_BULK_INT64_DB); @@ -2890,7 +2890,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl fmt::format("Error: failed to locate node sets defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } // inquire how many node sets are to be stored @@ -2903,7 +2903,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } SMART_ASSERT(static_cast(nodesets.size()) == num_node_sets); @@ -2933,7 +2933,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -2958,7 +2958,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -2973,7 +2973,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl nodesets[i].dfCount, nodesets[i].entityCount, nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // create variable for distribution factors status = nc_def_var(exodusFilePtr, VAR_FACT_NS(cur_num_node_sets + 1), @@ -2992,7 +2992,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3008,7 +3008,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl " in file id {}", nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -3022,7 +3022,7 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl " in file id {}", nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3040,20 +3040,20 @@ int Internals::put_metadata(const std::vector &nodesets, bool count_onl " in file id {}", nodesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } } } - return (EX_NOERR); + return EX_NOERR; } // ======================================================================== int Internals::put_metadata(const std::vector &edgesets, bool count_only) { if (edgesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } int bulk_type = get_type(exodusFilePtr, EX_BULK_INT64_DB); @@ -3072,7 +3072,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl fmt::format("Error: failed to locate edge sets defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } // inquire how many edge sets are to be stored @@ -3087,7 +3087,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (int i = 0; i < num_edge_sets; i++) { @@ -3115,7 +3115,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -3140,7 +3140,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3161,7 +3161,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3176,7 +3176,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl edgesets[i].dfCount, edgesets[i].entityCount, edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // create variable for distribution factors status = nc_def_var(exodusFilePtr, VAR_FACT_ES(cur_num_edge_sets + 1), @@ -3195,7 +3195,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3210,7 +3210,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl " in file id {}", edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -3224,7 +3224,7 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl " in file id {}", edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3242,20 +3242,20 @@ int Internals::put_metadata(const std::vector &edgesets, bool count_onl " in file id {}", edgesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } } } - return (EX_NOERR); + return EX_NOERR; } // ======================================================================== int Internals::put_metadata(const std::vector &facesets, bool count_only) { if (facesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } int bulk_type = get_type(exodusFilePtr, EX_BULK_INT64_DB); @@ -3274,7 +3274,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl fmt::format("Error: failed to locate face sets defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } // inquire how many face sets are to be stored @@ -3289,7 +3289,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (int i = 0; i < num_face_sets; i++) { @@ -3317,7 +3317,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -3342,7 +3342,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3363,7 +3363,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3378,7 +3378,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl facesets[i].dfCount, facesets[i].entityCount, facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // create variable for distribution factors status = nc_def_var(exodusFilePtr, VAR_FACT_FS(cur_num_face_sets + 1), @@ -3397,7 +3397,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3412,7 +3412,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl " in file id {}", facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -3426,7 +3426,7 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl " in file id {}", facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3444,20 +3444,20 @@ int Internals::put_metadata(const std::vector &facesets, bool count_onl " in file id {}", facesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } } } - return (EX_NOERR); + return EX_NOERR; } // ======================================================================== int Internals::put_metadata(const std::vector &elemsets, bool count_only) { if (elemsets.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Get number of element sets defined for this file int dimid; @@ -3475,7 +3475,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl fmt::format("Error: failed to locate element sets defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } // inquire how many element sets are to be stored @@ -3490,7 +3490,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } for (int i = 0; i < num_elem_sets; i++) { @@ -3518,7 +3518,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -3544,7 +3544,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3559,7 +3559,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl elemsets[i].dfCount, elemsets[i].entityCount, elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // create variable for distribution factors status = nc_def_var(exodusFilePtr, VAR_FACT_ELS(cur_num_elem_sets + 1), @@ -3578,7 +3578,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3593,7 +3593,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl " in file id {}", elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } { @@ -3607,7 +3607,7 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl " in file id {}", elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -3625,19 +3625,19 @@ int Internals::put_metadata(const std::vector &elemsets, bool count_onl " in file id {}", elemsets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); } } } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &nodesets, bool output_global_data) { if (nodesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Output nodeset ids... @@ -3648,12 +3648,12 @@ int Internals::put_non_define_data(const std::vector &nodesets, bool ou } if (put_id_array(exodusFilePtr, VAR_NS_IDS, nodeset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (output_global_data) { if (put_id_array(exodusFilePtr, VAR_NS_IDS_GLOBAL, nodeset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } std::vector counts(num_nodesets); @@ -3661,7 +3661,7 @@ int Internals::put_non_define_data(const std::vector &nodesets, bool ou counts[iset] = nodesets[iset].globalEntityCount; } if (put_int_array(exodusFilePtr, VAR_NS_NODE_CNT_GLOBAL, counts) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -3672,16 +3672,16 @@ int Internals::put_non_define_data(const std::vector &nodesets, bool ou } if (put_int_array(exodusFilePtr, VAR_NS_STAT, status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &edgesets) { if (edgesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Output edgeset ids... @@ -3692,7 +3692,7 @@ int Internals::put_non_define_data(const std::vector &edgesets) } if (put_id_array(exodusFilePtr, VAR_ES_IDS, edgeset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Now, write the status array @@ -3702,16 +3702,16 @@ int Internals::put_non_define_data(const std::vector &edgesets) } if (put_int_array(exodusFilePtr, VAR_ES_STAT, status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &facesets) { if (facesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Output faceset ids... @@ -3722,7 +3722,7 @@ int Internals::put_non_define_data(const std::vector &facesets) } if (put_id_array(exodusFilePtr, VAR_FS_IDS, faceset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Now, write the status array @@ -3732,16 +3732,16 @@ int Internals::put_non_define_data(const std::vector &facesets) } if (put_int_array(exodusFilePtr, VAR_FS_STAT, status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &elemsets) { if (elemsets.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Output elemset ids... @@ -3752,7 +3752,7 @@ int Internals::put_non_define_data(const std::vector &elemsets) } if (put_id_array(exodusFilePtr, VAR_ELS_IDS, elemset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } // Now, write the status array @@ -3762,17 +3762,17 @@ int Internals::put_non_define_data(const std::vector &elemsets) } if (put_int_array(exodusFilePtr, VAR_ELS_STAT, status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } // ======================================================================== int Internals::put_metadata(const std::vector &sidesets, bool count_only) { if (sidesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } int bulk_type = get_type(exodusFilePtr, EX_BULK_INT64_DB); @@ -3791,7 +3791,7 @@ int Internals::put_metadata(const std::vector &sidesets, bool count_onl fmt::format("Error: failed to locate side sets defined in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } // inquire how many side sets are to be stored @@ -3824,7 +3824,7 @@ int Internals::put_metadata(const std::vector &sidesets, bool count_onl sidesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } if (count_only) { continue; @@ -3848,7 +3848,7 @@ int Internals::put_metadata(const std::vector &sidesets, bool count_onl sidesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3869,7 +3869,7 @@ int Internals::put_metadata(const std::vector &sidesets, bool count_onl sidesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); @@ -3891,7 +3891,7 @@ int Internals::put_metadata(const std::vector &sidesets, bool count_onl sidesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } // create distribution factor list variable for side set @@ -3913,18 +3913,18 @@ int Internals::put_metadata(const std::vector &sidesets, bool count_onl sidesets[i].id, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); } - return (EX_FATAL); + return EX_FATAL; } } exi_compress_variable(exodusFilePtr, varid, 2); } - return (EX_NOERR); + return EX_NOERR; } int Internals::put_non_define_data(const std::vector &sidesets, bool output_global_data) { if (sidesets.empty()) { - return (EX_NOERR); + return EX_NOERR; } // Output sideset ids... @@ -3935,12 +3935,12 @@ int Internals::put_non_define_data(const std::vector &sidesets, bool ou } if (put_id_array(exodusFilePtr, VAR_SS_IDS, sideset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } if (output_global_data) { if (put_id_array(exodusFilePtr, VAR_SS_IDS_GLOBAL, sideset_id) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } std::vector counts(num_sidesets); @@ -3948,7 +3948,7 @@ int Internals::put_non_define_data(const std::vector &sidesets, bool ou counts[iset] = sidesets[iset].globalEntityCount; } if (put_int_array(exodusFilePtr, VAR_SS_SIDE_CNT_GLOBAL, counts) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } } @@ -3959,10 +3959,10 @@ int Internals::put_non_define_data(const std::vector &sidesets, bool ou } if (put_int_array(exodusFilePtr, VAR_SS_STAT, status) != NC_NOERR) { - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } namespace { @@ -3986,7 +3986,7 @@ namespace { } return (ex_put_names(exoid, ent_type, Data(names))); } - return (EX_NOERR); + return EX_NOERR; } int conditional_define_variable(int exodusFilePtr, const char *var, int dimid, int *varid, @@ -4000,11 +4000,11 @@ namespace { std::string errmsg = fmt::format("Error: Failed to define variable \"{}\" in file ID {}", var, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } } exi_compress_variable(exodusFilePtr, *varid, 1); - return (EX_NOERR); + return EX_NOERR; } int define_variable(int exodusFilePtr, int64_t size, const char *dim, const char *var, @@ -4019,7 +4019,7 @@ namespace { std::string errmsg = fmt::format("Error: failed to dimension \"{}\" in file id {}", DIM_NUM_BOR_ELEMS, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int varid; @@ -4029,11 +4029,11 @@ namespace { std::string errmsg = fmt::format("Error: failed to define variable \"{}\" in file ID {}", VAR_ELEM_MAP_BOR, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 1); } - return (EX_NOERR); + return EX_NOERR; } int define_variables(int exodusFilePtr, int64_t size, const char *dim, const char *var[], @@ -4047,7 +4047,7 @@ namespace { std::string errmsg = fmt::format("Error: failed to dimension \"{}\" in file id {}", DIM_NUM_BOR_ELEMS, exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int i = 0; @@ -4059,13 +4059,13 @@ namespace { std::string errmsg = fmt::format("Error: failed to define variable \"{}\" in file ID {}", var[i], exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); i++; } } - return (EX_NOERR); + return EX_NOERR; } int put_int_array(int exoid, const char *var_type, const std::vector &array) @@ -4076,7 +4076,7 @@ namespace { ex_opts(EX_VERBOSE); std::string errmsg = fmt::format("Error: failed to locate {} in file id {}", var_type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_put_var_int(exoid, var_id, Data(array)); @@ -4085,9 +4085,9 @@ namespace { std::string errmsg = fmt::format("Error: failed to write {} array in file id {}", var_type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } int put_int_array(int exoid, const char *var_type, const std::vector &array) @@ -4098,7 +4098,7 @@ namespace { ex_opts(EX_VERBOSE); std::string errmsg = fmt::format("Error: failed to locate {} in file id {}", var_type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_put_var_longlong(exoid, var_id, (long long *)Data(array)); @@ -4107,9 +4107,9 @@ namespace { std::string errmsg = fmt::format("Error: failed to write {} array in file id {}", var_type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } int put_id_array(int exoid, const char *var_type, const std::vector &ids) @@ -4120,7 +4120,7 @@ namespace { ex_opts(EX_VERBOSE); std::string errmsg = fmt::format("Error: failed to locate {} in file id {}", var_type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } int id_type = get_type(exoid, EX_IDS_INT64_API); @@ -4147,9 +4147,9 @@ namespace { std::string errmsg = fmt::format("Error: failed to write {} array in file id {}", var_type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } - return (EX_NOERR); + return EX_NOERR; } int define_coordinate_vars(int exodusFilePtr, int64_t nodes, int node_dim, int dimension, @@ -4168,7 +4168,7 @@ namespace { std::string errmsg = fmt::format( "Error: failed to define node x coordinate array in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -4181,7 +4181,7 @@ namespace { std::string errmsg = fmt::format( "Error: failed to define node y coordinate array in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -4194,7 +4194,7 @@ namespace { std::string errmsg = fmt::format( "Error: failed to define node z coordinate array in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_compress_variable(exodusFilePtr, varid, 2); } @@ -4209,10 +4209,10 @@ namespace { std::string errmsg = fmt::format("Error: failed to define coordinate name array in file id {}", exodusFilePtr); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exodusFilePtr, varid); - return (EX_NOERR); + return EX_NOERR; } int define_netcdf_vars(int exoid, const char *type, size_t count, const char *dim_num, @@ -4231,7 +4231,7 @@ namespace { if (status != NC_NOERR) { std::string errmsg = fmt::format("Error: failed to get string length in file id {}", exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } status = nc_def_dim(exoid, dim_num, count, &dimid); @@ -4240,7 +4240,7 @@ namespace { std::string errmsg = fmt::format("Error: failed to define number of {}s in file id {}", type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } // id status array: @@ -4251,7 +4251,7 @@ namespace { std::string errmsg = fmt::format("Error: failed to define side {} status in file id {}", type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (count * 4 < sixty_four_kb) { exi_set_compact_storage(exoid, varid); @@ -4266,7 +4266,7 @@ namespace { std::string errmsg = fmt::format("Error: failed to define {} property in file id {}", type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (count * ids_size < sixty_four_kb) { exi_set_compact_storage(exoid, varid); @@ -4279,7 +4279,7 @@ namespace { std::string errmsg = fmt::format("Error: failed to store {} property name {} in file id {}", type, "ID", exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } if (name_var != nullptr) { @@ -4290,10 +4290,10 @@ namespace { std::string errmsg = fmt::format("Error: failed to define {} name array in file id {}", type, exoid); ex_err_fn(exoid, __func__, errmsg.c_str(), status); - return (EX_FATAL); + return EX_FATAL; } exi_set_compact_storage(exoid, varid); } - return (EX_NOERR); + return EX_NOERR; } } // namespace diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C index b4c093182a37..8a73c77d3764 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.C @@ -399,6 +399,9 @@ namespace Ioex { } } } + + open_root_group_nl(); + open_child_group_nl(0); } ParallelDatabaseIO::~ParallelDatabaseIO() = default; @@ -553,7 +556,7 @@ namespace Ioex { #if !defined(__IOSS_WINDOWS__) if (!path.empty()) { - chdir(current_cwd); + (void)chdir(current_cwd); } std::free(current_cwd); #endif @@ -629,7 +632,7 @@ namespace Ioex { std::string path = file.pathname(); filename = file.tailname(); char *current_cwd = getcwd(nullptr, 0); - chdir(path.c_str()); + (void)chdir(path.c_str()); #endif bool do_timer = false; @@ -684,7 +687,7 @@ namespace Ioex { } #if !defined(__IOSS_WINDOWS__) - chdir(current_cwd); + (void)chdir(current_cwd); std::free(current_cwd); #endif @@ -693,6 +696,11 @@ namespace Ioex { if (is_ok) { ex_set_max_name_length(m_exodusFilePtr, maximumNameLength); + if (fileExists) { + open_root_group_nl(); + open_child_group_nl(0); + } + // Check properties handled post-create/open... if (properties.exists("COMPRESSION_METHOD")) { auto method = properties.get("COMPRESSION_METHOD").get_string(); @@ -712,6 +720,28 @@ namespace Ioex { fmt::print(Ioss::WarnOut(), "The NetCDF library does not have SZip compression enabled." " 'zlib' will be used instead.\n\n"); } +#endif + } + else if (method == "zstd") { +#if NC_HAS_ZSTD == 1 + exo_method = EX_COMPRESS_ZSTD; +#else + if (myProcessor == 0) { + fmt::print(Ioss::WarnOut(), + "The NetCDF library does not have ZStandard compression enabled." + " 'zlib' will be used instead.\n\n"); + } +#endif + } + else if (method == "bzip2") { +#if NC_HAS_BZ2 == 1 + exo_method = EX_COMPRESS_BZ2; +#else + if (myProcessor == 0) { + fmt::print(Ioss::WarnOut(), + "The NetCDF library does not have Bzip2 / BZ2 compression enabled." + " 'zlib' will be used instead.\n\n"); + } #endif } else { @@ -724,6 +754,12 @@ namespace Ioex { } ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_TYPE, exo_method); } + + if (properties.exists("COMPRESSION_QUANTIZE_NSD")) { + int quant_level = properties.get("COMPRESSION_QUANTIZE_NSD").get_int(); + ex_set_option(m_exodusFilePtr, EX_OPT_QUANTIZE_NSD, quant_level); + } + if (properties.exists("COMPRESSION_LEVEL")) { int comp_level = properties.get("COMPRESSION_LEVEL").get_int(); ex_set_option(m_exodusFilePtr, EX_OPT_COMPRESSION_LEVEL, comp_level); @@ -913,17 +949,20 @@ namespace Ioex { } } - void ParallelDatabaseIO::get_step_times_nl() + std::vector ParallelDatabaseIO::internal_get_step_times_nl(bool setRegionTimeSteps) { double last_time = DBL_MAX; + int tstepCount = 0; int timestep_count = 0; std::vector tsteps(0); + int &l_timestepCount = setRegionTimeSteps ? m_timestepCount : tstepCount; + { - timestep_count = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); - m_timestepCount = timestep_count; + timestep_count = ex_inquire_int(get_file_pointer(), EX_INQ_TIME); + l_timestepCount = timestep_count; if (timestep_count <= 0) { - return; + return tsteps; } // For an exodusII file, timesteps are global and are stored in the region. @@ -959,9 +998,15 @@ namespace Ioex { last_time = std::min(last_time, max_time); Ioss::Region *this_region = get_region(); + int numSteps = 0; for (int i = 0; i < max_step; i++) { if (tsteps[i] <= last_time) { - this_region->add_state(tsteps[i] * timeScaleFactor); + if (setRegionTimeSteps) { + this_region->add_state(tsteps[i] * timeScaleFactor); + } + + tsteps[i] *= timeScaleFactor; + numSteps++; } else { if (myProcessor == 0 && max_time == std::numeric_limits::max()) { @@ -977,8 +1022,18 @@ namespace Ioex { } } } + + tsteps.resize(numSteps); + return tsteps; + } + + std::vector ParallelDatabaseIO::get_db_step_times_nl() + { + return internal_get_step_times_nl(false); } + void ParallelDatabaseIO::get_step_times_nl() { internal_get_step_times_nl(true); } + const Ioss::Map &ParallelDatabaseIO::get_map(ex_entity_type type) const { switch (type) { @@ -3972,13 +4027,13 @@ namespace Ioex { index += comp_count; } } - auto eb_offset = - eb->get_offset(); // Offset of beginning of the element block elements for this block - int index = -1 * (field.get_index() + - comp); // Negative since specifying index, not id to exodus API. + int map_index = -1 * (field.get_index() + + comp); // Negative since specifying index, not id to exodus API. - ierr = ex_put_partial_num_map(get_file_pointer(), EX_ELEM_MAP, index, - proc_offset + eb_offset + 1, file_count, component.data()); + size_t global_map_offset = eb->get_property("global_map_offset").get_int(); + ierr = ex_put_partial_num_map(get_file_pointer(), EX_ELEM_MAP, map_index, + global_map_offset + proc_offset + 1, file_count, + component.data()); } } else if (role == Ioss::Field::ATTRIBUTE) { @@ -4805,11 +4860,10 @@ namespace Ioex { return num_to_get; } - template - void ParallelDatabaseIO::output_processor_id_map(Ioss::Region *region, INT /*dummy*/) + template void ParallelDatabaseIO::output_processor_id_map(Ioss::Region *region) { std::vector proc_id(elementCount, myProcessor); - const auto &blocks = region->get_element_blocks(); + const auto &blocks = region->get_element_blocks(); for (const auto &block : blocks) { put_field_internal(block, block->get_field("proc_id"), Data(proc_id), 0); } @@ -4870,10 +4924,10 @@ namespace Ioex { add_processor_id_map(region); output_other_metadata(); if (int_byte_size_api() == 8) { - output_processor_id_map(region, int64_t(0)); + output_processor_id_map(region); } else { - output_processor_id_map(region, int(0)); + output_processor_id_map(region); } } } diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.h b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.h index 2ab679de5414..e537c7c2cde3 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_ParallelDatabaseIO.h @@ -85,6 +85,10 @@ namespace Ioex { void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; + + std::vector internal_get_step_times_nl(bool setRegionTimeSteps); + bool open_input_file(bool write_message, std::string *error_msg, int *bad_count, bool abort_if_error) const override; bool handle_output_file(bool write_message, std::string *error_msg, int *bad_count, @@ -197,8 +201,7 @@ namespace Ioex { void write_entity_transient_field(const Ioss::Field &field, const Ioss::GroupingEntity *ge, int64_t count, void *variables) const; void write_meta_data(Ioss::IfDatabaseExistsBehavior behavior) override; - template - void output_processor_id_map(Ioss::Region *region, INT /*dummy*/); + template void output_processor_id_map(Ioss::Region *region); // Read related metadata and store it in the region... void read_region(); diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C index 12ac92d9e6b0..8cf3cf2b3f8f 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C @@ -16,8 +16,8 @@ #include #include #include -#include #include +#include #include "Ioss_BasisVariableType.h" #include "Ioss_CoordinateFrame.h" diff --git a/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C b/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C index 52f3d0f48f92..b724bc209884 100644 --- a/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C +++ b/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C @@ -207,7 +207,7 @@ namespace Ioexnl { auto errmsg = fmt::format("Error: failed to read processor info attribute from file {}", filename); ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status); - return (EX_FATAL) != 0; + return EX_FATAL != 0; } } return matches; @@ -488,7 +488,7 @@ namespace Ioexnl { } nodes.resize(active); nodes.shrink_to_fit(); // shrink to fit - return (active != orig_size); + return active != orig_size; } void filter_element_list(Ioss::Region *region, Ioss::Int64Vector &elements, diff --git a/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.C b/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.C index bf294cbd2e85..5c3dbb5b68ad 100644 --- a/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.C @@ -351,6 +351,35 @@ mpisyncstart.enable true // } } + std::vector DatabaseIO::get_db_step_times_nl() + { + std::vector tsteps; + auto search_key = make_states_search_key(parallel_rank(), *get_region()); + kelpie::ObjectCapacities oc; + pool.List(search_key, &oc); + if (oc.keys.size() == 1) { + lunasa::DataObject ldo; + pool.Need(oc.keys[0], oc.capacities[0], &ldo); + + auto meta = static_cast(ldo.GetMetaPtr()); + + auto entry = static_cast( + static_cast(static_cast(ldo.GetDataPtr()) + meta->value.offset)); + + auto data = static_cast( + static_cast(entry->data + entry->value.offset)); + + for (size_t state(1); state <= entry->count; state++) + tsteps.push_back(data[state - 1]); + } + // TODO + // else { + // Report error of not having 1 set of time steps + // } + + return tsteps; + } + void DatabaseIO::read_region() { diff --git a/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.h b/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.h index 7a609f2f3612..43b668e40403 100644 --- a/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/faodel/Iofaodel_DatabaseIO.h @@ -126,6 +126,8 @@ namespace Iofaodel { */ void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; + void get_edgeblocks(); void get_elemblocks(); void get_faceblocks(); diff --git a/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.C b/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.C index 4e0cf39be10f..34e57cb33692 100644 --- a/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.C @@ -489,6 +489,20 @@ namespace Iogs { } } + std::vector DatabaseIO::get_db_step_times_nl() + { + std::vector timesteps; + + int time_step_count = m_generatedMesh->timestep_count(); + timesteps.reserve(time_step_count); + + for (int i = 0; i < time_step_count; i++) { + timesteps.push_back(i); + } + + return timesteps; + } + void DatabaseIO::get_structured_blocks() { // Name, global range, local offset, local range. diff --git a/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.h b/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.h index 3a71d0a4809c..fe264d3a7be8 100644 --- a/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/gen_struc/Iogs_DatabaseIO.h @@ -97,7 +97,9 @@ namespace Iogs { bool begin_state_nl(int state, double time) override; - void get_step_times_nl() override; + void get_step_times_nl() override; + std::vector get_db_step_times_nl() override; + void get_nodeblocks(); void get_structured_blocks(); void get_nodesets(); diff --git a/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.C b/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.C index aab00bca2ba1..df82f3793a99 100644 --- a/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.C @@ -590,6 +590,19 @@ namespace Iogn { } } + std::vector DatabaseIO::get_db_step_times_nl() + { + std::vector timesteps; + + int time_step_count = m_generatedMesh->timestep_count(); + timesteps.reserve(time_step_count); + for (int i = 0; i < time_step_count; i++) { + timesteps.push_back(i); + } + + return timesteps; + } + void DatabaseIO::get_elemblocks() { // Attributes of an element block are: diff --git a/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.h b/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.h index 7ee2e5048815..a7643bd9de6a 100644 --- a/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/generated/Iogn_DatabaseIO.h @@ -106,7 +106,10 @@ namespace Iogn { bool begin_state_nl(int state, double time) override; - void get_step_times_nl() override; + void get_step_times_nl() override; + + std::vector get_db_step_times_nl() override; + void get_nodeblocks(); void get_elemblocks(); void get_nodesets(); diff --git a/packages/seacas/libraries/ioss/src/init/Ionit_Initializer.C b/packages/seacas/libraries/ioss/src/init/Ionit_Initializer.C index 47be56adea03..3c3ace3a8c65 100644 --- a/packages/seacas/libraries/ioss/src/init/Ionit_Initializer.C +++ b/packages/seacas/libraries/ioss/src/init/Ionit_Initializer.C @@ -9,6 +9,7 @@ #include "Ioss_CodeTypes.h" #if defined(SEACAS_HAVE_EXODUS) +#include "exodus/Ioex_ChangeSet.h" #include "exodus/Ioex_IOFactory.h" #if defined(SEACAS_HAVE_EXONULL) #include "exonull/Ioexnl_IOFactory.h" @@ -49,7 +50,8 @@ #include "Ioss_IOFactory.h" -#include "Ioss_DynamicTopology.h" +#include "Ioss_ChangeSetFactory.h" +#include "Ioss_DynamicTopologyBroker.h" namespace { #if defined(IOSS_THREADSAFE) @@ -76,6 +78,7 @@ namespace Ioss::Init { #if defined(SEACAS_HAVE_EXODUS) Ioex::IOFactory::factory(); // Exodus + Ioex::ChangeSetFactory::factory(); #if defined(SEACAS_HAVE_EXONULL) Ioexnl::IOFactory::factory(); #endif @@ -101,6 +104,7 @@ namespace Ioss::Init { Ionull::IOFactory::factory(); Ioss::StorageInitializer(); Ioss::DynamicTopologyBroker::broker(); + Ioss::ChangeSetFactory::factory(); Ioss::Initializer(); Iotr::Initializer(); #ifdef HAVE_SEACASIOSS_ADIOS2 diff --git a/packages/seacas/libraries/ioss/src/main/CMakeLists.txt b/packages/seacas/libraries/ioss/src/main/CMakeLists.txt index dc447fa7d40e..b3a0b5cb6376 100644 --- a/packages/seacas/libraries/ioss/src/main/CMakeLists.txt +++ b/packages/seacas/libraries/ioss/src/main/CMakeLists.txt @@ -105,9 +105,11 @@ if (TPL_ENABLE_MPI) set(JOIN_ARG "--compose=mpiio") set(PJOIN_ARG "--compose=pnetcdf") set(NPROCS "1") + set(NPROCS_BUG "1") set(SERIALIZE_ARG "--serialize_io_size=2") else() set(NPROCS "1") + set(NPROCS_BUG "1") endif() endif() @@ -124,6 +126,37 @@ TRIBITS_ADD_ADVANCED_TEST(exodus32_to_exodus32 XHOSTTYPE Windows ) + if (TPL_Netcdf_Enables_Netcdf4) + SET(IOSHELL_ARG --split_times 1 --in_type generated 10x10x10+shell:xXyYzZ+times:4+variables:element,2,nodal,3) + TRIBITS_ADD_ADVANCED_TEST( + io_shell_group_ungroup + TEST_0 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS ${IOSHELL_ARG} splits.g + TEST_1 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS splits.g_1 splits.g_2 splits.g_3 splits.g_4 grouped.g + TEST_2 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS --extract_group splits.g_1 grouped.g split-extract.g_1 + TEST_3 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS --extract_group splits.g_2 grouped.g split-extract.g_2 + TEST_4 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS --extract_group splits.g_3 grouped.g split-extract.g_3 + TEST_5 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS --extract_group splits.g_4 grouped.g split-extract.g_4 + TEST_6 EXEC exodiff ARGS -pedantic splits.g_1 split-extract.g_1 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_7 EXEC exodiff ARGS -pedantic splits.g_2 split-extract.g_2 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_8 EXEC exodiff ARGS -pedantic splits.g_3 split-extract.g_3 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_9 EXEC exodiff ARGS -pedantic splits.g_4 split-extract.g_4 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + COMM serial + FINAL_PASS_REGULAR_EXPRESSION + ) + endif() + if (TPL_ENABLE_MPI) IF (TPL_Netcdf_PARALLEL) TRIBITS_ADD_ADVANCED_TEST(exodus_fpp_serialize @@ -133,7 +166,7 @@ if (TPL_ENABLE_MPI) TEST_1 EXEC io_shell ARGS ${JOIN_ARG} ${SERIALIZE_ARG} 8-block32-ser.g 8-block-32-serj.g NOEXEPREFIX NOEXESUFFIX NUM_MPI_PROCS ${NPROCS} - TEST_2 EXEC exodiff ARGS -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/8-block.g 8-block-32-serj.g + TEST_2 EXEC exodiff ARGS -map -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/8-block.g 8-block-32-serj.g DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX NUM_MPI_PROCS 1 @@ -199,6 +232,37 @@ IF (SEACASIoss_ENABLE_THREADSAFE) COMM mpi serial FINAL_PASS_REGULAR_EXPRESSION ) + + if (TPL_Netcdf_Enables_Netcdf4) + SET(IOSHELL_ARG --split_times 1 --in_type generated 10x10x10+shell:xXyYzZ+times:4+variables:element,2,nodal,3) + TRIBITS_ADD_ADVANCED_TEST( + io_shell_ts_group_ungroup + TEST_0 NOEXEPREFIX NOEXESUFFIX EXEC io_shell ARGS ${IOSHELL_ARG} splits_ts.g + TEST_1 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS splits_ts.g_1 splits_ts.g_2 splits_ts.g_3 splits_ts.g_4 grouped_ts.g + TEST_2 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_1 grouped_ts.g split_ts-extract.g_1 + TEST_3 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_2 grouped_ts.g split_ts-extract.g_2 + TEST_4 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_3 grouped_ts.g split_ts-extract.g_3 + TEST_5 NOEXEPREFIX NOEXESUFFIX EXEC io_shell_ts ARGS --extract_group splits_ts.g_4 grouped_ts.g split_ts-extract.g_4 + TEST_6 EXEC exodiff ARGS -pedantic splits_ts.g_1 split_ts-extract.g_1 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_7 EXEC exodiff ARGS -pedantic splits_ts.g_2 split_ts-extract.g_2 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_8 EXEC exodiff ARGS -pedantic splits_ts.g_3 split_ts-extract.g_3 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + TEST_9 EXEC exodiff ARGS -pedantic splits_ts.g_4 split_ts-extract.g_4 + DIRECTORY ../../../../applications/exodiff + NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 + COMM serial + FINAL_PASS_REGULAR_EXPRESSION + ) + endif() ENDIF() ENDIF() @@ -342,7 +406,7 @@ TRIBITS_ADD_ADVANCED_TEST(exodus_to_unstructured_cgns_to_exodus NUM_MPI_PROCS ${NPROCS} TEST_1 EXEC io_shell ARGS ${JOIN_ARG} 8-block.cgns 8-block.g NOEXEPREFIX NOEXESUFFIX - NUM_MPI_PROCS ${NPROCS} + NUM_MPI_PROCS ${NPROCS_BUG} TEST_2 EXEC exodiff ARGS -stat -pedantic -map -dumpmap ${CMAKE_CURRENT_SOURCE_DIR}/test/8-block.g 8-block.g DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX @@ -354,13 +418,15 @@ TRIBITS_ADD_ADVANCED_TEST(exodus_to_unstructured_cgns_to_exodus TRIBITS_ADD_ADVANCED_TEST(exodus_to_unstructured_cgns_file_per_state_to_exodus TEST_0 EXEC io_shell ARGS ${DECOMP_ARG} --file_per_state ${CMAKE_CURRENT_SOURCE_DIR}/test/8-block.g 8-block-link.cgns NOEXEPREFIX NOEXESUFFIX - TEST_1 EXEC io_shell ARGS ${JOIN_ARG} 8-block-link.cgns 8-block-rt.g + NUM_MPI_PROCS ${NPROCS} + TEST_1 EXEC io_shell ARGS 8-block-link.cgns 8-block-rt.g NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS 1 TEST_2 EXEC exodiff ARGS -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/8-block.g 8-block-rt.g DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX NUM_MPI_PROCS 1 - COMM serial + COMM mpi serial XHOSTTYPE Windows ) @@ -370,7 +436,7 @@ TRIBITS_ADD_ADVANCED_TEST(exodus_to_unstructured_cgns_to_exodus_single_block NUM_MPI_PROCS ${NPROCS} TEST_1 EXEC io_shell ARGS ${JOIN_ARG} cube.cgns cube.g NOEXEPREFIX NOEXESUFFIX - NUM_MPI_PROCS ${NPROCS} + NUM_MPI_PROCS ${NPROCS_BUG} TEST_2 EXEC exodiff ARGS -stat -pedantic -map ${CMAKE_CURRENT_SOURCE_DIR}/test/cube.g cube.g DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX @@ -385,7 +451,7 @@ TRIBITS_ADD_ADVANCED_TEST(exodus_to_unstructured_cgns_to_exodus_double_block NUM_MPI_PROCS ${NPROCS} TEST_1 EXEC io_shell ARGS ${JOIN_ARG} two-block.cgns two-block.g NOEXEPREFIX NOEXESUFFIX - NUM_MPI_PROCS ${NPROCS} + NUM_MPI_PROCS ${NPROCS_BUG} TEST_2 EXEC exodiff ARGS -stat -pedantic -map ${CMAKE_CURRENT_SOURCE_DIR}/test/two-block.g two-block.g DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX @@ -398,7 +464,7 @@ IF (NOT SEACASIoss_ENABLE_THREADSAFE) TRIBITS_ADD_ADVANCED_TEST(cgns_bc_no_parents_to_exodus TEST_0 EXEC io_shell ARGS ${DECOMP_ARG} ${JOIN_ARG} ${CMAKE_CURRENT_SOURCE_DIR}/test/BC_without_parents.cgns exodus_bc_parents.e NOEXEPREFIX NOEXESUFFIX - NUM_MPI_PROCS ${NPROCS} + NUM_MPI_PROCS ${NPROCS_BUG} TEST_1 EXEC exodiff ARGS -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/exodus_bc_parents.gold exodus_bc_parents.e DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX @@ -410,7 +476,7 @@ TRIBITS_ADD_ADVANCED_TEST(cgns_bc_no_parents_to_exodus TRIBITS_ADD_ADVANCED_TEST(cgns_Q2_bc_no_parents_to_exodus TEST_0 EXEC io_shell ARGS ${DECOMP_ARG} ${JOIN_ARG} ${CMAKE_CURRENT_SOURCE_DIR}/test/BC_Q2_without_parents.cgns exodus_Q2_bc_parents.e NOEXEPREFIX NOEXESUFFIX - NUM_MPI_PROCS ${NPROCS} + NUM_MPI_PROCS ${NPROCS_BUG} TEST_1 EXEC exodiff ARGS -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/exodus_Q2_bc_parents.gold exodus_Q2_bc_parents.e DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX @@ -458,7 +524,7 @@ ENDIF() TRIBITS_ADD_ADVANCED_TEST(unstructured_cgns_to_exodus TEST_0 EXEC io_shell ARGS ${JOIN_ARG} ${CMAKE_CURRENT_SOURCE_DIR}/test/generated.cgns exodus_generated.e NOEXEPREFIX NOEXESUFFIX - NUM_MPI_PROCS ${NPROCS} + NUM_MPI_PROCS ${NPROCS_BUG} TEST_1 EXEC exodiff ARGS -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/exodus_generated.gold exodus_generated.e DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX @@ -476,18 +542,19 @@ TRIBITS_ADD_ADVANCED_TEST(structured_cgns_to_unstructured DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX NUM_MPI_PROCS 1 - COMM mpi + COMM mpi serial XHOSTTYPE Windows ) ELSE() TRIBITS_ADD_ADVANCED_TEST(structured_cgns_to_unstructured TEST_0 EXEC struc_to_unstruc ARGS ${CMAKE_CURRENT_SOURCE_DIR}/test/sparc1.cgns exodus_struc.e NOEXEPREFIX NOEXESUFFIX + NUM_MPI_PROCS ${NPROCS} TEST_1 EXEC exodiff ARGS -stat -pedantic ${CMAKE_CURRENT_SOURCE_DIR}/test/exodus_struc.gold exodus_struc.e DIRECTORY ../../../../applications/exodiff NOEXEPREFIX NOEXESUFFIX NUM_MPI_PROCS 1 - COMM serial + COMM mpi serial XHOSTTYPE Windows ) ENDIF() @@ -671,7 +738,7 @@ TRIBITS_ADD_ADVANCED_TEST(structured_cgns_assembly_copy NOEXEPREFIX NOEXESUFFIX TEST_1 CMND ${CGNS_CGNSDIFF_BINARY} ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/test/assemblies.cgns assemblies-out.cgns NUM_MPI_PROCS 1 - COMM mpi + COMM mpi serial ) if (TPL_ENABLE_MPI) diff --git a/packages/seacas/libraries/ioss/src/main/cgns_decomp.C b/packages/seacas/libraries/ioss/src/main/cgns_decomp.C index 2ef43f03c6b6..f49b3a395776 100644 --- a/packages/seacas/libraries/ioss/src/main/cgns_decomp.C +++ b/packages/seacas/libraries/ioss/src/main/cgns_decomp.C @@ -9,6 +9,7 @@ #include "Ionit_Initializer.h" #include "Ioss_DatabaseIO.h" +#include "Ioss_DecompositionUtils.h" #include "Ioss_GetLongOpt.h" #include "Ioss_IOFactory.h" #include "Ioss_Property.h" @@ -37,9 +38,7 @@ #include "Ioss_ScopeGuard.h" #include "Ioss_StructuredBlock.h" -#if !defined __NVCC__ #include -#endif #include namespace { @@ -385,10 +384,7 @@ namespace { auto search = comms.find(std::make_pair(value, key)); if (search == comms.end()) { valid = false; - fmt::print(stderr, -#if !defined __NVCC__ - fg(fmt::color::red), -#endif + fmt::print(stderr, fg(fmt::color::red), "ERROR: Could not find matching ZGC for {}, proc {} -> {}, proc {}\n", key.first, key.second, value.first, value.second); } @@ -439,11 +435,8 @@ namespace { for (const auto &proc : comms) { if (proc.second < 0) { // From decomposition - fmt::print( -#if !defined __NVCC__ - fg(fmt::color::yellow), -#endif - "[{:{}}->{:{}}] ", proc.first, pw, -proc.second, pw); + fmt::print(fg(fmt::color::yellow), "[{:{}}->{:{}}] ", proc.first, pw, -proc.second, + pw); } else { // Zone to Zone @@ -462,63 +455,6 @@ namespace { } } - void output_histogram(const std::vector &proc_work, size_t avg_work, size_t median) - { - fmt::print("Work-per-processor Histogram\n"); - std::array histogram{}; - - auto wmin = *std::min_element(proc_work.begin(), proc_work.end()); - auto wmax = *std::max_element(proc_work.begin(), proc_work.end()); - - size_t hist_size = std::min(size_t(16), (wmax - wmin)); - hist_size = std::min(hist_size, proc_work.size()); - - if (hist_size <= 1) { - fmt::print("\tWork is the same on all processors; no histogram needed.\n\n"); - return; - } - - auto delta = double(wmax + 1 - wmin) / hist_size; - for (const auto &pw : proc_work) { - auto bin = size_t(double(pw - wmin) / delta); - SMART_ASSERT(bin < hist_size)(bin)(hist_size); - histogram[bin]++; - } - - size_t proc_width = Ioss::Utils::number_width(proc_work.size(), true); - size_t work_width = Ioss::Utils::number_width(wmax, true); - - fmt::print("\n\t{:^{}} {:^{}}\n", "Work Range", 2 * work_width + 2, "#", proc_width); - auto hist_max = *std::max_element(histogram.begin(), histogram.end()); - for (size_t i = 0; i < hist_size; i++) { - int max_star = 50; - int star_cnt = ((double)histogram[i] / hist_max * max_star); - std::string stars(star_cnt, '*'); - for (int j = 9; j < star_cnt;) { - stars[j] = '|'; - j += 10; - } - if (histogram[i] > 0 && star_cnt == 0) { - stars = '.'; - } - size_t w1 = wmin + size_t(i * delta); - size_t w2 = wmin + size_t((i + 1) * delta); - std::string postfix; - if (w1 <= avg_work && avg_work < w2) { - postfix += "average"; - } - if (w1 <= median && median < w2) { - if (!postfix.empty()) { - postfix += ", "; - } - postfix += "median"; - } - fmt::print("\t{:{}}..{:{}} ({:{}}):\t{:{}} {}\n", fmt::group_digits(w1), work_width, - fmt::group_digits(w2), work_width, fmt::group_digits(histogram[i]), proc_width, - stars, max_star, postfix); - } - fmt::print("\n"); - } void describe_decomposition(std::vector &zones, size_t orig_zone_count, const Interface &interFace) { @@ -558,9 +494,7 @@ namespace { for (const auto &zone : zones) { if (zone->is_active()) { auto len = zone->m_name.length(); - if (len > name_len) { - name_len = len; - } + name_len = std::max(name_len, len); } } @@ -608,71 +542,27 @@ namespace { } } - auto min_work = *std::min_element(proc_work.begin(), proc_work.end()); - auto max_work = *std::max_element(proc_work.begin(), proc_work.end()); - size_t median = 0; - { - auto pw_copy(proc_work); - std::nth_element(pw_copy.begin(), pw_copy.begin() + pw_copy.size() / 2, pw_copy.end()); - median = pw_copy[pw_copy.size() / 2]; - fmt::print("\nWork per processor:\n\tMinimum = {}, Maximum = {}, Median = {}, Ratio = " - "{:.3}\n\n", - fmt::group_digits(min_work), fmt::group_digits(max_work), - fmt::group_digits(median), (double)(max_work) / min_work); - } - if (interFace.work_per_processor) { - if (min_work == max_work) { - fmt::print("\nWork on all processors is {}\n\n", fmt::group_digits(min_work)); - } - else { - int max_star = 40; - int min_star = max_star * ((double)min_work / (double)(max_work)); - int delta = max_star - min_star; - - for (size_t i = 0; i < proc_work.size(); i++) { - int star_cnt = - (double)(proc_work[i] - min_work) / (max_work - min_work) * delta + min_star; - std::string stars(star_cnt, '*'); - const std::string format = "\tProcessor {:{}}, work = {:{}} ({:.2f})\t{}\n"; - if (proc_work[i] == max_work) { - fmt::print( -#if !defined __NVCC__ - fg(fmt::color::red), -#endif - fmt::runtime(format), i, proc_width, fmt::group_digits(proc_work[i]), work_width, - proc_work[i] / avg_work, stars); - } - else if (proc_work[i] == min_work) { - fmt::print( -#if !defined __NVCC__ - fg(fmt::color::green), -#endif - fmt::runtime(format), i, proc_width, fmt::group_digits(proc_work[i]), work_width, - proc_work[i] / avg_work, stars); - } - else { - fmt::print(fmt::runtime(format), i, proc_width, fmt::group_digits(proc_work[i]), work_width, - proc_work[i] / avg_work, stars); - } - if (verbose) { - for (const auto &zone : zones) { - if ((size_t)zone->m_proc == i) { - auto pct = int(100.0 * (double)zone->work() / proc_work[i] + 0.5); - fmt::print("\t {:{}} {:{}}\t{:3}%\t{:^12}\n", zone->m_name, name_len, - fmt::group_digits(zone->work()), work_width, pct, - fmt::format("{1:{0}} x {2:{0}} x {3:{0}}", ord_width, zone->m_ordinal[0], - zone->m_ordinal[1], zone->m_ordinal[2])); - } - } - fmt::print("\n"); + auto avg_median = Ioss::DecompUtils::output_decomposition_statistics(proc_work); + + if (verbose) { + for (size_t i = 0; i < proc_work.size(); i++) { + for (const auto &zone : zones) { + if ((size_t)zone->m_proc == i) { + auto pct = int(100.0 * (double)zone->work() / proc_work[i] + 0.5); + fmt::print("\t {:{}} {:{}}\t{:3}%\t{:^12}\n", zone->m_name, name_len, + fmt::group_digits(zone->work()), work_width, pct, + fmt::format("{1:{0}} x {2:{0}} x {3:{0}}", ord_width, zone->m_ordinal[0], + zone->m_ordinal[1], zone->m_ordinal[2])); } } + fmt::print("\n"); } } + fmt::print("\n"); // Output Histogram... if (interFace.histogram) { - output_histogram(proc_work, (size_t)avg_work, median); + Ioss::DecompUtils::output_histogram(proc_work, avg_median.first, avg_median.second); } // Communication Information (proc X communicates with proc Z) @@ -698,14 +588,6 @@ namespace { fmt::group_digits(nodal_work), fmt::group_digits(new_nodal_work), fmt::group_digits(delta), (double)new_nodal_work / nodal_work); } - - // Imbalance penalty -- max work / avg work. If perfect balance, then all processors would have - // "avg_work" work to do. With current decomposition, every processor has to wait until - // "max_work" is done. Penalty = max_work / avg_work. - fmt::print("Imbalance Penalty:\n\tMaximum Work = {}, Average Work = {}, Penalty (max/avg) " - "= {:.2f}\n\n", - fmt::group_digits(max_work), fmt::group_digits((size_t)avg_work), - (double)max_work / avg_work); } } // namespace @@ -796,10 +678,7 @@ int main(int argc, char *argv[]) auto valid = validate_symmetric_communications(zones); if (!valid) { - fmt::print(stderr, -#if !defined __NVCC__ - fg(fmt::color::red), -#endif + fmt::print(stderr, fg(fmt::color::red), "\nERROR: Zone Grid Communication interfaces are not symmetric. There is an error " "in the decomposition.\n"); } diff --git a/packages/seacas/libraries/ioss/src/main/info_interface.C b/packages/seacas/libraries/ioss/src/main/info_interface.C index 2e10d616c680..cef12645709a 100644 --- a/packages/seacas/libraries/ioss/src/main/info_interface.C +++ b/packages/seacas/libraries/ioss/src/main/info_interface.C @@ -16,7 +16,10 @@ #include "Ioss_Utils.h" #include "info_interface.h" -Info::Interface::Interface() { enroll_options(); } +Info::Interface::Interface(std::string app_version) : version(std::move(app_version)) +{ + enroll_options(); +} void Info::Interface::enroll_options() { @@ -143,11 +146,19 @@ void Info::Interface::enroll_options() nullptr, nullptr, true); #endif + options_.enroll( + "list_change_sets", Ioss::GetLongOption::NoValue, + "Print a list of the names of all change_sets (previosly groups) in this file and then exit.", + nullptr); options_.enroll("list_groups", Ioss::GetLongOption::NoValue, - "Print a list of the names of all groups in this file and then exit.", nullptr); + "[deprecated] Use --list_change_sets", nullptr); + options_.enroll("change_set_name", Ioss::GetLongOption::MandatoryValue, + "List information only for the specified comma-separated list of change_set(s) " + "or `ALL` to list for all.", + nullptr); options_.enroll("group_name", Ioss::GetLongOption::MandatoryValue, - "List information only for the specified group.", nullptr, nullptr, true); + "[deprecated] Use --change_set_name.", nullptr, nullptr, true); options_.enroll("query_timesteps_only", Ioss::GetLongOption::NoValue, "Only read and output the timestep data on the file", nullptr); @@ -188,7 +199,7 @@ bool Info::Interface::parse_options(int argc, char **argv) } if (options_.retrieve("version") != nullptr) { - // Version is printed up front, just exit... + fmt::print(stderr, "IO_INFO\tVersion: {}\n", version); exit(0); } @@ -197,16 +208,18 @@ bool Info::Interface::parse_options(int argc, char **argv) ints64Bit_ = options_.retrieve("64-bit") != nullptr; computeVolume_ = options_.retrieve("compute_volume") != nullptr; computeBBox_ = options_.retrieve("compute_bbox") != nullptr; - listGroups_ = options_.retrieve("list_groups") != nullptr; + listChangeSets_ = options_.retrieve("list_change_sets") != nullptr || + options_.retrieve("list_groups") != nullptr; useGenericNames_ = options_.retrieve("use_generic_names") != nullptr; summary_ = options_.retrieve("summary") != nullptr; showConfig_ = options_.retrieve("configuration") != nullptr; queryTimeOnly_ = options_.retrieve("query_timesteps_only") != nullptr; fieldDetails_ = options_.retrieve("detailed_field_info") != nullptr; - filetype_ = options_.get_option_value("db_type", filetype_); - filetype_ = options_.get_option_value("in_type", filetype_); - groupname_ = options_.get_option_value("group_name", groupname_); + filetype_ = options_.get_option_value("db_type", filetype_); + filetype_ = options_.get_option_value("in_type", filetype_); + changeSetName_ = options_.get_option_value("change_set_name", changeSetName_); + changeSetName_ = options_.get_option_value("group_name", changeSetName_); { const char *temp = options_.retrieve("surface_split_scheme"); diff --git a/packages/seacas/libraries/ioss/src/main/info_interface.h b/packages/seacas/libraries/ioss/src/main/info_interface.h index a5191171eaef..f89e53f6557c 100644 --- a/packages/seacas/libraries/ioss/src/main/info_interface.h +++ b/packages/seacas/libraries/ioss/src/main/info_interface.h @@ -19,7 +19,7 @@ namespace Info { class IO_INFO_LIB_EXPORT Interface { public: - Interface(); + explicit Interface(std::string app_version); bool parse_options(int argc, char **argv); @@ -29,7 +29,7 @@ namespace Info { bool compute_bbox() const { return computeBBox_; } bool adjacencies() const { return adjacencies_; } bool ints_64_bit() const { return ints64Bit_; } - bool list_groups() const { return listGroups_; } + bool list_change_sets() const { return listChangeSets_; } bool show_config() const { return showConfig_; } bool query_timesteps_only() const { return queryTimeOnly_; } bool field_details() const { return fieldDetails_; } @@ -41,10 +41,10 @@ namespace Info { std::string decomp_method() const { return decompMethod_; } std::string filename() const { return filename_; } std::string type() const { return filetype_; } - std::string groupname() const { return groupname_; } + std::string change_set_name() const { return changeSetName_; } std::string custom_field() const { return customField_; } - //! Dumps representation of data in this class to cerr + std::string version{}; private: void enroll_options(); @@ -52,7 +52,7 @@ namespace Info { Ioss::GetLongOption options_; std::string filetype_{"exodus"}; std::string filename_{}; - std::string groupname_{}; + std::string changeSetName_{}; std::string decompMethod_{}; std::string customField_{}; @@ -61,7 +61,7 @@ namespace Info { bool adjacencies_{false}; bool ints64Bit_{false}; bool computeBBox_{false}; - bool listGroups_{false}; + bool listChangeSets_{false}; bool useGenericNames_{false}; bool disableFieldRecognition_{false}; bool showConfig_{false}; diff --git a/packages/seacas/libraries/ioss/src/main/io_info.C b/packages/seacas/libraries/ioss/src/main/io_info.C index 1483423816ee..e1af5433629b 100644 --- a/packages/seacas/libraries/ioss/src/main/io_info.C +++ b/packages/seacas/libraries/ioss/src/main/io_info.C @@ -51,6 +51,7 @@ #include "Ioss_SurfaceSplit.h" #include "Ioss_Utils.h" #include "Ioss_VariableType.h" +#include "Ioss_use_fmt.h" #if defined(SEACAS_HAVE_EXODUS) #include "exodusII.h" #endif @@ -92,7 +93,7 @@ namespace { } void file_info(const Info::Interface &interFace); - void group_info(Info::Interface &interFace); + void change_set_info(Info::Interface &interFace); void info_df(const Ioss::GroupingEntity *ge, const std::string &prefix) { @@ -162,45 +163,22 @@ namespace { } } -#if defined(SEACAS_HAVE_EXODUS) - int print_groups(int exoid, std::string prefix) - { - int idum; - float rdum; - char group_name[33]; - // Print name of this group... - ex_inquire(exoid, EX_INQ_GROUP_NAME, &idum, &rdum, group_name); - if (group_name[0] == '/') { - fmt::print("{}/ (root)\n", prefix); - } - else { - fmt::print("{}{}\n", prefix, group_name); - } - - int num_children = ex_inquire_int(exoid, EX_INQ_NUM_CHILD_GROUPS); - std::vector children(num_children); - ex_get_group_ids(exoid, nullptr, Data(children)); - prefix += '\t'; - for (int i = 0; i < num_children; i++) { - print_groups(children[i], prefix); - } - return 0; - } -#endif - - void group_info(Info::Interface &interFace) + void change_set_info(Info::Interface &interFace) { -#if defined(SEACAS_HAVE_EXODUS) - // Assume exodusII... - std::string inpfile = interFace.filename(); - float vers = 0.0; - int CPU_word_size = 0; - int IO_word_size = 0; + std::string inpfile = interFace.filename(); + std::string input_type = interFace.type(); + Ioss::PropertyManager properties = set_properties(interFace); - int exoid = ex_open(inpfile.c_str(), EX_READ, &CPU_word_size, &IO_word_size, &vers); + auto mode = Ioss::READ_RESTART; + Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(input_type, inpfile, mode, + Ioss::ParallelUtils::comm_world(), properties); - print_groups(exoid, "\t"); -#endif + Ioss::io_info_set_db_properties(interFace, dbi); + auto cs_names = dbi->internal_change_set_describe(); + fmt::print("\t/ (root)\n"); + for (const auto &cs_name : cs_names) { + fmt::print("\t\t{}\n", cs_name); + } } void file_info(const Info::Interface &interFace) @@ -234,7 +212,32 @@ namespace { info_timesteps(region); } else { - Ioss::io_info_file_info(interFace, region); + auto cs_list = Ioss::tokenize(interFace.change_set_name(), ","); + if (cs_list.empty()) { + cs_list.push_back("/"); + } + else { + if (cs_list[0] == "ALL") { + cs_list = dbi->internal_change_set_describe(); + } + } + + bool first = true; + for (const auto &cs_name : cs_list) { + if (!first) { + fmt::print("-----------------------------------------------------------------------------" + "-----------------------\n"); + } + if (cs_name != "/") { + bool success = region.load_internal_change_set_mesh(cs_name); + if (!success) { + fmt::print("ERROR: Unable to open change set '{}' in file '{}'\n", cs_name, inpfile); + return; + } + first = false; + } + Ioss::io_info_file_info(interFace, region); + } } } @@ -317,7 +320,11 @@ namespace { if (!sb->m_zoneConnectivity.empty()) { fmt::print("\tConnectivity with other blocks:\n"); for (const auto &zgc : sb->m_zoneConnectivity) { +#if defined __NVCC__ std::cout << zgc << "\n"; +#else + fmt::print("{}\n", zgc); +#endif } } if (!sb->m_boundaryConditions.empty()) { @@ -331,7 +338,11 @@ namespace { }); for (const auto &bc : sb_bc) { +#if defined __NVCC__ std::cout << bc << "\n"; +#else + fmt::print("{}\n", bc); +#endif } } if (interFace.compute_bbox()) { @@ -643,7 +654,7 @@ namespace { namespace Ioss { void io_info_file_info(const Info::Interface &interFace) { file_info(interFace); } - void io_info_group_info(Info::Interface &interFace) { group_info(interFace); } + void io_info_change_set_info(Info::Interface &interFace) { change_set_info(interFace); } void io_info_set_db_properties(const Info::Interface &interFace, Ioss::DatabaseIO *dbi) { @@ -663,16 +674,6 @@ namespace Ioss { if (interFace.ints_64_bit()) { dbi->set_int_byte_size_api(Ioss::USE_INT64_API); } - - if (!interFace.groupname().empty()) { - bool success = dbi->open_group(interFace.groupname()); - if (!success) { - std::string inpfile = interFace.filename(); - fmt::print("ERROR: Unable to open group '{}' in file '{}'\n", interFace.groupname(), - inpfile); - return; - } - } } void io_info_file_info(const Info::Interface &interFace, Ioss::Region ®ion) diff --git a/packages/seacas/libraries/ioss/src/main/io_info.h b/packages/seacas/libraries/ioss/src/main/io_info.h index beb6be062c83..ded93b87a5c1 100644 --- a/packages/seacas/libraries/ioss/src/main/io_info.h +++ b/packages/seacas/libraries/ioss/src/main/io_info.h @@ -1,5 +1,5 @@ /* - * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions + * Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * @@ -7,51 +7,7 @@ */ #pragma once -#include "Ionit_Initializer.h" -#include "Ioss_CodeTypes.h" -#include "Ioss_SurfaceSplit.h" -#include "Ioss_Utils.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "info_interface.h" #include "io_info_lib_export.h" -#if defined(SEACAS_HAVE_EXODUS) -#include -#endif - -#include - -#include "Ioss_Assembly.h" -#include "Ioss_Blob.h" -#include "Ioss_CommSet.h" -#include "Ioss_CoordinateFrame.h" -#include "Ioss_DBUsage.h" -#include "Ioss_DatabaseIO.h" -#include "Ioss_EdgeBlock.h" -#include "Ioss_EdgeSet.h" -#include "Ioss_ElementBlock.h" -#include "Ioss_ElementSet.h" -#include "Ioss_ElementTopology.h" -#include "Ioss_FaceBlock.h" -#include "Ioss_FaceSet.h" -#include "Ioss_Field.h" -#include "Ioss_GroupingEntity.h" -#include "Ioss_IOFactory.h" -#include "Ioss_NodeBlock.h" -#include "Ioss_NodeSet.h" -#include "Ioss_Property.h" -#include "Ioss_Region.h" -#include "Ioss_SideBlock.h" -#include "Ioss_SideSet.h" -#include "Ioss_StructuredBlock.h" -#include "Ioss_VariableType.h" namespace Info { class Interface; @@ -63,7 +19,7 @@ namespace Ioss { // internal to io_info IO_INFO_LIB_EXPORT void io_info_file_info(const Info::Interface &interFace); - IO_INFO_LIB_EXPORT void io_info_group_info(Info::Interface &interFace); + IO_INFO_LIB_EXPORT void io_info_change_set_info(Info::Interface &interFace); // for external calls IO_INFO_LIB_EXPORT void io_info_set_db_properties(const Info::Interface &interFace, diff --git a/packages/seacas/libraries/ioss/src/main/io_info_main.C b/packages/seacas/libraries/ioss/src/main/io_info_main.C index d528681661b6..1d1e5b8e4e11 100644 --- a/packages/seacas/libraries/ioss/src/main/io_info_main.C +++ b/packages/seacas/libraries/ioss/src/main/io_info_main.C @@ -22,7 +22,7 @@ namespace { std::string codename; - std::string version = "1.06"; + std::string version = "1.07 (2024/11/08)"; #ifdef SEACAS_HAVE_MPI void mpi_finalize() @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) ON_BLOCK_EXIT(mpi_finalize); #endif - Info::Interface interFace; + Info::Interface interFace(version); interFace.parse_options(argc, argv); Ioss::Init::Initializer io; @@ -61,8 +61,8 @@ int main(int argc, char *argv[]) codename = codename.substr(ind + 1, codename.size()); } - if (interFace.list_groups()) { - Ioss::io_info_group_info(interFace); + if (interFace.list_change_sets()) { + Ioss::io_info_change_set_info(interFace); } else { Ioss::io_info_file_info(interFace); diff --git a/packages/seacas/libraries/ioss/src/main/io_modify.C b/packages/seacas/libraries/ioss/src/main/io_modify.C index b0461dc297c0..9cbde6677649 100644 --- a/packages/seacas/libraries/ioss/src/main/io_modify.C +++ b/packages/seacas/libraries/ioss/src/main/io_modify.C @@ -969,13 +969,9 @@ namespace { if (Ioss::Utils::substr_equal(tokens[2], "add")) { // Must be at least 6 tokens... if (tokens.size() < 6) { - fmt::print(stderr, -#if !defined __NVCC__ - fg(fmt::color::red), -#endif - "ERROR: ATTRIBUTE Command does not have enough tokens to be valid.\n" - "\t\t{}\n", - fmt::join(tokens, " ")); + fmt::print(stderr, fg(fmt::color::red), + "ERROR: ATTRIBUTE Command does not have enough tokens to be valid.\n"); + fmt::print(stderr, "\t\t{}\n", fmt::join(tokens, " ")); handle_help("attribute"); return false; } @@ -1091,13 +1087,9 @@ namespace { // Must be at least 4 tokens... if (tokens.size() < 4) { - fmt::print(stderr, -#if !defined __NVCC__ - fg(fmt::color::red), -#endif - "ERROR: RENAME Command does not have enough tokens to be valid.\n" - "\t\t{}\n", - fmt::join(tokens, " ")); + fmt::print(stderr, fg(fmt::color::red), + "ERROR: RENAME Command does not have enough tokens to be valid.\n"); + fmt::print(stderr, "\t\t{}\n", fmt::join(tokens, " ")); handle_help("rename"); return false; } @@ -1225,13 +1217,9 @@ namespace { // TIME SCALE {{scale}} // TIME OFFSET {{offset} if (tokens.size() < 3) { - fmt::print(stderr, -#if !defined __NVCC__ - fg(fmt::color::red), -#endif - "ERROR: TIME Command does not have enough tokens to be valid.\n" - "\t\t{}\n", - fmt::join(tokens, " ")); + fmt::print(stderr, fg(fmt::color::red), + "ERROR: TIME Command does not have enough tokens to be valid.\n"); + fmt::print(stderr, "\t\t{}\n", fmt::join(tokens, " ")); handle_help("time"); return false; } @@ -1264,13 +1252,9 @@ namespace { // GEOMETRY OFFSET {{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{offset}} ... if (tokens.size() < 3) { - fmt::print(stderr, -#if !defined __NVCC__ - fg(fmt::color::red), -#endif - "ERROR: GEOMETRY Command does not have enough tokens to be valid.\n" - "\t\t{}\n", - fmt::join(tokens, " ")); + fmt::print(stderr, fg(fmt::color::red), + "ERROR: GEOMETRY Command does not have enough tokens to be valid.\n"); + fmt::print(stderr, "\t\t{}\n", fmt::join(tokens, " ")); handle_help("geometry"); return false; } diff --git a/packages/seacas/libraries/ioss/src/main/io_shell.C b/packages/seacas/libraries/ioss/src/main/io_shell.C index bba91946c7a1..7e61b2434b84 100644 --- a/packages/seacas/libraries/ioss/src/main/io_shell.C +++ b/packages/seacas/libraries/ioss/src/main/io_shell.C @@ -4,21 +4,11 @@ // // See packages/seacas/LICENSE for details -#include "Ionit_Initializer.h" -#include "Ioss_Compare.h" -#include "Ioss_CopyDatabase.h" -#include "Ioss_FileInfo.h" -#include "Ioss_MemoryUtils.h" -#include "Ioss_MeshCopyOptions.h" -#include "Ioss_MeshType.h" -#include "Ioss_ParallelUtils.h" -#include "Ioss_SerializeIO.h" -#include "Ioss_SurfaceSplit.h" -#include "Ioss_Utils.h" #include #include #include #include +#include #include #include #include @@ -26,15 +16,26 @@ #include #include +#include "Ionit_Initializer.h" +#include "Ioss_Compare.h" +#include "Ioss_CopyDatabase.h" #include "Ioss_DBUsage.h" #include "Ioss_DataSize.h" #include "Ioss_DatabaseIO.h" +#include "Ioss_FileInfo.h" #include "Ioss_GetLongOpt.h" #include "Ioss_IOFactory.h" +#include "Ioss_MemoryUtils.h" +#include "Ioss_MeshCopyOptions.h" +#include "Ioss_MeshType.h" +#include "Ioss_ParallelUtils.h" #include "Ioss_Property.h" #include "Ioss_PropertyManager.h" #include "Ioss_Region.h" #include "Ioss_ScopeGuard.h" +#include "Ioss_SerializeIO.h" +#include "Ioss_SurfaceSplit.h" +#include "Ioss_Utils.h" #include "Ioss_VariableType.h" #include "shell_interface.h" @@ -42,38 +43,39 @@ namespace { std::string codename; - std::string version = "6.8 (2024/05/31)"; + std::string version = "7.0 (2024/11/08)"; bool mem_stats = false; - void file_copy(IOShell::Interface &interFace, int rank); + bool file_copy(IOShell::Interface &interFace, int rank); bool file_compare(IOShell::Interface &interFace, int rank); Ioss::PropertyManager set_properties(IOShell::Interface &interFace); Ioss::MeshCopyOptions set_mesh_copy_options(IOShell::Interface &interFace) { Ioss::MeshCopyOptions options{}; - options.selected_times = interFace.selected_times; - options.rel_tolerance = interFace.rel_tolerance; - options.abs_tolerance = interFace.abs_tolerance; - options.tol_floor = interFace.tol_floor; - options.verbose = !interFace.quiet; - options.output_summary = true; - options.memory_statistics = interFace.memory_statistics; - options.debug = interFace.debug; - options.ints_64_bit = interFace.ints_64_bit; - options.delete_timesteps = interFace.delete_timesteps; - options.minimum_time = interFace.minimum_time; - options.maximum_time = interFace.maximum_time; - options.time_scale = interFace.time_scale; - options.time_offset = interFace.time_offset; - options.data_storage_type = interFace.data_storage_type; - options.delay = interFace.timestep_delay; - options.reverse = interFace.reverse; - options.add_proc_id = interFace.add_processor_id_field; - options.boundary_sideset = interFace.boundary_sideset; - options.ignore_qa_info = interFace.ignore_qa_info; - options.omitted_blocks = !interFace.omitted_blocks.empty(); + options.selected_times = interFace.selected_times; + options.rel_tolerance = interFace.rel_tolerance; + options.abs_tolerance = interFace.abs_tolerance; + options.tol_floor = interFace.tol_floor; + options.verbose = !interFace.quiet; + options.output_summary = true; + options.memory_statistics = interFace.memory_statistics; + options.debug = interFace.debug; + options.ints_64_bit = interFace.ints_64_bit; + options.delete_timesteps = interFace.delete_timesteps; + options.minimum_time = interFace.minimum_time; + options.maximum_time = interFace.maximum_time; + options.time_scale = interFace.time_scale; + options.time_offset = interFace.time_offset; + options.data_storage_type = interFace.data_storage_type; + options.delay = interFace.timestep_delay; + options.reverse = interFace.reverse; + options.add_proc_id = interFace.add_processor_id_field; + options.boundary_sideset = interFace.boundary_sideset; + options.ignore_qa_info = interFace.ignore_qa_info; + options.omitted_blocks = !interFace.omitted_blocks.empty(); + options.selected_change_sets = interFace.selectedChangeSets; options.omitted_sets = interFace.omitted_sets; Ioss::sort(options.omitted_sets); @@ -83,6 +85,21 @@ namespace { return options; } + bool open_change_set(const std::string &cs_name, Ioss::Region ®ion, int rank) + { + bool success = true; + if (!cs_name.empty()) { + success = region.load_internal_change_set_mesh(cs_name); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to open change_set '{}' in file '{}'\n", cs_name, + region.get_database()->get_filename()); + } + } + } + return success; + } + #ifdef SEACAS_HAVE_MPI void mpi_finalize() { @@ -166,7 +183,7 @@ int main(int argc, char *argv[]) success = file_compare(interFace, rank); } else { - file_copy(interFace, rank); + success = file_copy(interFace, rank); } } catch (std::exception &e) { @@ -213,17 +230,17 @@ int main(int argc, char *argv[]) #endif } if (rank == 0) { - fmt::print(stderr, "\n{} execution successful.\n", codename); + fmt::print(stderr, "\n{} execution {}.\n", codename, success ? "successful" : "failed"); } return success ? EXIT_SUCCESS : EXIT_FAILURE; } namespace { - void file_copy(IOShell::Interface &interFace, int rank) + bool file_copy(IOShell::Interface &interFace, int rank) { + bool success = true; Ioss::PropertyManager properties = set_properties(interFace); - bool first = true; for (const auto &inpfile : interFace.inputFile) { //======================================================================== @@ -259,17 +276,6 @@ namespace { dbi->set_int_byte_size_api(Ioss::USE_INT64_API); } - if (!interFace.groupName.empty()) { - bool success = dbi->open_group(interFace.groupName); - if (!success) { - if (rank == 0) { - fmt::print(stderr, "ERROR: Unable to open group '{}' in file '{}'\n", - interFace.groupName, inpfile); - } - return; - } - } - if (!interFace.omitted_blocks.empty()) { std::vector inclusions{}; dbi->set_block_omissions(interFace.omitted_blocks, inclusions); @@ -278,6 +284,17 @@ namespace { // NOTE: 'region' owns 'db' pointer at this time... Ioss::Region region(dbi, "region_1"); + // Change_set specified... We will read the specified changeSet from the input file + if (!interFace.changeSetName.empty()) { + success = Ioss::Utils::check_valid_change_set_name(interFace.changeSetName, region, rank); + if (success) { + success = open_change_set(interFace.changeSetName, region, rank); + } + if (!success) { + return success; + } + } + if (region.mesh_type() == Ioss::MeshType::HYBRID) { if (rank == 0) { fmt::print(stderr, @@ -285,7 +302,7 @@ namespace { "'Structured' mesh is supported at this time.\n", region.mesh_type_string()); } - return; + return success; } // Get length of longest name on input file... @@ -306,6 +323,7 @@ namespace { if (int_byte_size_api == 8) { interFace.ints_64_bit = true; } + //======================================================================== // OUTPUT Database... //======================================================================== @@ -335,8 +353,15 @@ namespace { int flush_interval = interFace.flush_interval; // Default is zero -- do not flush until end properties.add(Ioss::Property("FLUSH_INTERVAL", flush_interval)); + int change_set_count = dbi->num_internal_change_set(); + if (interFace.split_times == 0 || interFace.delete_timesteps || ts_count == 0 || append || - interFace.inputFile.size() > 1) { + interFace.inputFile.size() > 1 || + (change_set_count > 1 && interFace.changeSetName.empty())) { + if (interFace.inputFile.size() > 1 || + (change_set_count > 1 && interFace.changeSetName.empty())) { + properties.add(Ioss::Property("ENABLE_FILE_GROUPS", "YES")); + } Ioss::DatabaseIO *dbo = Ioss::IOFactory::create( interFace.outFiletype, interFace.outputFile, Ioss::WRITE_RESTART, Ioss::ParallelUtils::comm_world(), properties); @@ -355,19 +380,66 @@ namespace { if (interFace.inputFile.size() > 1) { properties.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - if (!first) { - // Putting each file into its own output group... - // The name of the group will be the basename portion of the filename... - Ioss::FileInfo file(inpfile); - dbo->create_subgroup(file.tailname()); + // Putting each file into its own change_set in the output file... + // The name of the change_set will be the basename portion of the filename... + Ioss::FileInfo file(inpfile); + + success = dbo->create_internal_change_set(file.tailname()); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to create change set {} in output file.\n", + file.tailname()); + } + return success; + } + } + + if (change_set_count > 1 && interFace.changeSetName.empty()) { + bool first = true; + Ioss::NameList cs_names; + if (!options.selected_change_sets.empty() && options.selected_change_sets != "ALL") { + cs_names = Ioss::tokenize(options.selected_change_sets, ","); + success = true; + for (const auto &cs_name : cs_names) { + success &= Ioss::Utils::check_valid_change_set_name(cs_name, region); + } + if (!success) { + return false; + } } else { + cs_names = dbi->internal_change_set_describe(); + } + for (const auto &cs_name : cs_names) { + success = region.load_internal_change_set_mesh(cs_name); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to open change set {} in input file.\n", cs_name); + } + return success; + } + output_region.reset_region(); + output_region.get_database()->release_memory(); + success = dbo->create_internal_change_set(cs_name); + if (!success) { + if (rank == 0) { + fmt::print(stderr, "ERROR: Unable to create change set {} in output file.\n", + cs_name); + } + return success; + } + fmt::print(stderr, "Copying change set {}\n", cs_name); + if (!first) { + options.ignore_qa_info = true; + } + Ioss::copy_database(region, output_region, options); first = false; } } - - // Do normal copy... - Ioss::copy_database(region, output_region, options); + else { + // Do normal copy... + Ioss::copy_database(region, output_region, options); + } if (mem_stats) { dbo->release_memory(); @@ -453,6 +525,7 @@ namespace { dbi->progress("Memory Released... "); } } // loop over input files + return true; } bool file_compare(IOShell::Interface &interFace, int rank) @@ -493,17 +566,6 @@ namespace { dbi1->set_int_byte_size_api(Ioss::USE_INT64_API); } - if (!interFace.groupName.empty()) { - bool success = dbi1->open_group(interFace.groupName); - if (!success) { - if (rank == 0) { - fmt::print(stderr, "ERROR: Unable to open group '{}' in file '{}'\n", interFace.groupName, - inpfile); - } - return false; - } - } - // NOTE: 'input_region1' owns 'dbi1' pointer at this time... Ioss::Region input_region1(dbi1, "region_1"); @@ -555,17 +617,6 @@ namespace { dbi2->set_int_byte_size_api(Ioss::USE_INT64_API); } - if (!interFace.groupName.empty()) { - bool success = dbi2->open_group(interFace.groupName); - if (!success) { - if (rank == 0) { - fmt::print(stderr, "ERROR: Unable to open group '{}' in file '{}'\n", interFace.groupName, - inpfile); - } - return false; - } - } - // NOTE: 'input_region2' owns 'dbi2' pointer at this time... Ioss::Region input_region2(dbi2, "region_2"); @@ -631,16 +682,27 @@ namespace { properties.add(Ioss::Property("IGNORE_INFO_RECORDS", "YES")); } - if (interFace.compression_level > 0 || interFace.shuffle || interFace.szip) { + if (interFace.compression_level > 0 || interFace.shuffle || interFace.szip || interFace.quant || + interFace.zlib || interFace.zstd || interFace.bz2) { properties.add(Ioss::Property("FILE_TYPE", "netcdf4")); properties.add(Ioss::Property("COMPRESSION_LEVEL", interFace.compression_level)); properties.add(Ioss::Property("COMPRESSION_SHUFFLE", static_cast(interFace.shuffle))); - if (interFace.szip) { + if (interFace.zlib) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "zlib")); + } + else if (interFace.szip) { properties.add(Ioss::Property("COMPRESSION_METHOD", "szip")); } - else if (interFace.zlib) { - properties.add(Ioss::Property("COMPRESSION_METHOD", "zlib")); + else if (interFace.zstd) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "zstd")); + } + else if (interFace.bz2) { + properties.add(Ioss::Property("COMPRESSION_METHOD", "bzip2")); + } + + if (interFace.quant) { + properties.add(Ioss::Property("COMPRESSION_QUANTIZE_NSD", interFace.quantize_nsd)); } } diff --git a/packages/seacas/libraries/ioss/src/main/io_shell_ts.C b/packages/seacas/libraries/ioss/src/main/io_shell_ts.C index 45bf61a950d2..e64c5f1c3585 100644 --- a/packages/seacas/libraries/ioss/src/main/io_shell_ts.C +++ b/packages/seacas/libraries/ioss/src/main/io_shell_ts.C @@ -4,6 +4,19 @@ // // See packages/seacas/LICENSE for details +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "Ionit_Initializer.h" #include "Ioss_CodeTypes.h" #include "Ioss_DataPool.h" @@ -17,26 +30,9 @@ #include "Ioss_SurfaceSplit.h" #include "Ioss_Transform.h" #include "Ioss_Utils.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "shell_interface.h" -#ifdef SEACAS_HAVE_KOKKOS -#include // for Kokkos::View -#endif - #define DO_OUTPUT \ if (rank == 0) \ std::cerr @@ -95,6 +91,22 @@ namespace { template void set_owned_node_count(Ioss::Region ®ion, int my_processor, INT dummy); + + bool open_change_set(const std::string &cs_name, Ioss::Region ®ion, int my_rank) + { + bool success = true; + if (!cs_name.empty()) { + success = region.load_internal_change_set_mesh(cs_name); + if (!success) { + if (my_rank == 0) { + fmt::print(stderr, "ERROR: Unable to open change_set '{}' in file '{}'\n", cs_name, + region.get_database()->get_filename()); + } + } + } + return success; + } + } // namespace // ======================================================================== @@ -192,11 +204,10 @@ int main(int argc, char *argv[]) } namespace { - void file_copy(IOShell::Interface &interFace, int rank) + void file_copy(IOShell::Interface &interFace, int my_rank) { Ioss::PropertyManager properties = set_properties(interFace); - bool first = true; for (const auto &inpfile : interFace.inputFile) { Ioss::DatabaseIO *dbi = Ioss::IOFactory::create(interFace.inFiletype, inpfile, Ioss::READ_MODEL, @@ -218,22 +229,22 @@ namespace { dbi->set_int_byte_size_api(Ioss::USE_INT64_API); } - if (!interFace.groupName.empty()) { - bool success = dbi->open_group(interFace.groupName); + // NOTE: 'region' owns 'db' pointer at this time... + Ioss::Region region(dbi, "region_1"); + + if (!interFace.changeSetName.empty()) { + bool success = open_change_set(interFace.changeSetName, region, my_rank); if (!success) { - if (rank == 0) { + if (my_rank == 0) { fmt::print(stderr, "ERROR: Unable to open group '{}' in file '{}'\n", - interFace.groupName, inpfile); + interFace.changeSetName, inpfile); } return; } } - // NOTE: 'region' owns 'db' pointer at this time... - Ioss::Region region(dbi, "region_1"); - if (region.mesh_type() != Ioss::MeshType::UNSTRUCTURED) { - if (rank == 0) { + if (my_rank == 0) { fmt::print(stderr, "\nERROR: io_shell does not support '{}' meshes. Only 'Unstructured' mesh is " "supported at this time.\n", @@ -283,15 +294,10 @@ namespace { if (interFace.inputFile.size() > 1) { properties.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - if (!first) { - // Putting each file into its own output group... - // The name of the group will be the basename portion of the filename... - Ioss::FileInfo file(inpfile); - dbo->create_subgroup(file.tailname()); - } - else { - first = false; - } + // Putting each file into its own output group... + // The name of the group will be the basename portion of the filename... + Ioss::FileInfo file(inpfile); + dbo->create_internal_change_set(file.tailname()); } if (interFace.debug) { @@ -315,9 +321,9 @@ namespace { // and output regions... (This is checked during nodeset output) if (output_region.get_database()->needs_shared_node_information()) { if (interFace.ints_64_bit) - set_owned_node_count(region, rank, (int64_t)0); + set_owned_node_count(region, my_rank, (int64_t)0); else - set_owned_node_count(region, rank, (int)0); + set_owned_node_count(region, my_rank, (int)0); } transfer_edgeblocks(region, output_region, interFace.debug); @@ -974,7 +980,9 @@ namespace { assert(oge->field_exists(out_field_name)); +#ifdef SEACAS_HAVE_KOKKOS int basic_type = ige->get_field(field_name).get_type(); +#endif size_t isize = ige->get_field(field_name).get_size(); size_t osize = oge->get_field(out_field_name).get_size(); @@ -1180,7 +1188,6 @@ namespace { if (isize != oge->get_field(field_name).get_size()) { assert(isize == oge->get_field(field_name).get_size()); } - int basic_type = ige->get_field(field_name).get_type(); if (field_name == "mesh_model_coordinates_x") { return; @@ -1216,6 +1223,10 @@ namespace { return; } +#ifdef SEACAS_HAVE_KOKKOS + int basic_type = ige->get_field(field_name).get_type(); +#endif + Ioss::DataPool pool; pool.data.resize(isize); switch (interFace.data_storage_type) { diff --git a/packages/seacas/libraries/ioss/src/main/shell_interface.C b/packages/seacas/libraries/ioss/src/main/shell_interface.C index 40fad4c4e6b3..8af2049735c0 100644 --- a/packages/seacas/libraries/ioss/src/main/shell_interface.C +++ b/packages/seacas/libraries/ioss/src/main/shell_interface.C @@ -113,15 +113,15 @@ void IOShell::Interface::enroll_options() options_.enroll("netcdf5", Ioss::GetLongOption::NoValue, "Output database will be a netcdf5 (CDF5) " "file instead of the classical netcdf file format", - nullptr); + nullptr, nullptr, true); options_.enroll("shuffle", Ioss::GetLongOption::NoValue, "Use a netcdf4 hdf5-based file and use hdf5s shuffle mode with compression.", nullptr); options_.enroll("compress", Ioss::GetLongOption::MandatoryValue, - "Specify the hdf5 zlib compression level [0..9] or szip [even, 4..32] to be used " - "on the output file.", + "Specify the compression level to be used. Values depend on algorithm:\n" + "\t\tzlib/bzip2: 0..9\t\tszip: even, 4..32\t\tzstd: -131072..22", nullptr); options_.enroll( @@ -132,7 +132,20 @@ void IOShell::Interface::enroll_options() options_.enroll( "szip", Ioss::GetLongOption::NoValue, "Use the SZip library if compression is enabled. Not as portable as zlib [exodus only]", - nullptr, nullptr, true); + nullptr); + + options_.enroll("zstd", Ioss::GetLongOption::NoValue, + "Use the Zstandard compression method if compression is enabled [exodus only].", + nullptr); + + options_.enroll("bzip2", Ioss::GetLongOption::NoValue, + "Use the Bzip2 compression method if compression is enabled [exodus only].", + nullptr); + + options_.enroll("quantize_nsd", Ioss::GetLongOption::MandatoryValue, + "Use the lossy quantize compression method. Value specifies number of digits to " + "retain (1..15) [exodus only]", + nullptr, nullptr, true); #if defined(SEACAS_HAVE_MPI) options_.enroll( @@ -228,8 +241,15 @@ void IOShell::Interface::enroll_options() nullptr, nullptr, true); #endif + options_.enroll("select_change_sets", Ioss::GetLongOption::MandatoryValue, + "Read only the specified change set(s) (comma-separated list) from the input " + "file. Use \"ALL\" for all change sets (default).", + nullptr); + options_.enroll( + "extract_change_set", Ioss::GetLongOption::MandatoryValue, + "Write the data from the specified change_set (formerly group) to the output file.", nullptr); options_.enroll("extract_group", Ioss::GetLongOption::MandatoryValue, - "Write the data from the specified group to the output file.", nullptr); + "[deprecated] Use `--extract_change_set`.", nullptr); options_.enroll( "split_times", Ioss::GetLongOption::MandatoryValue, @@ -424,6 +444,7 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) netcdf4 = false; netcdf5 = false; ints_32_bit = true; + zlib = false; } if (options_.retrieve("netcdf4") != nullptr) { @@ -442,40 +463,44 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) if (options_.retrieve("szip") != nullptr) { szip = true; zlib = false; + zstd = false; + bz2 = false; + } + if (options_.retrieve("zstd") != nullptr) { + szip = false; + zlib = false; + zstd = true; + bz2 = false; + } + if (options_.retrieve("zlib") != nullptr) { + szip = false; + zlib = true; + zstd = false; + bz2 = false; + } + if (options_.retrieve("bzip2") != nullptr) { + szip = false; + zlib = false; + zstd = false; + bz2 = true; } - zlib = (options_.retrieve("zlib") != nullptr); - if (szip && zlib) { + if (szip + zlib + zstd + bz2 > 1) { if (my_processor == 0) { - fmt::print(stderr, "ERROR: Only one of 'szip' or 'zlib' can be specified.\n"); + fmt::print(stderr, + "ERROR: Only one of 'szip' or 'zlib' or 'zstd' or 'bzip2' can be specified.\n"); } return false; } - compare = (options_.retrieve("compare") != nullptr); - ignore_qa_info = (options_.retrieve("ignore_qa_info") != nullptr); - ignore_node_map = (options_.retrieve("ignore_node_map") != nullptr); - ignore_elem_map = (options_.retrieve("ignore_element_map") != nullptr); - ignore_edge_map = (options_.retrieve("ignore_edge_map") != nullptr); - ignore_face_map = (options_.retrieve("ignore_face_map") != nullptr); - delete_qa = (options_.retrieve("delete_qa_records") != nullptr); - delete_info = (options_.retrieve("delete_info_records") != nullptr); { - const char *temp = options_.retrieve("absolute"); + const char *temp = options_.retrieve("quantize_nsd"); if (temp != nullptr) { - abs_tolerance = std::strtod(temp, nullptr); - } - } - { - const char *temp = options_.retrieve("relative"); - if (temp != nullptr) { - rel_tolerance = std::strtod(temp, nullptr); - } - } - { - const char *temp = options_.retrieve("floor"); - if (temp != nullptr) { - tol_floor = std::strtod(temp, nullptr); + quant = true; + quantize_nsd = std::strtol(temp, nullptr, 10); + if (szip + zlib + zstd + bz2 == 0) { + zlib = true; + } } } @@ -484,12 +509,20 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) if (temp != nullptr) { compression_level = std::strtol(temp, nullptr, 10); + if (szip + zlib + zstd + bz2 == 0) { + zlib = true; + if (my_processor == 0) { + fmt::print(stderr, "INFO: Compression level specified, but no algorithm. Defaulting to " + "'zlib' and setting netcdf-4 file type.\n"); + } + } + if (zlib) { if (compression_level < 0 || compression_level > 9) { if (my_processor == 0) { fmt::print(stderr, "ERROR: Bad compression level {}, valid value is between 0 and 9 inclusive " - "for gzip compression.\n", + "for gzip/zlib compression.\n", compression_level); } return false; @@ -518,6 +551,34 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) } } + compare = (options_.retrieve("compare") != nullptr); + ignore_qa_info = (options_.retrieve("ignore_qa_info") != nullptr); + ignore_node_map = (options_.retrieve("ignore_node_map") != nullptr); + ignore_elem_map = (options_.retrieve("ignore_element_map") != nullptr); + ignore_edge_map = (options_.retrieve("ignore_edge_map") != nullptr); + ignore_face_map = (options_.retrieve("ignore_face_map") != nullptr); + delete_qa = (options_.retrieve("delete_qa_records") != nullptr); + delete_info = (options_.retrieve("delete_info_records") != nullptr); + + { + const char *temp = options_.retrieve("absolute"); + if (temp != nullptr) { + abs_tolerance = std::strtod(temp, nullptr); + } + } + { + const char *temp = options_.retrieve("relative"); + if (temp != nullptr) { + rel_tolerance = std::strtod(temp, nullptr); + } + } + { + const char *temp = options_.retrieve("floor"); + if (temp != nullptr) { + tol_floor = std::strtod(temp, nullptr); + } + } + #if defined(SEACAS_HAVE_MPI) add_processor_id_field = (options_.retrieve("add_processor_id_field") != nullptr); @@ -622,7 +683,9 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) } } - groupName = options_.get_option_value("extract_group", groupName); + selectedChangeSets = options_.get_option_value("select_change_sets", selectedChangeSets); + changeSetName = options_.get_option_value("extract_group", changeSetName); + changeSetName = options_.get_option_value("extract_change_set", changeSetName); { const char *temp = options_.retrieve("field_suffix_separator"); @@ -732,6 +795,15 @@ bool IOShell::Interface::parse_options(int argc, char **argv, int my_processor) exit(EXIT_SUCCESS); } + if (!changeSetName.empty() && !selectedChangeSets.empty()) { + if (my_processor == 0) { + fmt::print( + stderr, + "ERROR: Only one of 'extract_change_set' or 'select_change_sets'can be specified.\n"); + } + return false; + } + // Parse remaining options as directory paths. if (option_index < argc - 1) { while (option_index < argc - 1) { diff --git a/packages/seacas/libraries/ioss/src/main/shell_interface.h b/packages/seacas/libraries/ioss/src/main/shell_interface.h index a391174c7a82..6b781b0d3c0a 100644 --- a/packages/seacas/libraries/ioss/src/main/shell_interface.h +++ b/packages/seacas/libraries/ioss/src/main/shell_interface.h @@ -35,7 +35,8 @@ namespace IOShell { std::string outputFile; std::string inFiletype{"unknown"}; std::string outFiletype{"unknown"}; - std::string groupName; + std::string changeSetName; + std::string selectedChangeSets; std::string decomp_method; std::string decomp_extra{"processor_id"}; std::string compose_output{"default"}; @@ -53,6 +54,7 @@ namespace IOShell { int surface_split_type{-1}; int data_storage_type{0}; int compression_level{0}; + int quantize_nsd{0}; int serialize_io_size{0}; int flush_interval{0}; @@ -78,8 +80,11 @@ namespace IOShell { // -> file.A, t=7,8 -> file.B int split_cyclic{0}; bool shuffle{false}; - bool zlib{true}; + bool zlib{false}; bool szip{false}; + bool zstd{false}; + bool bz2{false}; + bool quant{false}; bool debug{false}; bool detect_nans{false}; bool statistics{false}; diff --git a/packages/seacas/libraries/ioss/src/main/skinner.C b/packages/seacas/libraries/ioss/src/main/skinner.C index bda07b2181c2..f63ad50d9a56 100644 --- a/packages/seacas/libraries/ioss/src/main/skinner.C +++ b/packages/seacas/libraries/ioss/src/main/skinner.C @@ -65,11 +65,9 @@ namespace { size_t max_face = std::string("Face Count").length(); for (auto &eb : ebs) { const std::string &name = eb->name(); - if (name.length() > max_name) { - max_name = name.length(); - } - size_t face_width = Ioss::Utils::number_width(boundary_faces[name].size()); - max_face = face_width > max_face ? face_width : max_face; + max_name = std::max(max_name, name.length()); + size_t face_width = Ioss::Utils::number_width(boundary_faces[name].size()); + max_face = std::max(max_face, face_width); } max_name += 4; // Padding max_face += 4; diff --git a/packages/seacas/libraries/ioss/src/main/test/exodus_Q2_bc_parents.gold b/packages/seacas/libraries/ioss/src/main/test/exodus_Q2_bc_parents.gold index 6020ad82cc38..0c991edefa4a 100644 Binary files a/packages/seacas/libraries/ioss/src/main/test/exodus_Q2_bc_parents.gold and b/packages/seacas/libraries/ioss/src/main/test/exodus_Q2_bc_parents.gold differ diff --git a/packages/seacas/libraries/ioss/src/main/test/exodus_bc_parents.gold b/packages/seacas/libraries/ioss/src/main/test/exodus_bc_parents.gold index d85243b1b397..19d677554b86 100644 Binary files a/packages/seacas/libraries/ioss/src/main/test/exodus_bc_parents.gold and b/packages/seacas/libraries/ioss/src/main/test/exodus_bc_parents.gold differ diff --git a/packages/seacas/libraries/ioss/src/main/vector3d.h b/packages/seacas/libraries/ioss/src/main/vector3d.h index d0f29259053d..ff0e33dbff87 100644 --- a/packages/seacas/libraries/ioss/src/main/vector3d.h +++ b/packages/seacas/libraries/ioss/src/main/vector3d.h @@ -29,19 +29,19 @@ class vector3d vector3d &operator*=(double scalar); vector3d &operator/=(double scalar); + friend vector3d operator*(double scalar, const vector3d &from); + friend vector3d operator*(const vector3d &lhs, double scalar); + friend vector3d operator/(const vector3d &lhs, double scalar); + + friend vector3d operator+(const vector3d &lhs, const vector3d &rhs); + friend vector3d operator-(const vector3d &lhs, const vector3d &rhs); + double length() const; double normalize(double tolerance = 1e-06); vector3d cross(const vector3d &from) const; static vector3d plane_normal(const vector3d &v1, const vector3d &v2, const vector3d &v3); }; -vector3d operator*(double scalar, const vector3d &from); -vector3d operator*(const vector3d &lhs, double scalar); -vector3d operator/(const vector3d &lhs, double scalar); - -vector3d operator+(const vector3d &lhs, const vector3d &rhs); -vector3d operator-(const vector3d &lhs, const vector3d &rhs); - //---------------------------------------------------------------------------- inline vector3d vector3d::cross(const vector3d &from) const { diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.C b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.C index c61a6e441491..ee3d94f712d8 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.C @@ -643,6 +643,19 @@ namespace Iotm { } } + std::vector DatabaseIO::get_db_step_times_nl() + { + std::vector timesteps; + + int time_step_count = m_textMesh->timestep_count(); + timesteps.reserve(time_step_count); + for (int i = 0; i < time_step_count; i++) { + timesteps.push_back(i); + } + + return timesteps; + } + void DatabaseIO::update_block_omissions_from_assemblies() { m_textMesh->update_block_omissions_from_assemblies( diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.h b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.h index e7d520a8e0aa..475e9c916560 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.h +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_DatabaseIO.h @@ -48,7 +48,7 @@ namespace Ioss { class Map; } // namespace Ioss -/** \brief A namespace for the generated database format. +/** \brief A namespace for the textmesh database format. */ namespace Iotm { class IOTM_EXPORT IOFactory : public Ioss::IOFactory @@ -94,6 +94,9 @@ namespace Iotm { bool begin_state_nl(int state, double time) override; void get_step_times_nl() override; + + std::vector get_db_step_times_nl() override; + void get_nodeblocks(); void get_elemblocks(); void get_nodesets(); diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C index 51d6490033a8..6393bf319ffb 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMesh.C @@ -879,7 +879,12 @@ namespace Iotm { if (nullptr == sideset) return; - SideBlockInfo info = sideset->get_side_block_info(sideBlockName); + SideBlockInfo info = sideset->get_side_block_info(sideBlockName); + Ioss::ElementTopology *topology = Ioss::ElementTopology::factory(info.elementTopology, true); + Ioss::ElementTopology *side_topology = Ioss::ElementTopology::factory(info.sideTopology, true); + + int sideOffset = Ioss::Utils::get_side_offset(topology, side_topology); + std::vector localSideIndex = sideset->get_sideblock_indices_local_to_proc(info, m_myProcessor); elemSides.resize(2 * localSideIndex.size()); @@ -892,7 +897,7 @@ namespace Iotm { int side = elemSidePair.second; elemSides[count++] = elemId; - elemSides[count++] = side; + elemSides[count++] = side - sideOffset; } } diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h index 253d9f47ac80..ac51339d922c 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshAdjacencyGraph.h @@ -94,7 +94,7 @@ namespace Iotm { struct FaceConnection { FaceConnection() - : thisSide(INVALID_SIDE), thatElement(INVALID_INDEX), thatSide(INVALID_SIDE){}; + : thisSide(INVALID_SIDE), thatElement(INVALID_INDEX), thatSide(INVALID_SIDE) {}; FaceConnection(int thisSide_, IndexType otherElement_, int otherSide_) : thisSide(thisSide_), thatElement(otherElement_), thatSide(otherSide_) @@ -364,7 +364,8 @@ namespace Iotm { std::vector sideNodes = get_sorted_side_nodes(adjacency.elementIndex, adjacency.side); - for (int otherSide = 1; otherSide <= get_element_topology(neighborElementIndex).num_sides(); + for (int otherSide = 1; + otherSide <= get_element_topology(neighborElementIndex).num_face_sides(); ++otherSide) { std::vector otherSideNodes = get_sorted_side_nodes(neighborElementIndex, otherSide); @@ -738,7 +739,7 @@ namespace Iotm { initialize_side_connectivity_graph(elementIndices); for (size_t elementIndex : elementIndices) { - int numSides = get_element_topology(elementIndex).num_sides(); + int numSides = get_element_topology(elementIndex).num_face_sides(); for (int side = 1; side <= numSides; ++side) { if (m_indexGraph[elementIndex].sideReference[side - 1] == 0) { CurrentAdjacency adjacency(elementIndex, side); @@ -752,7 +753,7 @@ namespace Iotm { { for (size_t elementIndex : elementIndices) { m_indexGraph[elementIndex] = - FaceConnections(get_element_topology(elementIndex).num_sides()); + FaceConnections(get_element_topology(elementIndex).num_face_sides()); } } diff --git a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h index 6a17ff1f6a2f..e6a6f6d85943 100644 --- a/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h +++ b/packages/seacas/libraries/ioss/src/text_mesh/Iotm_TextMeshTopologyMapping.h @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions +// Copyright(C) 1999-2020, 2022, 2024 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -20,7 +20,6 @@ #include // for vector #include -#include #include "Ioss_ElementPermutation.h" #include "Ioss_ElementTopology.h" @@ -81,7 +80,7 @@ namespace Iotm { bool operator!=(const TopologyMapEntry &rhs) const { return !(*this == rhs); } - int num_sides() const + int num_face_sides() const { if (topology->is_shell()) { // Only interested in face boundaries, not edges @@ -93,6 +92,8 @@ namespace Iotm { return topology->number_boundaries(); } + int num_sides() const { return sideTopologies.size(); } + // Side references are one-based bool valid_side(unsigned side) const { @@ -584,7 +585,8 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({tri_3_factory(), tri_3_factory()}); + entry.set_side_topologies({tri_3_factory(), tri_3_factory(), line_2_factory(), + line_2_factory(), line_2_factory()}); entry.initialized = true; } @@ -597,7 +599,8 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({tri_4_factory(), tri_4_factory()}); + entry.set_side_topologies({tri_4_factory(), tri_4_factory(), line_2_factory(), + line_2_factory(), line_2_factory()}); entry.initialized = true; } @@ -610,7 +613,8 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({tri_6_factory(), tri_6_factory()}); + entry.set_side_topologies({tri_6_factory(), tri_6_factory(), line_3_factory(), + line_3_factory(), line_3_factory()}); entry.initialized = true; } @@ -628,7 +632,8 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({quad_4_factory(), quad_4_factory()}); + entry.set_side_topologies({quad_4_factory(), quad_4_factory(), line_2_factory(), + line_2_factory(), line_2_factory(), line_2_factory()}); entry.initialized = true; } @@ -641,7 +646,8 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({quad_8_factory(), quad_8_factory()}); + entry.set_side_topologies({quad_8_factory(), quad_8_factory(), line_3_factory(), + line_3_factory(), line_3_factory(), line_3_factory()}); entry.initialized = true; } @@ -654,7 +660,8 @@ namespace Iotm { if (!entry.initialized) { entry.set_valid_spatial_dimensions({false, false, false, true}); - entry.set_side_topologies({quad_9_factory(), quad_9_factory()}); + entry.set_side_topologies({quad_9_factory(), quad_9_factory(), line_3_factory(), + line_3_factory(), line_3_factory(), line_3_factory()}); entry.initialized = true; } @@ -904,15 +911,14 @@ namespace Iotm { for (int side = 1; side <= numSides; side++) { if (topology->boundary_type(side) != sideTopologies_[side - 1]->topology) { std::ostringstream errmsg; - fmt::print(errmsg, - "ERROR: For element topology: {} on side: {}, expected topology: {} does not " - "match topology: {}", - topology->name(), side, topology->boundary_type(side)->name(), - sideTopologies_[side - 1]->topology->name()); + // Would be nice to use fmt:: here, but we need to avoid using fmt includes in public + // headers... + errmsg << "ERROR: For element topology: " << topology->name() << " on side: " << side + << ", expected topology: " << topology->boundary_type(side)->name() + << " does not match topology: " << sideTopologies_[side - 1]->topology->name(); IOSS_ERROR(errmsg); } } - sideTopologies = sideTopologies_; } diff --git a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestDynamicTopology.C b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestDynamicTopology.C index b42cc43027d1..274cceecbc63 100644 --- a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestDynamicTopology.C +++ b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestDynamicTopology.C @@ -13,6 +13,7 @@ #include "gtest/gtest.h" #include +#include // std::tolower #include #include #include @@ -21,10 +22,15 @@ #include // for unlink #include "Ionit_Initializer.h" -#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_ChangeSet.h" +#include "Ioss_ChangeSetFactory.h" #include "Ioss_DBUsage.h" +#include "Ioss_DatabaseIO.h" // for DatabaseIO +#include "Ioss_DynamicTopology.h" +#include "Ioss_DynamicTopologyBroker.h" +#include "Ioss_DynamicTopologyFileControl.h" #include "Ioss_ElementBlock.h" -#include "Ioss_Field.h" // for Field, etc +#include "Ioss_Field.h" // for Field, etc #include "Ioss_FileInfo.h" #include "Ioss_IOFactory.h" #include "Ioss_NodeBlock.h" @@ -36,1076 +42,1601 @@ #include "exodus/Ioex_DatabaseIO.h" namespace { -std::string get_many_block_mesh_desc(unsigned numBlocks) -{ - std::ostringstream oss; - std::vector elementIds(numBlocks); - std::iota(elementIds.begin(), elementIds.end(), 1); - - unsigned proc = 0; - for (unsigned i = 0; i < numBlocks; ++i) { - unsigned elemId = elementIds[i]; - unsigned firstNodeId = i * 4 + 1; - oss << proc << "," << elemId << ",HEX_8,"; - for (unsigned node = firstNodeId; node < firstNodeId + 8; ++node) { - oss << node << ","; + std::string get_many_block_mesh_desc(unsigned numBlocks) + { + std::ostringstream oss; + std::vector elementIds(numBlocks); + std::iota(elementIds.begin(), elementIds.end(), 1); + + unsigned proc = 0; + for (unsigned i = 0; i < numBlocks; ++i) { + unsigned elemId = elementIds[i]; + unsigned firstNodeId = i * 4 + 1; + oss << proc << "," << elemId << ",HEX_8,"; + for (unsigned node = firstNodeId; node < firstNodeId + 8; ++node) { + oss << node << ","; + } + unsigned blockId = i + 1; + oss << "block_" << blockId; + + if (i < numBlocks - 1) { + oss << "\n"; + } + + proc++; + } + + oss << "|coordinates:"; + + std::vector planeCoords = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0}; + + for (double coord : planeCoords) { + oss << coord << ","; } - unsigned blockId = i + 1; - oss << "block_" << blockId; - if (i < numBlocks - 1) { - oss << "\n"; + for (unsigned i = 1; i <= numBlocks; ++i) { + for (unsigned point = 0; point < 4; ++point) { + planeCoords[3 * point + 2] += 1; + } + + for (double coord : planeCoords) { + oss << coord << ","; + } } - proc++; + return oss.str(); } - oss << "|coordinates:"; + void define_model(const Ioss::Region &i_region, Ioss::Region &o_region) + { + Ioss::DatabaseIO *o_database = o_region.get_database(); - std::vector planeCoords = {0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0}; + o_region.begin_mode(Ioss::STATE_DEFINE_MODEL); + + Ioss::NodeBlock *i_nb = i_region.get_node_blocks()[0]; + int64_t spatial_dim = 3; + int64_t num_nodes = i_nb->entity_count(); + Ioss::NodeBlock *o_nb = new Ioss::NodeBlock(o_database, "nodeblock_1", num_nodes, spatial_dim); + o_region.add(o_nb); + + for (Ioss::ElementBlock *i_eb : i_region.get_element_blocks()) { + Ioss::ElementBlock *o_eb = new Ioss::ElementBlock( + o_database, i_eb->name(), i_eb->topology()->name(), i_eb->entity_count()); + o_eb->property_add(i_eb->get_property("id")); + o_region.add(o_eb); + } - for (double coord : planeCoords) { - oss << coord << ","; + o_region.end_mode(Ioss::STATE_DEFINE_MODEL); } - for (unsigned i = 1; i <= numBlocks; ++i) { - for (unsigned point = 0; point < 4; ++point) { - planeCoords[3 * point + 2] += 1; + void write_model(const Ioss::Region &i_region, Ioss::Region &o_region) + { + Ioss::NodeBlock *i_nb = i_region.get_node_blocks()[0]; + Ioss::NodeBlock *o_nb = o_region.get_node_blocks()[0]; + + o_region.begin_mode(Ioss::STATE_MODEL); + std::vector coordinates; + std::vector node_ids; + i_nb->get_field_data("ids", node_ids); + i_nb->get_field_data("mesh_model_coordinates", coordinates); + + o_nb->put_field_data("ids", node_ids); + o_nb->put_field_data("mesh_model_coordinates", coordinates); + + for (Ioss::ElementBlock *i_eb : i_region.get_element_blocks()) { + Ioss::ElementBlock *o_eb = o_region.get_element_block(i_eb->name()); + std::vector elem_ids; + std::vector connectivity; + + i_eb->get_field_data("ids", elem_ids); + i_eb->get_field_data("connectivity", connectivity); + + o_eb->put_field_data("ids", elem_ids); + o_eb->put_field_data("connectivity", connectivity); } - for (double coord : planeCoords) { - oss << coord << ","; + o_region.end_mode(Ioss::STATE_MODEL); + } + + void define_transient(Ioss::Region &o_region, const std::string &elemFieldName) + { + o_region.begin_mode(Ioss::STATE_DEFINE_TRANSIENT); + + for (Ioss::ElementBlock *o_eb : o_region.get_element_blocks()) { + size_t num_elem = o_eb->get_property("entity_count").get_int(); + std::string storage = "scalar"; + + Ioss::Field field(elemFieldName, Ioss::Field::REAL, storage, 1, Ioss::Field::Field::TRANSIENT, + num_elem); + o_eb->field_add(field); } + o_region.end_mode(Ioss::STATE_DEFINE_TRANSIENT); } - return oss.str(); -} + int write_transient(Ioss::Region &o_region, const std::string &elemFieldName, const double time) + { + o_region.begin_mode(Ioss::STATE_TRANSIENT); + int step = o_region.add_state(time); + o_region.begin_state(step); + + for (Ioss::ElementBlock *o_eb : o_region.get_element_blocks()) { + size_t num_elem = o_eb->get_property("entity_count").get_int(); -void define_model(const Ioss::Region &i_region, Ioss::Region &o_region) -{ - Ioss::DatabaseIO *o_database = o_region.get_database(); + std::vector field_data(num_elem); + std::vector elem_ids; - o_region.begin_mode(Ioss::STATE_DEFINE_MODEL); + o_eb->get_field_data("ids", elem_ids); + for (size_t i = 0; i < elem_ids.size(); i++) { + field_data[i] = (double)elem_ids[i] + 100 * time; + } - auto& nodeblocks = o_region.get_node_blocks(); + o_eb->put_field_data(elemFieldName, field_data); + } - Ioss::NodeBlock *i_nb = i_region.get_node_blocks()[0]; - int64_t spatial_dim = 3; - int64_t num_nodes = i_nb->entity_count(); - Ioss::NodeBlock *o_nb = new Ioss::NodeBlock(o_database, "nodeblock_1", num_nodes, spatial_dim); - o_region.add(o_nb); + o_region.end_state(step); + o_region.end_mode(Ioss::STATE_TRANSIENT); - for (Ioss::ElementBlock *i_eb : i_region.get_element_blocks()) { - Ioss::ElementBlock *o_eb = new Ioss::ElementBlock( - o_database, i_eb->name(), i_eb->topology()->name(), i_eb->entity_count()); - o_eb->property_add(i_eb->get_property("id")); - o_region.add(o_eb); + return step; } - o_region.end_mode(Ioss::STATE_DEFINE_MODEL); -} + class Observer : public Ioss::DynamicTopologyObserver + { + public: + Observer(Ioss::Region &inputRegion_, const std::string &elemFieldName_, + const Ioss::FileControlOption fileControlOption_) + : Ioss::DynamicTopologyObserver(nullptr), inputRegion(inputRegion_), + elemFieldName(elemFieldName_), fileControlOption(fileControlOption_) + { + } -void write_model(const Ioss::Region &i_region, Ioss::Region &o_region) -{ - Ioss::NodeBlock *i_nb = i_region.get_node_blocks()[0]; - Ioss::NodeBlock *o_nb = o_region.get_node_blocks()[0]; + virtual ~Observer() {} - o_region.begin_mode(Ioss::STATE_MODEL); - std::vector coordinates; - std::vector node_ids; - i_nb->get_field_data("ids", node_ids); - i_nb->get_field_data("mesh_model_coordinates", coordinates); + void define_model() override { ::define_model(inputRegion, *get_region()); } - o_nb->put_field_data("ids", node_ids); - o_nb->put_field_data("mesh_model_coordinates", coordinates); + void write_model() override { ::write_model(inputRegion, *get_region()); } - for (Ioss::ElementBlock *i_eb : i_region.get_element_blocks()) { - Ioss::ElementBlock *o_eb = o_region.get_element_block(i_eb->name()); - std::vector elem_ids; - std::vector connectivity; + void define_transient() override { ::define_transient(*get_region(), elemFieldName); } - i_eb->get_field_data("ids", elem_ids); - i_eb->get_field_data("connectivity", connectivity); + Ioss::FileControlOption get_control_option() const { return fileControlOption; } - o_eb->put_field_data("ids", elem_ids); - o_eb->put_field_data("connectivity", connectivity); - } + private: + Observer(); - o_region.end_mode(Ioss::STATE_MODEL); -} + Ioss::Region &inputRegion; + const std::string elemFieldName; + Ioss::FileControlOption fileControlOption; + }; -void define_transient(const Ioss::Region &i_region, Ioss::Region &o_region, - const std::string &elemFieldName) -{ - o_region.begin_mode(Ioss::STATE_DEFINE_TRANSIENT); + struct OutputParams + { + OutputParams(const std::string &outFile_) : outFile(outFile_) {} - for (Ioss::ElementBlock *o_eb : o_region.get_element_blocks()) { - size_t num_elem = o_eb->get_property("entity_count").get_int(); - std::string storage = "scalar"; + OutputParams(const std::string &outFile_, const std::string &elemFieldName_) + : outFile(outFile_), elemFieldName(elemFieldName_) + { + } - Ioss::Field field(elemFieldName, Ioss::Field::REAL, storage, 1, Ioss::Field::Field::TRANSIENT, - num_elem); - o_eb->field_add(field); - } - o_region.end_mode(Ioss::STATE_DEFINE_TRANSIENT); -} + void set_data(const std::vector &output_times_, const std::vector &output_steps_, + const std::vector &modification_steps_) + { + ASSERT_EQ(output_times_.size(), output_steps_.size()); + ASSERT_EQ(output_times_.size(), modification_steps_.size()); -int write_transient(Ioss::Region &o_region, const std::string &elemFieldName, const double time) -{ - o_region.begin_mode(Ioss::STATE_TRANSIENT); - int step = o_region.add_state(time); - o_region.begin_state(step); + size_t numSteps = output_times_.size(); + for (size_t i = 1; i < numSteps; i++) { + // Monotone increasing + ASSERT_TRUE(output_times_[i] > output_times_[i - 1]); + } - for (Ioss::ElementBlock *o_eb : o_region.get_element_blocks()) { - size_t num_elem = o_eb->get_property("entity_count").get_int(); + output_times = output_times_; + output_steps = output_steps_; + modification_steps = modification_steps_; + } - std::vector field_data(num_elem); - std::vector elem_ids; + void set_data(const std::vector &output_steps_, + const std::vector &modification_steps_) + { + ASSERT_EQ(output_steps_.size(), modification_steps_.size()); - o_eb->get_field_data("ids", elem_ids); - for (size_t i = 0; i < elem_ids.size(); i++) { - field_data[i] = (double)elem_ids[i] + 100*time; + size_t numSteps = output_steps_.size(); + for (size_t i = 0; i < numSteps; i++) { + output_times.push_back((double)i); + } + output_steps = output_steps_; + modification_steps = modification_steps_; } - o_eb->put_field_data(elemFieldName, field_data); - } + struct OutputParams &add(const double time, const bool do_output, const bool do_modification) + { + size_t numSteps = output_times.size(); + if (numSteps > 0) { + // Monotone increasing + EXPECT_TRUE(time > output_times[numSteps - 1]); + } + + output_times.push_back(time); + output_steps.push_back(do_output); + modification_steps.push_back(do_modification); - o_region.end_state(step); - o_region.end_mode(Ioss::STATE_TRANSIENT); + return *this; + } - return step; -} + void clear() + { + output_times.clear(); + output_steps.clear(); + modification_steps.clear(); + } -class Observer : public Ioss::DynamicTopologyObserver -{ -public: - Observer(Ioss::Region& inputRegion_, - const std::string &elemFieldName_, - const Ioss::FileControlOption fileControlOption_) - : Ioss::DynamicTopologyObserver(nullptr) - , inputRegion(inputRegion_) - , elemFieldName(elemFieldName_) - , fileControlOption(fileControlOption_) - {} + void set_cyclic_count(unsigned cyclicCount_) { cyclicCount = cyclicCount_; } - virtual ~Observer() {} + unsigned cyclicCount{0}; + std::string outFile{"file.g"}; + std::string elemFieldName{"elem_field"}; + std::vector output_times; + std::vector output_steps; + std::vector modification_steps; + }; - void define_model() override + void do_output(Ioss::Region &o_region, const OutputParams ¶ms, size_t step, double &minTime, + int &maxStep, bool &doneOutputAfterModification) { - ::define_model(inputRegion, *get_region()); + if (params.output_steps[step]) { + if (!doneOutputAfterModification) { + minTime = params.output_times[step]; + } + + write_transient(o_region, params.elemFieldName, params.output_times[step]); + + auto min_result = o_region.get_min_time(); + EXPECT_EQ(1, min_result.first); + EXPECT_NEAR(minTime, min_result.second, 1.0e-6); + + auto max_result = o_region.get_max_time(); + EXPECT_EQ(maxStep, max_result.first); + EXPECT_NEAR(params.output_times[step], max_result.second, 1.0e-6); + + maxStep++; + doneOutputAfterModification = true; + } } - void write_model() override + void run_topology_change(const Ioss::Region &i_region, Ioss::Region &o_region, + const OutputParams ¶ms) { - ::write_model(inputRegion, *get_region()); + auto observer = o_region.get_mesh_modification_observer(); + + define_model(i_region, o_region); + write_model(i_region, o_region); + + define_transient(o_region, params.elemFieldName); + + auto numSteps = params.output_steps.size(); + + int maxStep = 1; + + double minTime = numSteps > 0 ? params.output_times[0] : 0.0; + + bool doneOutputAfterModification = true; + + for (size_t i = 0; i < numSteps; i++) { + if (params.modification_steps[i]) { + observer->set_topology_modification(Ioss::TOPOLOGY_UNKNOWN); + maxStep = 1; + doneOutputAfterModification = false; + } + + do_output(o_region, params, i, minTime, maxStep, doneOutputAfterModification); + } } - void define_transient() override + void cleanup_linear_multi_files(const std::string &outFile, int numOutputs = 1) { - ::define_transient(inputRegion, *get_region(), elemFieldName); + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + for (int i = 1; i <= numOutputs; i++) { + std::string baseFile = + Ioss::DynamicTopologyFileControl::get_linear_database_filename(outFile, i); + std::string parallelFile = + Ioss::Utils::decode_filename(baseFile, util.parallel_rank(), util.parallel_size()); + unlink(parallelFile.c_str()); + } } - Ioss::FileControlOption get_control_option() const + std::shared_ptr construct_region(const OutputParams ¶ms, + Ioss::PropertyManager &propertyManager, + Ioss::DatabaseUsage db_usage, + const std::string &name) { - return fileControlOption; + std::string outFile = params.outFile; + if (params.cyclicCount > 0) { + outFile = Ioss::DynamicTopologyFileControl::get_cyclic_database_filename( + params.outFile, params.cyclicCount, 0); + } + propertyManager.add(Ioss::Property("base_filename", params.outFile)); + Ioss::DatabaseIO *database = Ioss::IOFactory::create( + "exodus", outFile, db_usage, Ioss::ParallelUtils::comm_world(), propertyManager); + + auto region = std::make_shared(database, name); + region->set_file_cyclic_count(params.cyclicCount); + EXPECT_TRUE(database != nullptr); + EXPECT_TRUE(database->ok(true)); + + return region; } -private: - Observer(); + void run_multi_file_topology_change(const OutputParams ¶ms) + { + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + int numBlocks = util.parallel_size(); + + std::string meshDesc = get_many_block_mesh_desc(numBlocks); - Ioss::Region& inputRegion; - const std::string elemFieldName; - Ioss::FileControlOption fileControlOption; -}; + Ioss::PropertyManager propertyManager; -struct OutputParams { - OutputParams(const std::string& outFile_) - : outFile(outFile_) {} + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); - OutputParams(const std::string& outFile_, const std::string& elemFieldName_) - : outFile(outFile_) - , elemFieldName(elemFieldName_) {} + auto o_region = construct_region(params, propertyManager, Ioss::WRITE_RESULTS, "output_model"); - void set_data(const std::vector& output_times_, - const std::vector& output_steps_, - const std::vector& modification_steps_) + auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_MULTI_FILE; + auto observer = std::make_shared(i_region, params.elemFieldName, fileControlOption); + o_region->register_mesh_modification_observer(observer); + + run_topology_change(i_region, *o_region, params); + } + + TEST(TestDynamicWrite, multi_file_simple_topology_modification) { - ASSERT_EQ(output_times_.size(), output_steps_.size()); - ASSERT_EQ(output_times_.size(), modification_steps_.size()); + std::string outFile("multiFileManyBlocks.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); - size_t numSteps = output_times_.size(); - for(auto i=1; i output_times_[i-1]); + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + + params.set_data(output_steps, modification_steps); + + cleanup_linear_multi_files(outFile, params.output_times.size()); + run_multi_file_topology_change(params); + cleanup_linear_multi_files(outFile, params.output_times.size()); + } + + void cleanup_cyclic_multi_files(const std::string &outFile, unsigned cyclicCount = 3) + { + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + for (unsigned i = 1; i <= cyclicCount; i++) { + std::string baseFile = + Ioss::DynamicTopologyFileControl::get_cyclic_database_filename(outFile, cyclicCount, i); + std::string parallelFile = + Ioss::Utils::decode_filename(baseFile, util.parallel_rank(), util.parallel_size()); + unlink(parallelFile.c_str()); } + } + + TEST(TestDynamicWrite, multi_file_cyclic_topology_modification) + { + std::string outFile("cyclicMultiFileManyBlocks.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); - output_times = output_times_; - output_steps = output_steps_; - modification_steps = modification_steps_; + std::vector output_times{0.0, 0.5, 1.5, 1.75, 2.0, 3.0}; + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + + params.set_data(output_times, output_steps, modification_steps); + params.set_cyclic_count(3); + + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + run_multi_file_topology_change(params); + cleanup_cyclic_multi_files(outFile, params.cyclicCount); } - void set_data(const std::vector& output_steps_, - const std::vector& modification_steps_) + void fill_internal_file_change_set_gold_names(const int numChangeSets, + std::vector &gold_names, + std::vector &gold_full_names) { - ASSERT_EQ(output_steps_.size(), modification_steps_.size()); + gold_names.clear(); + gold_full_names.clear(); + + for (int i = 1; i <= numChangeSets; i++) { + std::string setName = Ioss::DynamicTopologyFileControl::get_internal_file_change_set_name(i); - size_t numSteps = output_steps_.size(); - for(size_t i=0; i 0) { - // Monotone increasing - EXPECT_TRUE(time > output_times[numSteps-1]); - } + Ioss::NameList names = database->internal_change_set_describe(false); + Ioss::NameList full_names = database->internal_change_set_describe(true); + + std::vector gold_names; + std::vector gold_full_names; + + fill_internal_file_change_set_gold_names(database->num_internal_change_set(), gold_names, + gold_full_names); + + EXPECT_EQ(gold_names, names); + EXPECT_EQ(gold_full_names, full_names); + } + + void cleanup_single_file(const std::string &outFile) + { + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); - output_times.push_back(time); - output_steps.push_back(do_output); - modification_steps.push_back(do_modification); + std::string file = + Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); + unlink(file.c_str()); + } + + void run_single_file_simple_topology_change(const OutputParams ¶ms) + { + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + int numBlocks = util.parallel_size(); + + std::string meshDesc = get_many_block_mesh_desc(numBlocks); + + Ioss::PropertyManager propertyManager; + + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); + + propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); + Ioss::DatabaseIO *o_database = + Ioss::IOFactory::create("exodus", params.outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region o_region(o_database, "output_model"); + EXPECT_TRUE(o_database != nullptr); + EXPECT_TRUE(o_database->ok(true)); + EXPECT_TRUE(o_database->supports_internal_change_set()); + + auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; + auto observer = std::make_shared(i_region, params.elemFieldName, fileControlOption); + o_region.register_mesh_modification_observer(observer); + + run_topology_change(i_region, o_region, params); + test_internal_file_change_set_names(o_database); + } + + TEST(TestDynamicWrite, single_file_simple_topology_modification) + { + std::string outFile("singleFileManyBlocks.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); + + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); - return *this; + cleanup_single_file(outFile); + run_single_file_simple_topology_change(params); + cleanup_single_file(outFile); } - void clear() + TEST(TestDynamicWrite, single_file_groups_not_enabled) { - output_times.clear(); - output_steps.clear(); - modification_steps.clear(); + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + int numBlocks = util.parallel_size(); + if (numBlocks > 1) + GTEST_SKIP(); + + std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" + "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; + + Ioss::PropertyManager propertyManager; + + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); + + std::string outFile("singleFileGroupsNotEnabled.g"); + std::string elemFieldName = "elem_field"; + cleanup_single_file(outFile); + + // Need the line below to allow this to pass + // propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); + Ioss::DatabaseIO *o_database = Ioss::IOFactory::create( + "exodus", outFile, Ioss::WRITE_RESULTS, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region o_region(o_database, "output_model"); + EXPECT_TRUE(o_database != nullptr); + EXPECT_TRUE(o_database->ok(true)); + + auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; + auto observer = std::make_shared(i_region, elemFieldName, fileControlOption); + EXPECT_THROW(o_region.register_mesh_modification_observer(observer), std::runtime_error); + cleanup_single_file(outFile); } - std::string outFile{"file.g"}; - std::string elemFieldName{"elem_field"}; - std::vector output_times; - std::vector output_steps; - std::vector modification_steps; -}; - -void do_output(Ioss::Region &o_region, - const OutputParams& params, - size_t step, - double& minTime, - int& maxStep, - bool& doneOutputAfterModification) -{ - if(params.output_steps[step]) { - if(!doneOutputAfterModification) { - minTime = params.output_times[step]; + TEST(TestDynamicWrite, create_subgroup_with_file_reopen) + { + std::string outFile("subgroupManyBlocks.g"); + std::string elemFieldName = "elem_field"; + + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + std::string file1 = + Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); + unlink(file1.c_str()); + + int numBlocks = util.parallel_size(); + if (numBlocks > 1) + GTEST_SKIP(); + + std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" + "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; + + Ioss::PropertyManager propertyManager; + + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); + + { + propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + Ioss::DatabaseIO *o_database = + Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + + Ioex::BaseDatabaseIO *ex_database = dynamic_cast(o_database); + EXPECT_TRUE(nullptr != ex_database); + + Ioss::Region o_region(o_database, "output_model"); + EXPECT_TRUE(o_database != nullptr); + EXPECT_TRUE(o_database->ok(true)); + EXPECT_TRUE(o_database->supports_internal_change_set()); + + ex_database->create_subgroup("GROUP_1"); } - write_transient(o_region, params.elemFieldName, params.output_times[step]); + { + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); + Ioss::DatabaseIO *o_database = + Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + + Ioex::BaseDatabaseIO *ex_database = dynamic_cast(o_database); + EXPECT_TRUE(nullptr != ex_database); + + Ioss::Region o_region(o_database, "output_model"); + EXPECT_TRUE(o_database != nullptr); + EXPECT_TRUE(o_database->ok(true)); + + EXPECT_TRUE(ex_database->supports_group()); - auto min_result = o_region.get_min_time(); - EXPECT_EQ(1, min_result.first); - EXPECT_NEAR(minTime, min_result.second, 1.0e-6); + // Group pointer is automatically at first child + ex_database->create_subgroup("GROUP_2"); - auto max_result = o_region.get_max_time(); - EXPECT_EQ(maxStep, max_result.first); - EXPECT_NEAR(params.output_times[step], max_result.second, 1.0e-6); + Ioss::NameList names = ex_database->groups_describe(false); + Ioss::NameList full_names = ex_database->groups_describe(true); - maxStep++; - doneOutputAfterModification = true; + std::vector gold_names{"/", "GROUP_1", "GROUP_2"}; + std::vector gold_full_names{"/", "/GROUP_1", "/GROUP_1/GROUP_2"}; + + EXPECT_EQ(gold_names, names); + EXPECT_EQ(gold_full_names, full_names); + } + + unlink(file1.c_str()); } -} -void run_topology_change(const Ioss::Region& i_region, - Ioss::Region &o_region, - const OutputParams& params) -{ - auto observer = o_region.get_mesh_modification_observer(); + TEST(TestDynamicWrite, create_subgroup_with_file_persistence_and_child_group) + { + std::string outFile("subgroupManyBlocks.g"); + std::string elemFieldName = "elem_field"; + + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + std::string file1 = + Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); + unlink(file1.c_str()); + + int numBlocks = util.parallel_size(); + if (numBlocks > 1) + GTEST_SKIP(); + + std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" + "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; + + Ioss::PropertyManager propertyManager; + + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); + + { + propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); + Ioss::DatabaseIO *o_database = + Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + + Ioex::BaseDatabaseIO *ex_database = dynamic_cast(o_database); + EXPECT_TRUE(nullptr != ex_database); + + Ioss::Region o_region(o_database, "output_model"); + EXPECT_TRUE(o_database != nullptr); + EXPECT_TRUE(o_database->ok(true)); - define_model(i_region, o_region); - write_model(i_region, o_region); + EXPECT_TRUE(ex_database->supports_group()); - define_transient(i_region, o_region, params.elemFieldName); + ex_database->create_subgroup("GROUP_1"); - auto numSteps = params.output_steps.size(); + // Group pointer is at "GROUP_1" ... "GROUP_2" is a child + ex_database->create_subgroup("GROUP_2"); - int maxStep = 1; + Ioss::NameList names = ex_database->groups_describe(false); + Ioss::NameList full_names = ex_database->groups_describe(true); - double minTime = numSteps > 0 ? params.output_times[0] : 0.0; - double maxTime = numSteps > 0 ? params.output_times[0] : 0.0; + std::vector gold_names{"/", "GROUP_1", "GROUP_2"}; + std::vector gold_full_names{"/", "/GROUP_1", "/GROUP_1/GROUP_2"}; - bool doneOutputAfterModification = true; + EXPECT_EQ(gold_names, names); + EXPECT_EQ(gold_full_names, full_names); + } + + unlink(file1.c_str()); + } - for(size_t i=0; iset_topology_modification(Ioss::TOPOLOGY_UNKNOWN); - maxStep = 1; - doneOutputAfterModification = false; + std::string outFile("subgroupManyBlocks.g"); + std::string elemFieldName = "elem_field"; + + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + std::string file1 = + Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); + unlink(file1.c_str()); + + int numBlocks = util.parallel_size(); + if (numBlocks > 1) + GTEST_SKIP(); + + std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" + "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; + + Ioss::PropertyManager propertyManager; + + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); + + { + propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); + Ioss::DatabaseIO *o_database = + Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + + Ioex::BaseDatabaseIO *ex_database = dynamic_cast(o_database); + EXPECT_TRUE(nullptr != ex_database); + + Ioss::Region o_region(o_database, "output_model"); + EXPECT_TRUE(o_database != nullptr); + EXPECT_TRUE(o_database->ok(true)); + + EXPECT_TRUE(ex_database->supports_group()); + + ex_database->create_subgroup("GROUP_1"); + + // Group pointer is reset to root group + EXPECT_TRUE(ex_database->open_root_group()); + ex_database->create_subgroup("GROUP_2"); + + Ioss::NameList names = ex_database->groups_describe(false); + Ioss::NameList full_names = ex_database->groups_describe(true); + + std::vector gold_names{"/", "GROUP_1", "GROUP_2"}; + std::vector gold_full_names{"/", "/GROUP_1", "/GROUP_2"}; + + EXPECT_EQ(gold_names, names); + EXPECT_EQ(gold_full_names, full_names); } - do_output(o_region, params, i, minTime, maxStep, doneOutputAfterModification); + unlink(file1.c_str()); } -} -void cleanup_simple_multi_files(const std::string &outFile) -{ - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + void run_topology_change_with_multiple_output(const Ioss::Region &i_region, + Ioss::Region &o_region1, Ioss::Region &o_region2, + const OutputParams ¶ms1, + const OutputParams ¶ms2) + { + ASSERT_EQ(params1.modification_steps, params2.modification_steps); + + auto observer1 = o_region1.get_mesh_modification_observer(); + auto observer2 = o_region2.get_mesh_modification_observer(); - std::string file1 = Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); - unlink(file1.c_str()); + define_model(i_region, o_region1); + write_model(i_region, o_region1); + define_transient(o_region1, params1.elemFieldName); - std::string file2 = Ioss::Utils::decode_filename(outFile + "-s0002", util.parallel_rank(), util.parallel_size()); - unlink(file2.c_str()); + define_model(i_region, o_region2); + write_model(i_region, o_region2); + define_transient(o_region2, params2.elemFieldName); - std::string file3 = Ioss::Utils::decode_filename(outFile + "-s0003", util.parallel_rank(), util.parallel_size()); - unlink(file3.c_str()); + auto numSteps = params1.output_steps.size(); - std::string file4 = Ioss::Utils::decode_filename(outFile + "-s0004", util.parallel_rank(), util.parallel_size()); - unlink(file4.c_str()); -} + int maxStep1 = 1; + int maxStep2 = 1; -void run_multi_file_simple_topology_change(const OutputParams& params) -{ - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + double minTime1 = numSteps > 0 ? params1.output_times[0] : 0.0; + double minTime2 = numSteps > 0 ? params2.output_times[0] : 0.0; + + bool doneOutputAfterModification1 = true; + bool doneOutputAfterModification2 = true; + + for (size_t i = 0; i < numSteps; i++) { + if (params1.modification_steps[i]) { + EXPECT_TRUE(params2.modification_steps[i]); + + observer1->set_topology_modification(Ioss::TOPOLOGY_UNKNOWN); + maxStep1 = 1; + maxStep2 = 1; + + EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer1->get_topology_modification()); + EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer2->get_topology_modification()); + + doneOutputAfterModification1 = false; + doneOutputAfterModification2 = false; + } - int numBlocks = util.parallel_size(); + do_output(o_region1, params1, i, minTime1, maxStep1, doneOutputAfterModification1); + do_output(o_region2, params2, i, minTime2, maxStep2, doneOutputAfterModification2); + } + } + + void run_single_file_simple_topology_change_with_multiple_output(const std::string &model, + const OutputParams ¶ms1, + const OutputParams ¶ms2) + { + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + + auto broker = Ioss::DynamicTopologyBroker::broker(); + broker->register_model(model); + + int numBlocks = util.parallel_size(); + + std::string meshDesc = get_many_block_mesh_desc(numBlocks); + + Ioss::PropertyManager propertyManager; + + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); + + propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - std::string meshDesc = get_many_block_mesh_desc(numBlocks); + Ioss::DatabaseIO *o_database1 = + Ioss::IOFactory::create("exodus", params1.outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region o_region1(o_database1, "region1"); + EXPECT_TRUE(o_database1 != nullptr); + EXPECT_TRUE(o_database1->ok(true)); + EXPECT_TRUE(o_database1->supports_internal_change_set()); - Ioss::PropertyManager propertyManager; + auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; + auto observer1 = std::make_shared(i_region, params1.elemFieldName, fileControlOption); + broker->register_observer(model, observer1, o_region1); - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + Ioss::DatabaseIO *o_database2 = + Ioss::IOFactory::create("exodus", params2.outFile, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region o_region2(o_database2, "region2"); + EXPECT_TRUE(o_database2 != nullptr); + EXPECT_TRUE(o_database2->ok(true)); + EXPECT_TRUE(o_database2->supports_internal_change_set()); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", params.outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); + auto observer2 = std::make_shared(i_region, params2.elemFieldName, fileControlOption); + broker->register_observer(model, observer2, o_region2); - auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_MULTI_FILE; - auto observer = std::make_shared(i_region, params.elemFieldName, fileControlOption); - o_region.register_mesh_modification_observer(observer); + run_topology_change_with_multiple_output(i_region, o_region1, o_region2, params1, params2); - run_topology_change(i_region, o_region, params); -} + test_internal_file_change_set_names(o_database1); + test_internal_file_change_set_names(o_database2); + } -TEST(TestDynamicWrite, multi_file_simple_topology_modification) -{ - std::string outFile("multiFileManyBlocks.g"); - std::string elemFieldName = "elem_field"; + TEST(TestDynamicWrite, single_file_simple_topology_modification_with_multiple_output) + { + std::string outFile1("singleFileManyBlocks1.g"); + std::string outFile2("singleFileManyBlocks2.g"); + std::string elemFieldName = "elem_field"; + std::string model = "multiple-output"; - OutputParams params(outFile, elemFieldName); + OutputParams params1(outFile1, elemFieldName); - std::vector output_steps{true , true, true, true, true, true}; - std::vector modification_steps{false, true, false, true, true, false}; + params1.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, false, false) + .add(3.0, true, true) + .add(4.0, true, false) + .add(5.0, true, true); - params.set_data(output_steps, modification_steps); + OutputParams params2(outFile2, elemFieldName); - cleanup_simple_multi_files(outFile); - run_multi_file_simple_topology_change(params); - cleanup_simple_multi_files(outFile); -} + params2.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, false, true) + .add(4.0, true, false) + .add(5.0, true, true); + + cleanup_single_file(outFile1); + cleanup_single_file(outFile2); + run_single_file_simple_topology_change_with_multiple_output(model, params1, params2); + cleanup_single_file(outFile1); + cleanup_single_file(outFile2); + } -void cleanup_cyclic_multi_files(const std::string &outFile) -{ - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + TEST(TestDynamicWrite, same_model_triggers_same_modification_for_all_observers) + { + Ioss::Init::Initializer io; + Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); - std::string file1 = Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); - unlink(file1.c_str()); + std::string outFile1("sameModelManyBlocks1.g"); + std::string outFile2("sameModelManyBlocks2.g"); + std::string elemFieldName("elem_field"); + std::string model("same-model"); - std::string file2 = Ioss::Utils::decode_filename(outFile + "-A", util.parallel_rank(), util.parallel_size()); - unlink(file2.c_str()); + auto broker = Ioss::DynamicTopologyBroker::broker(); + broker->register_model(model); - std::string file3 = Ioss::Utils::decode_filename(outFile + "-B", util.parallel_rank(), util.parallel_size()); - unlink(file3.c_str()); + std::string file1 = + Ioss::Utils::decode_filename(outFile1, util.parallel_rank(), util.parallel_size()); + std::string file2 = + Ioss::Utils::decode_filename(outFile2, util.parallel_rank(), util.parallel_size()); - std::string file4 = Ioss::Utils::decode_filename(outFile + "-C", util.parallel_rank(), util.parallel_size()); - unlink(file4.c_str()); -} + unlink(file1.c_str()); + unlink(file2.c_str()); -void run_multi_file_cyclic_topology_change(const OutputParams& params) -{ - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + int numBlocks = util.parallel_size(); + if (numBlocks > 1) + GTEST_SKIP(); - int numBlocks = util.parallel_size(); + std::string meshDesc = get_many_block_mesh_desc(numBlocks); - std::string meshDesc = get_many_block_mesh_desc(numBlocks); + Ioss::PropertyManager propertyManager; - Ioss::PropertyManager propertyManager; + Ioss::DatabaseIO *i_database = Ioss::IOFactory::create( + "textmesh", meshDesc, Ioss::READ_MODEL, Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region i_region(i_database, "input_model"); + EXPECT_TRUE(i_database != nullptr); + EXPECT_TRUE(i_database->ok(true)); - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + { + propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); + propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", params.outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); + Ioss::DatabaseIO *o_database1 = + Ioss::IOFactory::create("exodus", outFile1, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region o_region1(o_database1, "region1"); + EXPECT_TRUE(o_database1 != nullptr); + EXPECT_TRUE(o_database1->ok(true)); + EXPECT_TRUE(o_database1->supports_internal_change_set()); - auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_MULTI_FILE; - auto observer = std::make_shared(i_region, params.elemFieldName, fileControlOption); - o_region.register_mesh_modification_observer(observer); + auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; + auto observer1 = std::make_shared(i_region, elemFieldName, fileControlOption); + broker->register_observer(model, observer1, o_region1); - o_region.set_file_cyclic_count(3); - run_topology_change(i_region, o_region, params); -} + Ioss::DatabaseIO *o_database2 = + Ioss::IOFactory::create("exodus", outFile2, Ioss::WRITE_RESULTS, + Ioss::ParallelUtils::comm_world(), propertyManager); + Ioss::Region o_region2(o_database2, "region2"); + EXPECT_TRUE(o_database2 != nullptr); + EXPECT_TRUE(o_database2->ok(true)); + EXPECT_TRUE(o_database2->supports_internal_change_set()); -TEST(TestDynamicWrite, multi_file_cyclic_topology_modification) -{ - std::string outFile("cyclicMultiFileManyBlocks.g"); - std::string elemFieldName = "elem_field"; + auto observer2 = std::make_shared(i_region, elemFieldName, fileControlOption); + broker->register_observer(model, observer2, o_region2); - OutputParams params(outFile, elemFieldName); + EXPECT_EQ(Ioss::TOPOLOGY_SAME, observer1->get_topology_modification()); + EXPECT_EQ(Ioss::TOPOLOGY_SAME, observer2->get_topology_modification()); - std::vector output_times{0.0 , 0.5 , 1.5 , 1.75, 2.0 , 3.0}; - std::vector output_steps{true , true, true , true, true, true }; - std::vector modification_steps{false, true, false, true, true, false}; + observer1->set_topology_modification(Ioss::TOPOLOGY_UNKNOWN); - params.set_data(output_times, output_steps, modification_steps); + EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer1->get_topology_modification()); + EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer2->get_topology_modification()); + } - cleanup_cyclic_multi_files(outFile); - run_multi_file_cyclic_topology_change(params); - cleanup_cyclic_multi_files(outFile); -} + unlink(file1.c_str()); + unlink(file2.c_str()); + } -void fill_group_gold_names(const int numFileGroups, - std::vector& gold_names, - std::vector& gold_full_names) -{ - gold_names.clear(); - gold_full_names.clear(); + void test_single_file_simple_topology_change_data(Ioss::Region &i_region, + const std::string &elemFieldName, int gold_step, + double gold_time) + { + i_region.begin_state(gold_step); + for (Ioss::ElementBlock *i_eb : i_region.get_element_blocks()) { + size_t num_elem = i_eb->get_property("entity_count").get_int(); - gold_names.push_back("/"); - gold_full_names.push_back("/"); + std::vector field_data(num_elem); + std::vector elem_ids; - for(int i=1; i<=numFileGroups; i++) { - std::ostringstream oss; - oss << Ioss::DynamicTopologyFileControl::group_prefix(); - oss << i; + i_eb->get_field_data(elemFieldName, field_data); + i_eb->get_field_data("ids", elem_ids); - gold_names.push_back(oss.str()); - gold_full_names.push_back("/" + oss.str()); + for (size_t i = 0; i < elem_ids.size(); i++) { + double gold_value = (double)elem_ids[i] + 100 * gold_time; + EXPECT_NEAR(gold_value, field_data[i], 1.0e-6); + } + } } -} -void test_group_names(Ioss::DatabaseIO *database) -{ - Ioss::NameList names = database->groups_describe(false); - Ioss::NameList full_names = database->groups_describe(true); + void read_and_test_single_file_simple_topology_change(const OutputParams ¶ms) + { + Ioss::PropertyManager propertyManager; + auto i_region = construct_region(params, propertyManager, Ioss::READ_RESTART, "input_model"); + Ioss::DatabaseIO *i_database = i_region->get_database(); + + test_internal_file_change_set_names(i_database); - std::vector gold_names; - std::vector gold_full_names; + EXPECT_TRUE(i_database->supports_internal_change_set()); - fill_group_gold_names(database->num_child_group(), gold_names, gold_full_names); + auto numSteps = params.output_steps.size(); - EXPECT_EQ(gold_names, names); - EXPECT_EQ(gold_full_names, full_names); -} + int numMods = 0; -void cleanup_single_file(const std::string &outFile) -{ - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + int maxStep = 1; - std::string file1 = Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); - unlink(file1.c_str()); -} + double minTime = numSteps > 0 ? params.output_times[0] : 0.0; + double maxTime = numSteps > 0 ? params.output_times[0] : 0.0; -void run_single_file_simple_topology_change(const OutputParams& params) -{ - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + bool doneOutputAfterModification = true; - int numBlocks = util.parallel_size(); + Ioss::NameList names = i_database->internal_change_set_describe(false); - std::string meshDesc = get_many_block_mesh_desc(numBlocks); + for (size_t i = 0; i < numSteps; i++) { + maxTime = params.output_times[i]; - Ioss::PropertyManager propertyManager; + for (size_t j = i + 1; j < numSteps; j++) { + if (params.modification_steps[j]) { + maxTime = params.output_times[j - 1]; + break; + } - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + maxTime = params.output_times[j]; + } - propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", params.outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); + if (params.modification_steps[i]) { + numMods++; + maxStep = 1; - auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; - auto observer = std::make_shared(i_region, params.elemFieldName, fileControlOption); - o_region.register_mesh_modification_observer(observer); + EXPECT_TRUE(i_region->load_internal_change_set_mesh(names[numMods])); - run_topology_change(i_region, o_region, params); - test_group_names(o_database); -} + doneOutputAfterModification = false; + } -TEST(TestDynamicWrite, single_file_simple_topology_modification) -{ - std::string outFile("singleFileManyBlocks.g"); - std::string elemFieldName = "elem_field"; + if (params.output_steps[i]) { + if (!doneOutputAfterModification) { + minTime = params.output_times[i]; + } + auto min_result = i_region->get_min_time(); + EXPECT_EQ(1, min_result.first); + EXPECT_NEAR(minTime, min_result.second, 1.0e-6); + test_single_file_simple_topology_change_data(*i_region, params.elemFieldName, 1, minTime); + + if ((((i + 1) < numSteps) && params.modification_steps[i + 1]) || (i == (numSteps - 1))) { + auto max_result = i_region->get_max_time(); + EXPECT_EQ(maxStep, max_result.first); + EXPECT_NEAR(maxTime, max_result.second, 1.0e-6); + + test_single_file_simple_topology_change_data(*i_region, params.elemFieldName, maxStep, + maxTime); + } + + maxStep++; + doneOutputAfterModification = true; + } + } + } - OutputParams params(outFile, elemFieldName); + TEST(TestDynamicRead, single_file_simple_topology_modification) + { + std::string outFile("singleFileManyBlocks.g"); + std::string elemFieldName = "elem_field"; - params.add(0.0, true, false) + OutputParams params(outFile, elemFieldName); + + params.add(0.0, true, false) .add(1.0, true, true) .add(2.0, true, false) .add(3.0, true, true) .add(4.0, true, true) .add(5.0, true, false); - cleanup_single_file(outFile); - run_single_file_simple_topology_change(params); - cleanup_single_file(outFile); -} - -TEST(TestDynamicWrite, single_file_groups_not_enabled) -{ - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); - - int numBlocks = util.parallel_size(); - if(numBlocks > 1) GTEST_SKIP(); - - std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" - "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; - - Ioss::PropertyManager propertyManager; - - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); - - std::string outFile("singleFileGroupsNotEnabled.g"); - std::string elemFieldName = "elem_field"; - cleanup_single_file(outFile); - - // Need the line below to allow this to pass - // propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); - - auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; - auto observer = std::make_shared(i_region, elemFieldName, fileControlOption); - EXPECT_THROW(o_region.register_mesh_modification_observer(observer), std::runtime_error); - cleanup_single_file(outFile); -} - -TEST(TestDynamicWrite, create_subgroup_with_file_reopen) -{ - std::string outFile("subgroupManyBlocks.g"); - std::string elemFieldName = "elem_field"; - - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); - - std::string file1 = Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); - unlink(file1.c_str()); - - int numBlocks = util.parallel_size(); - if(numBlocks > 1) GTEST_SKIP(); - - std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" - "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; - - Ioss::PropertyManager propertyManager; - - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + cleanup_single_file(outFile); + run_single_file_simple_topology_change(params); + read_and_test_single_file_simple_topology_change(params); + cleanup_single_file(outFile); + } + std::tuple read_and_locate_db_state(const OutputParams ¶ms, + double targetTime) { - propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); - o_database->create_subgroup("GROUP_1"); + Ioss::PropertyManager propertyManager; + auto region = construct_region(params, propertyManager, Ioss::READ_RESTART, "input_model"); + return region->locate_db_state(targetTime); } + void run_single_file_locate_db_time_state(const std::string &outFile, const OutputParams ¶ms, + double targetTime, const std::string &goldSet, + int goldState, double goldTime) { - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); + cleanup_single_file(outFile); + run_single_file_simple_topology_change(params); - // Group pointer is automatically at first child - o_database->create_subgroup("GROUP_2"); + std::string changeSet; + int nearestState; + double nearestTime; - Ioss::NameList names = o_database->groups_describe(false); - Ioss::NameList full_names = o_database->groups_describe(true); + std::tie(changeSet, nearestState, nearestTime) = read_and_locate_db_state(params, targetTime); - std::vector gold_names{"/", "GROUP_1", "GROUP_2"}; - std::vector gold_full_names{"/", "/GROUP_1", "/GROUP_1/GROUP_2"}; + EXPECT_EQ(goldSet, changeSet); + EXPECT_EQ(goldState, nearestState); + EXPECT_EQ(goldTime, nearestTime); - EXPECT_EQ(gold_names, names); - EXPECT_EQ(gold_full_names, full_names); + cleanup_single_file(outFile); } - unlink(file1.c_str()); -} + TEST(TestDynamicRead, single_file_locate_db_time_state) + { + std::string outFile("singleFileManyBlocksPositiveTime.g"); + std::string elemFieldName = "elem_field"; -TEST(TestDynamicWrite, create_subgroup_with_file_persistence_and_child_group) -{ - std::string outFile("subgroupManyBlocks.g"); - std::string elemFieldName = "elem_field"; + OutputParams params(outFile, elemFieldName); - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); - std::string file1 = Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); - unlink(file1.c_str()); + double targetTime = 3.5; - int numBlocks = util.parallel_size(); - if(numBlocks > 1) GTEST_SKIP(); + std::string goldSet = Ioss::DynamicTopologyFileControl::get_internal_file_change_set_name(3); + int goldState = 1; + double goldTime = 3.0; - std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" - "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; + run_single_file_locate_db_time_state(outFile, params, targetTime, goldSet, goldState, goldTime); + } - Ioss::PropertyManager propertyManager; + TEST(TestDynamicRead, single_file_locate_db_time_state_all_negative_time) + { + std::string outFile("singleFileManyBlocksNegativeTime.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); + + params.add(-5.0, true, false) + .add(-4.0, true, true) + .add(-3.0, true, false) + .add(-2.0, true, true) + .add(-1.0, true, true) + .add(-0.0, true, false); + + double targetTime = -1.5; - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + std::string goldSet = Ioss::DynamicTopologyFileControl::get_internal_file_change_set_name(4); + int goldState = 1; + double goldTime = -1.0; + run_single_file_locate_db_time_state(outFile, params, targetTime, goldSet, goldState, goldTime); + } + + void run_multi_file_locate_db_time_state(const std::string &outFile, const OutputParams ¶ms, + double targetTime, const std::string &goldFile, + int goldState, double goldTime) { - propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); + if (params.cyclicCount > 0) { + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + } + else { + cleanup_linear_multi_files(outFile, params.output_times.size()); + } - o_database->create_subgroup("GROUP_1"); + run_multi_file_topology_change(params); - // Group pointer is at "GROUP_1" ... "GROUP_2" is a child - o_database->create_subgroup("GROUP_2"); + std::string file; + int nearestState; + double nearestTime; - Ioss::NameList names = o_database->groups_describe(false); - Ioss::NameList full_names = o_database->groups_describe(true); + std::tie(file, nearestState, nearestTime) = read_and_locate_db_state(params, targetTime); - std::vector gold_names{"/", "GROUP_1", "GROUP_2"}; - std::vector gold_full_names{"/", "/GROUP_1", "/GROUP_1/GROUP_2"}; + EXPECT_EQ(goldFile, file); + EXPECT_EQ(goldState, nearestState); + EXPECT_EQ(goldTime, nearestTime); - EXPECT_EQ(gold_names, names); - EXPECT_EQ(gold_full_names, full_names); + if (params.cyclicCount > 0) { + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + } + else { + cleanup_linear_multi_files(outFile, params.output_times.size()); + } } - unlink(file1.c_str()); -} + TEST(TestDynamicRead, linear_multi_file_locate_db_time_state) + { + std::string outFile("linearMultiFileManyBlocksPositiveTime.g"); + std::string elemFieldName = "elem_field"; -TEST(TestDynamicWrite, create_subgroup_with_file_persistence_and_no_child_group) -{ - std::string outFile("subgroupManyBlocks.g"); - std::string elemFieldName = "elem_field"; + OutputParams params(outFile, elemFieldName); - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); - std::string file1 = Ioss::Utils::decode_filename(outFile, util.parallel_rank(), util.parallel_size()); - unlink(file1.c_str()); + double targetTime = 3.5; - int numBlocks = util.parallel_size(); - if(numBlocks > 1) GTEST_SKIP(); + std::string goldFile = + Ioss::DynamicTopologyFileControl::get_linear_database_filename(outFile, 3); + int goldState = 1; + double goldTime = 3.0; - std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8,block_1" - "|coordinates:0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0,1,1"; + run_multi_file_locate_db_time_state(outFile, params, targetTime, goldFile, goldState, goldTime); + } + + TEST(TestDynamicRead, cyclic_multi_file_locate_db_time_state) + { + std::string outFile("cyclicMultiFileManyBlocksPositiveTime.g"); + std::string elemFieldName = "elem_field"; - Ioss::PropertyManager propertyManager; + OutputParams params(outFile, elemFieldName); - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + std::vector output_times{0.0, 0.5, 1.5, 1.75, 2.0, 3.0}; + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + // -A -B -B -C -B -B + params.set_data(output_times, output_steps, modification_steps); + params.set_cyclic_count(3); + + double targetTime = 1.95; + + std::string goldFile = Ioss::DynamicTopologyFileControl::get_cyclic_database_filename( + outFile, params.cyclicCount, 2); + int goldState = 1; + double goldTime = 2.0; + + run_multi_file_locate_db_time_state(outFile, params, targetTime, goldFile, goldState, goldTime); + } + + std::tuple read_and_locate_db_max_time(const OutputParams ¶ms) { - propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - Ioss::DatabaseIO *o_database = Ioss::IOFactory::create("exodus", outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region(o_database, "output_model"); - EXPECT_TRUE(o_database != nullptr); - EXPECT_TRUE(o_database->ok(true)); + Ioss::PropertyManager propertyManager; - o_database->create_subgroup("GROUP_1"); + std::string outFile = params.outFile; - // Group pointer is reset to root group - EXPECT_TRUE(o_database->open_root_group()); - o_database->create_subgroup("GROUP_2"); + if (params.cyclicCount > 0) { + outFile = Ioss::DynamicTopologyFileControl::get_cyclic_database_filename( + params.outFile, params.cyclicCount, 0); + propertyManager.add(Ioss::Property("base_filename", params.outFile)); + } - Ioss::NameList names = o_database->groups_describe(false); - Ioss::NameList full_names = o_database->groups_describe(true); + Ioss::DatabaseIO *db = Ioss::IOFactory::create( + "exodus", outFile, Ioss::READ_RESTART, Ioss::ParallelUtils::comm_world(), propertyManager); - std::vector gold_names{"/", "GROUP_1", "GROUP_2"}; - std::vector gold_full_names{"/", "/GROUP_1", "/GROUP_2"}; + Ioss::Region region(db, "input_model"); + region.set_file_cyclic_count(params.cyclicCount); - EXPECT_EQ(gold_names, names); - EXPECT_EQ(gold_full_names, full_names); - } + EXPECT_TRUE(db != nullptr); + EXPECT_TRUE(db->ok(true)); - unlink(file1.c_str()); -} + return region.get_db_max_time(); + } + TEST(TestDynamicRead, single_file_locate_db_max_time) + { + std::string outFile("singleFileManyBlocksMaxTime.g"); + std::string elemFieldName = "elem_field"; -void run_topology_change_with_multiple_output(const Ioss::Region& i_region, - Ioss::Region &o_region1, - Ioss::Region &o_region2, - const OutputParams& params1, - const OutputParams& params2) -{ - ASSERT_EQ(params1.modification_steps, params2.modification_steps); + OutputParams params(outFile, elemFieldName); - auto observer1 = o_region1.get_mesh_modification_observer(); - auto observer2 = o_region2.get_mesh_modification_observer(); + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); - define_model(i_region, o_region1); - write_model(i_region, o_region1); - define_transient(i_region, o_region1, params1.elemFieldName); + cleanup_single_file(outFile); + run_single_file_simple_topology_change(params); - define_model(i_region, o_region2); - write_model(i_region, o_region2); - define_transient(i_region, o_region2, params2.elemFieldName); + std::string maxSet; + int maxState; + double maxTime; - auto numSteps = params1.output_steps.size(); + std::tie(maxSet, maxState, maxTime) = read_and_locate_db_max_time(params); - int maxStep1 = 1; - int maxStep2 = 1; + std::string goldSet = Ioss::DynamicTopologyFileControl::get_internal_file_change_set_name(4); + int goldState = 2; + double goldTime = 5.0; - double minTime1 = numSteps > 0 ? params1.output_times[0] : 0.0; - double minTime2 = numSteps > 0 ? params2.output_times[0] : 0.0; + EXPECT_EQ(goldSet, maxSet); + EXPECT_EQ(goldState, maxState); + EXPECT_EQ(goldTime, maxTime); - bool doneOutputAfterModification1 = true; - bool doneOutputAfterModification2 = true; + cleanup_single_file(outFile); + } - for(size_t i=0; iset_topology_modification(Ioss::TOPOLOGY_UNKNOWN); - maxStep1 = 1; - maxStep2 = 1; + OutputParams params(outFile, elemFieldName); - EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer1->get_topology_modification()); - EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer2->get_topology_modification()); + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); - doneOutputAfterModification1 = false; - doneOutputAfterModification2 = false; - } + cleanup_linear_multi_files(outFile, params.output_times.size()); + run_multi_file_topology_change(params); + + std::string maxFile; + int maxState; + double maxTime; - do_output(o_region1, params1, i, minTime1, maxStep1, doneOutputAfterModification1); - do_output(o_region2, params2, i, minTime2, maxStep2, doneOutputAfterModification2); + std::tie(maxFile, maxState, maxTime) = read_and_locate_db_max_time(params); + + std::string goldFile = + Ioss::DynamicTopologyFileControl::get_linear_database_filename(outFile, 4); + int goldState = 2; + double goldTime = 5.0; + + EXPECT_EQ(goldFile, maxFile); + EXPECT_EQ(goldState, maxState); + EXPECT_EQ(goldTime, maxTime); + + cleanup_linear_multi_files(outFile, params.output_times.size()); } -} - -void run_single_file_simple_topology_change_with_multiple_output(const std::string& model, - const OutputParams& params1, - const OutputParams& params2) -{ - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); - - auto broker = Ioss::DynamicTopologyBroker::broker(); - broker->register_model(model); - - int numBlocks = util.parallel_size(); - std::string meshDesc = get_many_block_mesh_desc(numBlocks); - - Ioss::PropertyManager propertyManager; - - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); - - propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); - - Ioss::DatabaseIO *o_database1 = Ioss::IOFactory::create("exodus", params1.outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region1(o_database1, "region1"); - EXPECT_TRUE(o_database1 != nullptr); - EXPECT_TRUE(o_database1->ok(true)); - - auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; - auto observer1 = std::make_shared(i_region, params1.elemFieldName, fileControlOption); - broker->register_observer(model, observer1, o_region1); - - Ioss::DatabaseIO *o_database2 = Ioss::IOFactory::create("exodus", params2.outFile, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region2(o_database2, "region2"); - EXPECT_TRUE(o_database2 != nullptr); - EXPECT_TRUE(o_database2->ok(true)); - - auto observer2 = std::make_shared(i_region, params2.elemFieldName, fileControlOption); - broker->register_observer(model, observer2, o_region2); - - run_topology_change_with_multiple_output(i_region, o_region1, o_region2, params1, params2); - - test_group_names(o_database1); - test_group_names(o_database2); -} - -TEST(TestDynamicWrite, single_file_simple_topology_modification_with_multiple_output) -{ - std::string outFile1("singleFileManyBlocks1.g"); - std::string outFile2("singleFileManyBlocks2.g"); - std::string elemFieldName = "elem_field"; - std::string model = "multiple-output"; - - OutputParams params1(outFile1, elemFieldName); - - params1.add(0.0, true , false) - .add(1.0, true , true) - .add(2.0, false, false) - .add(3.0, true , true) - .add(4.0, true , false) - .add(5.0, true , true); - - OutputParams params2(outFile2, elemFieldName); - - params2.add(0.0, true , false) - .add(1.0, true , true) - .add(2.0, true , false) - .add(3.0, false, true) - .add(4.0, true , false) - .add(5.0, true , true); - - cleanup_single_file(outFile1); - cleanup_single_file(outFile2); - run_single_file_simple_topology_change_with_multiple_output(model, params1, params2); - cleanup_single_file(outFile1); - cleanup_single_file(outFile2); -} - -TEST(TestDynamicWrite, same_model_triggers_same_modification_for_all_observers) -{ - Ioss::Init::Initializer io; - Ioss::ParallelUtils util(Ioss::ParallelUtils::comm_world()); - - std::string outFile1("sameModelManyBlocks1.g"); - std::string outFile2("sameModelManyBlocks2.g"); - std::string elemFieldName("elem_field"); - std::string model("same-model"); - - auto broker = Ioss::DynamicTopologyBroker::broker(); - broker->register_model(model); - - std::string file1 = Ioss::Utils::decode_filename(outFile1, util.parallel_rank(), util.parallel_size()); - std::string file2 = Ioss::Utils::decode_filename(outFile2, util.parallel_rank(), util.parallel_size()); - - unlink(file1.c_str()); - unlink(file2.c_str()); + TEST(TestDynamicRead, cyclic_multi_file_locate_db_max_time) + { + std::string outFile("cyclicMultiFileManyBlocksMaxTime.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); + + std::vector output_times{0.0, 0.5, 1.5, 1.75, 2.0, 3.0}; + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + // -A -B -B -C -B -B - int numBlocks = util.parallel_size(); - if(numBlocks > 1) GTEST_SKIP(); + params.set_data(output_times, output_steps, modification_steps); + params.set_cyclic_count(3); - std::string meshDesc = get_many_block_mesh_desc(numBlocks); + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + run_multi_file_topology_change(params); - Ioss::PropertyManager propertyManager; - - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("textmesh", meshDesc, Ioss::READ_MODEL, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + std::string maxFile; + int maxState; + double maxTime; + std::tie(maxFile, maxState, maxTime) = read_and_locate_db_max_time(params); + + std::string goldFile = Ioss::DynamicTopologyFileControl::get_cyclic_database_filename( + outFile, params.cyclicCount, 2); // -B + int goldState = 2; + double goldTime = 3.0; + + EXPECT_EQ(goldFile, maxFile); + EXPECT_EQ(goldState, maxState); + EXPECT_EQ(goldTime, maxTime); + + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + } + + std::tuple read_and_locate_db_min_time(const OutputParams ¶ms) { - propertyManager.add(Ioss::Property("ENABLE_FILE_GROUPS", 1)); - propertyManager.add(Ioss::Property("APPEND_OUTPUT", Ioss::DB_APPEND_GROUP)); + Ioss::PropertyManager propertyManager; + auto region = construct_region(params, propertyManager, Ioss::READ_RESTART, "input_model"); - Ioss::DatabaseIO *o_database1 = Ioss::IOFactory::create("exodus", outFile1, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region1(o_database1, "region1"); - EXPECT_TRUE(o_database1 != nullptr); - EXPECT_TRUE(o_database1->ok(true)); + return region->get_db_min_time(); + } - auto fileControlOption = Ioss::FileControlOption::CONTROL_AUTO_GROUP_FILE; - auto observer1 = std::make_shared(i_region, elemFieldName, fileControlOption); - broker->register_observer(model, observer1, o_region1); + TEST(TestDynamicRead, single_file_locate_db_min_time) + { + std::string outFile("singleFileManyBlocksMinTime.g"); + std::string elemFieldName = "elem_field"; - Ioss::DatabaseIO *o_database2 = Ioss::IOFactory::create("exodus", outFile2, Ioss::WRITE_RESULTS, - Ioss::ParallelUtils::comm_world(), - propertyManager); - Ioss::Region o_region2(o_database2, "region2"); - EXPECT_TRUE(o_database2 != nullptr); - EXPECT_TRUE(o_database2->ok(true)); + OutputParams params(outFile, elemFieldName); - auto observer2 = std::make_shared(i_region, elemFieldName, fileControlOption); - broker->register_observer(model, observer2, o_region2); + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); + + cleanup_single_file(outFile); + run_single_file_simple_topology_change(params); + + std::string minSet; + int minState; + double minTime; + + std::tie(minSet, minState, minTime) = read_and_locate_db_min_time(params); - EXPECT_EQ(Ioss::TOPOLOGY_SAME, observer1->get_topology_modification()); - EXPECT_EQ(Ioss::TOPOLOGY_SAME, observer2->get_topology_modification()); + std::string goldSet = Ioss::DynamicTopologyFileControl::get_internal_file_change_set_name(1); + int goldState = 1; + double goldTime = 0.0; - observer1->set_topology_modification(Ioss::TOPOLOGY_UNKNOWN); + EXPECT_EQ(goldSet, minSet); + EXPECT_EQ(goldState, minState); + EXPECT_EQ(goldTime, minTime); - EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer1->get_topology_modification()); - EXPECT_EQ(Ioss::TOPOLOGY_UNKNOWN, observer2->get_topology_modification()); + cleanup_single_file(outFile); } - unlink(file1.c_str()); - unlink(file2.c_str()); -} + TEST(TestDynamicRead, linear_multi_file_locate_db_min_time) + { + std::string outFile("linearMultiFileManyBlocksMinTime.g"); + std::string elemFieldName = "elem_field"; -void test_single_file_simple_topology_change_data(Ioss::Region& i_region, const std::string& elemFieldName, - int gold_step, double gold_time) -{ - i_region.begin_state(gold_step); - for (Ioss::ElementBlock *i_eb : i_region.get_element_blocks()) { - size_t num_elem = i_eb->get_property("entity_count").get_int(); + OutputParams params(outFile, elemFieldName); - std::vector field_data(num_elem); - std::vector elem_ids; + params.add(0.0, true, false) + .add(1.0, true, true) + .add(2.0, true, false) + .add(3.0, true, true) + .add(4.0, true, true) + .add(5.0, true, false); - i_eb->get_field_data(elemFieldName, field_data); - i_eb->get_field_data("ids", elem_ids); + cleanup_linear_multi_files(outFile, params.output_times.size()); + run_multi_file_topology_change(params); - for (size_t i = 0; i < elem_ids.size(); i++) { - double gold_value = (double)elem_ids[i] + 100*gold_time; - EXPECT_NEAR(gold_value, field_data[i], 1.0e-6); - } + std::string minFile; + int minState; + double minTime; + + std::tie(minFile, minState, minTime) = read_and_locate_db_min_time(params); + + std::string goldFile = + Ioss::DynamicTopologyFileControl::get_linear_database_filename(outFile, 1); + int goldState = 1; + double goldTime = 0.0; + + EXPECT_EQ(goldFile, minFile); + EXPECT_EQ(goldState, minState); + EXPECT_EQ(goldTime, minTime); + + cleanup_linear_multi_files(outFile, params.output_times.size()); } -} -void read_and_test_single_file_simple_topology_change(const OutputParams& params) -{ - Ioss::PropertyManager propertyManager; + TEST(TestDynamicRead, cyclic_multi_file_locate_db_min_time) + { + std::string outFile("cyclicMultiFileManyBlocksMinTime.g"); + std::string elemFieldName = "elem_field"; - Ioss::DatabaseIO *i_database = Ioss::IOFactory::create("exodus", params.outFile, Ioss::READ_RESTART, - Ioss::ParallelUtils::comm_world(), - propertyManager); + OutputParams params(outFile, elemFieldName); - test_group_names(i_database); + std::vector output_times{0.0, 0.5, 1.5, 1.75, 2.0, 3.0}; + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + // -A -B -B -C -B -B - Ioss::Region i_region(i_database, "input_model"); - EXPECT_TRUE(i_database != nullptr); - EXPECT_TRUE(i_database->ok(true)); + params.set_data(output_times, output_steps, modification_steps); + params.set_cyclic_count(3); - auto numSteps = params.output_steps.size(); + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + run_multi_file_topology_change(params); - int numMods = 0; + std::string minFile; + int minState; + double minTime; - int maxStep = 1; + std::tie(minFile, minState, minTime) = read_and_locate_db_min_time(params); - double minTime = numSteps > 0 ? params.output_times[0] : 0.0; - double maxTime = numSteps > 0 ? params.output_times[0] : 0.0; + std::string goldFile = Ioss::DynamicTopologyFileControl::get_cyclic_database_filename( + outFile, params.cyclicCount, 1); + int goldState = 1; + double goldTime = 0.0; - bool doneOutputAfterModification = true; + EXPECT_EQ(goldFile, minFile); + EXPECT_EQ(goldState, minState); + EXPECT_EQ(goldTime, minTime); - Ioss::NameList names = i_database->groups_describe(false); + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + } - for(size_t i=0; ipopulate_change_sets(); - if((((i+1) < numSteps) && params.modification_steps[i+1]) || (i == (numSteps-1))) { - auto max_result = i_region.get_max_time(); - EXPECT_EQ(maxStep, max_result.first); - EXPECT_NEAR(maxTime, max_result.second, 1.0e-6); + EXPECT_EQ(Ioss::CHANGE_SET_INTERNAL_FILES, changeSet->database_format()); - test_single_file_simple_topology_change_data(i_region, params.elemFieldName, maxStep, maxTime); - } + std::vector gold_names; + std::vector gold_full_names; - maxStep++; - doneOutputAfterModification = true; - } + unsigned numMods = get_num_change_sets(params); + + fill_internal_file_change_set_gold_names(numMods, gold_names, gold_full_names); + + EXPECT_EQ(gold_names, changeSet->names()); } -} -TEST(TestDynamicRead, single_file_simple_topology_modification) -{ - std::string outFile("singleFileManyBlocks.g"); - std::string elemFieldName = "elem_field"; + TEST(TestChangeSet, single_file_simple_topology_modification) + { + std::string outFile("singleFileManyBlocksChangeSet.g"); + std::string elemFieldName = "elem_field"; - OutputParams params(outFile, elemFieldName); + OutputParams params(outFile, elemFieldName); - params.add(0.0, true, false) + params.add(0.0, true, false) .add(1.0, true, true) .add(2.0, true, false) .add(3.0, true, true) .add(4.0, true, true) .add(5.0, true, false); - cleanup_single_file(outFile); - run_single_file_simple_topology_change(params); - read_and_test_single_file_simple_topology_change(params); - cleanup_single_file(outFile); -} + cleanup_single_file(outFile); + run_single_file_simple_topology_change(params); + read_and_test_single_file_topology_change_set(params); + cleanup_single_file(outFile); + } + + void read_and_test_cyclic_multi_file_topology_change_set(const OutputParams ¶ms) + { + ASSERT_TRUE(params.cyclicCount > 0); + + Ioss::PropertyManager propertyManager; + auto i_region = construct_region(params, propertyManager, Ioss::READ_RESTART, "input_model"); -} + auto changeSet = Ioss::ChangeSetFactory::create(i_region.get()); + changeSet->populate_change_sets(); + EXPECT_EQ(Ioss::CHANGE_SET_CYCLIC_MULTI_FILES, changeSet->database_format()); + std::vector gold_names; + + unsigned numMods = get_num_change_sets(params); + if (numMods > params.cyclicCount) { + numMods = params.cyclicCount; + } + + for (unsigned i = 1; i <= numMods; i++) { + gold_names.push_back(Ioss::DynamicTopologyFileControl::get_cyclic_database_filename( + params.outFile, params.cyclicCount, i)); + } + + EXPECT_EQ(gold_names, changeSet->names()); + } + + TEST(TestChangeSet, multi_file_cyclic_topology_modification) + { + std::string outFile("cyclicMultiFileManyBlocksChangeSet.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); + + std::vector output_times{0.0, 0.5, 1.5, 1.75, 2.0, 3.0}; + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + + params.set_data(output_times, output_steps, modification_steps); + params.set_cyclic_count(3); + + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + run_multi_file_topology_change(params); + read_and_test_cyclic_multi_file_topology_change_set(params); + cleanup_cyclic_multi_files(outFile, params.cyclicCount); + } + + void read_and_test_linear_multi_file_topology_change_set(const OutputParams ¶ms) + { + ASSERT_TRUE(params.cyclicCount == 0); + + Ioss::PropertyManager propertyManager; + auto i_region = construct_region(params, propertyManager, Ioss::READ_RESTART, "input_model"); + + auto changeSet = Ioss::ChangeSetFactory::create(i_region.get()); + changeSet->populate_change_sets(); + + EXPECT_EQ(Ioss::CHANGE_SET_LINEAR_MULTI_FILES, changeSet->database_format()); + + std::vector gold_names; + + unsigned numMods = get_num_change_sets(params); + + for (unsigned i = 1; i <= numMods; i++) { + gold_names.push_back( + Ioss::DynamicTopologyFileControl::get_linear_database_filename(params.outFile, i)); + } + + EXPECT_EQ(gold_names, changeSet->names()); + } + + TEST(TestChangeSet, multi_file_linear_topology_modification) + { + std::string outFile("linearMultiFileManyBlocksChangeSet.g"); + std::string elemFieldName = "elem_field"; + + OutputParams params(outFile, elemFieldName); + + std::vector output_times{0.0, 0.5, 1.5, 1.75, 2.0, 3.0}; + std::vector output_steps{true, true, true, true, true, true}; + std::vector modification_steps{false, true, false, true, true, false}; + + params.set_data(output_times, output_steps, modification_steps); + + cleanup_linear_multi_files(outFile, params.output_times.size()); + run_multi_file_topology_change(params); + read_and_test_linear_multi_file_topology_change_set(params); + cleanup_linear_multi_files(outFile, params.output_times.size()); + } +} // namespace diff --git a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestElementBlockBatchRead.C b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestElementBlockBatchRead.C index cb90ab20fadd..dd8355d4762a 100644 --- a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestElementBlockBatchRead.C +++ b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestElementBlockBatchRead.C @@ -135,8 +135,7 @@ namespace { o_region.end_mode(Ioss::STATE_MODEL); } - void define_transient(const Ioss::Region &i_region, Ioss::Region &o_region, - const std::string &elemFieldName) + void define_transient(Ioss::Region &o_region, const std::string &elemFieldName) { o_region.begin_mode(Ioss::STATE_DEFINE_TRANSIENT); @@ -205,7 +204,7 @@ namespace { define_model(i_region, o_region); write_model(i_region, o_region); - define_transient(i_region, o_region, elemFieldName); + define_transient(o_region, elemFieldName); write_transient(o_region, elemFieldName); o_database->finalize_database(); diff --git a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmDatabaseIO.C b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmDatabaseIO.C index 248bc0c92e2c..69b90cf83345 100644 --- a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmDatabaseIO.C +++ b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmDatabaseIO.C @@ -50,20 +50,6 @@ namespace { return db_io; } - Iotm::DatabaseIO *create_output_db_io(const std::string &filename) - { - Ioss::Init::Initializer init_db; - Ioss::DatabaseUsage db_usage = Ioss::WRITE_RESULTS; - Ioss::PropertyManager properties; - - properties.add(Ioss::Property("INTEGER_SIZE_DB", 8)); - properties.add(Ioss::Property("INTEGER_SIZE_API", 8)); - - auto *db_io = new Iotm::DatabaseIO(nullptr, filename, db_usage, - Ioss::ParallelUtils::comm_world(), properties); - return db_io; - } - int get_parallel_size() { return Ioss::ParallelUtils(Ioss::ParallelUtils::comm_world()).parallel_size(); diff --git a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h index c07ba836ac38..315a0acc1e4e 100644 --- a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h +++ b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestIotmTextMeshFixture.h @@ -829,8 +829,6 @@ namespace Iotm { void verify() { - verify_num_nodes(); - for (size_t nodeIndex = 0; nodeIndex < goldNodeIds.size(); nodeIndex++) { EntityId nodeId = goldNodeIds[nodeIndex]; EXPECT_TRUE(is_valid_node(nodeId)); diff --git a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestTextMesh.C b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestTextMesh.C index e4fcb6a8b22c..1b735ec623ab 100644 --- a/packages/seacas/libraries/ioss/src/unit_tests/UnitTestTextMesh.C +++ b/packages/seacas/libraries/ioss/src/unit_tests/UnitTestTextMesh.C @@ -522,6 +522,10 @@ namespace { // | 1 \| 3 \ // // 1-----2-----3 // +#ifndef NDEBUG + GTEST_SKIP(); +#endif + if (get_parallel_size() != 2) return; int rank = get_parallel_rank(); @@ -542,7 +546,10 @@ namespace { else if (rank == 1) { verify_num_elements(1); verify_single_element(3u, "SHELL_TRI_3", EntityIdVector{2, 3, 5}); - verify_coordinates(EntityIdVector{2, 3, 5}, {1, 0, 0, 2, 0, 0, 1, 1, 0}); + // parallel consistency checks in IOSS fails because field access in + // parallel needs to test against same GroupingEntity type + verify_single_element(3u, "SHELL_TRI_3", EntityIdVector{2, 3, 5}); + verify_coordinates(EntityIdVector{2, 2, 3, 5}, {1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 1, 0}); } } diff --git a/packages/seacas/libraries/ioss/src/utest/Ut_ioad.C b/packages/seacas/libraries/ioss/src/utest/Ut_ioad.C index c5b6dc054382..4d65aaa751de 100644 --- a/packages/seacas/libraries/ioss/src/utest/Ut_ioad.C +++ b/packages/seacas/libraries/ioss/src/utest/Ut_ioad.C @@ -449,16 +449,15 @@ template <> const std::string get_entity_type_test() TEST_CASE("Ioad_BlockNames") { - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == - Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); - REQUIRE(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); + CHECK(get_entity_type_test() == Ioad::get_entity_type()); } diff --git a/packages/seacas/libraries/ioss/src/utest/Utst_ioel.C b/packages/seacas/libraries/ioss/src/utest/Utst_ioel.C index eddfe5bcddf4..e31354253819 100644 --- a/packages/seacas/libraries/ioss/src/utest/Utst_ioel.C +++ b/packages/seacas/libraries/ioss/src/utest/Utst_ioel.C @@ -63,7 +63,7 @@ TEST_CASE("invalid element") { // Check that asking for invalid element returns nullptr pointer. Ioss::ElementTopology *invalid = Ioss::ElementTopology::factory("Greg", true); - REQUIRE(invalid == nullptr); + CHECK(invalid == nullptr); } TEST_CASE("test_all_elements") @@ -102,13 +102,7 @@ namespace { fmt::print(stderr, "\n{:<25}({})\t[{}]", type, name, shape); // Check that master element name is an alias... - if (element->name() == "edge2d2" || element->name() == "edge2d3" || - element->name() == "edge2d4") { // kluge - CHECK_NOFAIL(element->is_alias(element->master_element_name())); - } - else { - CHECK(element->is_alias(element->master_element_name())); - } + CHECK(element->is_alias(element->master_element_name())); if (type == "unknown" || type == "invalid_topology") { return; @@ -133,15 +127,12 @@ namespace { auto *perm = element->permutation(); REQUIRE(perm != nullptr); - CHECKED_IF(element->name() != "node") - { + if (element->name() != "node") { REQUIRE(static_cast(perm->num_permutation_nodes()) == element->number_corner_nodes()); // Element shape matches permutation type - REQUIRE(Ioss::Utils::lowercase(Ioss::Utils::shape_to_string(element->shape())) == - perm->type()); + CHECK(Ioss::Utils::lowercase(Ioss::Utils::shape_to_string(element->shape())) == perm->type()); - CHECKED_IF(perm->num_permutations() > 0) - { + if (perm->num_permutations() > 0) { const auto &permutation = perm->permutation_indices(0); const auto connect = element->element_connectivity(); for (size_t i = 0; i < permutation.size(); i++) { @@ -194,8 +185,7 @@ namespace { for (int i = 1; i <= nf; i++) { Ioss::ElementTopology *face = element->face_type(i); CHECK(face != nullptr); - CHECKED_IF(face != nullptr) - { + if (face != nullptr) { unsigned int nnfi = element->number_nodes_face(i); CHECK(nnfi == static_cast(face->number_nodes())); std::vector conn = element->face_connectivity(i); @@ -203,6 +193,7 @@ namespace { } } } + // Edges... if (ne > 0) { Ioss::ElementTopology *edge0 = element->edge_type(0); @@ -216,8 +207,7 @@ namespace { for (int i = 1; i <= ne; i++) { Ioss::ElementTopology *edge = element->edge_type(i); CHECK(edge != nullptr); - CHECKED_IF(edge != nullptr) - { + if (edge != nullptr) { unsigned int nnei = element->number_nodes_edge(i); CHECK(nnei == static_cast(edge->number_nodes())); std::vector conn = element->edge_connectivity(i); @@ -225,16 +215,12 @@ namespace { } } } - // Variable types... const Ioss::VariableType *vt = Ioss::VariableType::factory(element->name()); REQUIRE(vt != nullptr); - CHECKED_IF(vt != nullptr) - { - // See if component counts match... - int vt_comp = vt->component_count(); - CHECK(nn == vt_comp); - } + // See if component counts match... + int vt_comp = vt->component_count(); + CHECK(nn == vt_comp); // For elements with parametric dimension == 3 // Get face-edge-order @@ -267,37 +253,35 @@ namespace { // Edges defining face... std::vector face_edge_conn = element->face_edge_connectivity(i); REQUIRE(num_edges_face == face_edge_conn.size()); - CHECKED_IF(num_edges_face == face_edge_conn.size()) - { - for (unsigned int j = 0; j < num_edges_face; j++) { - // Not implemented in all elements yet... - std::vector edge_conn = element->edge_connectivity(face_edge_conn[j] + 1); - // Check that first two nodes in 'edge_conn' match - // corresponding nodes in 'face_conn' - bool ok = (edge_conn[0] == face_conn[j] || edge_conn[1] == face_conn[j]) && - (edge_conn[0] == face_conn[(j + 1) % fncn] || - edge_conn[1] == face_conn[(j + 1) % fncn]); - CHECK(ok); - - if (element->name() == "wedge12" || element->name() == "hex16") { - continue; - } - - CHECK(edge_conn.size() == size_t(order) + 1); - - CHECK(order >= 1); - CHECK(face_conn.size() >= fncn + (order - 1) * num_edges_face); - CHECKED_IF(order == 2) { CHECK(edge_conn[2] == face_conn[fncn + j]); } - CHECKED_IF(order == 3) - { - auto en2 = edge_conn[2]; - auto en3 = edge_conn[3]; - - auto fn2 = face_conn[fncn + 2 * j]; - auto fn3 = face_conn[fncn + 2 * j + 1]; - // Mid-Side Node Edge Connectivity must match face connectivity - CHECK((en2 == fn2 || en3 == fn2 || en2 == fn3 || en3 == fn3)); - } + for (unsigned int j = 0; j < num_edges_face; j++) { + // Not implemented in all elements yet... + std::vector edge_conn = element->edge_connectivity(face_edge_conn[j] + 1); + // Check that first two nodes in 'edge_conn' match + // corresponding nodes in 'face_conn' + bool ok = (edge_conn[0] == face_conn[j] || edge_conn[1] == face_conn[j]) && + (edge_conn[0] == face_conn[(j + 1) % fncn] || + edge_conn[1] == face_conn[(j + 1) % fncn]); + CHECK(ok); + + if (element->name() == "wedge12" || element->name() == "hex16") { + continue; + } + + CHECK(edge_conn.size() == size_t(order) + 1); + + CHECK(order >= 1); + CHECK(face_conn.size() >= fncn + (order - 1) * num_edges_face); + if (order == 2) { + CHECK(edge_conn[2] == face_conn[fncn + j]); + } + if (order == 3) { + auto en2 = edge_conn[2]; + auto en3 = edge_conn[3]; + + auto fn2 = face_conn[fncn + 2 * j]; + auto fn3 = face_conn[fncn + 2 * j + 1]; + // Mid-Side Node Edge Connectivity must match face connectivity + CHECK((en2 == fn2 || en3 == fn2 || en2 == fn3 || en3 == fn3)); } } } diff --git a/packages/seacas/libraries/ioss/src/utest/Utst_sort.C b/packages/seacas/libraries/ioss/src/utest/Utst_sort.C index 0d14061d96ec..d2f46e561a8b 100644 --- a/packages/seacas/libraries/ioss/src/utest/Utst_sort.C +++ b/packages/seacas/libraries/ioss/src/utest/Utst_sort.C @@ -5,6 +5,7 @@ // See packages/seacas/LICENSE for details #include "Ioss_Sort.h" +#include #include #include #include @@ -73,9 +74,9 @@ namespace { TEST_CASE("empty") { - std::vector x{}; + std::vector x; Ioss::sort(x); - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } TEST_CASE("single-element") @@ -83,7 +84,7 @@ TEST_CASE("single-element") int64_t n = GENERATE(100, 1023, 1024, 1025, (2 << 16) - 1, 2 << 16, (2 << 16) + 1); std::vector x{n}; Ioss::sort(x); - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } TEST_CASE("sort") @@ -102,40 +103,40 @@ TEST_CASE("sort") SECTION("output") { // Just printing output; no test... - std::string type[] = {"sawtooth", "do_rand", "stagger", "plateau", "shuffle"}; + std::array type = {"sawtooth", "do_rand", "stagger", "plateau", "shuffle"}; fmt::print("Size: {:8}, Shape = {:8}, Type = {:12}\n", n, m, type[dist - 1]); } DYNAMIC_SECTION("as generated" << n << m << dist) { Ioss::sort(x); // Copy of x - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } DYNAMIC_SECTION("reversed" << n << m << dist) { std::reverse(x.begin(), x.end()); // Reversed Ioss::sort(x); - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } DYNAMIC_SECTION("front-half reversed" << n << m << dist) { std::reverse(&x[0], &x[n / 2]); // Front half reversed Ioss::sort(x); - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } DYNAMIC_SECTION("back-half reversed" << n << m << dist) { std::reverse(&x[n / 2], &x[n]); // Back half reversed Ioss::sort(x); - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); DYNAMIC_SECTION("already sorted" << n << m << dist) { - // REQUIRE(verify_sorted(x)); + // CHECK(verify_sorted(x)); Ioss::sort(x); // Already sorted - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } } @@ -145,7 +146,7 @@ TEST_CASE("sort") x[p] += p % 5; } Ioss::sort(x); // Dithered - REQUIRE(verify_sorted(x)); + CHECK(verify_sorted(x)); } } } diff --git a/packages/seacas/libraries/ioss/src/utest/Utst_structured_decomp.C b/packages/seacas/libraries/ioss/src/utest/Utst_structured_decomp.C index 7713bf98ef50..907ecb8158e3 100644 --- a/packages/seacas/libraries/ioss/src/utest/Utst_structured_decomp.C +++ b/packages/seacas/libraries/ioss/src/utest/Utst_structured_decomp.C @@ -1,4 +1,4 @@ -// Copyright(C) 1999-2024 National Technology & Engineering Solutions +// Copyright(C) 1999-2025 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government retains certain rights in this software. // @@ -1151,3 +1151,17 @@ TEST_CASE("half_sphere") SECTION(name) { check_split_assign(zones, load_balance_tolerance, 8, 0.9, 1.1); } cleanup(zones); } + +TEST_CASE("hwt_cone") +{ + int zone = 1; + std::vector zones; + zones.push_back(new Iocgns::StructuredZoneData(zone++, "520x200x200")); + zones.push_back(new Iocgns::StructuredZoneData(zone++, "50x200x50")); + + double load_balance_tolerance = 1.4; + + std::string name = "hwt_cone_16384"; + SECTION(name) { check_split_assign(zones, load_balance_tolerance, 16384, 0.9, 1.4); } + cleanup(zones); +} diff --git a/packages/seacas/libraries/ioss/src/utest/Utst_utils.C b/packages/seacas/libraries/ioss/src/utest/Utst_utils.C index bbfbeb9da3d0..74959d873821 100644 --- a/packages/seacas/libraries/ioss/src/utest/Utst_utils.C +++ b/packages/seacas/libraries/ioss/src/utest/Utst_utils.C @@ -20,45 +20,45 @@ TEST_CASE("number_width") SECTION("single digit") { for (int i = 0; i < 10; i++) { - REQUIRE(1 == Ioss::Utils::number_width(i)); - REQUIRE(1 == Ioss::Utils::number_width(i, true)); + CHECK(1 == Ioss::Utils::number_width(i)); + CHECK(1 == Ioss::Utils::number_width(i, true)); } } SECTION("double digit") { for (int i = 11; i < 100; i += 11) { - REQUIRE(2 == Ioss::Utils::number_width(i)); - REQUIRE(2 == Ioss::Utils::number_width(i, true)); + CHECK(2 == Ioss::Utils::number_width(i)); + CHECK(2 == Ioss::Utils::number_width(i, true)); } } SECTION("triple digit") { for (int i = 111; i < 1'000; i += 111) { - REQUIRE(3 == Ioss::Utils::number_width(i)); - REQUIRE(3 == Ioss::Utils::number_width(i, true)); + CHECK(3 == Ioss::Utils::number_width(i)); + CHECK(3 == Ioss::Utils::number_width(i, true)); } } SECTION("quad digit") { for (int i = 1111; i < 10'000; i += 1111) { - REQUIRE(4 == Ioss::Utils::number_width(i)); - REQUIRE(5 == Ioss::Utils::number_width(i, true)); + CHECK(4 == Ioss::Utils::number_width(i)); + CHECK(5 == Ioss::Utils::number_width(i, true)); } } SECTION("larger") { - REQUIRE(6 == Ioss::Utils::number_width(999'999)); - REQUIRE(7 == Ioss::Utils::number_width(999'999, true)); - REQUIRE(7 == Ioss::Utils::number_width(1'000'000)); - REQUIRE(9 == Ioss::Utils::number_width(1'000'000, true)); - REQUIRE(10 == Ioss::Utils::number_width(1'111'111'111)); - REQUIRE(13 == Ioss::Utils::number_width(1'111'111'111, true)); + CHECK(6 == Ioss::Utils::number_width(999'999)); + CHECK(7 == Ioss::Utils::number_width(999'999, true)); + CHECK(7 == Ioss::Utils::number_width(1'000'000)); + CHECK(9 == Ioss::Utils::number_width(1'000'000, true)); + CHECK(10 == Ioss::Utils::number_width(1'111'111'111)); + CHECK(13 == Ioss::Utils::number_width(1'111'111'111, true)); #if !defined(__IOSS_WINDOWS__) - REQUIRE(15 == Ioss::Utils::number_width(111'111'111'111, true)); + CHECK(15 == Ioss::Utils::number_width(111'111'111'111, true)); #endif } } @@ -70,43 +70,43 @@ TEST_CASE("detect large int64") Ioss::Field field{"test", Ioss::Field::INT64, "vector_2d", Ioss::Field::RoleType::TRANSIENT, 3}; std::vector data{0, max_double, max_double + 1, max_double - 1}; - REQUIRE(true == Ioss::Utils::check_int_to_real_overflow(field, Data(data), data.size())); + CHECK(true == Ioss::Utils::check_int_to_real_overflow(field, Data(data), data.size())); } #if !defined __NVCC__ TEST_CASE("str_equal") { - REQUIRE(Ioss::Utils::str_equal("", "")); - REQUIRE(!Ioss::Utils::str_equal("", "a")); - REQUIRE(!Ioss::Utils::str_equal("a", "")); - REQUIRE(Ioss::Utils::str_equal("a", "a")); - REQUIRE(Ioss::Utils::str_equal("A", "a")); - REQUIRE(Ioss::Utils::str_equal("a", "A")); - - REQUIRE(Ioss::Utils::str_equal("longer_than_single_character", "longer_than_single_character")); - REQUIRE(Ioss::Utils::str_equal("longer_than_single_character", "LONGER_THAN_SINGLE_CHARACTER")); - REQUIRE(Ioss::Utils::str_equal("LONGER_THAN_SINGLE_CHARACTER", "longer_than_single_character")); - REQUIRE(Ioss::Utils::str_equal("LONGER_THAN_SINGLE_CHARACTER", "LONGER_THAN_SINGLE_CHARACTER")); - REQUIRE(Ioss::Utils::str_equal("LoNgEr_ThAn_SiNgLe_ChArAcTeR", "lOnGeR_tHaN_sInGlE_cHaRaCtEr")); - - REQUIRE(!Ioss::Utils::str_equal("Almost_The_Same", "almost_the_sam")); + CHECK(Ioss::Utils::str_equal("", "")); + CHECK(!Ioss::Utils::str_equal("", "a")); + CHECK(!Ioss::Utils::str_equal("a", "")); + CHECK(Ioss::Utils::str_equal("a", "a")); + CHECK(Ioss::Utils::str_equal("A", "a")); + CHECK(Ioss::Utils::str_equal("a", "A")); + + CHECK(Ioss::Utils::str_equal("longer_than_single_character", "longer_than_single_character")); + CHECK(Ioss::Utils::str_equal("longer_than_single_character", "LONGER_THAN_SINGLE_CHARACTER")); + CHECK(Ioss::Utils::str_equal("LONGER_THAN_SINGLE_CHARACTER", "longer_than_single_character")); + CHECK(Ioss::Utils::str_equal("LONGER_THAN_SINGLE_CHARACTER", "LONGER_THAN_SINGLE_CHARACTER")); + CHECK(Ioss::Utils::str_equal("LoNgEr_ThAn_SiNgLe_ChArAcTeR", "lOnGeR_tHaN_sInGlE_cHaRaCtEr")); + + CHECK(!Ioss::Utils::str_equal("Almost_The_Same", "almost_the_sam")); } TEST_CASE("substr_equal") { - REQUIRE(Ioss::Utils::substr_equal("", "")); - REQUIRE(Ioss::Utils::substr_equal("", "a")); - REQUIRE(!Ioss::Utils::substr_equal("a", "")); - REQUIRE(Ioss::Utils::substr_equal("a", "a")); - REQUIRE(Ioss::Utils::substr_equal("A", "a")); - REQUIRE(Ioss::Utils::substr_equal("a", "A")); - - REQUIRE(!Ioss::Utils::substr_equal("prefix", "pref")); - REQUIRE(Ioss::Utils::substr_equal("prefix", "PREFIX")); - REQUIRE(Ioss::Utils::substr_equal("pre", "PREFIX")); - REQUIRE(Ioss::Utils::substr_equal("pre", "prefix")); - REQUIRE(Ioss::Utils::substr_equal("PRe", "prefix")); - REQUIRE(Ioss::Utils::substr_equal("PRe", "PREFIX")); + CHECK(Ioss::Utils::substr_equal("", "")); + CHECK(Ioss::Utils::substr_equal("", "a")); + CHECK(!Ioss::Utils::substr_equal("a", "")); + CHECK(Ioss::Utils::substr_equal("a", "a")); + CHECK(Ioss::Utils::substr_equal("A", "a")); + CHECK(Ioss::Utils::substr_equal("a", "A")); + + CHECK(!Ioss::Utils::substr_equal("prefix", "pref")); + CHECK(Ioss::Utils::substr_equal("prefix", "PREFIX")); + CHECK(Ioss::Utils::substr_equal("pre", "PREFIX")); + CHECK(Ioss::Utils::substr_equal("pre", "prefix")); + CHECK(Ioss::Utils::substr_equal("PRe", "prefix")); + CHECK(Ioss::Utils::substr_equal("PRe", "PREFIX")); } TEST_CASE("format_id_list") @@ -114,61 +114,61 @@ TEST_CASE("format_id_list") SECTION("ids_empty") { std::string ret = Ioss::Utils::format_id_list({}); - REQUIRE(ret == std::string("")); + CHECK(ret == std::string("")); } SECTION("ids_distinct") { std::string ret = Ioss::Utils::format_id_list({1, 3, 5, 7, 9, 11}); - REQUIRE(ret == std::string("1, 3, 5, 7, 9, 11")); + CHECK(ret == std::string("1, 3, 5, 7, 9, 11")); } SECTION("ids two element ranges") { std::string ret = Ioss::Utils::format_id_list({1, 2, 4, 5, 7, 8, 10, 11}); - REQUIRE(ret == std::string("1, 2, 4, 5, 7, 8, 10, 11")); + CHECK(ret == std::string("1, 2, 4, 5, 7, 8, 10, 11")); } SECTION("ids one-range") { std::string ret = Ioss::Utils::format_id_list({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, "--"); - REQUIRE(ret == std::string("1--11")); + CHECK(ret == std::string("1--11")); } SECTION("ids one value") { std::string ret = Ioss::Utils::format_id_list({11}, "--"); - REQUIRE(ret == std::string("11")); + CHECK(ret == std::string("11")); } SECTION("ids two consecutive values") { std::string ret = Ioss::Utils::format_id_list({10, 11}, "--"); - REQUIRE(ret == std::string("10, 11")); + CHECK(ret == std::string("10, 11")); } SECTION("ids two separated values") { std::string ret = Ioss::Utils::format_id_list({2, 11}, "--"); - REQUIRE(ret == std::string("2, 11")); + CHECK(ret == std::string("2, 11")); } SECTION("ids two separated values pipe sep") { std::string ret = Ioss::Utils::format_id_list({2, 11}, "--"); - REQUIRE(ret == std::string("2, 11")); + CHECK(ret == std::string("2, 11")); } SECTION("ids two ranges") { std::string ret = Ioss::Utils::format_id_list({1, 2, 3, 4, 6, 7, 8}, "--"); - REQUIRE(ret == std::string("1--4, 6--8")); + CHECK(ret == std::string("1--4, 6--8")); } SECTION("ids two ranges pipe separated") { std::string ret = Ioss::Utils::format_id_list({1, 2, 3, 4, 6, 7, 8}, "--", "|"); - REQUIRE(ret == std::string("1--4|6--8")); + CHECK(ret == std::string("1--4|6--8")); } SECTION("ids large range") @@ -176,7 +176,7 @@ TEST_CASE("format_id_list") std::vector range(100'000); std::iota(range.begin(), range.end(), 42); std::string ret = Ioss::Utils::format_id_list(range, "--"); - REQUIRE(ret == std::string("42--100041")); + CHECK(ret == std::string("42--100041")); } SECTION("ids large range with singles") @@ -186,7 +186,7 @@ TEST_CASE("format_id_list") range[0] = 1; range[range.size() - 1]++; std::string ret = Ioss::Utils::format_id_list(range, "--"); - REQUIRE(ret == std::string("1, 43--100040, 100042")); + CHECK(ret == std::string("1, 43--100040, 100042")); } SECTION("ids large range with singles with to") @@ -196,7 +196,7 @@ TEST_CASE("format_id_list") range[0] = 1; range[range.size() - 1]++; std::string ret = Ioss::Utils::format_id_list(range); - REQUIRE(ret == std::string("1, 43 to 100040, 100042")); + CHECK(ret == std::string("1, 43 to 100040, 100042")); } SECTION("ids large range with singles with colon") @@ -206,7 +206,7 @@ TEST_CASE("format_id_list") range[0] = 1; range[range.size() - 1]++; std::string ret = Ioss::Utils::format_id_list(range, ":"); - REQUIRE(ret == std::string("1, 43:100040, 100042")); + CHECK(ret == std::string("1, 43:100040, 100042")); } SECTION("ids large range with singles with words") @@ -216,7 +216,7 @@ TEST_CASE("format_id_list") range[0] = 1; range[range.size() - 1]++; std::string ret = Ioss::Utils::format_id_list(range, " to ", " and "); - REQUIRE(ret == std::string("1 and 43 to 100040 and 100042")); + CHECK(ret == std::string("1 and 43 to 100040 and 100042")); } SECTION("detect unsorted two ids") { CHECK_THROWS(Ioss::Utils::format_id_list({2, 1})); } diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/CMakeLists.txt b/packages/seacas/libraries/ioss/src/visualization/catalyst/CMakeLists.txt index 98566e201270..4f8722e7f82c 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/CMakeLists.txt +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2021 National Technology & Engineering Solutions +# Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -29,11 +29,11 @@ ENDIF() SET(CMAKE_SKIP_BUILD_RPATH FALSE) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" ${PARAVIEW_PYTHON_LIBRARY_RPATH_DIRECTORY}) +SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" ${PARAVIEW_PYTHON_LIBRARY_RPATH_DIRECTORY}) SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_LIBDIR}" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}") ENDIF() INCLUDE_DIRECTORIES("manager") diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/cgns/CatalystCGNSMesh.h b/packages/seacas/libraries/ioss/src/visualization/catalyst/cgns/CatalystCGNSMesh.h index 0358a120c212..ac48d4ee9dde 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/cgns/CatalystCGNSMesh.h +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/cgns/CatalystCGNSMesh.h @@ -7,12 +7,12 @@ #ifndef __CATALYST_CGNS_MESH_H #define __CATALYST_CGNS_MESH_H +#include "vtkNew.h" +#include "vtkPartitionedDataSetCollection.h" #include #include #include #include -#include "vtkPartitionedDataSetCollection.h" -#include "vtkNew.h" class vtkStructuredGrid; @@ -28,7 +28,7 @@ namespace Iovs_cgns { ~CatalystCGNSMesh(); - void PerformCoProcessing(std::vector & error_and_warning_codes, + void PerformCoProcessing(std::vector &error_and_warning_codes, std::vector &error_and_warning_messages); void SetTimeData(double currentTime, int timeStep); @@ -39,30 +39,29 @@ namespace Iovs_cgns { void Delete(); - void AddStructuredZoneData(const ZoneData& zoneData); + void AddStructuredZoneData(const ZoneData &zoneData); vtkPartitionedDataSetCollection *getPartitionedDataSetCollection(); private: - CatalystCGNSMesh(); - CatalystCGNSMesh(const CatalystCGNSMesh &) = delete; + CatalystCGNSMesh(const CatalystCGNSMesh &) = delete; CatalystCGNSMesh &operator=(const CatalystCGNSMesh &) = delete; std::map zone_id_to_zone_location_map; vtkNew vpdc; - Iovs::CatalystManager *catManager = nullptr; - bool writeCatalystMesh; - std::string catalystMeshFilePrefix; - CatalystPipelineInfo catalystPipelineInfo; - const std::string ASSEMBLY_LABEL = "label"; - const std::string ASSEMBLY_ROOT_NAME = "IOSS"; - const std::string ASSEMBLY_STRUCTURED_BLOCKS = "structured_blocks"; - const int PDS_STRUCTURED_GRID_INDEX = 0; - int getStructuredBlocksAssemblyNode(); - void createPartitionedDataSet(const ZoneData& zoneData, vtkStructuredGrid* sg); - vtkStructuredGrid* getStucturedGrid(const ZoneData& zoneData); + Iovs::CatalystManager *catManager = nullptr; + bool writeCatalystMesh; + std::string catalystMeshFilePrefix; + CatalystPipelineInfo catalystPipelineInfo; + const std::string ASSEMBLY_LABEL = "label"; + const std::string ASSEMBLY_ROOT_NAME = "IOSS"; + const std::string ASSEMBLY_STRUCTURED_BLOCKS = "structured_blocks"; + const int PDS_STRUCTURED_GRID_INDEX = 0; + int getStructuredBlocksAssemblyNode(); + void createPartitionedDataSet(const ZoneData &zoneData, vtkStructuredGrid *sg); + vtkStructuredGrid *getStucturedGrid(const ZoneData &zoneData); }; } // namespace Iovs_cgns diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/exodus/CatalystExodusMesh.h b/packages/seacas/libraries/ioss/src/visualization/catalyst/exodus/CatalystExodusMesh.h index 337846b11ee3..11d770f08790 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/exodus/CatalystExodusMesh.h +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/exodus/CatalystExodusMesh.h @@ -138,12 +138,12 @@ namespace Iovs_exodus { bool UnderscoreVectors; bool ApplyDisplacements; CatalystPipelineInfo catalystPipelineInfo; - const std::string ASSEMBLY_LABEL = "label"; - const std::string ASSEMBLY_ROOT_NAME = "IOSS"; - const std::string ASSEMBLY_ELEMENT_BLOCKS = "element_blocks"; - const int PDS_UNSTRUCTURED_GRID_INDEX = 0; - int getElementBlocksAssemblyNode(); - vtkUnstructuredGrid* getUnstructuredGrid(int blockId); + const std::string ASSEMBLY_LABEL = "label"; + const std::string ASSEMBLY_ROOT_NAME = "IOSS"; + const std::string ASSEMBLY_ELEMENT_BLOCKS = "element_blocks"; + const int PDS_UNSTRUCTURED_GRID_INDEX = 0; + int getElementBlocksAssemblyNode(); + vtkUnstructuredGrid *getUnstructuredGrid(int blockId); }; } // namespace Iovs_exodus diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/manager/CatalystMeshWriter.h b/packages/seacas/libraries/ioss/src/visualization/catalyst/manager/CatalystMeshWriter.h index 199a34807e4a..462961c55980 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/manager/CatalystMeshWriter.h +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/manager/CatalystMeshWriter.h @@ -13,29 +13,28 @@ class vtkDataObject; namespace Iovs { -class CatalystMeshWriter { - -public: + class CatalystMeshWriter + { + public: CatalystMeshWriter(); ~CatalystMeshWriter(); bool outputCatalystMeshOneFileON(); - void setOutputCatalystMeshOneFilePrefix(std::string & prefix); + void setOutputCatalystMeshOneFilePrefix(std::string &prefix); bool outputCatalystMeshFilePerProcON(); - void setOutputCatalystMeshFilePerProcPrefix(std::string & prefix); - - void writeCatalystMeshOneFile(vtkDataObject* dobj, int timeStep); - void writeCatalystMeshFilePerProc(vtkDataObject* dobj, int timeStep); + void setOutputCatalystMeshFilePerProcPrefix(std::string &prefix); -private: + void writeCatalystMeshOneFile(vtkDataObject *dobj, int timeStep); + void writeCatalystMeshFilePerProc(vtkDataObject *dobj, int timeStep); - bool catalystMeshOneFile; - bool catalystMeshFilePerProc; + private: + bool catalystMeshOneFile; + bool catalystMeshFilePerProc; std::string catalystMeshOneFilePrefix; std::string catalystMeshFilePerProcPrefix; -}; + }; } // namespace Iovs diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/parser/PhactoriParserInterface.h b/packages/seacas/libraries/ioss/src/visualization/catalyst/parser/PhactoriParserInterface.h index 36bfd6665855..a2b763802b61 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/parser/PhactoriParserInterface.h +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/parser/PhactoriParserInterface.h @@ -14,42 +14,43 @@ namespace Iovs { -class PhactoriParserInterface { - -public: - - enum VarType { - SCALAR, - VECTOR, - TENSOR, - ALLTYPE, - SCALAR_USED, - VECTOR_USED, - TENSOR_USED, - ALLTYPE_USED + class PhactoriParserInterface + { + + public: + enum VarType { + SCALAR, + VECTOR, + TENSOR, + ALLTYPE, + SCALAR_USED, + VECTOR_USED, + TENSOR_USED, + ALLTYPE_USED + }; + + typedef std::map varMap; + typedef std::pair idRange; + + struct ParseInfo + { + varMap nodeVars; + varMap elementVars; + varMap globalVars; + bool checkNodeIDRange = false; + idRange nodeIDRange; + bool checkElementIDRange = false; + idRange elementIDRange; + std::string separator = "_"; + std::string jsonParseResult = ""; + bool parseFailed = true; + }; + + static void parseFile(const std::string &filepath, ParseInfo &pinfo); + + static void parseString(const std::string &s, ParseInfo &pinfo); }; - typedef std::map varMap; - typedef std::pair idRange; - - struct ParseInfo { - varMap nodeVars; - varMap elementVars; - varMap globalVars; - bool checkNodeIDRange = false; - idRange nodeIDRange; - bool checkElementIDRange = false; - idRange elementIDRange; - std::string separator = "_"; - std::string jsonParseResult = ""; - bool parseFailed = true; - }; - - static void parseFile(const std::string &filepath, ParseInfo &pinfo); - - static void parseString(const std::string &s, ParseInfo &pinfo); -}; - } // namespace Iovs #endif diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriAppendLocationAttributesOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriAppendLocationAttributesOperation.py index 67145dfed5fa..a419bab46027 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriAppendLocationAttributesOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriAppendLocationAttributesOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -57,7 +57,7 @@ def ParseParametersFromJson(self, inJson): self.AppendPointLocations = 1 else: self.AppendPointLocations = 0 - + key2 = "append cell centers" if key2 in inJson: testval = inJson[key2] @@ -80,7 +80,7 @@ def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3('PhactoriAppendLocationAttributesOperation:CreateParaViewFilter entered\n', 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3('about to call UpdatePipelineWithCurrentTimeArgument\n', 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCSVExportOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCSVExportOperation.py index 1b3f23be7233..41e43b4ff0c1 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCSVExportOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCSVExportOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -67,7 +67,7 @@ def ParseOutputFilenameParametersFromJson(self, inJson): if (self.Precision < 1) or (self.Precision > 100): myDebugPrint3AndException("PhactoriCSVExportOperation:\n" "precision must be 1-100, not " + str(self.Precision) + "\n") - + def ParseParametersFromJson(self, inJson): self.ParseOutputFilenameParametersFromJson(inJson) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCalculatorOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCalculatorOperation.py index 8338bd8bcb77..c019227d33c3 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCalculatorOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCalculatorOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -107,7 +107,7 @@ def CreateParaViewFilter(self, inInputFilter): numArrays = inInputFilter.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + inInputFilter.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" calculator inInputFilter cell data arrays:\n") numArrays = inInputFilter.CellData.GetNumberOfArrays() diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellEdgeAngleMetrics.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellEdgeAngleMetrics.py index bb0f36aed75c..67b24707b428 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellEdgeAngleMetrics.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellEdgeAngleMetrics.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -86,10 +86,10 @@ def ParseParametersFromJson(self, inJson): self.OffsetIndex = 0 keyval10 = "output angle cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.OutputAngleCellVariableName = inJson[keyval10] keyval10 = "output height cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.OutputHeightCellVariableName = inJson[keyval10] keyval11 = "do operation in createparaview method" diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellSizeOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellSizeOperation.py index dea7bce04420..d7aad135fc86 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellSizeOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriCellSizeOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -47,7 +47,7 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3('PhactoriCellSizeOperation:CreateParaViewFilter entered\n', 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3('about to call UpdatePipelineWithCurrentTimeArgument\n', 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriDataArtifactMetaDataControl.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriDataArtifactMetaDataControl.py index e7eb49e32050..fb1ae4e5ae67 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriDataArtifactMetaDataControl.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriDataArtifactMetaDataControl.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -111,8 +111,3 @@ def AddImageToDataArtifactOutputList(self, fileName): pdamdc.AddDataExportToDataArtifactOutputList("CatalystVtkDataOutput/test2.vtm") #phactori_combine_to_single_python_file_subpiece_end_1 - - - - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractBlockOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractBlockOperation.py index bc84d49be8a1..bf00deba7541 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractBlockOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractBlockOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -144,7 +144,7 @@ def CreateParaViewFilter(self, inInputFilter): numArrays = inInputFilter.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + inInputFilter.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" extractblock inInputFilter cell data arrays:\n") numArrays = inInputFilter.CellData.GetNumberOfArrays() @@ -163,7 +163,7 @@ def CreateParaViewFilter(self, inInputFilter): numArrays = newParaViewFilter.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + newParaViewFilter.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" extractblock newParaViewFilter cell data arrays:\n") numArrays = newParaViewFilter.CellData.GetNumberOfArrays() diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractComponentOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractComponentOperation.py index 43c1a54246a1..2818a9c207df 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractComponentOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractComponentOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -84,7 +84,7 @@ def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3("PhactoriExtractComponentOperation:CreateParaViewFilter entered\n", 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3("about to call UpdatePipelineWithCurrentTimeArgument\n", 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py index ea12784fbec2..f3aad146ae50 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -255,7 +255,7 @@ def FigureBlockIndicesFromBlockList(includeBlockList, inInputFilter): listOfBlockIndicesToInclude = [] FigureBlockIndicesFromBlockListRecurse1(listOfBlockIndicesToInclude, includeBlockList, csdata, None, flatIndexCounter, 0) - + #if PhactoriDbg(100): # myDebugPrint3("number of times existing block names found:\n") # for blknm, count in gDuplicateNameCounter.items(): @@ -373,7 +373,7 @@ def ParseParametersFromJson(self, inJson): def MakeExtractBlockFilter(self, inInputFilter, blockName): if PhactoriDbg(100): myDebugPrint3("MakeExtractBlockFilter entered: " + str(blockName) + "\n") - newPvExtractBlockFilter = ExtractBlock(inInputFilter) + newPvExtractBlockFilter = ExtractBlock(inInputFilter) #newParaViewFilter.PruneOutput = 1 #newParaViewFilter.MaintainStructure = 0 #newParaViewFilter.MaintainStructure = 1 @@ -404,7 +404,7 @@ def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent): rngFunc = [0,0,0,0,0,0] if rngFuncAllAbsolute: - retIjkRange = ijkJson["ijkrange"] + retIjkRange = ijkJson["ijkrange"] if PhactoriDbg(100): myDebugPrint3("rngFunc is [0,0,0,0,0,0], all absolute, " "so just return explicit ijkrange:\nretIjkRange: \n" + \ @@ -417,7 +417,7 @@ def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent): return [0,-1,0,-1,0,-1] if "ijkrange" in ijkJson: - ijkRangeFromJson = ijkJson["ijkrange"] + ijkRangeFromJson = ijkJson["ijkrange"] else: ijkRangeFromJson = [0,0,0,0,0,0] @@ -458,22 +458,22 @@ def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent): if hadToCorrect: if PhactoriDbg(100): myDebugPrint3("return ijkrange had to be corrected because it was outside block extent" - "\nblockExtent: " + str(blockExtent) + - "\nijkRangeFromJson: " + str(retIjkRange) + - "\nrngFunc (from json): " + str(rngFunc) + + "\nblockExtent: " + str(blockExtent) + + "\nijkRangeFromJson: " + str(retIjkRange) + + "\nrngFunc (from json): " + str(rngFunc) + "\nuncorrectedIjkRange: " + str(uncorrectedIjkRange) + "\nretIjkRange: " + str(retIjkRange) + "\n") else: if PhactoriDbg(100): myDebugPrint3("return ijkrange did not need correction" - "\nblockExtent: " + str(blockExtent) + + "\nblockExtent: " + str(blockExtent) + "\nijkRangeFromJson: " + str(retIjkRange) + - "\nrngFunc (from json): " + str(rngFunc) + + "\nrngFunc (from json): " + str(rngFunc) + "\nretIjkRange: " + str(retIjkRange) + "\n") return retIjkRange - - + + def MakeExtractSubsetFilter(self, extractBlockFilter, oneBlockExtractSubsetJson, oneBlockExtents): if PhactoriDbg(100): myDebugPrint3("MakeOneExtractBlockExtractSubsetFilter entered\n") @@ -523,7 +523,7 @@ def MakeGroupAllExtractSubsetsFilter(self): if PhactoriDbg(100): myDebugPrint3("MakeGroupAllExtractSubsetsFilter returning\n") - + def CreateParaViewFilter(self, inInputFilter): """create the PhactoriExtractStructuredMultiBlock filter for ParaView""" if PhactoriDbg(100): diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFindCellEdgeLengths.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFindCellEdgeLengths.py index 31b2274c9599..cbf249455f46 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFindCellEdgeLengths.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFindCellEdgeLengths.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -77,7 +77,7 @@ def ParseParametersFromJson(self, inJson): self.OutputShortestLongestIndex = 0 keyval10 = "output cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.ProgrammableFilterOutputCellVariableName = inJson[keyval10] def CreateParaViewFilter(self, inInputFilter): diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFollowSurfaceSide1.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFollowSurfaceSide1.py index 0c865a02f31c..2f8128df99ce 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFollowSurfaceSide1.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriFollowSurfaceSide1.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -82,7 +82,7 @@ def ParseParametersFromJson(self, inJson): self.OffsetIndex = 0 keyval10 = "output cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.ProgrammableFilterOutputCellVariableName = inJson[keyval10] def CreateParaViewFilter(self, inInputFilter): @@ -128,7 +128,7 @@ def CreateParaViewFilter(self, inInputFilter): # lvly[zz] = 0 # lvlz = lvly[zz] # lvly[zz] = lvlz + 1 - + @staticmethod def IncrementTouchingCellCountForAllPointsInOneCell(inInputCsData, inParameters, inCellIndex, cellsTouchingPointCount): @@ -389,7 +389,7 @@ def FindWhichSurfaceCellsTouchEachPoint(inInputCsData, surfaceCellMap): for ptId, cellList in cellsTouchingPoints: myDebugPrint(str(ptId) + " " + str(celllist) + "\n") return cellsTouchingPoints - + def FollowSurfaceSideFromSeedCell(inInputCsData, seedCellIndex, surfaceStatus): #get a list of all surface cells surfaceCellMap, seedCellIndex = FindSurfaceCells(surfaceStatus) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGeometricCellSampler1.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGeometricCellSampler1.py index 4e33171c004c..9b274de414a3 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGeometricCellSampler1.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGeometricCellSampler1.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -333,7 +333,7 @@ def GatherGeometricallySampledCellsInBlock(recursionObject, inInputCsData, inPar myDebugPrint3("None\n") else: myDebugPrint3(str(oneCellDataArray.GetNumberOfTuples()) + "\n") - + if dataArrayNumCmpnts != 0: defaultTuple = [] for ii in range(0, dataArrayNumCmpnts): @@ -513,7 +513,7 @@ def CreateInternalListOfDataControlledSampledCellsOnThisProcess(self): else: myDebugPrint3AndException("CreateInternalListOfDataControlledSampledCellsOnThisProcess:\n" +\ "bad self.DataControlledSamplingMethod\n") - + if PhactoriDbg(100): myDebugPrint3("CreateInternalListOfDataControlledSampledCellsOnThisProcess returning\n") @@ -576,7 +576,7 @@ def CollectDataOnSampledCellsInBlock(recursionObject, inInputCsData, inParameter myDebugPrint3("None\n") else: myDebugPrint3(str(oneCellDataArray.GetNumberOfTuples()) + "\n") - + if dataArrayNumCmpnts != 0: defaultTuple = [] for ii in range(0, dataArrayNumCmpnts): @@ -647,7 +647,7 @@ def CreateLeafRecursionTrackingStructure(self): for leafKey in self.GeometricallySampledCellsByRecursionLeaf: cellListForLeaf = self.GeometricallySampledCellsByRecursionLeaf[leafKey] myDebugPrint3(str(len(cellListForLeaf)) + " cells for leaf " + str(leafKey) + "\n") - + if PhactoriDbg(100): myDebugPrint3("CreateLeafRecursionTrackingStructure returning\n") @@ -866,7 +866,7 @@ def CreateProgrammableFilterString(self): scriptLines.append(" iter.GoToNextItem();\n") scriptLines.append("else:\n") scriptLines.append(" flatten(input, output)\n") - + self.mainScriptString = "".join(scriptLines) myCellIndexesToSet = [] @@ -884,10 +884,10 @@ def CreateProgrammableFilterString(self): myCellIndexesToSet.append(oneCellInfo.index) myMaskValuesToSet.append(maskValue) myLeafVisitCount.append(oneCellInfo.leafVisitCount) - - newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" - newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" - newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" + + newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" + newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" + newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" self.mProgFilterString = newstr1 + newstr2 + newstr3 + self.mainScriptString if PhactoriDbg(100): diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGlyphOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGlyphOperation.py index f16d37186324..da3cfc0ef535 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGlyphOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGlyphOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2021 National Technology & Engineering Solutions +# Copyright(C) 1999-2021, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -52,7 +52,7 @@ def ParseParametersFromJson(self, inJson): if PhactoriDbg(100): myDebugPrint3("PhactoriGlyphOperation.ParseParametersFromJson " "entered\n", 100) - + key1 = "scale factor" if key1 in inJson: self.scaleFactor = inJson[key1] diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGroupOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGroupOperation.py index 938f92b77570..67894314b124 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGroupOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriGroupOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -83,7 +83,7 @@ def CreateParaViewFilter2(self, ioPipeAndViewsState): "Error: operation '" + str(ii) + "' paraview filter not " "constructed\n") self.mOperationList.append(inputOperationBlock.GetPvFilter()) - + newParaViewFilter = GroupDatasets(Input = self.mOperationList) SetActiveSource(newParaViewFilter) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriIntegrateVariablesOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriIntegrateVariablesOperation.py index 22dfe96e9841..d952bfcc0b2f 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriIntegrateVariablesOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriIntegrateVariablesOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -53,7 +53,7 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3('PhactoriIntegrateVariablesOperation:CreateParaViewFilter entered\n', 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3('about to call UpdatePipelineWithCurrentTimeArgument\n', 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMarkCellSurfaceStatus2.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMarkCellSurfaceStatus2.py index 217f6df2933f..4d135951f8e4 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMarkCellSurfaceStatus2.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMarkCellSurfaceStatus2.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -82,7 +82,7 @@ def ParseParametersFromJson(self, inJson): self.OffsetIndex = 0 keyval10 = "output cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.OutputCellVariableName = inJson[keyval10] keyval11 = "do operation in createparaview method" diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMpiUtilities.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMpiUtilities.py index 08c9d70ec307..3a19e68b4d9a 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMpiUtilities.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriMpiUtilities.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -172,7 +172,7 @@ def UseMpiToSendAllProcessesFloatArrayToOneProcess(thisProcessFloatArray, pidToC retVal = [] if PhactoriDbg(100): - if len(globalFloatArray) == 0: + if len(globalFloatArray) == 0: myDebugPrint3(str(len(globalFloatArray)) + "\n") else: myDebugPrint3(str(len(globalFloatArray)) + " " + str(globalFloatArray[0]) + " " + str(globalFloatArray[-1]) + "\n") diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriOperationBlock.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriOperationBlock.py index 80363d359907..db62f46cef24 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriOperationBlock.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriOperationBlock.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -66,7 +66,7 @@ class PhactoriOperationBlock: Operations with multiple inputs and outputs are conceiveable, and may be added pending user requirements. The instance is presumed to contain a name unique amound the operation - blocks and keeps a reference to the input operation (by name), the + blocks and keeps a reference to the input operation (by name), the ParaView/Catalyst filter which is built, and some flags determining where we are in the construction process. """ @@ -226,7 +226,7 @@ def OutputElementListFromOneBlockToFile(self, inInputCsData, inParameters): myDebugPrint3("OutputElementListFromOneBlockToFile returning\n") class FindClosestNPointsToListParams: - """recursion structure for FindClosestNPointsToList(). Also servers to + """recursion structure for FindClosestNPointsToList(). Also servers to store/track data for passing back answer""" def __init__(self, inParentOperation, inNumToFind, inTargetGlobalNodeIdList, inTargetPointXyzList): @@ -343,7 +343,7 @@ def TestPointSub2(self, inSrcId, inSrcXyz, inTgtId, inTgtXyz, inNrstdist): # str(self.mTargetMatchXyzs.GetValue(gndx+2)) + "\n") #now find which in the current list has the biggest distance, as it is - #next in line for replacement (we do this to avoid having to shift + #next in line for replacement (we do this to avoid having to shift #elements every time self.mcfndx = 0 self.mMinDistSqrd = self.mDistSqrds.GetValue(0) @@ -414,7 +414,7 @@ def TestPointSub1(self, inId, inX, inY, inZ, tId, tX, tY, tZ): str(self.mTargetMatchXyzs.GetValue(gndx+2)) + "\n") #now find which in the current list has the biggest distance, as it is - #next in line for replacement (we do this to avoid having to shift + #next in line for replacement (we do this to avoid having to shift #elements every time self.mcfndx = 0 self.mMinDistSqrd = self.mDistSqrds.GetValue(0) @@ -530,7 +530,7 @@ def MakeListOfAllPoints1(self): self.DoMethodPerBlock(recursionItem) return recursionItem.mParameters.mGlobalNodeIdList, \ recursionItem.mParameters.mPointXYZList - + def MakeListOfAllPointsInBlock1(self, inInputCsData, inParameters): #if PhactoriDbg(100): # myDebugPrint3("MakeListOfAllPointsInBlock1 entered\n") diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParallelGeometryUtilities.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParallelGeometryUtilities.py index 65ce2a61b6a0..ff0ab895ae9d 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParallelGeometryUtilities.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParallelGeometryUtilities.py @@ -143,7 +143,7 @@ def GetPidWithLeastValueListV5(inLocalDistSqrdList): pidWithDataList = UseReduceOnIntegerList(localPidList, 0) return pidWithDataList, globalDistSqrdList - + def UseMpiToGetGlobalCellPointsClosestV5(inInputFilter, inLocalCellPointList, inLocalDistSqrdList): if PhactoriDbg(100): diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParaviewMultiBlockRecursion.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParaviewMultiBlockRecursion.py index 5824fd966251..ae82e0def0bf 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParaviewMultiBlockRecursion.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriParaviewMultiBlockRecursion.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -92,7 +92,7 @@ def DebugPrintBlockName(csData, blockIndex): myDebugPrint3("oneBlockMetaData is None (2)\n") def PhactoriRecusivelyDoMethodPerBlockFromParaViewFilter(inRecursionControlItem, inPvFilter): - """grab client side data object, and use that to do recursion""" + """grab client side data object, and use that to do recursion""" pvClientSideData = inPvFilter.GetClientSideObject().GetOutputDataObject(0) if pvClientSideData == None: if PhactoriDbg(100): diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceFromJsonList.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceFromJsonList.py index e309bb6d49ab..f868639d5f52 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceFromJsonList.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceFromJsonList.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -69,7 +69,7 @@ def ValidateJsonPointList(self): myDebugPrint3AndException(errStr) return True - + def ParseParametersFromJson(self, inJson): if 'filename' in inJson: self.JsonListFileName = inJson['filename'] @@ -128,4 +128,3 @@ def CreateParaViewFilter(self, inInputFilter): return self.ParaviewPointSource #phactori_combine_to_single_python_file_subpiece_end_1 - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceGeometrySampler1.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceGeometrySampler1.py index d9dcd53429ef..fa489d2e7c60 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceGeometrySampler1.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceGeometrySampler1.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -70,7 +70,7 @@ def ValidateJsonPointList(self): errStr = "PhactoriPointSourceGeometrySampler1::ValidateJsonPointList\n" \ "point with index " + str(ptNdx) + "does not have three elements\n" myDebugPrint3AndException(errStr) - + def ParseParametersFromJson(self, inJson): if 'filename' in inJson: @@ -93,7 +93,7 @@ def GetPidWithLeastValueList(self, inLocalDistSqrdList): pidWithDataList = UseReduceOnIntegerList(localPidList, 0) return pidWithDataList, globalDistSqrdList - + def UseMpiToGetGlobalQuadsClosest(self, inLocalQuadList, inLocalDistSqrdList): if PhactoriDbg(100): myDebugPrint3("PhactoriPointSourceGeometrySampler1.UseMpiToGetGlobalQuadsClosest entered\n", 100) @@ -205,4 +205,3 @@ def CreateParaViewFilter(self, inInputFilter): return self.ParaviewPointSource #phactori_combine_to_single_python_file_subpiece_end_1 - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceNearbyCorrelator.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceNearbyCorrelator.py index 14f2f525c037..3a46926b749c 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceNearbyCorrelator.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriPointSourceNearbyCorrelator.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -72,7 +72,7 @@ def ValidateJsonPointList(self): errStr = "PhactoriPointSourceFromJsonList::ValidateJsonPointList\n" \ "point with index " + str(ptNdx) + "does not have three elements\n" myDebugPrint3AndException(errStr) - + def ParseParametersFromJson(self, inJson): if 'filename' in inJson: @@ -163,13 +163,13 @@ def UseMpiToFindGlobalNearestPointList(self, inTargetPointList, inDistanceSquare for idx in range(0, numSrcPnts): xyzIdx = idx*3 resultPoints.append([globalXyz[xyzIdx], globalXyz[xyzIdx+1], globalXyz[xyzIdx+2], globalNodeId[idx]]) - + if PhactoriDbg(100): myDebugPrint3("resultPoints:\n" + str(resultPoints) + "\n") if PhactoriDbg(100): myDebugPrint3("UseMpiToFindGlobalNearestPointList returning\n") - return resultPoints + return resultPoints def CalculateOneDisplacedPoint(self, srcPt, tgtPt, dispDist): deltaVec = vecFromAToB(srcPt, tgtPt) @@ -200,7 +200,7 @@ def FindCorrelatedInputOperationPoints(self, inInputFilter): """in parallel, using mpi to help, find the nodes from the input filter which are closest to the points in self.mJsonPointList, and record the 3d location of those points""" - + #grab local process points thisProcessPointList = self.mPhactoriOperationBlockOwner.MakeListOfAllPointsAndNodeIdsOnThisProcessFromParaViewFilter(inInputFilter) @@ -228,7 +228,7 @@ def FindCorrelatedInputOperationPoints(self, inInputFilter): distx = math.sqrt(distSqrd) myDebugPrint3(str(ndx) + ": " + str(sourcePt) + " " + str(distSqrd) + " " + str(distx) + " " + str(self.DisplacedPointList[ndx]) + "\n") - + def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3("PhactoriPointSourceFromJsonList.CreateParaViewFilter entered\n", 100) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriRepresentationBlock.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriRepresentationBlock.py index 374bcfa2148c..b75d4c4b2ea4 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriRepresentationBlock.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriRepresentationBlock.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2022 National Technology & Engineering Solutions +# Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -325,7 +325,7 @@ def ParseSettingsFromJson(self, inRepresentationBlockJson): def SetFromRestartInfo(self, inJson): """given a map (json format), use the info in the map to set the - representation state--this reads the info created in + representation state--this reads the info created in GetRestartInfo""" if 'mColorRangeMinMaxTracker' not in inJson: @@ -392,4 +392,3 @@ def SetUpForInterpretValuesAsCateories(self, variableLookUpTable): if PhactoriDbg(): myDebugPrint3("SetUpForInterpretValuesAsCateories returning\n") #phactori_combine_to_single_python_file_subpiece_end_1 - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriResampleWithDataset.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriResampleWithDataset.py index 0cf6d6000797..621b9bd92efc 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriResampleWithDataset.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriResampleWithDataset.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -105,7 +105,7 @@ def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState): self.InternalParaViewFilterPtr.CellLocator = 'Static Cell Locator' self.DebugPrintInputPortAndOutputPortInfo("pre filter update 1\n") - + SetActiveSource(self.InternalParaViewFilterPtr) SetActiveSource(savedActiveSource) @@ -119,7 +119,7 @@ def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState): self.InternalParaViewFilterPtr.UpdatePipeline() self.DebugPrintInputPortAndOutputPortInfo("post filter update 1\n") - + if PhactoriDbg(100): myDebugPrint3("self.InternalParaViewFilterPtr: " + str(self.InternalParaViewFilterPtr) + "\n", 100) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSampledCellInfo.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSampledCellInfo.py index 0f6f20917caf..dd034f5d2b8d 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSampledCellInfo.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSampledCellInfo.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -445,9 +445,9 @@ def PhactoriLocalToGlobalCellsWithMinMaxDataUsingMPI(localPidMinMaxCellPair, tup globalMaxCell = PhactoriSampledCellInfo() globalMinCell.SerializeSetFromFloatAndIntArray(globalSerializedFloatArray, globalSerializedIntArray, 0, tupleSize) globalMaxCell.SerializeSetFromFloatAndIntArray(globalSerializedFloatArray, globalSerializedIntArray, 1, tupleSize) - + if PhactoriDbg(100): myDebugPrint3("PhactoriLocalToGlobalCellsWithMinMaxDataUsingMPI returning\n") - return [globalMinCell, globalMaxCell] - + return [globalMinCell, globalMaxCell] + #phactori_combine_to_single_python_file_subpiece_end_1 diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSegmentCellSampler3.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSegmentCellSampler3.py index 787464d17749..36a4f6908b4f 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSegmentCellSampler3.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSegmentCellSampler3.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -263,7 +263,7 @@ def ValidateJsonSegmentList(self, testlist): errStr = "PhactoriSegmentCellSampler3:ValidateJsonSegmentList\n" \ "segment with index " + str(segNdx) + " point 2 does not have 3 components\n" myDebugPrint3AndException(errStr) - + return True def ParseParametersFromJson(self, inJson): @@ -420,7 +420,7 @@ def CreateInternalSegmentListFromJson(self, segmentListJson): if PhactoriDbg(100): myDebugPrint3("PhactoriSegmentCellSampler3.ExportOperationData entered\n", 100) - if self.SegmentDefinitionFormat == "two geometric points": + if self.SegmentDefinitionFormat == "two geometric points": self.ValidateJsonSegmentList(segmentListJson) self.SegmentList = [] self.NearbyGeometryPointList = [] @@ -501,7 +501,7 @@ def CreateParaViewFilter(self, inInputFilter): savedActiveSource = GetActiveSource() segmentListJson = ReadAndMpiBroadcastJsonFile(self.JsonListFileName) - + self.myCopyOfInputFilter = inInputFilter UpdatePipelineWithCurrentTimeArgument(self.myCopyOfInputFilter) @@ -568,7 +568,7 @@ def GetPidWithLeastValueList(self, inLocalDistSqrdList): pidWithDataList = UseReduceOnIntegerList(localPidList, 0) return pidWithDataList, globalDistSqrdList - + def UseMpiToGetGlobalCellPointsClosestStructured(self, ioCellList, inLocalDistSqrdList): if PhactoriDbg(100): myDebugPrint3("PhactoriSegmentCellSampler3.UseMpiToGetGlobalCellPointsClosestStructured entered\n", 100) @@ -758,12 +758,12 @@ def SetMaskValueForCellsNearSegmentsInBlock(recursionObject, inInputCsData, inPa thisCellDataTuple = outputCellArray.GetTuple(cellIndex) newCellInfo = PhactoriSampledCellInfo() newCellInfo.SetFromList([cellTestPoint, [-1,-1,-1], thisCellDataTuple, myPid, leafVisitCount, cellIndex, segIndex, -1]) - + inParameters.markedCellSet[segIndex].append(newCellInfo) if PhactoriDbg(100): myDebugPrint3("new cell close to segment:\n") myDebugPrint3(newCellInfo.ToStr()) - + if PhactoriDbg(100): for idx, cellsForThisSegment in enumerate(inParameters.markedCellSet): @@ -1273,7 +1273,7 @@ def CreateProgrammableFilterString(self): scriptLines.append(" iter.GoToNextItem();\n") scriptLines.append("else:\n") scriptLines.append(" flatten(input, output)\n") - + mainScriptString = "".join(scriptLines) myCellIndexesToSet = [] @@ -1287,10 +1287,10 @@ def CreateProgrammableFilterString(self): myCellIndexesToSet.append(oneCellInfo.index) myMaskValuesToSet.append(maskValue) myLeafVisitCount.append(oneCellInfo.leafVisitCount) - - newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" - newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" - newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" + + newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" + newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" + newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" self.mProgFilterString = newstr1 + newstr2 + newstr3 + mainScriptString if PhactoriDbg(100): diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSliceWithPlaneOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSliceWithPlaneOperation.py index cb847577e508..1c9bfe23ff6f 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSliceWithPlaneOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriSliceWithPlaneOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -85,7 +85,7 @@ class PhactoriSliceWithPlaneOperation(PhactoriPlaneOpBase): "plane normal":[1.0, 2.0, 3.0] } } - } + } the plane normal does not need to be a unit vector: Phactori will normalize it for you (again, see PhactoriClipPlaneOperation) @@ -183,4 +183,3 @@ def UpdateSlice(self, inIncomingPvFilter, ioOutgoingPvFilter): myDebugPrint3("PhactoriSliceWithPlanePlaneOperation::UpdateSlice returning\n") #phactori_combine_to_single_python_file_subpiece_end_1 - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerOperation.py index 3928af4ccc0d..9436c2c3533a 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -90,12 +90,12 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3("stido0 st: " + str(stido0.GetClassName()) + "\n") stido1 = stcso.GetInputDataObject(1,0) myDebugPrint3("stido1 st: " + str(stido1.GetClassName()) + " numcells " + str(stido1.GetNumberOfCells()) + " numpoints " + str(stido1.GetNumberOfPoints()) + "\n") - + SetActiveSource(newParaViewFilter) SetActiveSource(savedActiveSource) UpdatePipelineWithCurrentTimeArgument(newParaViewFilter) - + if PhactoriDbg(100): stcso = newParaViewFilter.GetClientSideObject() stodo = stcso.GetOutputDataObject(0) @@ -104,7 +104,7 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3("B stido0 st: " + str(stido0.GetClassName()) + "\n") stido1 = stcso.GetInputDataObject(1,0) myDebugPrint3("B stido1 st: " + str(stido1.GetClassName()) + " numcells " + str(stido1.GetNumberOfCells()) + " numpoints " + str(stido1.GetNumberOfPoints()) + "\n") - + if PhactoriDbg(100): myDebugPrint3('PhactoriStreamTracerOperation.CreateParaViewFilter returning\n', 100) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerSeedSourceOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerSeedSourceOperation.py index bdb41b6cfb6f..48a380853d52 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerSeedSourceOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStreamTracerSeedSourceOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -104,14 +104,14 @@ def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState): #self.InternalParaViewFilterPtr.InitialStepLength = 0.01 self.DebugPrintInputPortAndOutputPortInfo("pre filter update 1\n") - + SetActiveSource(self.InternalParaViewFilterPtr) SetActiveSource(savedActiveSource) UpdatePipelineWithCurrentTimeArgument(self.InternalParaViewFilterPtr) self.DebugPrintInputPortAndOutputPortInfo("post filter update 1\n") - + if PhactoriDbg(100): myDebugPrint3("self.InternalParaViewFilterPtr: " + str(self.InternalParaViewFilterPtr) + "\n", 100) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStructuredGridSampler.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStructuredGridSampler.py index 967a78e37d69..bbc94bffbe89 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStructuredGridSampler.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriStructuredGridSampler.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -131,7 +131,7 @@ def GatherStructuredSampledCellsOnThisProcess(self): dataArrayNumCmpnts = -1 defaultTuple = [] - + def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3("PhactoriStructuredGridSampler.CreateParaViewFilter entered\n", 100) @@ -139,7 +139,7 @@ def CreateParaViewFilter(self, inInputFilter): savedActiveSource = GetActiveSource() ##segmentListJson = ReadAndMpiBroadcastJsonFile(self.JsonListFileName) - + self.myCopyOfInputFilter = inInputFilter UpdatePipelineWithCurrentTimeArgument(self.myCopyOfInputFilter) @@ -151,4 +151,3 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3("PhactoriStructuredGridSampler.CreateParaViewFilter returning\n", 100) #phactori_combine_to_single_python_file_subpiece_end_1 - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriThresholdOperation.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriThresholdOperation.py index 91e671751b6a..ce4921cb2b79 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriThresholdOperation.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriThresholdOperation.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -122,7 +122,7 @@ def DoUpdateDueToChangeInData(self, inIncomingPvFilter, if self.mVariableInfo.mVariableTypeNeedsDetection == False: UpdatePipelineWithCurrentTimeArgument(outOutgoingPvFilter) - + def ParseParametersFromJson(self, inJson): self.mBypassFlag = getParameterFromBlock(inJson, 'bypass flag', @@ -257,4 +257,3 @@ def CreateParaViewFilter(self, inInputFilter): return newParaViewFilter #phactori_combine_to_single_python_file_subpiece_end_1 - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriVtkCellOperations.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriVtkCellOperations.py index 47d4985cce71..b6d07108dc90 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriVtkCellOperations.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriVtkCellOperations.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -181,9 +181,9 @@ def PhactoriCountCellTouchingEachFace(inInputCsData): "\nnum faces with 1 cell: " + str(cctef.totalNumFacesWithOneCellTouching) + \ "\nnum faces with 2 cells: " + str(cctef.totalNumFacesWithTwoCellsTouching) + \ "\nnum faces with 3+ cells: " + str(cctef.totalNumFacesWith3plCellsTouching) + "\n") - + return countCellsTouchingEachFace - + def PhactoriCountCellTouchingEachPoint(inInputCsData): numCells = inInputCsData.GetNumberOfCells() numPoints = inInputCsData.GetNumberOfPoints() @@ -474,7 +474,7 @@ def PhactoriGetAverageOfCellPoints(inInputCsData, oneCell): avgFac = 1.0/float(numPoints) vecScaleInPlace(avgFac, retAvgPt) return retAvgPt - + def PhactoriFindSelectedAngleBetweenEdgeAndCellNormal(inInputCsData, oneCell, compareNormal, paramUseSmallestAngle, paramOffsetIndex): edgeCompareDotProdList = [] @@ -484,7 +484,7 @@ def PhactoriFindSelectedAngleBetweenEdgeAndCellNormal(inInputCsData, oneCell, vecNormalize2(oneEdgeVec, oneEdgeVec) edgeCompareDotProd = abs(vecDotProduct(compareNormal, oneEdgeVec)) edgeCompareDotProdList.append(edgeCompareDotProd) - + sortedEdgeCompareDotProdList = sorted(edgeCompareDotProdList) if paramUseSmallestAngle: @@ -499,7 +499,7 @@ def DebugPrintPhactoriFindHeightOfCell(inInputCsData, oneCell, compareNormal): if PhactoriDbg(100): dbght = [] dbglen = [] - dbgretHeight = -1.0 + dbgretHeight = -1.0 dbgretHeightIndex = -1 for ii in range(0, numCellEdges): oneCellEdgeVec = PhactoriGetCellEdgeVector(inInputCsData, oneCell, ii) @@ -528,7 +528,7 @@ def PhactoriFindHeightOfCell(inInputCsData, oneCell, compareNormal): #than the four shortest sides? numCellEdges = oneCell.GetNumberOfEdges() - retHeight = -1.0 + retHeight = -1.0 for ii in range(0, numCellEdges): #get edge vectory and project on to normal vector (which is unit length) #and find magnitude diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCameraBlock.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCameraBlock.py index 79fc49702ae3..b1f791b5bf56 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCameraBlock.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCameraBlock.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -230,7 +230,7 @@ def getjson_ForTestHelper1(testname, thisTestJson): } } return testname, myjson - + @staticmethod def getjson_CameraLookDirectionWithDefaultLookAtPointZMinus1(): testname = "CameraLookDirectionWithDefaultLookAtPointZMinus1" @@ -255,7 +255,7 @@ def test_CameraLookDirectionWithDefaultLookAtPointZMinus1(self): baselineCamFocalPt = [5.0, -0.001999974250793457, -0.625] self.CheckCameraPostionAndFocalPoint(testOutFile, baselineCamPos, baselineCamFocalPt) self.RemoveTestOutputFiles2(testname); - + @staticmethod def getjson_CameraLookDirectionWithDefaultLookAtPointZPlus1(): testname = "CameraLookDirectionWithDefaultLookAtPointZPlus1" @@ -687,4 +687,3 @@ def test_CameraImageNameAddon(self): cc = Cone() rr = Show() unittest.main() - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCreateSegmentsNormalToCells.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCreateSegmentsNormalToCells.py index 2328b7b354af..f3f832d3610f 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCreateSegmentsNormalToCells.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriCreateSegmentsNormalToCells.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -50,9 +50,9 @@ def MakeOneHexahdtronGridFrom8Points1(self, pointList): points.InsertNextPoint(pointList[5]) points.InsertNextPoint(pointList[6]) points.InsertNextPoint(pointList[7]) - + # Create a hexahedron from the points - hex = vtk.vtkHexahedron() + hex = vtk.vtkHexahedron() hex.GetPointIds().SetId(0,0) hex.GetPointIds().SetId(1,1) hex.GetPointIds().SetId(2,2) @@ -61,11 +61,11 @@ def MakeOneHexahdtronGridFrom8Points1(self, pointList): hex.GetPointIds().SetId(5,5) hex.GetPointIds().SetId(6,6) hex.GetPointIds().SetId(7,7) - + # Add the hexahedron to a cell array hexs = vtk.vtkCellArray() hexs.InsertNextCell(hex) - + # Add the points and hexahedron to an unstructured grid uGrid = vtk.vtkUnstructuredGrid() uGrid.SetPoints(points) @@ -163,7 +163,7 @@ def test_Parse4(self): self.assertRaises(Exception, pcsntc1.ParseParametersFromJson, testJson1) testJson1 = {"segment direction reference point":13.5} self.assertRaises(Exception, pcsntc1.ParseParametersFromJson, testJson1) - + def test_CalculateGeometricProgressionSampleValues_linear(self): pcsntc1 = PhactoriCreateSegmentsNormalToCells() @@ -242,7 +242,7 @@ def test_CreateParaViewSourcesForSegments(self): pcsntc1 = PhactoriCreateSegmentsNormalToCells() pcsntc1.CreateSegmentsForAllCells(xfrm1) pcsntc1.CreateParaViewSourcesForSegments() - + if __name__ == '__main__': cc = Cone() diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriGeometricCellSampler1.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriGeometricCellSampler1.py index eb5d43ae42de..c667fafff8d2 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriGeometricCellSampler1.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriGeometricCellSampler1.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -238,7 +238,7 @@ def test_CreateInternalListOfGeometricallySampledCellsOnThisProcess(self): [[-1.5, 3.5, 6.5], [-1, -1, -1], [204.49305725097656], 0, 1, 6668, -1, -1]] } """ - + goldJson = json.loads(goldTestStringJson) ff = open("test_PhactoriGeometricCellSampler1_1.json", "r") testJson = json.load(ff) @@ -567,5 +567,3 @@ def test_CollectDataOnSampledCellsOnThisProcess(self): cc = Cone() rr = Show() unittest.main() - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriPointSourceFromJsonList.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriPointSourceFromJsonList.py index 1e55b80fd2ac..24240801fbfa 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriPointSourceFromJsonList.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriPointSourceFromJsonList.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -55,11 +55,11 @@ def test_ValidateJsonPointList(self): ] with self.assertRaises(Exception): theSource.ValidateJsonPointList() - + theSource.JsonList = [] with self.assertRaises(Exception): theSource.ValidateJsonPointList() - + def test_CreateVtkPolyDataFromJsonList(self): theSource = PhactoriPointSourceFromJsonList() @@ -77,10 +77,8 @@ def test_CreateVtkPolyDataFromJsonList(self): self.assertEqual(pt0, tuple(theSource.JsonList[0])) pt3 = vtkPts.GetPoint(3) self.assertEqual(pt3, tuple(theSource.JsonList[3])) - + if __name__ == '__main__': cc = Cone() rr = Show() unittest.main() - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegment.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegment.py index f2a8720debe1..e65f26191b11 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegment.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegment.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -55,7 +55,7 @@ def test_FindNearestPointOnSegmentToPoint(self): self.assertEqual(testpt1, theSegment.ptB) testpt1 = theSegment.FindNearestPointOnSegmentToPoint([0.0, 0.0, 0.0]) self.assertEqual(testpt1, [-0.3793103448275862, -0.06896551724137923, 0.24137931034482762]) - + def test_FindDistanceSquaredToPoint(self): theSegment = PhactoriSegment() theSegment.SetPoints([-1.0, -1.0, -1.0], [1.0, 2.0, 3.0]) @@ -223,5 +223,3 @@ def test_IntersectsBoundingBoxProjected(self): cc = Cone() rr = Show() unittest.main() - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegmentCellSampler3.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegmentCellSampler3.py index 29949536772d..e518d645d3bd 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegmentCellSampler3.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriSegmentCellSampler3.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -154,7 +154,7 @@ def test_GetListOfCellTestPointsNearestListOfPoints(self): #myDebugPrint3('DoMethodPerBlock: pvClientSideData is None\n') #outstr3 = "num points in sphere: " + str(pvClientSideData.GetNumberOfPoints()) + "\n" #myDebugPrint3(outstr3) - + PhactoriSegmentCellSampler3Instance = newOperationBlock.mOperationSpecifics PhactoriSegmentCellSampler3Instance.myCopyOfInputFilter = testSphere thisProcessNearestCellPointList, thisProcDistSqrdList = PhactoriSegmentCellSampler3Instance.\ @@ -327,8 +327,8 @@ def test_GatherStructuredCellsFromSeedCells(self): localDataTuples.append(oneStructuredCell.dataTuple) self.assertEqual(localResultPoints, goldPoints[ii]) #myDebugPrint3("end cell test points for segment k axis " + str(ii) + "\n") - - #test j axis collection instead of k + + #test j axis collection instead of k operationParams = { "filename":"dummyfilename", "cell center to segment test distance":0.5, @@ -348,7 +348,7 @@ def test_GatherStructuredCellsFromSeedCells(self): self.assertTrue(PhactoriSegmentCellSampler3Instance.ValidateJsonStructuredSeedCellList(testGeometryPointsJson)) PhactoriSegmentCellSampler3Instance.CreateInternalStructuredSeedCellListFromJson(testGeometryPointsJson) testWavelet.UpdatePipeline() - + perSegmentStructuredCellList = PhactoriSegmentCellSampler3Instance.GatherStructuredCellsFromSeedCells() self.assertEqual(len(perSegmentStructuredCellList),len(PhactoriSegmentCellSampler3Instance.StructuredNearbyCellPointList)) @@ -365,8 +365,8 @@ def test_GatherStructuredCellsFromSeedCells(self): #myDebugPrint3(str(oneStructuredCell.cellTestPoint) + "\n") self.assertEqual(localResultPoints, goldPoints[ii]) #myDebugPrint3("end cell test points for segment j axis " + str(ii) + "\n") - - #test i axis collection instead of j or k + + #test i axis collection instead of j or k operationParams = { "filename":"dummyfilename", "cell center to segment test distance":0.5, @@ -375,7 +375,7 @@ def test_GatherStructuredCellsFromSeedCells(self): } PhactoriSegmentCellSampler3Instance.ParseParametersFromJson(operationParams) - + testGeometryPointsJson = [ {"geometric seed point":[0.5, 0.5, 0.5], "collection axis":"i"}, @@ -386,7 +386,7 @@ def test_GatherStructuredCellsFromSeedCells(self): self.assertTrue(PhactoriSegmentCellSampler3Instance.ValidateJsonStructuredSeedCellList(testGeometryPointsJson)) PhactoriSegmentCellSampler3Instance.CreateInternalStructuredSeedCellListFromJson(testGeometryPointsJson) testWavelet.UpdatePipeline() - + perSegmentStructuredCellList = PhactoriSegmentCellSampler3Instance.GatherStructuredCellsFromSeedCells() self.assertEqual(len(perSegmentStructuredCellList),len(PhactoriSegmentCellSampler3Instance.StructuredNearbyCellPointList)) @@ -509,7 +509,7 @@ def test_WriteAllDataFromOneProcessUsingMPI(self): testJson = json.load(ff) ff.close() self.assertEqual(goldJson, testJson) - + #remove file that got made during test os.remove(testFileName) @@ -847,11 +847,9 @@ def test_WriteAllDataFromOneProcessUsingMPIStructured(self): #remove file that got made during test os.remove(testFileName) - - + + if __name__ == '__main__': cc = Cone() rr = Show() unittest.main() - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriVtkCellOperations.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriVtkCellOperations.py index 27fb01cc6da2..39627a16161b 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriVtkCellOperations.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/test_PhactoriVtkCellOperations.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -50,9 +50,9 @@ def MakeOneHexahdtronGridFrom8Points1(self, pointList): points.InsertNextPoint(pointList[5]) points.InsertNextPoint(pointList[6]) points.InsertNextPoint(pointList[7]) - + # Create a hexahedron from the points - hex = vtk.vtkHexahedron() + hex = vtk.vtkHexahedron() hex.GetPointIds().SetId(0,0) hex.GetPointIds().SetId(1,1) hex.GetPointIds().SetId(2,2) @@ -61,11 +61,11 @@ def MakeOneHexahdtronGridFrom8Points1(self, pointList): hex.GetPointIds().SetId(5,5) hex.GetPointIds().SetId(6,6) hex.GetPointIds().SetId(7,7) - + # Add the hexahedron to a cell array hexs = vtk.vtkCellArray() hexs.InsertNextCell(hex) - + # Add the points and hexahedron to an unstructured grid uGrid = vtk.vtkUnstructuredGrid() uGrid.SetPoints(points) @@ -429,12 +429,12 @@ def test_PhactoriGetCellEdgeVector(self): self.assertEqual(testEdgeVec, [0.0, 0.0, 4.0]) testEdgeVec = PhactoriGetCellEdgeVector(testugrid1, testhex1, 11) self.assertEqual(testEdgeVec, [0.0, 0.0, 3.0]) - + def test_PhactoriFindCellEdgeAngleMetricsForOneCell(self): testugrid1 = self.MakeOneHexahdronGrid1() testAngle, testHeight = PhactoriFindCellEdgeAngleMetricsForOneCell(testugrid1, 0, True, 0) self.assertEqual(testAngle, 67.38013505195958) - self.assertEqual(testHeight, 3.692307692307693) + self.assertEqual(testHeight, 3.692307692307693) testugrid2 = self.MakeOneFlatHexahdronGrid1() testAngle, testHeight = PhactoriFindCellEdgeAngleMetricsForOneCell(testugrid2, 0, True, 0) self.assertEqual(testAngle, 10.024987862075733) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriCombineToOneFile.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriCombineToOneFile.py index 58de09d924e1..9a53d0b73143 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriCombineToOneFile.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriCombineToOneFile.py @@ -96,7 +96,7 @@ def RemoveTripleQuotes(inlines): print(chgLine) outlines.append(chgLine) ndx = qend_ndx + 1 - return outlines + return outlines @@ -248,7 +248,3 @@ def GetCombineSectionFromClass(inClassName): if frmphimprtlnfound == False: print("error, from phactori import * not found in PhactoriDriver_modular.py") exit(-12) - - - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py index 90dde56b1877..eabb655279c1 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -690,7 +690,7 @@ def TestUserDataForBypassScript(datadescription): myDebugPrint3("no user data, no catalyst_script_extra_file (2)\n") return - if(sa.GetNumberOfValues() > 8): + if(sa.GetNumberOfValues() > 8): catalyst_script_extra_file = sa.GetValue(8) if PhactoriDbg(100): myDebugPrint3(" catalyst_script_extra_file: ->" + \ @@ -901,7 +901,7 @@ def ParseSettingsFromJson(self, inJsn): halfH - betweenEyeY, -eyeToScreenDistance ] - + def GetScreenBottomLeft(self, inLeftEyeFlag): if inLeftEyeFlag: return self.mLeftEyeScreenBottomLeft @@ -1778,7 +1778,7 @@ def DebugPrintCellAndPointArrayInfo(label, pvFilter, priority): DebugPrintVtkDataArraysInfo("PointData:\n", theData, priority) theData = pvFilter.CellData DebugPrintVtkDataArraysInfo("CellData:\n", theData, priority) - + #def SetCpViewsAndCpWriters(inCpViews, inCpWriters): # global localCpViews # global localCpWriters @@ -2122,9 +2122,9 @@ def PhactoriCountCellTouchingEachFace(inInputCsData): "\nnum faces with 1 cell: " + str(cctef.totalNumFacesWithOneCellTouching) + \ "\nnum faces with 2 cells: " + str(cctef.totalNumFacesWithTwoCellsTouching) + \ "\nnum faces with 3+ cells: " + str(cctef.totalNumFacesWith3plCellsTouching) + "\n") - + return countCellsTouchingEachFace - + def PhactoriCountCellTouchingEachPoint(inInputCsData): numCells = inInputCsData.GetNumberOfCells() numPoints = inInputCsData.GetNumberOfPoints() @@ -2415,7 +2415,7 @@ def PhactoriGetAverageOfCellPoints(inInputCsData, oneCell): avgFac = 1.0/float(numPoints) vecScaleInPlace(avgFac, retAvgPt) return retAvgPt - + def PhactoriFindSelectedAngleBetweenEdgeAndCellNormal(inInputCsData, oneCell, compareNormal, paramUseSmallestAngle, paramOffsetIndex): edgeCompareDotProdList = [] @@ -2425,7 +2425,7 @@ def PhactoriFindSelectedAngleBetweenEdgeAndCellNormal(inInputCsData, oneCell, vecNormalize2(oneEdgeVec, oneEdgeVec) edgeCompareDotProd = abs(vecDotProduct(compareNormal, oneEdgeVec)) edgeCompareDotProdList.append(edgeCompareDotProd) - + sortedEdgeCompareDotProdList = sorted(edgeCompareDotProdList) if paramUseSmallestAngle: @@ -2440,7 +2440,7 @@ def DebugPrintPhactoriFindHeightOfCell(inInputCsData, oneCell, compareNormal): if PhactoriDbg(100): dbght = [] dbglen = [] - dbgretHeight = -1.0 + dbgretHeight = -1.0 dbgretHeightIndex = -1 for ii in range(0, numCellEdges): oneCellEdgeVec = PhactoriGetCellEdgeVector(inInputCsData, oneCell, ii) @@ -2469,7 +2469,7 @@ def PhactoriFindHeightOfCell(inInputCsData, oneCell, compareNormal): #than the four shortest sides? numCellEdges = oneCell.GetNumberOfEdges() - retHeight = -1.0 + retHeight = -1.0 for ii in range(0, numCellEdges): #get edge vectory and project on to normal vector (which is unit length) #and find magnitude @@ -2924,7 +2924,7 @@ def DebugPrintBlockName(csData, blockIndex): myDebugPrint3("oneBlockMetaData is None (2)\n") def PhactoriRecusivelyDoMethodPerBlockFromParaViewFilter(inRecursionControlItem, inPvFilter): - "grab client side data object, and use that to do recursion" + "grab client side data object, and use that to do recursion" pvClientSideData = inPvFilter.GetClientSideObject().GetOutputDataObject(0) if pvClientSideData == None: if PhactoriDbg(100): @@ -3009,7 +3009,7 @@ class PhactoriRenderViewInfo: def __init__(self): self.RenderView1 = None self.DataRepresentation1 = None - + #class PhactoriRenderViewInfo: # RenderView1 = None # DataRepresentation1 = None @@ -3156,12 +3156,12 @@ def SafeColorBy(inDataRepresentation, ptOrNodeAndVarname): if PhactoriDbg(100): myDebugPrint3("SafeColorBy returning (valid cell data)\n") return - + def SetDataRepresentationToDefault(inDataRepresentation): #a3_vel__PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) - + inDataRepresentation.SelectionPointLabelColor = [0.5, 0.5, 0.5] inDataRepresentation.SelectionPointFieldDataArrayName = 'displ' inDataRepresentation.SuppressLOD = 0 @@ -3488,7 +3488,7 @@ def AddRenderView(inPhactoriImagesetInfo, inColorSettings, inPhactoriImagesetInfo.mPvDataRepresentation2 = DataRepresentation1 inPhactoriImagesetInfo.mVisiblePvDataReps[0] = DataRepresentation1 else: - DataRepresentation1 = inPhactoriImagesetInfo.mPvDataRepresentation2 + DataRepresentation1 = inPhactoriImagesetInfo.mPvDataRepresentation2 if PhactoriDbg(): myDebugPrint3("new DataRepresentation1: " + str(DataRepresentation1) + "\n") @@ -3631,9 +3631,9 @@ def CheckForParallelVector(vec1, vec2): if PhactoriDbg(): myDebugPrint3("same ratio between vectors, parallel\n") return True - + #given a bounds in the form [xmin, xmax, ymin, ymax, zmin, zmax], return the -# maximum dimension out of all those (max of xmax-xmin, ymax-ymin, and +# maximum dimension out of all those (max of xmax-xmin, ymax-ymin, and # zmax-zmin) def GetMaximumDimensionFromBounds(inBounds): maxDim = inBounds[1] - inBounds[0] @@ -4133,7 +4133,7 @@ def GetXyzForNodeOrElementParallelOneBlock(inInputCsData, inIdIsNode, def GetXyzForNodeOrElementParallelRecurse1(inInputCsData, inIdIsNode, inGlobalId, outXyz): "utility function used by GetXyzForNodeOrElementParallel\n\n looking for inGlobalId to potentially set outXyz, recurses through\n structure and calls GetXyzForNodeOrElementParallelOneBlock() on\n unstructured grids to do the real work of checking for the id and setting\n outXyz\n " - + #myDebugPrint3('GetXyzForNodeOrElementParallelRecurse1 entered\n', 100) icsdClassname = inInputCsData.GetClassName() @@ -4258,7 +4258,7 @@ def CalcRelativeCameraDistance2_AA(inFocalPoint, inNormCameraDir, "finds point X which is along the inNormCameraDir vector starting from\n point inFocalPoint, such that inTestPoint is visible. This is\n accomplished by taking a parametric value ss to move the camera position\n out from the focal point (along the inNormCameraDir vector) and finding\n the parametric value such that the angle between the vector from the\n camera position to the focal point and the camera position to inTestPoint\n is equal to (or greater than) the camera field of view. The parametric\n value is returned. We use the law of sines. assumes inNormCameraDir\n is normalized and pointing in the direction from inFocalPoint towards\n where we want to place the camera (the opposite of the look direction)" #angle between camera-to-focal point vector and camera-to-testpoint vector - #is equal to half the camera fOV. Call this angle AA. + #is equal to half the camera fOV. Call this angle AA. #The side opposite this angle has length equal to the distance between #the focal point and the test point. Call this distance aa. We also #know the angle between the focal point-to-camera vector and the focal @@ -4349,7 +4349,7 @@ def CalcRelativeCameraDistance2_BB(inFocalPoint, inNormCameraDir, myDebugPrint3("pointH: " + str(pointH) + "\n"); dd1 = CalcRelativeCameraDistance2_AA(inFocalPoint, inNormCameraDir, - pointH, inFovH) + pointH, inFovH) if PhactoriDbg(100): myDebugPrint3("dd1: " + str(dd1) + "\n"); dd2 = CalcRelativeCameraDistance2_AA(inFocalPoint, inNormCameraDir, @@ -4434,7 +4434,7 @@ def CalcRelativeCameraDistance2(inFocalPoint, inLookDirection, inUpVector, aspectRatio = float(inXyPixelSize[0]) / float(inXyPixelSize[1]) else: aspectRatio = float(pixelSizeWithBorder[0]) / float(pixelSizeWithBorder[1]) - + if PhactoriDbg(100): myDebugPrint3("bordered aspectRatio: " + str(aspectRatio) + "\n"); @@ -4558,7 +4558,7 @@ def SetParaViewRepresentationCameraParams(inXParaViewRenderView, inCameraC, if PhactoriDbg(): myDebugPrint3(' lookDirection ' + str(lookDirection) + '\n') - myViewBounds = viewBoundsIo[0] + myViewBounds = viewBoundsIo[0] if PhactoriDbg(): myDebugPrint3(' focalPoint ' + str(focalPoint) + '\n') @@ -5316,11 +5316,11 @@ def MakeFiltersFromViewMapOperationsC(ioPipeAndViewsState, inOperationBlocksJson keepConstructing = False #at the beginning of the loop, we haven't seen any unconstructed operations for operationName, operationBlock in ioPipeAndViewsState.mOperationBlocks.items(): if operationBlock.mHasBeenConstructed == False: - #this one still needs constructing, and we'll have to loop again to + #this one still needs constructing, and we'll have to loop again to #make sure all are constructed keepConstructing = True - #determine whether or not we can construct this operation yet, or if + #determine whether or not we can construct this operation yet, or if #we need to wait for something else to be constructed canBeConstructedNow = True inputOperationNames = operationBlock.GetListOfInputOperationNames() @@ -5329,7 +5329,7 @@ def MakeFiltersFromViewMapOperationsC(ioPipeAndViewsState, inOperationBlocksJson if inputBlock.mHasBeenConstructed == False: canBeConstructedNow = False break - + if PhactoriDbg(100): myDebugPrint3("trying: " + str(operationName) + "\n" + \ "depends on: " + str(inputOperationNames) + "\n" + \ @@ -5340,7 +5340,7 @@ def MakeFiltersFromViewMapOperationsC(ioPipeAndViewsState, inOperationBlocksJson operationBlock.mHasBeenConstructed = True if PhactoriDbg(100): myDebugPrint3("done constructing all operation blocks\n",100) - + #helper method: given a block A which potentially contains a key B with @@ -5403,7 +5403,7 @@ def CreateParaViewRepresentationAndViewFromInfoC(inImageset, inLookDirection, in raise Exception(errStr) meshRenderControl = theRepresentation.mMeshRenderControl - + showColorLegend = theRepresentation.mColorLegendFlag colorLegendPositionAndSize = theRepresentation.mColorLegendPositionAndSize showDataCubeAxes = theRepresentation.mDataCubeAxesFlag @@ -5433,7 +5433,7 @@ def CreateParaViewRepresentationAndViewFromInfoC(inImageset, inLookDirection, in numArrays = pvPvGeomFilterFromOp.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + pvPvGeomFilterFromOp.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" operation cell data arrays:\n") numArrays = pvPvGeomFilterFromOp.CellData.GetNumberOfArrays() @@ -5627,7 +5627,7 @@ def ParseOneCameraBlockC(ioCameraBlock, ioCameraBlockJson, inPipeAndViewsState): ioCameraBlock.mLookDirectionSpecifiedFlag = True else: ioCameraBlock.mLookDirectionSpecifiedFlag = False - + #get text to add to each image created with this camera, if any if "image name addon" in ioCameraBlockJson: ioCameraBlock.mFilenameAddon = ioCameraBlockJson["image name addon"] @@ -5679,7 +5679,7 @@ def ParseOneCameraBlockC(ioCameraBlock, ioCameraBlockJson, inPipeAndViewsState): 'lock camera call count', -1) if "lockingcamera" in ioCameraBlock.mName: ioCameraBlock.LockAfterNCalls = 1 - + def localGet1or0(inJsn, inKey, inDefault): value = getParameterFromBlock(inJsn, inKey, inDefault) @@ -6432,7 +6432,7 @@ def GetCurrentGeometricPoint(self, inParaViewSource, ioViewBounds, if PhactoriDbg(): myDebugPrint3(errStr) raise Exception(errStr) - + if PhactoriDbg(100): myDebugPrint3("GetCurrentGeometricPoint returning: " + \ str(returnXyz) + "\n", 100) @@ -6512,7 +6512,7 @@ def ParseParametersFromJson(self, inJsn): if 'auto size 1 view angle delta in degrees' in inJsn: angleInDegrees = inJsn['auto size 1 view angle delta in degrees'] self.mAutoSize1ViewAngleDeltaInRadians = math.radians(angleInDegrees) - + def SetUpIfEnabled(self, inRenderView, ioCameraPosition, ioLookAtPoint, inViewUpVector): @@ -6612,7 +6612,7 @@ def ChangeEyeAndFocusInModelSpaceForStereo(self, lookDirection = vecFromAToB(ioEyePosition, ioFocalPoint) axisBetweenEyes = vecCrossProduct(lookDirection, inViewUpVector) axisBetweenEyesNorm = vecNormalize(axisBetweenEyes) - + if self.mLeftEyeFlag: modelCsHalfIpd = -self.mIpdInModelUnits * \ self.mVirtualSelfSizeMultiplier * 0.5 @@ -7010,7 +7010,7 @@ def DcoaiParseParametersFromJson(self, parentAxesInfo, inJsn, inXyzKey): if theKey in inJsn: self.mUseLabelFlag = True self.mAxisLabel = getParameterFromBlock(inJsn, theKey, "") - + if PhactoriDbg(): myDebugPrint3('DcoaiParseParametersFromJson ' + inXyzKey + ' ' \ + str(parentAxesInfo.mShowTicks) + ' ' \ @@ -7136,7 +7136,7 @@ def DoUpdateDueToChangeInData(self, inIncomingPvFilter, if self.mVariableInfo.mVariableTypeNeedsDetection == False: UpdatePipelineWithCurrentTimeArgument(outOutgoingPvFilter) - + def ParseParametersFromJson(self, inJson): self.mBypassFlag = getParameterFromBlock(inJson, 'bypass flag', @@ -7592,7 +7592,7 @@ def CreateParaViewFilter(self, inInputFilter): numArrays = inInputFilter.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + inInputFilter.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" calculator inInputFilter cell data arrays:\n") numArrays = inInputFilter.CellData.GetNumberOfArrays() @@ -7932,13 +7932,13 @@ def IntersectWithOneRayViaBSPTree(self, inIndex, inRayStart, inRayDirection, if inPointOrCellData <= 0: oldvv = ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ GetValue(inIndex) - if (oldvv < 0.0) or (hitdist < oldvv): + if (oldvv < 0.0) or (hitdist < oldvv): ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitdist) else: oldvv = ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ GetValue(inIndex) - if (oldvv < 0.0) or (hitdist < oldvv): + if (oldvv < 0.0) or (hitdist < oldvv): ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitdist) @@ -8006,14 +8006,14 @@ def IntersectWithOneRay(self, inIndex, inRayStart, inRayDirection, oldvv = ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ GetValue(inIndex) newvv = hitPoint[3] - if (oldvv < 0.0) or (newvv < oldvv): + if (oldvv < 0.0) or (newvv < oldvv): ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitPoint[3]) else: oldvv = ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ GetValue(inIndex) newvv = hitPoint[3] - if (oldvv < 0.0) or (newvv < oldvv): + if (oldvv < 0.0) or (newvv < oldvv): ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitPoint[3]) @@ -8304,7 +8304,7 @@ def TestAndSet(self, inLengthSquared, inPt1, inPt2): self.LengthSquared = inLengthSquared vecCopy(self.Point1, inPt1) vecCopy(self.Point2, inPt2) - + class PhactoriSegmentGroup1: "manage a set of segments for purposes of showing raycast results" def __init__(self): @@ -8840,7 +8840,7 @@ def ParseOutputFilenameParametersFromJson(self, inJson): if (self.Precision < 1) or (self.Precision > 100): myDebugPrint3AndException("PhactoriCSVExportOperation:\n" "precision must be 1-100, not " + str(self.Precision) + "\n") - + def ParseParametersFromJson(self, inJson): self.ParseOutputFilenameParametersFromJson(inJson) @@ -8923,7 +8923,7 @@ def __init__(self): self.mCellNormalRayIntersectDistanceArray = None self.SegmentsFromPointRays = PhactoriSegmentGroup1() - self.SegmentsFromTriangleRays = PhactoriSegmentGroup1() + self.SegmentsFromTriangleRays = PhactoriSegmentGroup1() def ParseParametersFromJson(self, inJson): if "target operation" in inJson: @@ -8971,7 +8971,7 @@ def CreateParaViewFilter(self, inInputFilter): self.mTriangleRayLineSource = PVTrivialProducer() self.mTriangleRayLineSource.GetClientSideObject().SetOutput( self.SegmentsFromTriangleRays.mVtkPolyData) - + #newParaViewFilter = GroupDatasets(Input = []) #self.mGroupLineSource = newParaViewFilter @@ -8986,7 +8986,7 @@ def CreateParaViewFilter(self, inInputFilter): else: newParaViewFilter = PVTrivialProducer() passthru = inInputFilter.GetClientSideObject().GetOutputDataObject(0) - + numpts = passthru.GetNumberOfPoints() newvar = vtk.vtkDoubleArray() @@ -9085,7 +9085,7 @@ def RunCalculationToCastRays(self, ioPipeAndViewsState): #now loop through all processes; one process at a time share the triangles #from each process to the others and intersect with the local surface - #portion + #portion mypid = SmartGetLocalProcessId() @@ -9139,7 +9139,7 @@ def RunCalculationToCastRays(self, ioPipeAndViewsState): def ExportOperationData(self, datadescription): "this will be called once per callback (before WriteImages) to allow the\n operation to export any desired data which is not an image. The child\n class should override this method if it wants so do something.\n For PhactoriIntersectNodeNormalsWithSurface we will output information\n about the nearest and furthest intersections" - + if PhactoriDbg(100): myDebugPrint3( "PhactoriIntersectNodeNormalsWithSurface::ExportOperationData " @@ -9315,7 +9315,7 @@ def CreateParaViewFilter(self, inInputFilter): newParaViewFilter = Line() newParaViewFilter.Point1 = [0.0, 0.0, 0.0] newParaViewFilter.Point2 = [0.01, 0.01, 0.01] - + SetActiveSource(newParaViewFilter) SetActiveSource(savedActiveSource) @@ -9418,7 +9418,7 @@ def RunCalculationToFindNearestPoints(self, ioPipeAndViewsState): tgty = self.mClosestNPointsFromEachProcess.mTargetMatchXyzs.GetValue(pndx+1) tgtz = self.mClosestNPointsFromEachProcess.mTargetMatchXyzs.GetValue(pndx+2) - self.mLineSource.Point1 = [srcx, srcy, srcz] + self.mLineSource.Point1 = [srcx, srcy, srcz] self.mLineSource.Point2 = [tgtx, tgty, tgtz] self.mLineSource.UpdatePipeline() @@ -9461,7 +9461,7 @@ def OutputToTextAnnotation(self, ioPipeAndViewsState): tgty = clstpts.mTargetMatchXyzs.GetValue(pndx+1) tgtz = clstpts.mTargetMatchXyzs.GetValue(pndx+2) - if self.mTxtAntnFormatString == None: + if self.mTxtAntnFormatString == None: self.mTextAnnotationOutputTarget.mTextString = \ "nearest: " + str(dist) + "\n" \ "node id 1: " + str(srcndid) + "\n" \ @@ -9646,7 +9646,7 @@ def CreateParaViewFilter2(self, ioPipeAndViewsState): "Error: operation '" + str(ii) + "' paraview filter not " "constructed\n") self.mOperationList.append(inputOperationBlock.GetPvFilter()) - + newParaViewFilter = GroupDatasets(Input = self.mOperationList) SetActiveSource(newParaViewFilter) @@ -10340,7 +10340,7 @@ def ParseParametersFromJson(self, inJson): if PhactoriDbg(100): myDebugPrint3("PhactoriGlyphOperation.ParseParametersFromJson " "entered\n", 100) - + key1 = "scale factor" if key1 in inJson: self.scaleFactor = inJson[key1] @@ -10589,7 +10589,7 @@ def CreateParaViewFilter(self, inInputFilter): numArrays = inInputFilter.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + inInputFilter.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" extractblock inInputFilter cell data arrays:\n") numArrays = inInputFilter.CellData.GetNumberOfArrays() @@ -10608,7 +10608,7 @@ def CreateParaViewFilter(self, inInputFilter): numArrays = newParaViewFilter.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + newParaViewFilter.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" extractblock newParaViewFilter cell data arrays:\n") numArrays = newParaViewFilter.CellData.GetNumberOfArrays() @@ -10724,7 +10724,7 @@ def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3("PhactoriExtractComponentOperation:CreateParaViewFilter entered\n", 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3("about to call UpdatePipelineWithCurrentTimeArgument\n", 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) @@ -10769,7 +10769,7 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3('PhactoriCellSizeOperation:CreateParaViewFilter entered\n', 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3('about to call UpdatePipelineWithCurrentTimeArgument\n', 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) @@ -10818,7 +10818,7 @@ def ParseParametersFromJson(self, inJson): self.AppendPointLocations = 1 else: self.AppendPointLocations = 0 - + key2 = "append cell centers" if key2 in inJson: testval = inJson[key2] @@ -10841,7 +10841,7 @@ def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3('PhactoriAppendLocationAttributesOperation:CreateParaViewFilter entered\n', 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3('about to call UpdatePipelineWithCurrentTimeArgument\n', 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) @@ -10888,7 +10888,7 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3('PhactoriIntegrateVariablesOperation:CreateParaViewFilter entered\n', 100) #info in block class should already be parsed and checked - + if PhactoriDbg(100): myDebugPrint3('about to call UpdatePipelineWithCurrentTimeArgument\n', 100) UpdatePipelineWithCurrentTimeArgument(inInputFilter) @@ -11858,12 +11858,12 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3("stido0 st: " + str(stido0.GetClassName()) + "\n") stido1 = stcso.GetInputDataObject(1,0) myDebugPrint3("stido1 st: " + str(stido1.GetClassName()) + " numcells " + str(stido1.GetNumberOfCells()) + " numpoints " + str(stido1.GetNumberOfPoints()) + "\n") - + SetActiveSource(newParaViewFilter) SetActiveSource(savedActiveSource) UpdatePipelineWithCurrentTimeArgument(newParaViewFilter) - + if PhactoriDbg(100): stcso = newParaViewFilter.GetClientSideObject() stodo = stcso.GetOutputDataObject(0) @@ -11872,7 +11872,7 @@ def CreateParaViewFilter(self, inInputFilter): myDebugPrint3("B stido0 st: " + str(stido0.GetClassName()) + "\n") stido1 = stcso.GetInputDataObject(1,0) myDebugPrint3("B stido1 st: " + str(stido1.GetClassName()) + " numcells " + str(stido1.GetNumberOfCells()) + " numpoints " + str(stido1.GetNumberOfPoints()) + "\n") - + if PhactoriDbg(100): myDebugPrint3('PhactoriStreamTracerOperation.CreateParaViewFilter returning\n', 100) @@ -11952,14 +11952,14 @@ def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState): #self.InternalParaViewFilterPtr.InitialStepLength = 0.01 self.DebugPrintInputPortAndOutputPortInfo("pre filter update 1\n") - + SetActiveSource(self.InternalParaViewFilterPtr) SetActiveSource(savedActiveSource) UpdatePipelineWithCurrentTimeArgument(self.InternalParaViewFilterPtr) self.DebugPrintInputPortAndOutputPortInfo("post filter update 1\n") - + if PhactoriDbg(100): myDebugPrint3("self.InternalParaViewFilterPtr: " + str(self.InternalParaViewFilterPtr) + "\n", 100) @@ -12043,7 +12043,7 @@ def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState): self.InternalParaViewFilterPtr.CellLocator = 'Static Cell Locator' self.DebugPrintInputPortAndOutputPortInfo("pre filter update 1\n") - + SetActiveSource(self.InternalParaViewFilterPtr) SetActiveSource(savedActiveSource) @@ -12057,7 +12057,7 @@ def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState): self.InternalParaViewFilterPtr.UpdatePipeline() self.DebugPrintInputPortAndOutputPortInfo("post filter update 1\n") - + if PhactoriDbg(100): myDebugPrint3("self.InternalParaViewFilterPtr: " + str(self.InternalParaViewFilterPtr) + "\n", 100) @@ -12099,7 +12099,7 @@ def ValidateJsonPointList(self): myDebugPrint3AndException(errStr) return True - + def ParseParametersFromJson(self, inJson): if 'filename' in inJson: self.JsonListFileName = inJson['filename'] @@ -12367,7 +12367,7 @@ def ValidateJsonPointList(self): errStr = "PhactoriPointSourceFromJsonList::ValidateJsonPointList\n" \ "point with index " + str(ptNdx) + "does not have three elements\n" myDebugPrint3AndException(errStr) - + def ParseParametersFromJson(self, inJson): if 'filename' in inJson: @@ -12458,13 +12458,13 @@ def UseMpiToFindGlobalNearestPointList(self, inTargetPointList, inDistanceSquare for idx in range(0, numSrcPnts): xyzIdx = idx*3 resultPoints.append([globalXyz[xyzIdx], globalXyz[xyzIdx+1], globalXyz[xyzIdx+2], globalNodeId[idx]]) - + if PhactoriDbg(100): myDebugPrint3("resultPoints:\n" + str(resultPoints) + "\n") if PhactoriDbg(100): myDebugPrint3("UseMpiToFindGlobalNearestPointList returning\n") - return resultPoints + return resultPoints def CalculateOneDisplacedPoint(self, srcPt, tgtPt, dispDist): deltaVec = vecFromAToB(srcPt, tgtPt) @@ -12491,7 +12491,7 @@ def CalculateDisplacedPointList(self): def FindCorrelatedInputOperationPoints(self, inInputFilter): "in parallel, using mpi to help, find the nodes from the input filter\n which are closest to the points in self.mJsonPointList, and record the\n 3d location of those points" - + #grab local process points thisProcessPointList = self.mPhactoriOperationBlockOwner.MakeListOfAllPointsAndNodeIdsOnThisProcessFromParaViewFilter(inInputFilter) @@ -12519,7 +12519,7 @@ def FindCorrelatedInputOperationPoints(self, inInputFilter): distx = math.sqrt(distSqrd) myDebugPrint3(str(ndx) + ": " + str(sourcePt) + " " + str(distSqrd) + " " + str(distx) + " " + str(self.DisplacedPointList[ndx]) + "\n") - + def CreateParaViewFilter(self, inInputFilter): if PhactoriDbg(100): myDebugPrint3("PhactoriPointSourceFromJsonList.CreateParaViewFilter entered\n", 100) @@ -12980,11 +12980,11 @@ def PhactoriLocalToGlobalCellsWithMinMaxDataUsingMPI(localPidMinMaxCellPair, tup globalMaxCell = PhactoriSampledCellInfo() globalMinCell.SerializeSetFromFloatAndIntArray(globalSerializedFloatArray, globalSerializedIntArray, 0, tupleSize) globalMaxCell.SerializeSetFromFloatAndIntArray(globalSerializedFloatArray, globalSerializedIntArray, 1, tupleSize) - + if PhactoriDbg(100): myDebugPrint3("PhactoriLocalToGlobalCellsWithMinMaxDataUsingMPI returning\n") - return [globalMinCell, globalMaxCell] - + return [globalMinCell, globalMaxCell] + #phactori_combine_to_single_python_file_subpiece_end_1 #phactori_combine_to_single_python_file_parent_1 @@ -13018,7 +13018,7 @@ def ValidateJsonPointList(self): errStr = "PhactoriPointSourceGeometrySampler1::ValidateJsonPointList\n" \ "point with index " + str(ptNdx) + "does not have three elements\n" myDebugPrint3AndException(errStr) - + def ParseParametersFromJson(self, inJson): if 'filename' in inJson: @@ -13041,7 +13041,7 @@ def GetPidWithLeastValueList(self, inLocalDistSqrdList): pidWithDataList = UseReduceOnIntegerList(localPidList, 0) return pidWithDataList, globalDistSqrdList - + def UseMpiToGetGlobalQuadsClosest(self, inLocalQuadList, inLocalDistSqrdList): if PhactoriDbg(100): myDebugPrint3("PhactoriPointSourceGeometrySampler1.UseMpiToGetGlobalQuadsClosest entered\n", 100) @@ -13375,7 +13375,7 @@ def ValidateJsonSegmentList(self, testlist): errStr = "PhactoriSegmentCellSampler3:ValidateJsonSegmentList\n" \ "segment with index " + str(segNdx) + " point 2 does not have 3 components\n" myDebugPrint3AndException(errStr) - + return True def ParseParametersFromJson(self, inJson): @@ -13532,7 +13532,7 @@ def CreateInternalSegmentListFromJson(self, segmentListJson): if PhactoriDbg(100): myDebugPrint3("PhactoriSegmentCellSampler3.ExportOperationData entered\n", 100) - if self.SegmentDefinitionFormat == "two geometric points": + if self.SegmentDefinitionFormat == "two geometric points": self.ValidateJsonSegmentList(segmentListJson) self.SegmentList = [] self.NearbyGeometryPointList = [] @@ -13613,7 +13613,7 @@ def CreateParaViewFilter(self, inInputFilter): savedActiveSource = GetActiveSource() segmentListJson = ReadAndMpiBroadcastJsonFile(self.JsonListFileName) - + self.myCopyOfInputFilter = inInputFilter UpdatePipelineWithCurrentTimeArgument(self.myCopyOfInputFilter) @@ -13680,7 +13680,7 @@ def GetPidWithLeastValueList(self, inLocalDistSqrdList): pidWithDataList = UseReduceOnIntegerList(localPidList, 0) return pidWithDataList, globalDistSqrdList - + def UseMpiToGetGlobalCellPointsClosestStructured(self, ioCellList, inLocalDistSqrdList): if PhactoriDbg(100): myDebugPrint3("PhactoriSegmentCellSampler3.UseMpiToGetGlobalCellPointsClosestStructured entered\n", 100) @@ -13870,12 +13870,12 @@ def SetMaskValueForCellsNearSegmentsInBlock(recursionObject, inInputCsData, inPa thisCellDataTuple = outputCellArray.GetTuple(cellIndex) newCellInfo = PhactoriSampledCellInfo() newCellInfo.SetFromList([cellTestPoint, [-1,-1,-1], thisCellDataTuple, myPid, leafVisitCount, cellIndex, segIndex, -1]) - + inParameters.markedCellSet[segIndex].append(newCellInfo) if PhactoriDbg(100): myDebugPrint3("new cell close to segment:\n") myDebugPrint3(newCellInfo.ToStr()) - + if PhactoriDbg(100): for idx, cellsForThisSegment in enumerate(inParameters.markedCellSet): @@ -14381,7 +14381,7 @@ def CreateProgrammableFilterString(self): scriptLines.append(" iter.GoToNextItem();\n") scriptLines.append("else:\n") scriptLines.append(" flatten(input, output)\n") - + mainScriptString = "".join(scriptLines) myCellIndexesToSet = [] @@ -14395,10 +14395,10 @@ def CreateProgrammableFilterString(self): myCellIndexesToSet.append(oneCellInfo.index) myMaskValuesToSet.append(maskValue) myLeafVisitCount.append(oneCellInfo.leafVisitCount) - - newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" - newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" - newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" + + newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" + newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" + newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" self.mProgFilterString = newstr1 + newstr2 + newstr3 + mainScriptString if PhactoriDbg(100): @@ -14696,7 +14696,7 @@ def GatherGeometricallySampledCellsInBlock(recursionObject, inInputCsData, inPar myDebugPrint3("None\n") else: myDebugPrint3(str(oneCellDataArray.GetNumberOfTuples()) + "\n") - + if dataArrayNumCmpnts != 0: defaultTuple = [] for ii in range(0, dataArrayNumCmpnts): @@ -14876,7 +14876,7 @@ def CreateInternalListOfDataControlledSampledCellsOnThisProcess(self): else: myDebugPrint3AndException("CreateInternalListOfDataControlledSampledCellsOnThisProcess:\n" +\ "bad self.DataControlledSamplingMethod\n") - + if PhactoriDbg(100): myDebugPrint3("CreateInternalListOfDataControlledSampledCellsOnThisProcess returning\n") @@ -14939,7 +14939,7 @@ def CollectDataOnSampledCellsInBlock(recursionObject, inInputCsData, inParameter myDebugPrint3("None\n") else: myDebugPrint3(str(oneCellDataArray.GetNumberOfTuples()) + "\n") - + if dataArrayNumCmpnts != 0: defaultTuple = [] for ii in range(0, dataArrayNumCmpnts): @@ -15009,7 +15009,7 @@ def CreateLeafRecursionTrackingStructure(self): for leafKey in self.GeometricallySampledCellsByRecursionLeaf: cellListForLeaf = self.GeometricallySampledCellsByRecursionLeaf[leafKey] myDebugPrint3(str(len(cellListForLeaf)) + " cells for leaf " + str(leafKey) + "\n") - + if PhactoriDbg(100): myDebugPrint3("CreateLeafRecursionTrackingStructure returning\n") @@ -15228,7 +15228,7 @@ def CreateProgrammableFilterString(self): scriptLines.append(" iter.GoToNextItem();\n") scriptLines.append("else:\n") scriptLines.append(" flatten(input, output)\n") - + self.mainScriptString = "".join(scriptLines) myCellIndexesToSet = [] @@ -15246,10 +15246,10 @@ def CreateProgrammableFilterString(self): myCellIndexesToSet.append(oneCellInfo.index) myMaskValuesToSet.append(maskValue) myLeafVisitCount.append(oneCellInfo.leafVisitCount) - - newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" - newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" - newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" + + newstr1 = "cellIndexesToSet = " + str(myCellIndexesToSet) + "\n" + newstr2 = "maskValuesToSet = " + str(myMaskValuesToSet) + "\n" + newstr3 = "leafVisitCount = " + str(myLeafVisitCount) + "\n" self.mProgFilterString = newstr1 + newstr2 + newstr3 + self.mainScriptString if PhactoriDbg(100): @@ -15391,7 +15391,7 @@ def GetPidWithLeastValueListV5(inLocalDistSqrdList): pidWithDataList = UseReduceOnIntegerList(localPidList, 0) return pidWithDataList, globalDistSqrdList - + def UseMpiToGetGlobalCellPointsClosestV5(inInputFilter, inLocalCellPointList, inLocalDistSqrdList): if PhactoriDbg(100): @@ -15784,7 +15784,7 @@ def FigureBlockIndicesFromBlockList(includeBlockList, inInputFilter): listOfBlockIndicesToInclude = [] FigureBlockIndicesFromBlockListRecurse1(listOfBlockIndicesToInclude, includeBlockList, csdata, None, flatIndexCounter, 0) - + #if PhactoriDbg(100): # myDebugPrint3("number of times existing block names found:\n") # for blknm, count in gDuplicateNameCounter.items(): @@ -15902,7 +15902,7 @@ def ParseParametersFromJson(self, inJson): def MakeExtractBlockFilter(self, inInputFilter, blockName): if PhactoriDbg(100): myDebugPrint3("MakeExtractBlockFilter entered: " + str(blockName) + "\n") - newPvExtractBlockFilter = ExtractBlock(inInputFilter) + newPvExtractBlockFilter = ExtractBlock(inInputFilter) #newParaViewFilter.PruneOutput = 1 #newParaViewFilter.MaintainStructure = 0 #newParaViewFilter.MaintainStructure = 1 @@ -15933,7 +15933,7 @@ def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent): rngFunc = [0,0,0,0,0,0] if rngFuncAllAbsolute: - retIjkRange = ijkJson["ijkrange"] + retIjkRange = ijkJson["ijkrange"] if PhactoriDbg(100): myDebugPrint3("rngFunc is [0,0,0,0,0,0], all absolute, " "so just return explicit ijkrange:\nretIjkRange: \n" + \ @@ -15946,7 +15946,7 @@ def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent): return [0,-1,0,-1,0,-1] if "ijkrange" in ijkJson: - ijkRangeFromJson = ijkJson["ijkrange"] + ijkRangeFromJson = ijkJson["ijkrange"] else: ijkRangeFromJson = [0,0,0,0,0,0] @@ -15987,22 +15987,22 @@ def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent): if hadToCorrect: if PhactoriDbg(100): myDebugPrint3("return ijkrange had to be corrected because it was outside block extent" - "\nblockExtent: " + str(blockExtent) + - "\nijkRangeFromJson: " + str(retIjkRange) + - "\nrngFunc (from json): " + str(rngFunc) + + "\nblockExtent: " + str(blockExtent) + + "\nijkRangeFromJson: " + str(retIjkRange) + + "\nrngFunc (from json): " + str(rngFunc) + "\nuncorrectedIjkRange: " + str(uncorrectedIjkRange) + "\nretIjkRange: " + str(retIjkRange) + "\n") else: if PhactoriDbg(100): myDebugPrint3("return ijkrange did not need correction" - "\nblockExtent: " + str(blockExtent) + + "\nblockExtent: " + str(blockExtent) + "\nijkRangeFromJson: " + str(retIjkRange) + - "\nrngFunc (from json): " + str(rngFunc) + + "\nrngFunc (from json): " + str(rngFunc) + "\nretIjkRange: " + str(retIjkRange) + "\n") return retIjkRange - - + + def MakeExtractSubsetFilter(self, extractBlockFilter, oneBlockExtractSubsetJson, oneBlockExtents): if PhactoriDbg(100): myDebugPrint3("MakeOneExtractBlockExtractSubsetFilter entered\n") @@ -16052,7 +16052,7 @@ def MakeGroupAllExtractSubsetsFilter(self): if PhactoriDbg(100): myDebugPrint3("MakeGroupAllExtractSubsetsFilter returning\n") - + def CreateParaViewFilter(self, inInputFilter): "create the PhactoriExtractStructuredMultiBlock filter for ParaView" if PhactoriDbg(100): @@ -16889,7 +16889,7 @@ def TestPointSub2(self, inSrcId, inSrcXyz, inTgtId, inTgtXyz, inNrstdist): # str(self.mTargetMatchXyzs.GetValue(gndx+2)) + "\n") #now find which in the current list has the biggest distance, as it is - #next in line for replacement (we do this to avoid having to shift + #next in line for replacement (we do this to avoid having to shift #elements every time self.mcfndx = 0 self.mMinDistSqrd = self.mDistSqrds.GetValue(0) @@ -16957,7 +16957,7 @@ def TestPointSub1(self, inId, inX, inY, inZ, tId, tX, tY, tZ): str(self.mTargetMatchXyzs.GetValue(gndx+2)) + "\n") #now find which in the current list has the biggest distance, as it is - #next in line for replacement (we do this to avoid having to shift + #next in line for replacement (we do this to avoid having to shift #elements every time self.mcfndx = 0 self.mMinDistSqrd = self.mDistSqrds.GetValue(0) @@ -17061,7 +17061,7 @@ def MakeListOfAllPoints1(self): self.DoMethodPerBlock(recursionItem) return recursionItem.mParameters.mGlobalNodeIdList, \ recursionItem.mParameters.mPointXYZList - + def MakeListOfAllPointsInBlock1(self, inInputCsData, inParameters): #if PhactoriDbg(100): # myDebugPrint3("MakeListOfAllPointsInBlock1 entered\n") @@ -17428,7 +17428,7 @@ def ParseParametersFromJson(self, inJson): self.OutputShortestLongestIndex = 0 keyval10 = "output cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.ProgrammableFilterOutputCellVariableName = inJson[keyval10] def CreateParaViewFilter(self, inInputFilter): @@ -17675,10 +17675,10 @@ def ParseParametersFromJson(self, inJson): self.OffsetIndex = 0 keyval10 = "output angle cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.OutputAngleCellVariableName = inJson[keyval10] keyval10 = "output height cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.OutputHeightCellVariableName = inJson[keyval10] keyval11 = "do operation in createparaview method" @@ -17928,7 +17928,7 @@ def ParseParametersFromJson(self, inJson): self.OffsetIndex = 0 keyval10 = "output cell variable name" - if keyval10 in inJson: + if keyval10 in inJson: self.OutputCellVariableName = inJson[keyval10] keyval11 = "do operation in createparaview method" @@ -18494,7 +18494,7 @@ def CreateParaViewStuff(self, inColor, inImageset = None): "to work off, and None was supplied\n") return self.mInputOperation = inImageset.mOperation - + savedActiveSource = GetActiveSource() inOprtn = self.mInputOperation if(inOprtn.mParaViewTimeAnnotationSource == None): @@ -18644,11 +18644,11 @@ def SetSizeScale(self, inNewSizeScale): def SetWindowLocation(self, inNewPosition): global gParaViewCatalystVersionFlag if gParaViewCatalystVersionFlag < 51000: - validPositions = ['UpperLeftCorner', 'UpperRightCorner', + validPositions = ['UpperLeftCorner', 'UpperRightCorner', 'LowerLeftCorner', 'LowerRightCorner', 'UpperCenter', 'LowerCenter'] else: - validPositions = ['Upper Left Corner', 'Upper Right Corner', + validPositions = ['Upper Left Corner', 'Upper Right Corner', 'Lower Left Corner', 'Lower Right Corner', 'Upper Center', 'Lower Center'] if inNewPosition in validPositions: @@ -18758,7 +18758,7 @@ def GetImageFilename(self, datadescription, inImageSettings, inImageBasedirectory = inImageSettings.mImageBasedirectory inNumCounterDigits = inImageSettings.mNumCounterDigits inImageFormat = inImageSettings.mImageFormat - + timestep = datadescription.GetTimeStep() lastImagesetName = "" @@ -18793,7 +18793,7 @@ def GetImageFilename(self, datadescription, inImageSettings, while len(timestepString) < inNumCounterDigits: timestepString = "0" + timestepString myDebugPrint2("image fname: " + fname + "\ndigit count: " + str(inNumCounterDigits) + "\ntimestepString: " + timestepString + "\n") - + rplstr1 = None if self.mUseDateTime: ttnow = gPipeAndViewsState.mCallbackDateTime @@ -18823,7 +18823,7 @@ def GetImageFilename(self, datadescription, inImageSettings, fnameRR = fname.replace("%t", rplstr1) else: fnameRR = None - + fname = fname.replace("%t", timestepString) myDebugPrint2("fname after replace: ->" + fname + "<-\n") @@ -18852,7 +18852,7 @@ class PhactoriPlot1Base: def __init__(self): self.mName = "" self.m_DataCubeAxesInfo = PhactoriDataCubeAxesInfo() - + self.m_PlotType = "PhactoriPlot1Base" self.mImageSettings = PhactoriImageSettings() self.mImageSettings.mPixelBorderRatioXY = [0.175 / self.mImageSettings.GetAspectRatio(), 0.175] @@ -18911,7 +18911,7 @@ def WriteImages(self, datadescription): oneLookDirectionFilenameAddon = "" else: oneLookDirectionFilenameAddon = "" - + fname, fnameRR = self.mImageFileNameCountSettings.GetImageFilename( datadescription, self.mImageSettings, oneLookDirectionFilenameAddon, @@ -19781,7 +19781,7 @@ def ParseOperationAndRepresentationPair(self, ioPipeAndViewsState, ioJson, "inOperationKey: " + str(inOperationKey) + "\n" "inRepresentationKey: " + str(inRepresentationKey) + "\n" "incoming json:\n" + str(ioJson) + "\n") - + if inOperationKey not in ioJson: if inSkipIfOperationKeyNotPresent: @@ -20031,7 +20031,7 @@ def PerRendersetInitialization(datadescription): #cellDataInfo = paraviewSource.GetCellDataInformation() myDebugPrint3(" PerRendersetInitialization:\n num cells: " + str(pvsDi.GetNumberOfCells()) + "\n num points: " + str(pvsDi.GetNumberOfPoints()) + "\n") - #we assume to begin with that all global data bounds in operations are + #we assume to begin with that all global data bounds in operations are #invalid as data may have changed for oneOperationName, oneOperation in \ gPipeAndViewsState.mOperationBlocks.items(): @@ -20064,7 +20064,7 @@ def UpdateRepresentationColorBy(ioPhactoriImagesetBlock): if PhactoriDbg(100): myDebugPrint3("in PhactoriImagsetBlock named: " + \ ioPhactoriImagesetBlock.mName + "\n" + \ - "mColorLegendRepRefs " + str(ii) + + "mColorLegendRepRefs " + str(ii) + "is set to " + str(retVal) + "\n") ioPhactoriImagesetBlock.mColorLegendRepRefs[ii] = retVal @@ -20097,7 +20097,7 @@ def UpdateRepresentationColorBySub1(inPvView, inPvRep, if PhactoriDbg(100): myDebugPrint3('bad element type: returning\n', 100) return None - + if colorVarName != '': if inPhactoriRep.mColorVariableInfo.mVariableIsVectorComponent: ColorByVariableComponentOrMagnitudeXX(inPvRep, inPhactoriRep, @@ -20404,7 +20404,7 @@ def SaveRestartInfoCallback(): for onePlotOtName, onePlotOt in \ gPipeAndViewsState.mPlotOverTimeBlocks.items(): if PhactoriDbg(): - myDebugPrint3("making end vis callback json for plot over time: " + + myDebugPrint3("making end vis callback json for plot over time: " + onePlotOtName + "\n") plotsOverTimeJsonOut[onePlotOtName] = onePlotOt.GetRestartInfo() @@ -20511,7 +20511,7 @@ def HandleOperationShortcuts2(inBlockName, inJson, ioOperationBlocks, inCount): if PhactoriDbg(): myDebugPrint3(errStr) raise Exception(errStr) - #stuff should have 4 items + #stuff should have 4 items #[scalar|vector magnitude|vector component|tensor #component, component, namekeep between|keep above|keep #below, [, ]] @@ -20531,7 +20531,7 @@ def HandleOperationShortcuts2(inBlockName, inJson, ioOperationBlocks, inCount): if PhactoriDbg(): myDebugPrint3(errStr) raise Exception(errStr) - + if PhactoriDbg(): myDebugPrint3('got threshold operation shortcut ' + str(newOperationJson) + '\n') if lastShortcutOperationName != None: @@ -21130,7 +21130,7 @@ def CreateViewSetFromPhactoriViewMapC(inViewMapC): myDebugPrint3(str(inViewMapC) + "\n") global gPipeAndViewsState gPipeAndViewsState.mJsonDescription = inViewMapC - + #get pointers to the various block types (currently 6, camera, #representation, operation, imageset, plot over time, and scatter plot) @@ -21723,7 +21723,7 @@ def ColorByBlock(inParaViewDataSource, inParaViewDataRepresentation, ColorByBlockRecurse1(csdata, blockAndLeafBlockCounter, inParaViewDataRepresentation.BlockColor, False) #inParaViewDataRepresentation.BlockColor = blockColorData - + if PhactoriDbg(100): myDebugPrint3(' block color data: ' + str(inParaViewDataRepresentation.BlockColor) + '\n', 100) if PhactoriDbg(100): @@ -21774,8 +21774,8 @@ def UseDataRangeForColorValues(inPvDataRepresentation, inRepresentation, if PhactoriDbg(): myDebugPrint3(" input:" + str(input) + "\n") UpdatePipelineWithCurrentTimeArgument(input) - - #assume point info + + #assume point info #datainformation = rep.Input.GetPointDataInformation() if pointsOrCellsType == gPointsString: @@ -21979,7 +21979,7 @@ def helpFindNewRgbPoint(inBaseRgbPts, inRatio): #print "deltaPt: ", deltaPt #print "ratioPt: ", ratioPt - subrangePt1 = [inRatio, + subrangePt1 = [inRatio, rr1 + ratioPt * (rr2 - rr1), gg1 + ratioPt * (gg2 - gg1), bb1 + ratioPt * (bb2 - bb1)] @@ -22306,7 +22306,7 @@ def ShowCubeAxesXX(inPvRenderView, inOnOrOff, inShowDataCubeAxesInfo = None): SetAxesGridVisibility(inPvRenderView, 0) if PhactoriDbg(100): myDebugPrint3("ShowCubeAxesXX returning\n", 100) - + def ShowDataColorLegendXX(inPvView, inOnOffSetting, inColorLegendPositionAndSize, inColorSettings, @@ -22452,7 +22452,7 @@ def ShowDataColorLegendXX(inPvView, defaultMidPos = 0.5 - 0.5*defaultLegendLength #legendFontSize = 16 #legendSize = 1.0 - #validPositions = ['UpperLeftCorner', 'UpperRightCorner', + #validPositions = ['UpperLeftCorner', 'UpperRightCorner', # 'LowerLeftCorner', 'LowerRightCorner', # 'UpperCenter', 'LowerCenter'] legendPosition=[0.0, 0.0] @@ -22494,7 +22494,7 @@ def ShowDataColorLegendXX(inPvView, defaultMidPos = 0.5 - 0.5*defaultLegendLength #legendFontSize = 16 #legendSize = 1.0 - #validPositions = ['UpperLeftCorner', 'UpperRightCorner', + #validPositions = ['UpperLeftCorner', 'UpperRightCorner', # 'LowerLeftCorner', 'LowerRightCorner', # 'UpperCenter', 'LowerCenter'] legendPosition=[0.0, 0.0] @@ -22742,9 +22742,9 @@ def ExtractComponentFromVectorVariable(inVariableName, inWhichComponent, inResul newFunctionString = "" if(inWhichComponent == 0): newFunctionString = inVariableName + '_X' - elif(inWhichComponent == 1): + elif(inWhichComponent == 1): newFunctionString = inVariableName + '_Y' - elif(inWhichComponent == 2): + elif(inWhichComponent == 2): newFunctionString = inVariableName + '_Z' else: if PhactoriDbg(): @@ -22830,7 +22830,7 @@ def CollectCells2(inClientSideData, inBlockIndex, ioCollectList, ioTotalCellCoun appendCount += 1 if PhactoriDbg(): myDebugPrint3(' proc ' + str(SmartGetLocalProcessId()) + ' Leaving CollectCells2\n') - + def CollectCells1(cellVariableName, thresholdValue, thresholdDir): if PhactoriDbg(): @@ -22932,7 +22932,7 @@ def UseReduceToSpreadValues(ioListOfValues): if value != 0.0: value = -value ioListOfValues[ii] = value - + if PhactoriDbg(): myDebugPrint3(' ' + 'proc ' + str(SmartGetLocalProcessId()) + ' final values: ' + str(ioListOfValues) + '\n') if PhactoriDbg(100): @@ -23315,7 +23315,7 @@ def GetRestartInfo(self): # def SetRepresentationAndViewColors(self, ioRenderViewInfo): # myDebugPrint3('PlotColorInfo.SetRepresentationColors entered\n', 100) # rep1 = ioRenderViewInfo.DataRepresentation1 -# view1 = ioRenderViewInfo.RenderView1 +# view1 = ioRenderViewInfo.RenderView1 # view1.Background = self.m_BackgroundColor # rep1.EdgeColor = self.m_EdgeColor # rep1.DiffuseColor = self.m_DiffuseColor @@ -23324,7 +23324,7 @@ def GetRestartInfo(self): # rep1.BackfaceDiffuseColor = self.m_BackfaceDiffuseColor # rep1.CubeAxesColor = self.m_CubeAxesColor # myDebugPrint3('PlotColorInfo.SetRepresentationColors returning\n', 100) - + #global gPlotColorInfoPreset #gPlotColorInfoPreset = PlotColorInfo() @@ -23708,7 +23708,7 @@ def FindNodeOrElementIdForMinMax(inputcsData, inVariableInfo): myDebugPrint3("min/max not available, calculating\n", 100) DataMinMax = [0.0, 0.0, False] DataSumCnt = [0.0, 0] - FindMinMaxSumCntFromData(inputcsData, inVariableInfo, + FindMinMaxSumCntFromData(inputcsData, inVariableInfo, None, DataMinMax, DataSumCnt, None, None) else: @@ -23735,7 +23735,7 @@ def FindNodeOrElementIdForMinMax(inputcsData, inVariableInfo): inVariableInfo.mStats.mMaxId = idForMinAndidForMax[1] #mark done for this catalyst callback, so we won't do extra mpi - #communication if we call this routine again + #communication if we call this routine again inVariableInfo.mStats.mIdsTestCounter = gPipeAndViewsState.mFrameTagCounter if PhactoriDbg(100): @@ -24245,7 +24245,7 @@ def FindThisProcessorMinMaxForVar(inOperation, inVariableInfo): return myDataMinMax -def FindMinMaxSumCntFromData(inputcsData, inVariableInfo, +def FindMinMaxSumCntFromData(inputcsData, inVariableInfo, inSecondaryVariableInfo, DataMinMax, DataSumCnt, DataForIds, inPlotIdLineList): "fairly complex high level mpi-operation routine. This takes a paraview\n filter client side object, gets the client side data\n (which is presumably a multiblock\n dataset) and finds the min, max, sum, and count of items for a variable.\n It uses MPI (if the item is not global) to share values and get them\n across all processors. Used for plotting min/max/mean and for evaluating\n boolean criteria (such as whether or not to produce images) for min/max\n /mean/count. Data return is a bit messy and should be updated--it fills\n in DataMinMax, DataSumCnt, and DataForIds if it is not None" @@ -24253,7 +24253,7 @@ def FindMinMaxSumCntFromData(inputcsData, inVariableInfo, if PhactoriDbg(): myDebugPrint3("FindMinMaxSumCntFromData entered\n") - FindMinMaxSumCntFromDataRecurse1(inputcsData, inVariableInfo, + FindMinMaxSumCntFromDataRecurse1(inputcsData, inVariableInfo, inSecondaryVariableInfo, DataMinMax, DataSumCnt, DataForIds, inPlotIdLineList) @@ -24326,7 +24326,7 @@ def SetPlotOverTimePointsFromData(ioPlotInfo): DataForIds = None FindMinMaxSumCntFromData(inputcsData, - ioPlotInfo.m_YAxisVariableInfo, ioPlotInfo.m_XAxisVariableInfo, + ioPlotInfo.m_YAxisVariableInfo, ioPlotInfo.m_XAxisVariableInfo, DataMinMax, DataSumCnt, DataForIds, ioPlotInfo.m_IdPlotLineList) if DataSumCnt[1] == 0: @@ -24422,7 +24422,7 @@ def SetPlotPointsFromData(ioPlotInfo): #myDebugPrint3(' done updating ids\n') - + FindPlotXYZMinMax(plotPts, ioPlotInfo.m_xyzMinMaxTrkC) ScalePlotYForFit(plotPts, ioPlotInfo.m_xyzMinMaxTrkC, @@ -24858,7 +24858,7 @@ def UseMpiToSendAllProcessesFloatArrayToOneProcess(thisProcessFloatArray, pidToC retVal = [] if PhactoriDbg(100): - if len(globalFloatArray) == 0: + if len(globalFloatArray) == 0: myDebugPrint3(str(len(globalFloatArray)) + "\n") else: myDebugPrint3(str(len(globalFloatArray)) + " " + str(globalFloatArray[0]) + " " + str(globalFloatArray[-1]) + "\n") @@ -25897,7 +25897,7 @@ def TestForTruth(self, ioPipeAndViewsState): DataMinMax = [0.0, 0.0, False] DataSumCnt = [0.0, 0] - FindMinMaxSumCntFromData(inputcsData, self.mVariableInfo, None, + FindMinMaxSumCntFromData(inputcsData, self.mVariableInfo, None, DataMinMax, DataSumCnt, None, None) #just return false if there is no min/max found @@ -26255,16 +26255,16 @@ def InitializePerPipeRoot(datadescription, inCoprocessor): sa4 = sa[4] sa5 = sa[5] dbDummyFname = sa[6] - if(len(sa) > 7): + if(len(sa) > 7): defaultDirectory = sa[7] else: defaultDirectory = "" - if(len(sa) > 8): + if(len(sa) > 8): catalyst_script_extra_file = sa[8] else: catalyst_script_extra_file = "" - outputResultBaseId, remeshRestartTag = parseDbDummyFname(dbDummyFname) + outputResultBaseId, remeshRestartTag = parseDbDummyFname(dbDummyFname) if PhactoriDbg(): myDebugPrint3(" extra data list:\n") if PhactoriDbg(): @@ -26624,7 +26624,7 @@ class Pipeline: #reuse same coprocesor instance (?), then have LocalWriteImages3 only do the images for a given output results bloxk:q #PhactoriScript.CreatePipeline(datadescription) - + return Pipeline() class CoProcessor(coprocessing.CoProcessor): @@ -26773,7 +26773,7 @@ def compareTearDeath(tList, dList): myDebugPrint2('compareTearDeath entered\n') myDebugPrint2('compareTearDeath returning\n') #end tear/death persistence; not used now but may be useful later - + # ---------------------- Data Selection method ---------------------- @@ -26799,14 +26799,14 @@ def RequestDataDescription(datadescription): if GetBypassUserDataFlag() == False: fd = datadescription.GetUserData() - + if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC global gCatchAllExceptionsAndPassUpFlag - if gCatchAllExceptionsAndPassUpFlag: + if gCatchAllExceptionsAndPassUpFlag: try: return RequestDataDescriptionSub(datadescription) except: @@ -26824,7 +26824,7 @@ def RequestDataDescriptionSub(datadescription): if GetBypassUserDataFlag() == False: fd = datadescription.GetUserData() - + if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} @@ -26887,15 +26887,15 @@ def DoCoProcessing(datadescription): fd = datadescription.GetUserData() - + if GetBypassUserDataFlag() == False: if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC - + global gCatchAllExceptionsAndPassUpFlag - if gCatchAllExceptionsAndPassUpFlag: + if gCatchAllExceptionsAndPassUpFlag: try: DoCoProcessingSub(datadescription) except: @@ -26915,13 +26915,13 @@ def DoCoProcessingSub(datadescription): fd = datadescription.GetUserData() - + if GetBypassUserDataFlag() == False: if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC - + global coprocessor global gFirstTimeInDoCoProcessing global gSkipCountdown @@ -26994,7 +26994,7 @@ def DoCoProcessingSub(datadescription): coprocessor.WriteData(datadescription) coprocessor.LocalExportOperationsData3(datadescription) - + # Write image capture (Last arg: rescale lookup table), if appropriate. coprocessor.LocalWriteImages3(datadescription, rescale_lookuptable=False) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver_modular.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver_modular.py index 73dd77523a82..440c79dcbed4 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver_modular.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver_modular.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -105,7 +105,7 @@ class Pipeline: #reuse same coprocesor instance (?), then have LocalWriteImages3 only do the images for a given output results bloxk:q #PhactoriScript.CreatePipeline(datadescription) - + return Pipeline() class CoProcessor(coprocessing.CoProcessor): @@ -254,7 +254,7 @@ def compareTearDeath(tList, dList): myDebugPrint2('compareTearDeath entered\n') myDebugPrint2('compareTearDeath returning\n') #end tear/death persistence; not used now but may be useful later - + # ---------------------- Data Selection method ---------------------- @@ -280,14 +280,14 @@ def RequestDataDescription(datadescription): if GetBypassUserDataFlag() == False: fd = datadescription.GetUserData() - + if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC global gCatchAllExceptionsAndPassUpFlag - if gCatchAllExceptionsAndPassUpFlag: + if gCatchAllExceptionsAndPassUpFlag: try: return RequestDataDescriptionSub(datadescription) except: @@ -305,7 +305,7 @@ def RequestDataDescriptionSub(datadescription): if GetBypassUserDataFlag() == False: fd = datadescription.GetUserData() - + if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} @@ -368,15 +368,15 @@ def DoCoProcessing(datadescription): fd = datadescription.GetUserData() - + if GetBypassUserDataFlag() == False: if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC - + global gCatchAllExceptionsAndPassUpFlag - if gCatchAllExceptionsAndPassUpFlag: + if gCatchAllExceptionsAndPassUpFlag: try: DoCoProcessingSub(datadescription) except: @@ -396,13 +396,13 @@ def DoCoProcessingSub(datadescription): fd = datadescription.GetUserData() - + if GetBypassUserDataFlag() == False: if fd == None: myDebugPrint2("no user data, returning {}\n") returnViewMapC = {} return returnViewMapC - + global coprocessor global gFirstTimeInDoCoProcessing global gSkipCountdown @@ -475,7 +475,7 @@ def DoCoProcessingSub(datadescription): coprocessor.WriteData(datadescription) coprocessor.LocalExportOperationsData3(datadescription) - + # Write image capture (Last arg: rescale lookup table), if appropriate. coprocessor.LocalWriteImages3(datadescription, rescale_lookuptable=False) diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/phactori.py b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/phactori.py index 296f1a8f203b..9e83e988ff12 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/phactori.py +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/phactori.py @@ -1,4 +1,4 @@ -# Copyright(C) 1999-2020 National Technology & Engineering Solutions +# Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with # NTESS, the U.S. Government retains certain rights in this software. # @@ -648,7 +648,7 @@ def TestUserDataForBypassScript(datadescription): myDebugPrint3("no user data, no catalyst_script_extra_file (2)\n") return - if(sa.GetNumberOfValues() > 8): + if(sa.GetNumberOfValues() > 8): catalyst_script_extra_file = sa.GetValue(8) if PhactoriDbg(100): myDebugPrint3(" catalyst_script_extra_file: ->" + \ @@ -868,7 +868,7 @@ def ParseSettingsFromJson(self, inJsn): halfH - betweenEyeY, -eyeToScreenDistance ] - + def GetScreenBottomLeft(self, inLeftEyeFlag): if inLeftEyeFlag: return self.mLeftEyeScreenBottomLeft @@ -1751,7 +1751,7 @@ def DebugPrintCellAndPointArrayInfo(label, pvFilter, priority): DebugPrintVtkDataArraysInfo("PointData:\n", theData, priority) theData = pvFilter.CellData DebugPrintVtkDataArraysInfo("CellData:\n", theData, priority) - + #def SetCpViewsAndCpWriters(inCpViews, inCpWriters): # global localCpViews # global localCpWriters @@ -1799,7 +1799,7 @@ class PhactoriRenderViewInfo: def __init__(self): self.RenderView1 = None self.DataRepresentation1 = None - + #class PhactoriRenderViewInfo: # RenderView1 = None # DataRepresentation1 = None @@ -1946,12 +1946,12 @@ def SafeColorBy(inDataRepresentation, ptOrNodeAndVarname): if PhactoriDbg(100): myDebugPrint3("SafeColorBy returning (valid cell data)\n") return - + def SetDataRepresentationToDefault(inDataRepresentation): #a3_vel__PiecewiseFunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) - + inDataRepresentation.SelectionPointLabelColor = [0.5, 0.5, 0.5] inDataRepresentation.SelectionPointFieldDataArrayName = 'displ' inDataRepresentation.SuppressLOD = 0 @@ -2278,7 +2278,7 @@ def AddRenderView(inPhactoriImagesetInfo, inColorSettings, inPhactoriImagesetInfo.mPvDataRepresentation2 = DataRepresentation1 inPhactoriImagesetInfo.mVisiblePvDataReps[0] = DataRepresentation1 else: - DataRepresentation1 = inPhactoriImagesetInfo.mPvDataRepresentation2 + DataRepresentation1 = inPhactoriImagesetInfo.mPvDataRepresentation2 if PhactoriDbg(): myDebugPrint3("new DataRepresentation1: " + str(DataRepresentation1) + "\n") @@ -2421,9 +2421,9 @@ def CheckForParallelVector(vec1, vec2): if PhactoriDbg(): myDebugPrint3("same ratio between vectors, parallel\n") return True - + #given a bounds in the form [xmin, xmax, ymin, ymax, zmin, zmax], return the -# maximum dimension out of all those (max of xmax-xmin, ymax-ymin, and +# maximum dimension out of all those (max of xmax-xmin, ymax-ymin, and # zmax-zmin) def GetMaximumDimensionFromBounds(inBounds): maxDim = inBounds[1] - inBounds[0] @@ -2898,7 +2898,7 @@ def GetXyzForNodeOrElementParallelRecurse1(inInputCsData, unstructured grids to do the real work of checking for the id and setting outXyz """ - + #myDebugPrint3('GetXyzForNodeOrElementParallelRecurse1 entered\n', 100) icsdClassname = inInputCsData.GetClassName() @@ -3043,7 +3043,7 @@ def CalcRelativeCameraDistance2_AA(inFocalPoint, inNormCameraDir, where we want to place the camera (the opposite of the look direction)""" #angle between camera-to-focal point vector and camera-to-testpoint vector - #is equal to half the camera fOV. Call this angle AA. + #is equal to half the camera fOV. Call this angle AA. #The side opposite this angle has length equal to the distance between #the focal point and the test point. Call this distance aa. We also #know the angle between the focal point-to-camera vector and the focal @@ -3139,7 +3139,7 @@ def CalcRelativeCameraDistance2_BB(inFocalPoint, inNormCameraDir, myDebugPrint3("pointH: " + str(pointH) + "\n"); dd1 = CalcRelativeCameraDistance2_AA(inFocalPoint, inNormCameraDir, - pointH, inFovH) + pointH, inFovH) if PhactoriDbg(100): myDebugPrint3("dd1: " + str(dd1) + "\n"); dd2 = CalcRelativeCameraDistance2_AA(inFocalPoint, inNormCameraDir, @@ -3224,7 +3224,7 @@ def CalcRelativeCameraDistance2(inFocalPoint, inLookDirection, inUpVector, aspectRatio = float(inXyPixelSize[0]) / float(inXyPixelSize[1]) else: aspectRatio = float(pixelSizeWithBorder[0]) / float(pixelSizeWithBorder[1]) - + if PhactoriDbg(100): myDebugPrint3("bordered aspectRatio: " + str(aspectRatio) + "\n"); @@ -3348,7 +3348,7 @@ def SetParaViewRepresentationCameraParams(inXParaViewRenderView, inCameraC, if PhactoriDbg(): myDebugPrint3(' lookDirection ' + str(lookDirection) + '\n') - myViewBounds = viewBoundsIo[0] + myViewBounds = viewBoundsIo[0] if PhactoriDbg(): myDebugPrint3(' focalPoint ' + str(focalPoint) + '\n') @@ -4108,11 +4108,11 @@ def MakeFiltersFromViewMapOperationsC(ioPipeAndViewsState, inOperationBlocksJson keepConstructing = False #at the beginning of the loop, we haven't seen any unconstructed operations for operationName, operationBlock in ioPipeAndViewsState.mOperationBlocks.items(): if operationBlock.mHasBeenConstructed == False: - #this one still needs constructing, and we'll have to loop again to + #this one still needs constructing, and we'll have to loop again to #make sure all are constructed keepConstructing = True - #determine whether or not we can construct this operation yet, or if + #determine whether or not we can construct this operation yet, or if #we need to wait for something else to be constructed canBeConstructedNow = True inputOperationNames = operationBlock.GetListOfInputOperationNames() @@ -4121,7 +4121,7 @@ def MakeFiltersFromViewMapOperationsC(ioPipeAndViewsState, inOperationBlocksJson if inputBlock.mHasBeenConstructed == False: canBeConstructedNow = False break - + if PhactoriDbg(100): myDebugPrint3("trying: " + str(operationName) + "\n" + \ "depends on: " + str(inputOperationNames) + "\n" + \ @@ -4132,7 +4132,7 @@ def MakeFiltersFromViewMapOperationsC(ioPipeAndViewsState, inOperationBlocksJson operationBlock.mHasBeenConstructed = True if PhactoriDbg(100): myDebugPrint3("done constructing all operation blocks\n",100) - + #helper method: given a block A which potentially contains a key B with @@ -4195,7 +4195,7 @@ def CreateParaViewRepresentationAndViewFromInfoC(inImageset, inLookDirection, in raise Exception(errStr) meshRenderControl = theRepresentation.mMeshRenderControl - + showColorLegend = theRepresentation.mColorLegendFlag colorLegendPositionAndSize = theRepresentation.mColorLegendPositionAndSize showDataCubeAxes = theRepresentation.mDataCubeAxesFlag @@ -4225,7 +4225,7 @@ def CreateParaViewRepresentationAndViewFromInfoC(inImageset, inLookDirection, in numArrays = pvPvGeomFilterFromOp.PointData.GetNumberOfArrays() for ii in range (0, numArrays): myDebugPrint3(" " + str(ii) + ": " + pvPvGeomFilterFromOp.PointData.GetArray(ii).GetName() + "\n") - + if PhactoriDbg(): myDebugPrint3(" operation cell data arrays:\n") numArrays = pvPvGeomFilterFromOp.CellData.GetNumberOfArrays() @@ -4421,7 +4421,7 @@ def ParseOneCameraBlockC(ioCameraBlock, ioCameraBlockJson, inPipeAndViewsState): ioCameraBlock.mLookDirectionSpecifiedFlag = True else: ioCameraBlock.mLookDirectionSpecifiedFlag = False - + #get text to add to each image created with this camera, if any if "image name addon" in ioCameraBlockJson: ioCameraBlock.mFilenameAddon = ioCameraBlockJson["image name addon"] @@ -4473,7 +4473,7 @@ def ParseOneCameraBlockC(ioCameraBlock, ioCameraBlockJson, inPipeAndViewsState): 'lock camera call count', -1) if "lockingcamera" in ioCameraBlock.mName: ioCameraBlock.LockAfterNCalls = 1 - + def localGet1or0(inJsn, inKey, inDefault): value = getParameterFromBlock(inJsn, inKey, inDefault) @@ -5230,7 +5230,7 @@ def GetCurrentGeometricPoint(self, inParaViewSource, ioViewBounds, if PhactoriDbg(): myDebugPrint3(errStr) raise Exception(errStr) - + if PhactoriDbg(100): myDebugPrint3("GetCurrentGeometricPoint returning: " + \ str(returnXyz) + "\n", 100) @@ -5310,7 +5310,7 @@ def ParseParametersFromJson(self, inJsn): if 'auto size 1 view angle delta in degrees' in inJsn: angleInDegrees = inJsn['auto size 1 view angle delta in degrees'] self.mAutoSize1ViewAngleDeltaInRadians = math.radians(angleInDegrees) - + def SetUpIfEnabled(self, inRenderView, ioCameraPosition, ioLookAtPoint, inViewUpVector): @@ -5410,7 +5410,7 @@ def ChangeEyeAndFocusInModelSpaceForStereo(self, lookDirection = vecFromAToB(ioEyePosition, ioFocalPoint) axisBetweenEyes = vecCrossProduct(lookDirection, inViewUpVector) axisBetweenEyesNorm = vecNormalize(axisBetweenEyes) - + if self.mLeftEyeFlag: modelCsHalfIpd = -self.mIpdInModelUnits * \ self.mVirtualSelfSizeMultiplier * 0.5 @@ -5615,7 +5615,7 @@ class PhactoriCameraBlock: look at the point where pressure is maximum: -:: +:: "mycam10":{ "type":"camera", @@ -5740,7 +5740,7 @@ def DcoaiParseParametersFromJson(self, parentAxesInfo, inJsn, inXyzKey): if theKey in inJsn: self.mUseLabelFlag = True self.mAxisLabel = getParameterFromBlock(inJsn, theKey, "") - + if PhactoriDbg(): myDebugPrint3('DcoaiParseParametersFromJson ' + inXyzKey + ' ' \ + str(parentAxesInfo.mShowTicks) + ' ' \ @@ -6104,13 +6104,13 @@ def IntersectWithOneRayViaBSPTree(self, inIndex, inRayStart, inRayDirection, if inPointOrCellData <= 0: oldvv = ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ GetValue(inIndex) - if (oldvv < 0.0) or (hitdist < oldvv): + if (oldvv < 0.0) or (hitdist < oldvv): ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitdist) else: oldvv = ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ GetValue(inIndex) - if (oldvv < 0.0) or (hitdist < oldvv): + if (oldvv < 0.0) or (hitdist < oldvv): ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitdist) @@ -6179,14 +6179,14 @@ def IntersectWithOneRay(self, inIndex, inRayStart, inRayDirection, oldvv = ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ GetValue(inIndex) newvv = hitPoint[3] - if (oldvv < 0.0) or (newvv < oldvv): + if (oldvv < 0.0) or (newvv < oldvv): ioRaycastOperation.mPointNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitPoint[3]) else: oldvv = ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ GetValue(inIndex) newvv = hitPoint[3] - if (oldvv < 0.0) or (newvv < oldvv): + if (oldvv < 0.0) or (newvv < oldvv): ioRaycastOperation.mCellNormalRayIntersectDistanceArray.\ SetValue(inIndex, hitPoint[3]) @@ -6477,7 +6477,7 @@ def TestAndSet(self, inLengthSquared, inPt1, inPt2): self.LengthSquared = inLengthSquared vecCopy(self.Point1, inPt1) vecCopy(self.Point2, inPt2) - + class PhactoriSegmentGroup1: """manage a set of segments for purposes of showing raycast results""" def __init__(self): @@ -6568,7 +6568,7 @@ def __init__(self): self.mCellNormalRayIntersectDistanceArray = None self.SegmentsFromPointRays = PhactoriSegmentGroup1() - self.SegmentsFromTriangleRays = PhactoriSegmentGroup1() + self.SegmentsFromTriangleRays = PhactoriSegmentGroup1() def ParseParametersFromJson(self, inJson): if "target operation" in inJson: @@ -6616,7 +6616,7 @@ def CreateParaViewFilter(self, inInputFilter): self.mTriangleRayLineSource = PVTrivialProducer() self.mTriangleRayLineSource.GetClientSideObject().SetOutput( self.SegmentsFromTriangleRays.mVtkPolyData) - + #newParaViewFilter = GroupDatasets(Input = []) #self.mGroupLineSource = newParaViewFilter @@ -6631,7 +6631,7 @@ def CreateParaViewFilter(self, inInputFilter): else: newParaViewFilter = PVTrivialProducer() passthru = inInputFilter.GetClientSideObject().GetOutputDataObject(0) - + numpts = passthru.GetNumberOfPoints() newvar = vtk.vtkDoubleArray() @@ -6742,7 +6742,7 @@ def RunCalculationToCastRays(self, ioPipeAndViewsState): #now loop through all processes; one process at a time share the triangles #from each process to the others and intersect with the local surface - #portion + #portion mypid = SmartGetLocalProcessId() @@ -6800,7 +6800,7 @@ def ExportOperationData(self, datadescription): class should override this method if it wants so do something. For PhactoriIntersectNodeNormalsWithSurface we will output information about the nearest and furthest intersections""" - + if PhactoriDbg(100): myDebugPrint3( "PhactoriIntersectNodeNormalsWithSurface::ExportOperationData " @@ -6986,7 +6986,7 @@ def CreateParaViewFilter(self, inInputFilter): newParaViewFilter = Line() newParaViewFilter.Point1 = [0.0, 0.0, 0.0] newParaViewFilter.Point2 = [0.01, 0.01, 0.01] - + SetActiveSource(newParaViewFilter) SetActiveSource(savedActiveSource) @@ -7089,7 +7089,7 @@ def RunCalculationToFindNearestPoints(self, ioPipeAndViewsState): tgty = self.mClosestNPointsFromEachProcess.mTargetMatchXyzs.GetValue(pndx+1) tgtz = self.mClosestNPointsFromEachProcess.mTargetMatchXyzs.GetValue(pndx+2) - self.mLineSource.Point1 = [srcx, srcy, srcz] + self.mLineSource.Point1 = [srcx, srcy, srcz] self.mLineSource.Point2 = [tgtx, tgty, tgtz] self.mLineSource.UpdatePipeline() @@ -7132,7 +7132,7 @@ def OutputToTextAnnotation(self, ioPipeAndViewsState): tgty = clstpts.mTargetMatchXyzs.GetValue(pndx+1) tgtz = clstpts.mTargetMatchXyzs.GetValue(pndx+2) - if self.mTxtAntnFormatString == None: + if self.mTxtAntnFormatString == None: self.mTextAnnotationOutputTarget.mTextString = \ "nearest: " + str(dist) + "\n" \ "node id 1: " + str(srcndid) + "\n" \ @@ -8118,7 +8118,7 @@ def CreateParaViewStuff(self, inColor, inImageset = None): "to work off, and None was supplied\n") return self.mInputOperation = inImageset.mOperation - + savedActiveSource = GetActiveSource() inOprtn = self.mInputOperation if(inOprtn.mParaViewTimeAnnotationSource == None): @@ -8268,11 +8268,11 @@ def SetSizeScale(self, inNewSizeScale): def SetWindowLocation(self, inNewPosition): global gParaViewCatalystVersionFlag if gParaViewCatalystVersionFlag < 51000: - validPositions = ['UpperLeftCorner', 'UpperRightCorner', + validPositions = ['UpperLeftCorner', 'UpperRightCorner', 'LowerLeftCorner', 'LowerRightCorner', 'UpperCenter', 'LowerCenter'] else: - validPositions = ['Upper Left Corner', 'Upper Right Corner', + validPositions = ['Upper Left Corner', 'Upper Right Corner', 'Lower Left Corner', 'Lower Right Corner', 'Upper Center', 'Lower Center'] if inNewPosition in validPositions: @@ -8404,7 +8404,7 @@ def GetImageFilename(self, datadescription, inImageSettings, inImageBasedirectory = inImageSettings.mImageBasedirectory inNumCounterDigits = inImageSettings.mNumCounterDigits inImageFormat = inImageSettings.mImageFormat - + timestep = datadescription.GetTimeStep() lastImagesetName = "" @@ -8439,7 +8439,7 @@ def GetImageFilename(self, datadescription, inImageSettings, while len(timestepString) < inNumCounterDigits: timestepString = "0" + timestepString myDebugPrint2("image fname: " + fname + "\ndigit count: " + str(inNumCounterDigits) + "\ntimestepString: " + timestepString + "\n") - + rplstr1 = None if self.mUseDateTime: ttnow = gPipeAndViewsState.mCallbackDateTime @@ -8469,7 +8469,7 @@ def GetImageFilename(self, datadescription, inImageSettings, fnameRR = fname.replace("%t", rplstr1) else: fnameRR = None - + fname = fname.replace("%t", timestepString) myDebugPrint2("fname after replace: ->" + fname + "<-\n") @@ -8498,7 +8498,7 @@ class PhactoriPlot1Base: def __init__(self): self.mName = "" self.m_DataCubeAxesInfo = PhactoriDataCubeAxesInfo() - + self.m_PlotType = "PhactoriPlot1Base" self.mImageSettings = PhactoriImageSettings() self.mImageSettings.mPixelBorderRatioXY = [0.175 / self.mImageSettings.GetAspectRatio(), 0.175] @@ -8559,7 +8559,7 @@ def WriteImages(self, datadescription): oneLookDirectionFilenameAddon = "" else: oneLookDirectionFilenameAddon = "" - + fname, fnameRR = self.mImageFileNameCountSettings.GetImageFilename( datadescription, self.mImageSettings, oneLookDirectionFilenameAddon, @@ -8712,7 +8712,7 @@ def __init__(self): def SetFromRestartInfo(self, inJson): """given a map (json format), use the info in the map to set the - plot state--this reads the info created by out in + plot state--this reads the info created by out in GetRestartInfo. It should only occur on a restart, and it fills in the data that had been generated during the earlier run of the system""" @@ -9465,7 +9465,7 @@ def ParseOperationAndRepresentationPair(self, ioPipeAndViewsState, ioJson, "inOperationKey: " + str(inOperationKey) + "\n" "inRepresentationKey: " + str(inRepresentationKey) + "\n" "incoming json:\n" + str(ioJson) + "\n") - + if inOperationKey not in ioJson: if inSkipIfOperationKeyNotPresent: @@ -9774,7 +9774,7 @@ def PerRendersetInitialization(datadescription): #cellDataInfo = paraviewSource.GetCellDataInformation() myDebugPrint3(" PerRendersetInitialization:\n num cells: " + str(pvsDi.GetNumberOfCells()) + "\n num points: " + str(pvsDi.GetNumberOfPoints()) + "\n") - #we assume to begin with that all global data bounds in operations are + #we assume to begin with that all global data bounds in operations are #invalid as data may have changed for oneOperationName, oneOperation in \ gPipeAndViewsState.mOperationBlocks.items(): @@ -9810,7 +9810,7 @@ def UpdateRepresentationColorBy(ioPhactoriImagesetBlock): if PhactoriDbg(100): myDebugPrint3("in PhactoriImagsetBlock named: " + \ ioPhactoriImagesetBlock.mName + "\n" + \ - "mColorLegendRepRefs " + str(ii) + + "mColorLegendRepRefs " + str(ii) + "is set to " + str(retVal) + "\n") ioPhactoriImagesetBlock.mColorLegendRepRefs[ii] = retVal @@ -9843,7 +9843,7 @@ def UpdateRepresentationColorBySub1(inPvView, inPvRep, if PhactoriDbg(100): myDebugPrint3('bad element type: returning\n', 100) return None - + if colorVarName != '': if inPhactoriRep.mColorVariableInfo.mVariableIsVectorComponent: ColorByVariableComponentOrMagnitudeXX(inPvRep, inPhactoriRep, @@ -10102,7 +10102,7 @@ def HandleRestartUpdateForOutputResultsBlock(ioPipeAndViewsState): """this method is a companion to SaveRestartInfoCallback. It is called after the pipeline is first initialized for the given output block, and it will read the data stored by SaveRestartInfoCallback in a file. - The presumption is that the pipeline will be initialized for the + The presumption is that the pipeline will be initialized for the given output block only once when the system starts or only once when the system restarts. The intent is to deal with restart by allowing persistent @@ -10167,7 +10167,7 @@ def SaveRestartInfoCallback(): for onePlotOtName, onePlotOt in \ gPipeAndViewsState.mPlotOverTimeBlocks.items(): if PhactoriDbg(): - myDebugPrint3("making end vis callback json for plot over time: " + + myDebugPrint3("making end vis callback json for plot over time: " + onePlotOtName + "\n") plotsOverTimeJsonOut[onePlotOtName] = onePlotOt.GetRestartInfo() @@ -10274,7 +10274,7 @@ def HandleOperationShortcuts2(inBlockName, inJson, ioOperationBlocks, inCount): if PhactoriDbg(): myDebugPrint3(errStr) raise Exception(errStr) - #stuff should have 4 items + #stuff should have 4 items #[scalar|vector magnitude|vector component|tensor #component, component, namekeep between|keep above|keep #below, [, ]] @@ -10294,7 +10294,7 @@ def HandleOperationShortcuts2(inBlockName, inJson, ioOperationBlocks, inCount): if PhactoriDbg(): myDebugPrint3(errStr) raise Exception(errStr) - + if PhactoriDbg(): myDebugPrint3('got threshold operation shortcut ' + str(newOperationJson) + '\n') if lastShortcutOperationName != None: @@ -10919,7 +10919,7 @@ def CreateViewSetFromPhactoriViewMapC(inViewMapC): myDebugPrint3(str(inViewMapC) + "\n") global gPipeAndViewsState gPipeAndViewsState.mJsonDescription = inViewMapC - + #get pointers to the various block types (currently 6, camera, #representation, operation, imageset, plot over time, and scatter plot) @@ -11513,7 +11513,7 @@ def ColorByBlock(inParaViewDataSource, inParaViewDataRepresentation, ColorByBlockRecurse1(csdata, blockAndLeafBlockCounter, inParaViewDataRepresentation.BlockColor, False) #inParaViewDataRepresentation.BlockColor = blockColorData - + if PhactoriDbg(100): myDebugPrint3(' block color data: ' + str(inParaViewDataRepresentation.BlockColor) + '\n', 100) if PhactoriDbg(100): @@ -11564,8 +11564,8 @@ def UseDataRangeForColorValues(inPvDataRepresentation, inRepresentation, if PhactoriDbg(): myDebugPrint3(" input:" + str(input) + "\n") UpdatePipelineWithCurrentTimeArgument(input) - - #assume point info + + #assume point info #datainformation = rep.Input.GetPointDataInformation() if pointsOrCellsType == gPointsString: @@ -11769,7 +11769,7 @@ def helpFindNewRgbPoint(inBaseRgbPts, inRatio): #print "deltaPt: ", deltaPt #print "ratioPt: ", ratioPt - subrangePt1 = [inRatio, + subrangePt1 = [inRatio, rr1 + ratioPt * (rr2 - rr1), gg1 + ratioPt * (gg2 - gg1), bb1 + ratioPt * (bb2 - bb1)] @@ -12096,7 +12096,7 @@ def ShowCubeAxesXX(inPvRenderView, inOnOrOff, inShowDataCubeAxesInfo = None): SetAxesGridVisibility(inPvRenderView, 0) if PhactoriDbg(100): myDebugPrint3("ShowCubeAxesXX returning\n", 100) - + def ShowDataColorLegendXX(inPvView, inOnOffSetting, inColorLegendPositionAndSize, inColorSettings, @@ -12247,7 +12247,7 @@ def ShowDataColorLegendXX(inPvView, defaultMidPos = 0.5 - 0.5*defaultLegendLength #legendFontSize = 16 #legendSize = 1.0 - #validPositions = ['UpperLeftCorner', 'UpperRightCorner', + #validPositions = ['UpperLeftCorner', 'UpperRightCorner', # 'LowerLeftCorner', 'LowerRightCorner', # 'UpperCenter', 'LowerCenter'] legendPosition=[0.0, 0.0] @@ -12289,7 +12289,7 @@ def ShowDataColorLegendXX(inPvView, defaultMidPos = 0.5 - 0.5*defaultLegendLength #legendFontSize = 16 #legendSize = 1.0 - #validPositions = ['UpperLeftCorner', 'UpperRightCorner', + #validPositions = ['UpperLeftCorner', 'UpperRightCorner', # 'LowerLeftCorner', 'LowerRightCorner', # 'UpperCenter', 'LowerCenter'] legendPosition=[0.0, 0.0] @@ -12537,9 +12537,9 @@ def ExtractComponentFromVectorVariable(inVariableName, inWhichComponent, inResul newFunctionString = "" if(inWhichComponent == 0): newFunctionString = inVariableName + '_X' - elif(inWhichComponent == 1): + elif(inWhichComponent == 1): newFunctionString = inVariableName + '_Y' - elif(inWhichComponent == 2): + elif(inWhichComponent == 2): newFunctionString = inVariableName + '_Z' else: if PhactoriDbg(): @@ -12625,7 +12625,7 @@ def CollectCells2(inClientSideData, inBlockIndex, ioCollectList, ioTotalCellCoun appendCount += 1 if PhactoriDbg(): myDebugPrint3(' proc ' + str(SmartGetLocalProcessId()) + ' Leaving CollectCells2\n') - + def CollectCells1(cellVariableName, thresholdValue, thresholdDir): if PhactoriDbg(): @@ -12727,7 +12727,7 @@ def UseReduceToSpreadValues(ioListOfValues): if value != 0.0: value = -value ioListOfValues[ii] = value - + if PhactoriDbg(): myDebugPrint3(' ' + 'proc ' + str(SmartGetLocalProcessId()) + ' final values: ' + str(ioListOfValues) + '\n') if PhactoriDbg(100): @@ -13127,7 +13127,7 @@ def GetRestartInfo(self): # def SetRepresentationAndViewColors(self, ioRenderViewInfo): # myDebugPrint3('PlotColorInfo.SetRepresentationColors entered\n', 100) # rep1 = ioRenderViewInfo.DataRepresentation1 -# view1 = ioRenderViewInfo.RenderView1 +# view1 = ioRenderViewInfo.RenderView1 # view1.Background = self.m_BackgroundColor # rep1.EdgeColor = self.m_EdgeColor # rep1.DiffuseColor = self.m_DiffuseColor @@ -13136,7 +13136,7 @@ def GetRestartInfo(self): # rep1.BackfaceDiffuseColor = self.m_BackfaceDiffuseColor # rep1.CubeAxesColor = self.m_CubeAxesColor # myDebugPrint3('PlotColorInfo.SetRepresentationColors returning\n', 100) - + #global gPlotColorInfoPreset #gPlotColorInfoPreset = PlotColorInfo() @@ -13524,7 +13524,7 @@ def FindNodeOrElementIdForMinMax(inputcsData, inVariableInfo): myDebugPrint3("min/max not available, calculating\n", 100) DataMinMax = [0.0, 0.0, False] DataSumCnt = [0.0, 0] - FindMinMaxSumCntFromData(inputcsData, inVariableInfo, + FindMinMaxSumCntFromData(inputcsData, inVariableInfo, None, DataMinMax, DataSumCnt, None, None) else: @@ -13551,7 +13551,7 @@ def FindNodeOrElementIdForMinMax(inputcsData, inVariableInfo): inVariableInfo.mStats.mMaxId = idForMinAndidForMax[1] #mark done for this catalyst callback, so we won't do extra mpi - #communication if we call this routine again + #communication if we call this routine again inVariableInfo.mStats.mIdsTestCounter = gPipeAndViewsState.mFrameTagCounter if PhactoriDbg(100): @@ -14061,7 +14061,7 @@ def FindThisProcessorMinMaxForVar(inOperation, inVariableInfo): return myDataMinMax -def FindMinMaxSumCntFromData(inputcsData, inVariableInfo, +def FindMinMaxSumCntFromData(inputcsData, inVariableInfo, inSecondaryVariableInfo, DataMinMax, DataSumCnt, DataForIds, inPlotIdLineList): """fairly complex high level mpi-operation routine. This takes a paraview @@ -14077,7 +14077,7 @@ def FindMinMaxSumCntFromData(inputcsData, inVariableInfo, if PhactoriDbg(): myDebugPrint3("FindMinMaxSumCntFromData entered\n") - FindMinMaxSumCntFromDataRecurse1(inputcsData, inVariableInfo, + FindMinMaxSumCntFromDataRecurse1(inputcsData, inVariableInfo, inSecondaryVariableInfo, DataMinMax, DataSumCnt, DataForIds, inPlotIdLineList) @@ -14150,7 +14150,7 @@ def SetPlotOverTimePointsFromData(ioPlotInfo): DataForIds = None FindMinMaxSumCntFromData(inputcsData, - ioPlotInfo.m_YAxisVariableInfo, ioPlotInfo.m_XAxisVariableInfo, + ioPlotInfo.m_YAxisVariableInfo, ioPlotInfo.m_XAxisVariableInfo, DataMinMax, DataSumCnt, DataForIds, ioPlotInfo.m_IdPlotLineList) if DataSumCnt[1] == 0: @@ -14246,7 +14246,7 @@ def SetPlotPointsFromData(ioPlotInfo): #myDebugPrint3(' done updating ids\n') - + FindPlotXYZMinMax(plotPts, ioPlotInfo.m_xyzMinMaxTrkC) ScalePlotYForFit(plotPts, ioPlotInfo.m_xyzMinMaxTrkC, @@ -14962,7 +14962,7 @@ def HandleUserInteractionIfEnabled(ioPipeAndViewsState): trigger which will cause a read-and-update of the state. Provides control to skip interaction when it is not enabled, the default case. Allows for a wait for an interaction trigger of N tries at M seconds - per try, mainly to deal with situations where images are being + per try, mainly to deal with situations where images are being rendered quickly. Eventually may be altered to help deal with cases where we want to keep re-rendering with changed pipeline states until we are happy and then let the simulation return to operation""" @@ -15208,7 +15208,7 @@ def TestForTruth(self, ioPipeAndViewsState): DataMinMax = [0.0, 0.0, False] DataSumCnt = [0.0, 0] - FindMinMaxSumCntFromData(inputcsData, self.mVariableInfo, None, + FindMinMaxSumCntFromData(inputcsData, self.mVariableInfo, None, DataMinMax, DataSumCnt, None, None) #just return false if there is no min/max found @@ -15572,16 +15572,16 @@ def InitializePerPipeRoot(datadescription, inCoprocessor): sa4 = sa[4] sa5 = sa[5] dbDummyFname = sa[6] - if(len(sa) > 7): + if(len(sa) > 7): defaultDirectory = sa[7] else: defaultDirectory = "" - if(len(sa) > 8): + if(len(sa) > 8): catalyst_script_extra_file = sa[8] else: catalyst_script_extra_file = "" - outputResultBaseId, remeshRestartTag = parseDbDummyFname(dbDummyFname) + outputResultBaseId, remeshRestartTag = parseDbDummyFname(dbDummyFname) if PhactoriDbg(): myDebugPrint3(" extra data list:\n") if PhactoriDbg(): @@ -15872,5 +15872,3 @@ def GetColorMapInfoFromColorLegendCollection(inColorMapSettings, inMin, inMax): myDebugPrint3("gParaViewCatalystVersionFlag is: " + str(gParaViewCatalystVersionFlag) +"\n") - - diff --git a/packages/seacas/libraries/ioss/src/visualization/catalyst/test/Catch2/catch.hpp b/packages/seacas/libraries/ioss/src/visualization/catalyst/test/Catch2/catch.hpp index 0384171ae4a7..d34e50834e0e 100644 --- a/packages/seacas/libraries/ioss/src/visualization/catalyst/test/Catch2/catch.hpp +++ b/packages/seacas/libraries/ioss/src/visualization/catalyst/test/Catch2/catch.hpp @@ -12,88 +12,88 @@ #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED // start catch.hpp - #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 13 #define CATCH_VERSION_PATCH 4 #ifdef __clang__ -# pragma clang system_header +#pragma clang system_header #elif defined __GNUC__ -# pragma GCC system_header +#pragma GCC system_header #endif // start catch_suppress_warnings.h #ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif +#ifdef __ICC // icpc defines the __clang__ macro +#pragma warning(push) +#pragma warning(disable : 161 1682) +#else // __ICC +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#pragma clang diagnostic ignored "-Wswitch-enum" +#pragma clang diagnostic ignored "-Wcovered-switch-default" +#endif #elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" +// Because REQUIREs trigger GCC's -Wparentheses, and because still +// supported version of g++ have only buggy support for _Pragmas, +// Wparentheses have to be suppressed globally. +#pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wpadded" #endif // end catch_suppress_warnings.h #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS +#define CATCH_IMPL +#define CATCH_CONFIG_ALL_PARTS #endif // In the impl file, we want to have access to all parts of the headers // Can also be used to sanely support PCHs #if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif +#define CATCH_CONFIG_EXTERNAL_INTERFACES +#if defined(CATCH_CONFIG_DISABLE_MATCHERS) +#undef CATCH_CONFIG_DISABLE_MATCHERS +#endif +#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif #endif #if !defined(CATCH_CONFIG_IMPL_ONLY) // start catch_platform.h #ifdef __APPLE__ -# include -# if TARGET_OS_OSX == 1 -# define CATCH_PLATFORM_MAC -# elif TARGET_OS_IPHONE == 1 -# define CATCH_PLATFORM_IPHONE -# endif +#include +#if TARGET_OS_OSX == 1 +#define CATCH_PLATFORM_MAC +#elif TARGET_OS_IPHONE == 1 +#define CATCH_PLATFORM_IPHONE +#endif #elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX +#define CATCH_PLATFORM_LINUX -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS +#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || \ + defined(__MINGW32__) +#define CATCH_PLATFORM_WINDOWS #endif // end catch_platform.h #ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif +#ifndef CLARA_CONFIG_MAIN +#define CLARA_CONFIG_MAIN_NOT_DEFINED +#define CLARA_CONFIG_MAIN +#endif #endif // start catch_user_interfaces.h namespace Catch { - unsigned int rngSeed(); + unsigned int rngSeed(); } // end catch_user_interfaces.h @@ -122,30 +122,30 @@ namespace Catch { #ifdef __cplusplus -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif +#if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +#define CATCH_CPP14_OR_GREATER +#endif -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif +#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +#define CATCH_CPP17_OR_GREATER +#endif #endif // We have to avoid both ICC and Clang, because they try to mask themselves // as gcc, and we want only GCC in this block #if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic push") +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic pop") -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) +#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) #endif #if defined(__clang__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("clang diagnostic push") +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("clang diagnostic pop") // As of this writing, IBM XL's implementation of __builtin_constant_p has a bug // which results in calls to destructors being emitted for each temporary, @@ -158,62 +158,64 @@ namespace Catch { // ``` // // Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -# if !defined(__ibmxl__) && !defined(__CUDACC__) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ -# endif +#if !defined(__ibmxl__) && !defined(__CUDACC__) +#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) \ + (void)__builtin_constant_p( \ + __VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ +#endif -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") +#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"") \ + _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wparentheses\"") -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) +#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wunused-variable\"") -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) +#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"") -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) +#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + _Pragma("clang diagnostic ignored \"-Wunused-template\"") #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// // Assume that non-Windows platforms support posix signals by default #if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS #endif //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS #endif #ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE +#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#define CATCH_CONFIG_COLOUR_NONE #endif //////////////////////////////////////////////////////////////////////////////// // Android somehow still does not support std::to_string #if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE +#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE #endif //////////////////////////////////////////////////////////////////////////////// // Not all Windows environments support SEH properly #if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH #endif //////////////////////////////////////////////////////////////////////////////// // PS4 #if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE #endif //////////////////////////////////////////////////////////////////////////////// @@ -222,64 +224,64 @@ namespace Catch { // Required for some versions of Cygwin to declare gettimeofday // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE +#define _BSD_SOURCE // some versions of cygwin (most) do not support std::to_string. Use the libstd check. // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) +#if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) && \ + !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# endif +#endif #endif // __CYGWIN__ //////////////////////////////////////////////////////////////////////////////// // Visual C++ #if defined(_MSC_VER) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma(warning(push)) +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma(warning(pop)) // Universal Windows platform does not support SEH // Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +#define CATCH_CONFIG_COLOUR_NONE +#else +#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +#endif // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(__clang__) // Handle Clang masquerading for msvc -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif // MSVC_TRADITIONAL -# endif // __clang__ +#if !defined(__clang__) // Handle Clang masquerading for msvc +#if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +#define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif // MSVC_TRADITIONAL +#endif // __clang__ #endif // _MSC_VER #if defined(_REENTRANT) || defined(_MSC_VER) // Enable async processing, as -pthread is specified or no additional linking is required -# define CATCH_INTERNAL_CONFIG_USE_ASYNC +#define CATCH_INTERNAL_CONFIG_USE_ASYNC #endif // _MSC_VER //////////////////////////////////////////////////////////////////////////////// // Check if we are compiled with -fno-exceptions or equivalent #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED #endif //////////////////////////////////////////////////////////////////////////////// // DJGPP #ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#define CATCH_INTERNAL_CONFIG_NO_WCHAR #endif // __DJGPP__ //////////////////////////////////////////////////////////////////////////////// // Embarcadero C++Build #if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN #endif //////////////////////////////////////////////////////////////////////////////// @@ -289,8 +291,8 @@ namespace Catch { // handled by it. // Otherwise all supported compilers support COUNTER macro, // but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER +#if (!defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L) +#define CATCH_INTERNAL_CONFIG_COUNTER #endif //////////////////////////////////////////////////////////////////////////////// @@ -299,9 +301,9 @@ namespace Catch { // This means that it is detected as Windows, but does not provide // the same set of capabilities as real Windows does. #if defined(UNDER_RTSS) || defined(RTX64_BUILD) - #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH - #define CATCH_INTERNAL_CONFIG_NO_ASYNC - #define CATCH_CONFIG_COLOUR_NONE +#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#define CATCH_INTERNAL_CONFIG_NO_ASYNC +#define CATCH_CONFIG_COLOUR_NONE #endif #if !defined(_GLIBCXX_USE_C99_MATH_TR1) @@ -310,248 +312,271 @@ namespace Catch { // Various stdlib support checks that require __has_include #if defined(__has_include) - // Check if string_view is available and usable - #if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW - #endif - - // Check if optional is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if byte is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # include - # if __cpp_lib_byte > 0 - # define CATCH_INTERNAL_CONFIG_CPP17_BYTE - # endif - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if variant is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 - # include - # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # define CATCH_CONFIG_NO_CPP17_VARIANT - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__clang__) && (__clang_major__ < 8) - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) +// Check if string_view is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW +#endif + +// Check if optional is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL +#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + +// Check if byte is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#include +#if __cpp_lib_byte > 0 +#define CATCH_INTERNAL_CONFIG_CPP17_BYTE +#endif +#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + +// Check if variant is available and usable +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +#if defined(__clang__) && (__clang_major__ < 8) +// work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 +// fix should be in clang 8, workaround in libstdc++ 8.2 +#include +#if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +#define CATCH_CONFIG_NO_CPP17_VARIANT +#else +#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +#endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +#else +#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +#endif // defined(__clang__) && (__clang_major__ < 8) +#endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) #endif // defined(__has_include) -#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER +#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && \ + !defined(CATCH_CONFIG_COUNTER) +#define CATCH_CONFIG_COUNTER #endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && \ + !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) +#define CATCH_CONFIG_WINDOWS_SEH #endif -// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS +// This is set by default, because we assume that unix compilers are posix-signal-compatible by +// default. +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && \ + !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && \ + !defined(CATCH_CONFIG_POSIX_SIGNALS) +#define CATCH_CONFIG_POSIX_SIGNALS #endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR +// This is set by default, because we assume that compilers with no wchar_t support are just rare +// exceptions. +#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && \ + !defined(CATCH_CONFIG_WCHAR) +#define CATCH_CONFIG_WCHAR #endif -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && \ + !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +#define CATCH_CONFIG_CPP11_TO_STRING #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL +#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && \ + !defined(CATCH_CONFIG_CPP17_OPTIONAL) +#define CATCH_CONFIG_CPP17_OPTIONAL #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && \ + !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +#define CATCH_CONFIG_CPP17_STRING_VIEW #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && \ + !defined(CATCH_CONFIG_CPP17_VARIANT) +#define CATCH_CONFIG_CPP17_VARIANT #endif -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE +#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && \ + !defined(CATCH_CONFIG_CPP17_BYTE) +#define CATCH_CONFIG_CPP17_BYTE #endif #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#define CATCH_INTERNAL_CONFIG_NEW_CAPTURE #endif -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && \ + !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && \ + !defined(CATCH_CONFIG_NEW_CAPTURE) +#define CATCH_CONFIG_NEW_CAPTURE #endif #if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#define CATCH_CONFIG_DISABLE_EXCEPTIONS #endif -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && \ + !defined(CATCH_CONFIG_POLYFILL_ISNAN) +#define CATCH_CONFIG_POLYFILL_ISNAN #endif -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) -# define CATCH_CONFIG_USE_ASYNC +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && \ + !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +#define CATCH_CONFIG_USE_ASYNC #endif -#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) -# define CATCH_CONFIG_ANDROID_LOGWRITE +#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && \ + !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) +#define CATCH_CONFIG_ANDROID_LOGWRITE #endif -#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -# define CATCH_CONFIG_GLOBAL_NEXTAFTER +#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && \ + !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) +#define CATCH_CONFIG_GLOBAL_NEXTAFTER #endif // Even if we do not think the compiler has that warning, we still have // to provide a macro that can be used by the code. #if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION #endif #if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #endif #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif // The goal of this macro is to avoid evaluation of the arguments, but // still have the compiler warn on problems inside... #if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) #endif #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #elif defined(__clang__) && (__clang_major__ < 5) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) #define CATCH_CATCH_ANON(type) if ((false)) #else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) #define CATCH_CATCH_ANON(type) catch (type) #endif -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && \ + !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && \ + !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #endif // end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE(name, line) INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) #ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __COUNTER__) #else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __LINE__) #endif +#include #include #include -#include // We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); +struct Catch_global_namespace_dummy +{ +}; +std::ostream &operator<<(std::ostream &, Catch_global_namespace_dummy); namespace Catch { - struct CaseSensitive { enum Choice { - Yes, - No - }; }; - - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} - - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - - bool empty() const noexcept { return file[0] == '\0'; } - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; - - char const* file; - std::size_t line; - }; - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } -} + struct CaseSensitive + { + enum Choice { Yes, No }; + }; + + class NonCopyable + { + NonCopyable(NonCopyable const &) = delete; + NonCopyable(NonCopyable &&) = delete; + NonCopyable &operator=(NonCopyable const &) = delete; + NonCopyable &operator=(NonCopyable &&) = delete; + + protected: + NonCopyable(); + virtual ~NonCopyable(); + }; + + struct SourceLineInfo + { + + SourceLineInfo() = delete; + SourceLineInfo(char const *_file, std::size_t _line) noexcept : file(_file), line(_line) {} + + SourceLineInfo(SourceLineInfo const &other) = default; + SourceLineInfo &operator=(SourceLineInfo const &) = default; + SourceLineInfo(SourceLineInfo &&) noexcept = default; + SourceLineInfo &operator=(SourceLineInfo &&) noexcept = default; + + bool empty() const noexcept { return file[0] == '\0'; } + bool operator==(SourceLineInfo const &other) const noexcept; + bool operator<(SourceLineInfo const &other) const noexcept; + + char const *file; + std::size_t line; + }; + + std::ostream &operator<<(std::ostream &os, SourceLineInfo const &info); + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop + { + std::string operator+() const; + }; + template T const &operator+(T const &value, StreamEndStop) { return value; } +} // namespace Catch -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo(__FILE__, static_cast(__LINE__)) // end catch_common.h namespace Catch { - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; + struct RegistrarForTagAliases + { + RegistrarForTagAliases(char const *alias, char const *tag, SourceLineInfo const &lineInfo); + }; } // end namespace Catch -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#define CATCH_REGISTER_TAG_ALIAS(alias, spec) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace { \ + Catch::RegistrarForTagAliases \ + INTERNAL_CATCH_UNIQUE_NAME(AutoRegisterTagAlias)(alias, spec, CATCH_INTERNAL_LINEINFO); \ + } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION // end catch_tag_alias_autoregistrar.h // start catch_test_registry.h @@ -562,143 +587,146 @@ namespace Catch { namespace Catch { - class TestSpec; + class TestSpec; - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; + struct ITestInvoker + { + virtual void invoke() const = 0; + virtual ~ITestInvoker(); + }; - class TestCase; - struct IConfig; + class TestCase; + struct IConfig; - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; + struct ITestCaseRegistry + { + virtual ~ITestCaseRegistry(); + virtual std::vector const &getAllTests() const = 0; + virtual std::vector const &getAllTestsSorted(IConfig const &config) const = 0; + }; - bool isThrowSafe( TestCase const& testCase, IConfig const& config ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); + bool isThrowSafe(TestCase const &testCase, IConfig const &config); + bool matchTest(TestCase const &testCase, TestSpec const &testSpec, IConfig const &config); + std::vector filterTests(std::vector const &testCases, + TestSpec const &testSpec, IConfig const &config); + std::vector const &getAllTestCasesSorted(IConfig const &config); -} +} // namespace Catch // end catch_interfaces_testcase.h // start catch_stringref.h +#include #include -#include #include -#include +#include namespace Catch { - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. - class StringRef { - public: - using size_type = std::size_t; - using const_iterator = const char*; + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. + class StringRef + { + public: + using size_type = std::size_t; + using const_iterator = const char *; - private: - static constexpr char const* const s_empty = ""; + private: + static constexpr char const *const s_empty = ""; - char const* m_start = s_empty; - size_type m_size = 0; + char const *m_start = s_empty; + size_type m_size = 0; - public: // construction - constexpr StringRef() noexcept = default; + public: // construction + constexpr StringRef() noexcept = default; - StringRef( char const* rawChars ) noexcept; + StringRef(char const *rawChars) noexcept; - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} + constexpr StringRef(char const *rawChars, size_type size) noexcept + : m_start(rawChars), m_size(size) + { + } - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} + StringRef(std::string const &stdString) noexcept + : m_start(stdString.c_str()), m_size(stdString.size()) + { + } - explicit operator std::string() const { - return std::string(m_start, m_size); - } + explicit operator std::string() const { return std::string(m_start, m_size); } - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { - return !(*this == other); - } + public: // operators + auto operator==(StringRef const &other) const noexcept -> bool; + auto operator!=(StringRef const &other) const noexcept -> bool { return !(*this == other); } - auto operator[] ( size_type index ) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } + auto operator[](size_type index) const noexcept -> char + { + assert(index < m_size); + return m_start[index]; + } - public: // named queries - constexpr auto empty() const noexcept -> bool { - return m_size == 0; - } - constexpr auto size() const noexcept -> size_type { - return m_size; - } + public: // named queries + constexpr auto empty() const noexcept -> bool { return m_size == 0; } + constexpr auto size() const noexcept -> size_type { return m_size; } - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const*; + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const *; - public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr( size_type start, size_type length ) const noexcept -> StringRef; + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, size()). + // If start > size(), then the substring is empty. + auto substr(size_type start, size_type length) const noexcept -> StringRef; - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const*; + // Returns the current start pointer. May not be null-terminated. + auto data() const noexcept -> char const *; - constexpr auto isNullTerminated() const noexcept -> bool { - return m_start[m_size] == '\0'; - } + constexpr auto isNullTerminated() const noexcept -> bool { return m_start[m_size] == '\0'; } - public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } - }; + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } + }; - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + auto operator+=(std::string &lhs, StringRef const &sr) -> std::string &; + auto operator<<(std::ostream &os, StringRef const &sr) -> std::ostream &; - constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } + constexpr auto operator"" _sr(char const *rawChars, std::size_t size) noexcept -> StringRef + { + return StringRef(rawChars, size); + } } // namespace Catch -constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); +constexpr auto operator"" _catch_sr(char const *rawChars, + std::size_t size) noexcept -> Catch::StringRef +{ + return Catch::StringRef(rawChars, size); } // end catch_stringref.h // start catch_preprocessor.hpp - #define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ -#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL1(...) \ + CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL2(...) \ + CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL3(...) \ + CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL4(...) \ + CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL5(...) \ + CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) #ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ // MSVC needs more evaluations -#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#define CATCH_RECURSION_LEVEL6(...) \ + CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) #else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) #endif #define CATCH_REC_END(...) @@ -707,41 +735,55 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n #define CATCH_EMPTY() #define CATCH_DEFER(id) id CATCH_EMPTY() -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 #define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) - -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, -// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER(CATCH_REC_NEXT0)(test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) \ + , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__) +#define CATCH_REC_LIST1(f, x, peek, ...) \ + , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0))(f, peek, __VA_ARGS__) +#define CATCH_REC_LIST2(f, x, peek, ...) \ + f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) \ + , f(userdata, x) \ + CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) \ + , f(userdata, x) \ + CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD))(f, userdata, peek, __VA_ARGS__) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) \ + f(userdata, x) \ + CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__) + +// Applies the function macro `f` to each of the remaining parameters, inserts commas between the +// results, and passes userdata as the first parameter to each invocation, e.g. CATCH_REC_LIST_UD(f, +// x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) +#define CATCH_REC_LIST_UD(f, userdata, ...) \ + CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define CATCH_REC_LIST(f, ...) \ + CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) #define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO##__VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF #define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR #define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) \ + INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) #else -// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +// MSVC is adding extra space and needs another indirection to expand +// INTERNAL_CATCH_NOINTERNAL_CATCH_DEF #define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) #define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) \ + (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) #endif #define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ @@ -750,588 +792,955 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n #define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) \ + decltype(get_wrapper()) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) \ + INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) #else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) \ + INTERNAL_CATCH_EXPAND_VARGS( \ + decltype(get_wrapper())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) \ + INTERNAL_CATCH_EXPAND_VARGS( \ + INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) #endif -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...) \ + CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST, __VA_ARGS__) #define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) -#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) -#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) +#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) +#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), \ + INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), \ + INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + INTERNAL_CATCH_REMOVE_PARENS(_0), \ + INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define INTERNAL_CATCH_TYPE_GEN\ - template struct TypeList {};\ - template\ - constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ - template class...> struct TemplateTypeList{};\ - template class...Cs>\ - constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ - template\ - struct append;\ - template\ - struct rewrap;\ - template class, typename...>\ - struct create;\ - template class, typename>\ - struct convert;\ - \ - template \ - struct append { using type = T; };\ - template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ - struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ - template< template class L1, typename...E1, typename...Rest>\ - struct append, TypeList, Rest...> { using type = L1; };\ - \ - template< template class Container, template class List, typename...elems>\ - struct rewrap, List> { using type = TypeList>; };\ - template< template class Container, template class List, class...Elems, typename...Elements>\ - struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ - \ - template