diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0507404b6..c0038f6f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,20 +11,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check formatting - uses: DoozyX/clang-format-lint-action@v0.13 + uses: DoozyX/clang-format-lint-action@v0.17 with: source: 'nalu.C unit_tests.C ./include ./src ./unit_tests' extensions: 'H,h,cpp,C' - clangFormatVersion: 13 + clangFormatVersion: 17 CPU-Trilinos: needs: Formatting runs-on: ubuntu-latest container: image: ecpe4s/exawind-snapshot env: - SPACK_MANAGER: /spack-manager + EXAWIND_MANAGER: /exawind-manager E4S_MACHINE: true steps: - name: Cancel previous runs @@ -38,13 +38,16 @@ jobs: - name: Tests run: | /bin/bash -c " \ - source ${SPACK_MANAGER}/start.sh && \ - mkdir -p ${SPACK_MANAGER}/environments/exawind && \ - cd ${SPACK_MANAGER}/environments/exawind && \ + source ${EXAWIND_MANAGER}/start.sh && \ + mkdir -p ${EXAWIND_MANAGER}/environments/exawind && \ + cd ${EXAWIND_MANAGER}/environments/exawind && \ ln -s ${GITHUB_WORKSPACE} nalu-wind && \ - source ${SPACK_MANAGER}/start.sh && \ + spack-start && \ + spack -e e4s-build config add view:true && \ + spack -e e4s-build add cmake && \ + spack -e e4s-build install && \ quick-create-dev -s nalu-wind@master+tioga+hypre && \ - spack manager external --latest --blacklist nalu-wind gmake && \ + spack manager external ${EXAWIND_MANAGER}/environments/e4s-build --exclude nalu-wind gmake && \ spack install && \ spack cd -b nalu-wind && \ spack build-env nalu-wind ctest -j $(nproc) -L unit --output-on-failure \ @@ -55,7 +58,7 @@ jobs: container: image: ecpe4s/exawind-snapshot env: - SPACK_MANAGER: /spack-manager + EXAWIND_MANAGER: /exawind-manager E4S_MACHINE: true steps: - name: Cancel previous runs @@ -69,13 +72,16 @@ jobs: - name: Tests run: | /bin/bash -c " \ - source ${SPACK_MANAGER}/start.sh && \ - mkdir -p ${SPACK_MANAGER}/environments/exawind && \ - cd ${SPACK_MANAGER}/environments/exawind && \ + source ${EXAWIND_MANAGER}/start.sh && \ + mkdir -p ${EXAWIND_MANAGER}/environments/exawind && \ + cd ${EXAWIND_MANAGER}/environments/exawind && \ ln -s ${GITHUB_WORKSPACE} nalu-wind && \ - source ${SPACK_MANAGER}/start.sh && \ + spack-start && \ + spack -e e4s-build config add view:true && \ + spack -e e4s-build add cmake && \ + spack -e e4s-build install && \ quick-create-dev -s nalu-wind@master+tioga+hypre~trilinos-solvers && \ - spack manager external --latest --blacklist nalu-wind gmake && \ + spack manager external ${EXAWIND_MANAGER}/environments/e4s-build --exclude nalu-wind gmake && \ spack install && \ spack cd -b nalu-wind && \ spack build-env nalu-wind ctest -j $(nproc) -L unit --output-on-failure \ diff --git a/CMakeLists.txt b/CMakeLists.txt index cfa1c6f12..d0afa62d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,10 +56,6 @@ endif() add_library(nalu "") -########################## MPI #################################### -find_package(MPI REQUIRED) -target_link_libraries(nalu PUBLIC $<$:MPI::MPI_CXX>) - if(ENABLE_CUDA) enable_language(CUDA) find_package(CUDAToolkit REQUIRED) @@ -185,6 +181,7 @@ if(ENABLE_OPENFAST_FSI) endif() if(ENABLE_OPENFAST) set(CMAKE_PREFIX_PATH ${OpenFAST_DIR} ${CMAKE_PREFIX_PATH}) + enable_language(Fortran) find_package(OpenFAST QUIET REQUIRED) message(STATUS "Found OpenFAST = ${OpenFAST_LIBRARY_DIRS}") target_link_libraries(nalu PUBLIC ${OpenFAST_LIBRARIES} ${OpenFAST_CPP_LIBRARIES}) @@ -205,6 +202,10 @@ if(ENABLE_TIOGA) endif() endif() +########################## MPI #################################### +find_package(MPI REQUIRED) +target_link_libraries(nalu PUBLIC $<$:MPI::MPI_CXX>) +target_link_libraries(nalu PUBLIC $<$:MPI::MPI_Fortran>) ############################ MATRIXREE ##################################### if(ENABLE_MATRIXFREE) diff --git a/docs/source/theory/codeAbstractions.rst b/docs/source/theory/codeAbstractions.rst index 3c75e8a9b..aa69da022 100644 --- a/docs/source/theory/codeAbstractions.rst +++ b/docs/source/theory/codeAbstractions.rst @@ -259,12 +259,11 @@ elemental, nodal, face and edge of desired size. const int numStates = realm_.number_of_states(); // declare it - density_ - = &(metaData_.declare_field(stk::topology::NODE_RANK, - "density", numStates)); + density_ = &(metaData_.declare_field(stk::topology::NODE_RANK, + "density", numStates)); // put it on this part - stk::mesh::put_field(*density_, *part); + stk::mesh::put_field_on_mesh(*density_, *part, nullptr); } :math:`\bullet` edge field registration: @@ -277,9 +276,11 @@ elemental, nodal, face and edge of desired size. { const int nDim = metaData_.spatial_dimension(); edgeAreaVec_ - = &(metaData_.declare_field(stk::topology::EDGE_RANK, - "edge_area_vector")); - stk::mesh::put_field(*edgeAreaVec_, *part, nDim); + = &(metaData_.declare_field(stk::topology::EDGE_RANK, + "edge_area_vector")); + stk::mesh::put_field_on_mesh(*edgeAreaVec_, *part, nDim, nullptr); + stk::io::set_field_output_type(*edgeAreaVec_, + stk::io::FieldOutputType::VECTOR_3D); } :math:`\bullet` side/face field registration: @@ -297,9 +298,10 @@ elemental, nodal, face and edge of desired size. stk::topology::rank_t sideRank = static_cast(metaData_.side_rank()); GenericFieldType *wallFrictionVelocityBip - = &(metaData_.declare_field + = &(metaData_.declare_field (sideRank, "wall_friction_velocity_bip")); - stk::mesh::put_field(*wallFrictionVelocityBip, *part, numIp); + stk::mesh::put_field_on_mesh(*wallFrictionVelocityBip, *part, numIp, + nullptr); } } @@ -317,23 +319,21 @@ addition to the field template type, .. code-block:: c++ VectorFieldType *velocityRTM - = metaData_.get_field(stk::topology::NODE_RANK, - "velocity"); + = metaData_.get_field(stk::topology::NODE_RANK, "velocity"); ScalarFieldType *density - = metaData_.get_field(stk::topology::NODE_RANK, - "density");} + = metaData_.get_field(stk::topology::NODE_RANK, "density");} VectorFieldType *edgeAreaVec - = metaData_.get_field(stk::topology::EDGE_RANK, - "edge_area_vector"); + = metaData_.get_field(stk::topology::EDGE_RANK, + "edge_area_vector"); - GenericFieldType *massFlowRate - = metaData_.get_field(stk::topology::ELEMENT_RANK, - "mass_flow_rate_scs"); + GenericFieldType *massFlowRate + = metaData_.get_field(stk::topology::ELEMENT_RANK, + "mass_flow_rate_scs"); GenericFieldType *wallFrictionVelocityBip_ - = metaData_.get_field(metaData_.side_rank(), - "wall_friction_velocity_bip"); + = metaData_.get_field(metaData_.side_rank(), + "wall_friction_velocity_bip"); State ~~~~~ @@ -346,8 +346,7 @@ extracted, .. code-block:: c++ ScalarFieldType *density - = metaData_.get_field(stk::topology::NODE_RANK, - "density"); + = metaData_.get_field(stk::topology::NODE_RANK, "density"); densityNm1_ = &(density->field_of_state(stk::mesh::StateNM1)); densityN_ = &(density->field_of_state(stk::mesh::StateN)); densityNp1_ = &(density->field_of_state(stk::mesh::StateNP1)); diff --git a/include/Algorithm.h b/include/Algorithm.h index 4b19861ca..eb76e2153 100644 --- a/include/Algorithm.h +++ b/include/Algorithm.h @@ -25,6 +25,7 @@ class Realm; class MasterElement; class SupplementalAlgorithm; class Kernel; +class FieldManager; class Algorithm { @@ -43,6 +44,7 @@ class Algorithm Realm& realm_; stk::mesh::PartVector partVec_; + const FieldManager& fieldManager_; std::vector supplementalAlg_; std::vector activeKernels_; diff --git a/include/AssembleElemSolverAlgorithm.h b/include/AssembleElemSolverAlgorithm.h index 3cf9ee589..c4ba55daa 100644 --- a/include/AssembleElemSolverAlgorithm.h +++ b/include/AssembleElemSolverAlgorithm.h @@ -87,7 +87,7 @@ class AssembleElemSolverAlgorithm : public SolverAlgorithm auto& b = ngpMesh.get_bucket(entityRank, bktId); #if !defined(KOKKOS_ENABLE_GPU) - ThrowAssertMsg( + STK_ThrowAssertMsg( b.topology().num_nodes() == (unsigned)nodesPerEntity_, "AssembleElemSolverAlgorithm expected nodesPerEntity_ = " << nodesPerEntity_ diff --git a/include/AssembleFaceElemSolverAlgorithm.h b/include/AssembleFaceElemSolverAlgorithm.h index fbd9715db..2340e26ea 100644 --- a/include/AssembleFaceElemSolverAlgorithm.h +++ b/include/AssembleFaceElemSolverAlgorithm.h @@ -83,7 +83,7 @@ class AssembleFaceElemSolverAlgorithm : public SolverAlgorithm auto& b = ngpMesh.get_bucket(sideRank, bktId); #if !defined(KOKKOS_ENABLE_GPU) - ThrowAssertMsg( + STK_ThrowAssertMsg( b.topology().num_nodes() == (unsigned)nodesPerFace_, "AssembleFaceElemSolverAlgorithm expected nodesPerEntity_ = " << nodesPerFace_ @@ -111,7 +111,7 @@ class AssembleFaceElemSolverAlgorithm : public SolverAlgorithm stk::mesh::Entity face = b[bktIndex * simdLen + numFacesProcessed + simdFaceIndex]; const auto ngpFaceIndex = ngpMesh.fast_mesh_index(face); - // ThrowAssertMsg( + // STK_ThrowAssertMsg( // bulk.num_elements(face) == 1, // "Expecting just 1 element attached to face!"); int thisElemFaceOrdinal = diff --git a/include/CopyAndInterleave.h b/include/CopyAndInterleave.h index db656eefb..5905d937f 100644 --- a/include/CopyAndInterleave.h +++ b/include/CopyAndInterleave.h @@ -59,11 +59,11 @@ copy_and_interleave( for (unsigned viewIndex = 0; viewIndex < numViews; ++viewIndex) { for (int simdIndex = 0; simdIndex < simdElems; ++simdIndex) { src[simdIndex] = data[simdIndex]->get_1D_view_by_index(viewIndex).data(); - NGP_ThrowAssert( + STK_NGP_ThrowAssert( data[simdIndex]->get_1D_view_by_index(viewIndex).size() == simdData.get_1D_view_by_index(viewIndex).size()); - NGP_ThrowAssert(src[simdIndex] != nullptr); - NGP_ThrowAssert( + STK_NGP_ThrowAssert(src[simdIndex] != nullptr); + STK_NGP_ThrowAssert( src[simdIndex][0] == data[simdIndex]->get_1D_view_by_index(viewIndex).data()[0]); } @@ -74,11 +74,11 @@ copy_and_interleave( for (unsigned viewIndex = 0; viewIndex < numViews; ++viewIndex) { for (int simdIndex = 0; simdIndex < simdElems; ++simdIndex) { src[simdIndex] = data[simdIndex]->get_2D_view_by_index(viewIndex).data(); - NGP_ThrowAssert( + STK_NGP_ThrowAssert( data[simdIndex]->get_2D_view_by_index(viewIndex).size() == simdData.get_2D_view_by_index(viewIndex).size()); - NGP_ThrowAssert(src[simdIndex] != nullptr); - NGP_ThrowAssert( + STK_NGP_ThrowAssert(src[simdIndex] != nullptr); + STK_NGP_ThrowAssert( src[simdIndex][0] == data[simdIndex]->get_2D_view_by_index(viewIndex).data()[0]); } @@ -89,11 +89,11 @@ copy_and_interleave( for (unsigned viewIndex = 0; viewIndex < numViews; ++viewIndex) { for (int simdIndex = 0; simdIndex < simdElems; ++simdIndex) { src[simdIndex] = data[simdIndex]->get_3D_view_by_index(viewIndex).data(); - NGP_ThrowAssert( + STK_NGP_ThrowAssert( data[simdIndex]->get_3D_view_by_index(viewIndex).size() == simdData.get_3D_view_by_index(viewIndex).size()); - NGP_ThrowAssert(src[simdIndex] != nullptr); - NGP_ThrowAssert( + STK_NGP_ThrowAssert(src[simdIndex] != nullptr); + STK_NGP_ThrowAssert( src[simdIndex][0] == data[simdIndex]->get_3D_view_by_index(viewIndex).data()[0]); } diff --git a/include/ElemDataRequests.h b/include/ElemDataRequests.h index 89de49ee7..6e2cbed12 100644 --- a/include/ElemDataRequests.h +++ b/include/ElemDataRequests.h @@ -217,7 +217,7 @@ class ElemDataRequests get_coordinates_field(const COORDS_TYPES cType) const { auto it = coordsFields_.find(cType); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( it != coordsFields_.end(), "ElemDataRequests:get_coordinates_field: Coordinates field " "must be registered to ElemDataRequests before access"); diff --git a/include/Enums.h b/include/Enums.h index 08c3f5941..4013b43fc 100644 --- a/include/Enums.h +++ b/include/Enums.h @@ -105,6 +105,7 @@ static const std::string EquationTypeMap[] = { "PNG_U", "PNG_TKE", "Wall_Distance", + "Gamma_Transition", "Volume_of_Fluid"}; enum UserDataType { diff --git a/include/FieldDefinitions.h b/include/FieldDefinitions.h index 45f2e1f1e..aba827f36 100644 --- a/include/FieldDefinitions.h +++ b/include/FieldDefinitions.h @@ -15,30 +15,33 @@ namespace sierra { namespace nalu { -template +enum class FieldLayout { SCALAR, VECTOR, TENSOR, ARRAY }; + +template struct FieldDefinition { - using FieldType = T; + using DataType = T; const stk::topology::rank_t rank; const int num_states{1}; const int num_components{1}; + const FieldLayout layout{Layout}; }; -using FieldDefScalar = FieldDefinition; -using FieldDefVector = FieldDefinition; -using FieldDefTensor = FieldDefinition; -using FieldDefGeneric = FieldDefinition; -using FieldDefGenericInt = FieldDefinition; -using FieldDefTpetraId = FieldDefinition; -using FieldDefLocalId = FieldDefinition; -using FieldDefGlobalId = FieldDefinition; -using FieldDefHypreId = FieldDefinition; -using FieldDefScalarInt = FieldDefinition; +using FieldDefScalar = FieldDefinition; +using FieldDefVector = FieldDefinition; +using FieldDefTensor = FieldDefinition; +using FieldDefGeneric = FieldDefinition; +using FieldDefGenericInt = FieldDefinition; +using FieldDefTpetraId = FieldDefinition; +using FieldDefLocalId = FieldDefinition; +using FieldDefGlobalId = FieldDefinition; +using FieldDefHypreId = FieldDefinition; +using FieldDefScalarInt = FieldDefinition; // Type redundancy can occur between HypreId and ScalarInt // which will break std::variant using FieldDefTypes = std::conditional< - std::is_same_v, + std::is_same_v, std::variant< FieldDefScalar, FieldDefVector, @@ -61,29 +64,22 @@ using FieldDefTypes = std::conditional< FieldDefScalarInt, FieldDefHypreId>>::type; +// Trouble! using FieldPointerTypes = std::conditional< - std::is_same_v, + std::is_same_v, std::variant< - ScalarFieldType*, - VectorFieldType*, - TensorFieldType*, - GenericFieldType*, - GenericIntFieldType*, - TpetIDFieldType*, - LocalIdFieldType*, - GlobalIdFieldType*, - ScalarIntFieldType*>, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*>, std::variant< - ScalarFieldType*, - VectorFieldType*, - TensorFieldType*, - GenericFieldType*, - GenericIntFieldType*, - TpetIDFieldType*, - LocalIdFieldType*, - GlobalIdFieldType*, - ScalarIntFieldType*, - HypreIDFieldType*>>::type; + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*, + stk::mesh::Field*>>::type; } // namespace nalu } // namespace sierra diff --git a/include/FieldManager.h b/include/FieldManager.h index d8727524e..837dcb6b3 100644 --- a/include/FieldManager.h +++ b/include/FieldManager.h @@ -57,11 +57,11 @@ class FieldManager /// ScalarFieldType* and so on. /// template - T* register_field( + stk::mesh::Field* register_field( const std::string& name, const stk::mesh::PartVector& parts, const void* init_val = nullptr, - stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) + stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { const int numStates = 0; const int numComponents = 0; @@ -70,7 +70,7 @@ class FieldManager } /// Check to see if the field has been registered. - bool field_exists(const std::string& name); + bool field_exists(const std::string& name) const; unsigned size() const { return meta_.get_fields().size(); } /// Register a Generic field. @@ -83,10 +83,10 @@ class FieldManager const int numStates, const int numComponents, const void* init_val = nullptr, - stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) + stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { register_field(name, parts, numStates, numComponents, init_val); - return get_field_ptr(name, state); + return get_field_ptr(name, state); } // Return a field by the given name and of type T, the template parameter. @@ -94,7 +94,7 @@ class FieldManager // specified by the template parameter: ScalarFieldType, VectorFieldType, // ScalarIntFieldType, GlobalIdFieldType,.... template - T* get_field_ptr( + stk::mesh::Field* get_field_ptr( const std::string& name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { @@ -102,12 +102,10 @@ class FieldManager FieldRegistry::query(numDimensions_, numStates_, name); FieldPointerTypes pointerSet = std::visit( [&](auto def) -> FieldPointerTypes { - return &meta_ - .get_field(def.rank, name) - ->field_of_state(state); + return &meta_.get_field(def.rank, name)->field_of_state(state); }, fieldDef); - return std::get(pointerSet); + return std::get*>(pointerSet); } /// Register a field with the option to override default parameters that @@ -126,7 +124,7 @@ class FieldManager const stk::mesh::PartVector& parts, const int numStates = 0, const int numComponents = 0, - const void* init_val = nullptr); + const void* init_val = nullptr) const; /// Given the named field that has already been registered on the CPU /// return the GPU version of the same field. @@ -139,9 +137,7 @@ class FieldManager FieldRegistry::query(numDimensions_, numStates_, name); const stk::mesh::FieldBase& stkField = std::visit( [&](auto def) -> stk::mesh::FieldBase& { - return meta_ - .get_field(def.rank, name) - ->field_of_state(state); + return meta_.get_field(def.rank, name)->field_of_state(state); }, fieldDef); stk::mesh::NgpField& tmp = stk::mesh::get_updated_ngp_field(stkField); @@ -154,16 +150,16 @@ class FieldManager std::string name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { - return MakeSmartField().template operator()( + return MakeSmartField().template operator()( get_ngp_field_ptr(name, state)); } template - SmartField get_legacy_smart_field( + SmartField, tags::LEGACY, ACCESS> get_legacy_smart_field( std::string name, stk::mesh::FieldState state = stk::mesh::FieldState::StateNone) const { - return MakeSmartField().template operator()( + return MakeSmartField().template operator()( get_field_ptr(name, state)); } }; diff --git a/include/FieldTypeDef.h b/include/FieldTypeDef.h index 9b436ae11..f13818fb1 100644 --- a/include/FieldTypeDef.h +++ b/include/FieldTypeDef.h @@ -11,7 +11,6 @@ #define FieldTypeDef_h #include -#include #include #include @@ -27,43 +26,38 @@ namespace sierra { namespace nalu { -// define scalar field typedef -typedef stk::mesh::Field ScalarFieldType; -typedef stk::mesh::Field GlobalIdFieldType; -typedef stk::mesh::Field ScalarIntFieldType; -typedef stk::mesh::NgpField NGPDoubleFieldType; -typedef stk::mesh::NgpField NGPGlobalIdFieldType; -typedef stk::mesh::NgpField NGPScalarIntFieldType; +using ScalarFieldType = stk::mesh::Field; +using GlobalIdFieldType = stk::mesh::Field; +using ScalarIntFieldType = stk::mesh::Field; +using NGPDoubleFieldType = stk::mesh::NgpField; +using NGPGlobalIdFieldType = stk::mesh::NgpField; +using NGPScalarIntFieldType = stk::mesh::NgpField; -// define vector field typedef; however, what is the value of Cartesian? -typedef stk::mesh::Field VectorFieldType; -typedef stk::mesh::Field TensorFieldType; +using VectorFieldType = stk::mesh::Field; +using TensorFieldType = stk::mesh::Field; -// define generic -typedef stk::mesh::Field GenericFieldType; +using GenericFieldType = stk::mesh::Field; -typedef stk::mesh::Field GenericIntFieldType; +using GenericIntFieldType = stk::mesh::Field; -// field type for local ids -typedef unsigned LocalId; -typedef stk::mesh::Field LocalIdFieldType; +using LocalId = unsigned; +using LocalIdFieldType = stk::mesh::Field; -// Hypre Integer types #ifdef NALU_USES_HYPRE -typedef HYPRE_Int HypreIntType; +using HypreIntType = HYPRE_Int; #else -typedef int HypreIntType; +using HypreIntType = int; #endif #ifdef NALU_USES_TRILINOS_SOLVERS -typedef stk::mesh::Field - TpetIDFieldType; +using TpetIdType = Tpetra::Details::DefaultTypes::global_ordinal_type; #else -typedef stk::mesh::Field TpetIDFieldType; +using TpetIdType = int64_t; #endif -typedef stk::mesh::Field HypreIDFieldType; -typedef stk::mesh::NgpField NGPHypreIDFieldType; +using TpetIDFieldType = stk::mesh::Field; +using HypreIDFieldType = stk::mesh::Field; +using NGPHypreIDFieldType = stk::mesh::NgpField; } // namespace nalu } // namespace sierra diff --git a/include/MatrixFreeHeatCondEquationSystem.h b/include/MatrixFreeHeatCondEquationSystem.h index d92fdcd21..1df84b120 100644 --- a/include/MatrixFreeHeatCondEquationSystem.h +++ b/include/MatrixFreeHeatCondEquationSystem.h @@ -16,7 +16,6 @@ #include "Kokkos_Array.hpp" #include "stk_mesh/base/Ngp.hpp" -#include "stk_mesh/base/CoordinateSystems.hpp" #include "Realm.h" diff --git a/include/MultiDimViews.h b/include/MultiDimViews.h index f5353aaa1..c523907f6 100644 --- a/include/MultiDimViews.h +++ b/include/MultiDimViews.h @@ -63,7 +63,7 @@ class MultiDimViews views_3D_size(0), views_4D_size(0) { - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( (numNeededViews.num1DViews <= maxViewsPerDim || numNeededViews.num2DViews <= maxViewsPerDim || numNeededViews.num3DViews <= maxViewsPerDim || @@ -176,7 +176,7 @@ class MultiDimViews KOKKOS_FUNCTION void add_1D_view(unsigned ordinal, const SharedMemView1D& view) { - NGP_ThrowRequire(ordinal < maxFieldOrdinals); + STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals); #if !defined(KOKKOS_ENABLE_GPU) views_1D[views_1D_size] = new SharedMemView1D; *views_1D[views_1D_size] = view; @@ -190,7 +190,7 @@ class MultiDimViews KOKKOS_FUNCTION void add_2D_view(unsigned ordinal, const SharedMemView2D& view) { - NGP_ThrowRequire(ordinal < maxFieldOrdinals); + STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals); #if !defined(KOKKOS_ENABLE_GPU) views_2D[views_2D_size] = new SharedMemView2D; *views_2D[views_2D_size] = view; @@ -204,7 +204,7 @@ class MultiDimViews KOKKOS_FUNCTION void add_3D_view(unsigned ordinal, const SharedMemView3D& view) { - NGP_ThrowRequire(ordinal < maxFieldOrdinals); + STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals); #if !defined(KOKKOS_ENABLE_GPU) views_3D[views_3D_size] = new SharedMemView3D; *views_3D[views_3D_size] = view; @@ -218,7 +218,7 @@ class MultiDimViews KOKKOS_FUNCTION void add_4D_view(unsigned ordinal, const SharedMemView4D& view) { - NGP_ThrowRequire(ordinal < maxFieldOrdinals); + STK_NGP_ThrowRequire(ordinal < maxFieldOrdinals); #if !defined(KOKKOS_ENABLE_GPU) views_4D[views_4D_size] = new SharedMemView4D; *views_4D[views_4D_size] = view; diff --git a/include/ProjectedNodalGradientEquationSystem.h b/include/ProjectedNodalGradientEquationSystem.h index e728b7001..1748c6729 100644 --- a/include/ProjectedNodalGradientEquationSystem.h +++ b/include/ProjectedNodalGradientEquationSystem.h @@ -16,7 +16,6 @@ #include #include -#include namespace stk { struct topology; diff --git a/include/ScratchViews.h b/include/ScratchViews.h index 8e863c900..3386303ad 100644 --- a/include/ScratchViews.h +++ b/include/ScratchViews.h @@ -61,7 +61,7 @@ count_needed_field_views(const FieldInfoViewType& neededFields) numNeededViews.num3DViews++; } } else { - NGP_ThrowRequireMsg(false, "Unknown stk-rank"); + STK_NGP_ThrowRequireMsg(false, "Unknown stk-rank"); } } @@ -203,7 +203,7 @@ create_needed_field_views( numScalars += nodesPerEntity * scalarsDim1 * scalarsDim2; } } else { - NGP_ThrowRequireMsg(false, "Unknown stk-rank"); + STK_NGP_ThrowRequireMsg(false, "Unknown stk-rank"); } } @@ -257,7 +257,7 @@ class ScratchViews MasterElementViews& get_me_views(const COORDS_TYPES cType) { - NGP_ThrowRequire(hasCoordField[cType] == true); + STK_NGP_ThrowRequire(hasCoordField[cType] == true); return meViews[cType]; } @@ -310,7 +310,7 @@ SharedMemView& ScratchViews::get_scratch_view_1D( const stk::mesh::FieldBase& field) { - // ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, + // STK_ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, // "ScratchViews ERROR, trying to get 1D scratch-view for field // "<>* vt = @@ -323,7 +323,7 @@ SharedMemView& ScratchViews::get_scratch_view_2D( const stk::mesh::FieldBase& field) { - // ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, + // STK_ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, // "ScratchViews ERROR, trying to get 2D scratch-view for field // "<>* vt = @@ -336,7 +336,7 @@ SharedMemView& ScratchViews::get_scratch_view_3D( const stk::mesh::FieldBase& field) { - // ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, + // STK_ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, // "ScratchViews ERROR, trying to get 3D scratch-view for field // "<>* vt = @@ -349,7 +349,7 @@ SharedMemView& ScratchViews::get_scratch_view_4D( const stk::mesh::FieldBase& field) { - // ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, + // STK_ThrowAssertMsg(fieldViews[field.mesh_meta_data_ordinal()] != nullptr, // "ScratchViews ERROR, trying to get 4D scratch-view for field // "<>* vt = @@ -416,7 +416,7 @@ MasterElementViews::create_master_element_views( for (unsigned i = 0; i < dataEnums.size(); ++i) { switch (dataEnums(i)) { case FC_AREAV: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFaceIp > 0, "ERROR, meFC must be non-null if FC_AREAV is requested."); fc_areav = @@ -424,7 +424,7 @@ MasterElementViews::create_master_element_views( numScalars += numFaceIp * nDim; break; case FC_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFaceIp > 0, "ERROR, meFC must be non-null if FC_SHAPE_FCN is requested"); fc_shape_fcn = get_shmem_view_2D( @@ -432,7 +432,7 @@ MasterElementViews::create_master_element_views( numScalars += numFaceIp * nodesPerFace; break; case FC_SHIFTED_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFaceIp > 0, "ERROR, meFC must be non-null if FC_SHIFTED_SHAPE_FCN is requested"); fc_shifted_shape_fcn = get_shmem_view_2D( @@ -440,7 +440,7 @@ MasterElementViews::create_master_element_views( numScalars += numFaceIp * nodesPerFace; break; case SCS_FACE_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFaceIp > 0, "ERROR, meSCS must be non-null if SCS_FACE_GRAD_OP is requested."); dndx_fc_scs = get_shmem_view_3D( @@ -450,7 +450,7 @@ MasterElementViews::create_master_element_views( needDetjFC = true; break; case SCS_SHIFTED_FACE_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFaceIp > 0, "ERROR, meSCS must be non-null if " "SCS_SHIFTED_FACE_GRAD_OP is requested."); dndx_shifted_fc_scs = get_shmem_view_3D( @@ -460,7 +460,7 @@ MasterElementViews::create_master_element_views( needDetjFC = true; break; case SCS_AREAV: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScsIp > 0, "ERROR, meSCS must be non-null if SCS_AREAV is requested."); scs_areav = @@ -469,7 +469,7 @@ MasterElementViews::create_master_element_views( break; case SCS_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScsIp > 0, "ERROR, meSCS must be non-null if SCS_GRAD_OP is requested."); dndx = get_shmem_view_3D( @@ -480,7 +480,7 @@ MasterElementViews::create_master_element_views( break; case SCS_SHIFTED_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScsIp > 0, "ERROR, meSCS must be non-null if SCS_SHIFTED_GRAD_OP is requested."); dndx_shifted = get_shmem_view_3D( @@ -491,7 +491,7 @@ MasterElementViews::create_master_element_views( break; case SCS_GIJ: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScsIp > 0, "ERROR, meSCS must be non-null if SCS_GIJ is requested."); gijUpper = get_shmem_view_3D(team, numScsIp, nDim, nDim); @@ -502,7 +502,7 @@ MasterElementViews::create_master_element_views( break; case SCV_MIJ: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScvIp > 0, "ERROR, meSCV must be non-null if SCV_MIJ is requested."); metric = get_shmem_view_3D(team, numScvIp, nDim, nDim); @@ -511,7 +511,7 @@ MasterElementViews::create_master_element_views( break; case SCS_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScsIp > 0, "ERROR, meSCS must be non-null if SCS_SHAPE_FCN is requested"); scs_shape_fcn = get_shmem_view_2D( @@ -520,7 +520,7 @@ MasterElementViews::create_master_element_views( break; case SCS_SHIFTED_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScsIp > 0, "ERROR, meSCS must be non-null if SCS_SHIFTED_SHAPE_FCN is requested"); scs_shifted_shape_fcn = get_shmem_view_2D( @@ -529,7 +529,7 @@ MasterElementViews::create_master_element_views( break; case SCV_VOLUME: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScvIp > 0, "ERROR, meSCV must be non-null if SCV_VOLUME is requested."); scv_volume = get_shmem_view_1D(team, numScvIp); @@ -537,7 +537,7 @@ MasterElementViews::create_master_element_views( break; case SCV_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScvIp > 0, "ERROR, meSCV must be non-null if SCV_GRAD_OP is requested."); dndx_scv = get_shmem_view_3D( @@ -548,7 +548,7 @@ MasterElementViews::create_master_element_views( break; case SCV_SHIFTED_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScvIp > 0, "ERROR, meSCV must be non-null if SCV_SHIFTED_GRAD_OP is requested."); dndx_scv_shifted = get_shmem_view_3D( @@ -559,7 +559,7 @@ MasterElementViews::create_master_element_views( break; case SCV_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScvIp > 0, "ERROR, meSCV must be non-null if SCV_SHAPE_FCN is requested"); scv_shape_fcn = get_shmem_view_2D( @@ -568,7 +568,7 @@ MasterElementViews::create_master_element_views( break; case SCV_SHIFTED_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numScvIp > 0, "ERROR, meSCV must be non-null if SCV_SHIFTED_SHAPE_FCN is requested"); scv_shifted_shape_fcn = get_shmem_view_2D( @@ -577,7 +577,7 @@ MasterElementViews::create_master_element_views( break; case FEM_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFemIp > 0, "ERROR, meFEM must be non-null if FEM_GRAD_OP is requested."); dndx_fem = get_shmem_view_3D( @@ -589,7 +589,7 @@ MasterElementViews::create_master_element_views( break; case FEM_SHIFTED_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFemIp > 0, "ERROR, meFEM must be non-null if FEM_SHIFTED_GRAD_OP is requested."); dndx_fem = get_shmem_view_3D( @@ -601,7 +601,7 @@ MasterElementViews::create_master_element_views( break; case FEM_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFemIp > 0, "ERROR, meFEM must be non-null if FEM_SHAPE_FCN is requested"); fem_shape_fcn = get_shmem_view_2D( @@ -610,7 +610,7 @@ MasterElementViews::create_master_element_views( break; case FEM_SHIFTED_SHAPE_FCN: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFemIp > 0, "ERROR, meFEM must be non-null if FEM_SHIFTED_SHAPE_FCN is requested"); fem_shifted_shape_fcn = get_shmem_view_2D( @@ -669,7 +669,7 @@ MasterElementViews::create_master_element_views( // error check if (femGradOp && femShiftedGradOp) - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( numFemIp > 0, "ERROR, femGradOp and femShiftedGradOp both requested."); return numScalars; @@ -737,113 +737,113 @@ MasterElementViews::fill_master_element_views_new_me( for (unsigned i = 0; i < dataEnums.size(); ++i) { switch (dataEnums(i)) { case FC_AREAV: - NGP_ThrowRequireMsg(false, "FC_AREAV not implemented yet."); + STK_NGP_ThrowRequireMsg(false, "FC_AREAV not implemented yet."); break; case SCS_AREAV: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCS needs to be non-null if SCS_AREAV is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_AREAV requested."); meSCS->determinant(*coordsView, scs_areav); break; case SCS_FACE_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCS needs to be non-null if SCS_FACE_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_FACE_GRAD_OP requested."); meSCS->face_grad_op(faceOrdinal, *coordsView, dndx_fc_scs, deriv_fc_scs); break; case SCS_SHIFTED_FACE_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCS needs to be non-null if " "SCS_SHIFTED_FACE_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_SHIFTED_FACE_GRAD_OP requested."); meSCS->shifted_face_grad_op( faceOrdinal, *coordsView, dndx_shifted_fc_scs, deriv_fc_scs); break; case SCS_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCS needs to be non-null if SCS_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_GRAD_OP requested."); meSCS->grad_op(*coordsView, dndx, deriv); break; case SCS_SHIFTED_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCS needs to be non-null if SCS_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_GRAD_OP requested."); meSCS->shifted_grad_op(*coordsView, dndx_shifted, deriv); break; case SCS_GIJ: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCS needs to be non-null if SCS_GIJ is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_GIJ requested."); meSCS->gij(*coordsView, gijUpper, gijLower, deriv); break; case SCS_MIJ: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCS != nullptr, "ERROR, meSCV needs to be non-null if SCS_MIJ is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCS_MIJ requested."); meSCS->Mij(*coordsView, metric, deriv); break; case SCV_MIJ: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCV != nullptr, "ERROR, meSCV needs to be non-null if SCV_MIJ is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCV_MIJ requested."); meSCV->Mij(*coordsView, metric, deriv_scv); break; case SCV_VOLUME: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCV != nullptr, "ERROR, meSCV needs to be non-null if SCV_VOLUME is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCV_VOLUME requested."); meSCV->determinant(*coordsView, scv_volume); break; case SCV_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCV != nullptr, "ERROR, meSCV needs to be non-null if SCV_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCV_GRAD_OP requested."); meSCV->grad_op(*coordsView, dndx_scv, deriv_scv); break; case SCV_SHIFTED_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meSCV != nullptr, "ERROR, meSCV needs to be non-null if " "SCV_SHIFTED_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but SCV_SHIFTED_GRAD_OP requested."); meSCV->shifted_grad_op(*coordsView, dndx_scv_shifted, deriv_scv); break; case FEM_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meFEM != nullptr, "ERROR, meFEM needs to be non-null if FEM_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but FEM_GRAD_OP requested."); meFEM->grad_op_fem(*coordsView, dndx_fem, deriv_fem, det_j_fem); break; case FEM_SHIFTED_GRAD_OP: - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( meFEM != nullptr, "ERROR, meFEM needs to be non-null if " "FEM_SHIFTED_GRAD_OP is requested."); - NGP_ThrowRequireMsg( + STK_NGP_ThrowRequireMsg( coordsView != nullptr, "ERROR, coords null but FEM_GRAD_OP requested."); meFEM->shifted_grad_op_fem(*coordsView, dndx_fem, deriv_fem, det_j_fem); break; diff --git a/include/SmartField.h b/include/SmartField.h index a21252c37..af4f58005 100644 --- a/include/SmartField.h +++ b/include/SmartField.h @@ -110,6 +110,13 @@ class SmartField return stk::mesh::field_data(stkField_, entity); } + template + inline typename std::enable_if_t, T>* + operator()(const stk::mesh::Bucket& bucket) const + { + return stk::mesh::field_data(stkField_, bucket); + } + // --- Const Accessors template inline const typename std::enable_if_t, T>* @@ -125,6 +132,13 @@ class SmartField return stk::mesh::field_data(stkField_, entity); } + template + inline const typename std::enable_if_t, T>* + operator()(const stk::mesh::Bucket& bucket) const + { + return stk::mesh::field_data(stkField_, bucket); + } + ~SmartField() { if (is_write_) { @@ -401,9 +415,10 @@ struct MakeSmartField { // use pointer since that is the common access type for stk::mesh::Field template - SmartField operator()(T* field) + SmartField, LEGACY, ACCESS> + operator()(stk::mesh::Field* field) { - return SmartField(*field); + return SmartField, LEGACY, ACCESS>(*field); } }; diff --git a/include/TpetraLinearSystem.h b/include/TpetraLinearSystem.h index b676df031..554013bbc 100644 --- a/include/TpetraLinearSystem.h +++ b/include/TpetraLinearSystem.h @@ -363,7 +363,7 @@ copy_kokkos_unordered_map( fail_count += insert_result.failed() ? 1 : 0; } } - ThrowRequire(fail_count == 0); + STK_ThrowRequire(fail_count == 0); } int getDofStatus_impl(stk::mesh::Entity node, const Realm& realm); diff --git a/include/aero/actuator/ActuatorGenericSearchFunctor.h b/include/aero/actuator/ActuatorGenericSearchFunctor.h index dd68cace8..408a3fa5a 100644 --- a/include/aero/actuator/ActuatorGenericSearchFunctor.h +++ b/include/aero/actuator/ActuatorGenericSearchFunctor.h @@ -35,15 +35,12 @@ struct GenericLoopOverCoarseSearchResults ActuatorBulk& actBulk, stk::mesh::BulkData& stkBulk) : actBulk_(actBulk), stkBulk_(stkBulk), - coordinates_( - stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "coordinates")), - actuatorSource_( - stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "actuator_source")), - dualNodalVolume_( - stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "dual_nodal_volume")), + coordinates_(stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "coordinates")), + actuatorSource_(stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "actuator_source")), + dualNodalVolume_(stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "dual_nodal_volume")), innerLoopFunctor_(actBulk) { actBulk_.coarseSearchElemIds_.sync_host(); @@ -58,15 +55,12 @@ struct GenericLoopOverCoarseSearchResults functor innerLoopFunctor) : actBulk_(actBulk), stkBulk_(stkBulk), - coordinates_( - stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "coordinates")), - actuatorSource_( - stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "actuator_source")), - dualNodalVolume_( - stkBulk_.mesh_meta_data().template get_field( - stk::topology::NODE_RANK, "dual_nodal_volume")), + coordinates_(stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "coordinates")), + actuatorSource_(stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "actuator_source")), + dualNodalVolume_(stkBulk_.mesh_meta_data().template get_field( + stk::topology::NODE_RANK, "dual_nodal_volume")), innerLoopFunctor_(innerLoopFunctor) { actBulk_.coarseSearchElemIds_.sync_host(); @@ -89,8 +83,8 @@ struct GenericLoopOverCoarseSearchResults const int numIp = meSCV->num_integration_points(); // just allocate for largest expected size (hex27) - ThrowAssert(numIp <= 216); - ThrowAssert(numNodes <= 27); + STK_ThrowAssert(numIp <= 216); + STK_ThrowAssert(numNodes <= 27); double scvip[216]; double elemcoords[27 * 3]; @@ -101,7 +95,7 @@ struct GenericLoopOverCoarseSearchResults for (unsigned i = 0; i < numNodes; i++) { const double* coords = - (double*)stk::mesh::field_data(*coordinates_, elem_nod_rels[i]); + stk::mesh::field_data(*coordinates_, elem_nod_rels[i]); for (int j = 0; j < 3; j++) { elemCoords(i, j) = coords[j]; } @@ -114,12 +108,9 @@ struct GenericLoopOverCoarseSearchResults for (int nIp = 0; nIp < numIp; nIp++) { const int nodeIndex = ipNodeMap[nIp]; stk::mesh::Entity node = elem_nod_rels[nodeIndex]; - const double* nodeCoords = - (double*)stk::mesh::field_data(*coordinates_, node); - const double dual_vol = - *(double*)stk::mesh::field_data(*dualNodalVolume_, node); - double* sourceTerm = - (double*)stk::mesh::field_data(*actuatorSource_, node); + const double* nodeCoords = stk::mesh::field_data(*coordinates_, node); + const double dual_vol = *stk::mesh::field_data(*dualNodalVolume_, node); + double* sourceTerm = stk::mesh::field_data(*actuatorSource_, node); // anything else that is required should be stashed on the functor // during functor construction i.e. ActuatorBulk, flags, ActuatorMeta, diff --git a/include/aero/actuator/ActuatorScalingFLLC.h b/include/aero/actuator/ActuatorScalingFLLC.h index ddb80d5ac..62f8e2fc0 100644 --- a/include/aero/actuator/ActuatorScalingFLLC.h +++ b/include/aero/actuator/ActuatorScalingFLLC.h @@ -57,7 +57,7 @@ scale_lift_force( case (ActuatorType::ActLineFASTNGP): case (ActuatorType::ActDiskFASTNGP): { #ifndef NALU_USES_OPENFAST - ThrowErrorMsg("Actuator methods require OpenFAST"); + STK_ThrowErrorMsg("Actuator methods require OpenFAST"); #if !defined(KOKKOS_ENABLE_GPU) break; #endif diff --git a/include/aero/actuator/UtilitiesActuator.h b/include/aero/actuator/UtilitiesActuator.h index 1f9ef605b..58d12598f 100644 --- a/include/aero/actuator/UtilitiesActuator.h +++ b/include/aero/actuator/UtilitiesActuator.h @@ -87,8 +87,8 @@ template inline void reduce_view_on_host(T view) { - ThrowAssert(view.size() > 0); - ThrowAssert(view.data()); + STK_ThrowAssert(view.size() > 0); + STK_ThrowAssert(view.data()); MPI_Datatype mpi_type; if (std::is_same::value) { mpi_type = MPI_DOUBLE; @@ -99,7 +99,7 @@ reduce_view_on_host(T view) } else if (std::is_same::value) { mpi_type = MPI_LONG; } else { - ThrowErrorMsg("unsupported type to reduce view on host"); + STK_ThrowErrorMsg("unsupported type to reduce view on host"); } MPI_Allreduce( diff --git a/include/aero/fsi/FSIturbine.h b/include/aero/fsi/FSIturbine.h index c4b0feaa4..473ace420 100644 --- a/include/aero/fsi/FSIturbine.h +++ b/include/aero/fsi/FSIturbine.h @@ -16,7 +16,6 @@ #include "stk_mesh/base/MetaData.hpp" #include "stk_mesh/base/BulkData.hpp" -#include "stk_mesh/base/CoordinateSystems.hpp" #include "stk_mesh/base/Field.hpp" #include "FieldTypeDef.h" #include @@ -53,10 +52,10 @@ struct DeflectionRampingParams // TODO(psakiev) find a better place for this // ********************************************************************** //! convenience function for generating a vs::Vector from a stk::field -template +template inline vs::VectorT vector_from_field( - const stk::mesh::Field& field, const stk::mesh::Entity& node) + const stk::mesh::Field& field, const stk::mesh::Entity& node) { // debug only check for optimization assert(field.max_size(stk::topology::NODE_RANK) == 3); @@ -67,12 +66,10 @@ vector_from_field( //! convenience function for putting vector computations back onto the //! stk::fields -template +template inline void vector_to_field( - vs::VectorT vec, - stk::mesh::Field& field, - const stk::mesh::Entity& node) + vs::VectorT vec, stk::mesh::Field& field, const stk::mesh::Entity& node) { // debug only check for optimization assert(field.max_size(stk::topology::NODE_RANK) == 3); diff --git a/include/element_promotion/PromoteElement.h b/include/element_promotion/PromoteElement.h index 5a92bd0ce..2f3b8faa1 100644 --- a/include/element_promotion/PromoteElement.h +++ b/include/element_promotion/PromoteElement.h @@ -10,8 +10,8 @@ #define PromoteElement_h #include -#include #include +#include #include @@ -30,7 +30,6 @@ namespace mesh { class BulkData; } } // namespace stk -typedef stk::mesh::Field VectorFieldType; namespace sierra { namespace nalu { diff --git a/include/element_promotion/PromoteElementImpl.h b/include/element_promotion/PromoteElementImpl.h index cb75d55ac..496095ced 100644 --- a/include/element_promotion/PromoteElementImpl.h +++ b/include/element_promotion/PromoteElementImpl.h @@ -12,13 +12,13 @@ #include #include -#include #include #include #include #include +#include namespace stk { namespace mesh { @@ -60,7 +60,6 @@ namespace nalu { struct ElementDescription; } } // namespace sierra -typedef stk::mesh::Field VectorFieldType; namespace sierra { namespace nalu { diff --git a/include/element_promotion/PromotedElementIO.h b/include/element_promotion/PromotedElementIO.h index 3d802ac31..d0aad823c 100644 --- a/include/element_promotion/PromotedElementIO.h +++ b/include/element_promotion/PromotedElementIO.h @@ -10,13 +10,13 @@ #ifndef PromotedElementIO_h #define PromotedElementIO_h -#include #include #include #include #include #include +#include #include #include @@ -39,11 +39,6 @@ struct ElementDescription; } // namespace nalu } // namespace sierra -// field types -typedef stk::mesh::Field ScalarFieldType; -typedef stk::mesh::Field GenericFieldType; -typedef stk::mesh::Field VectorFieldType; - namespace stk { namespace mesh { class BulkData; diff --git a/include/kernel/KernelBuilder.h b/include/kernel/KernelBuilder.h index 100770073..deaa4fda3 100644 --- a/include/kernel/KernelBuilder.h +++ b/include/kernel/KernelBuilder.h @@ -48,7 +48,7 @@ build_or_add_part_to_solver_alg( topo == stk::topology::QUADRILATERAL_4_2D || topo == stk::topology::TRIANGLE_3_2D || topo == stk::topology::WEDGE_6 || topo == stk::topology::TETRAHEDRON_4 || topo == stk::topology::PYRAMID_5); - ThrowRequireMsg( + STK_ThrowRequireMsg( !isNotNGP, "Consolidated algorithm called on non-NGP MasterElement"); auto itc = solverAlgs.find(algName); @@ -57,7 +57,7 @@ build_or_add_part_to_solver_alg( auto* theSolverAlg = new AssembleElemSolverAlgorithm( eqSys.realm_, &part, &eqSys, stk::topology::ELEMENT_RANK, topo.num_nodes()); - ThrowRequire(theSolverAlg != nullptr); + STK_ThrowRequire(theSolverAlg != nullptr); NaluEnv::self().naluOutputP0() << "Created the following interior elem alg: " << algName << std::endl; @@ -71,7 +71,7 @@ build_or_add_part_to_solver_alg( auto* theSolverAlg = dynamic_cast(solverAlgs.at(algName)); - ThrowRequire(theSolverAlg != nullptr); + STK_ThrowRequire(theSolverAlg != nullptr); return {theSolverAlg, createNewAlg}; } @@ -80,7 +80,7 @@ template