diff --git a/scripts/manualdockerimage.bash b/scripts/manualdockerimage.bash new file mode 100644 index 00000000000..59bb87fe2a3 --- /dev/null +++ b/scripts/manualdockerimage.bash @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +set -euo pipefail + +# --------- CONFIG (edit or pass as env vars) ----------------- +: "${APP_IMAGE_REPO:=geosx/geosx_ubuntu22.04-clang15}" # Docker Hub repo to push to +: "${GIT_URL:=git@github.com:GEOS-DEV/GEOS.git}" # SSH repo URL +: "${GIT_REF:=stdMap}" # branch/tag/sha (optional; will try to checkout) +: "${BASE_IMAGE:=geosx/ubuntu22.04-clang15:320-766}" # TPL image to build in +: "${CMAKE_BUILD_TYPE:=Release}" +: "${HOSTCFG:=/spack-generated.cmake}" +: "${ENABLE_HYPRE:=ON}" +: "${ENABLE_TRILINOS:=OFF}" +: "${GEOS_ENABLE_BOUNDS_CHECK:=OFF}" +: "${PLATFORM:=}" # e.g. set to linux/amd64 on Apple Silicon +# ------------------------------------------------------------- + +# sanity: need an ssh-agent socket to forward +if [[ -z "${SSH_AUTH_SOCK:-}" || ! -S "$SSH_AUTH_SOCK" ]]; then + echo "ERROR: SSH_AUTH_SOCK not set or not a socket. Run: eval \"\$(ssh-agent -s)\" && ssh-add ~/.ssh/id_ed25519" >&2 + exit 1 +fi + +NAME="geosx_build_$(date +%s)" + +echo "Base image: ${BASE_IMAGE}" +echo "Repo URL: ${GIT_URL}" +echo "Git ref: ${GIT_REF}" +echo "Output registry: ${APP_IMAGE_REPO}" + +docker rm -f "$NAME" >/dev/null 2>&1 || true +docker run -it ${PLATFORM:+--platform="${PLATFORM}"} --name "$NAME" --cap-add=SYS_PTRACE \ + -v "$SSH_AUTH_SOCK:/ssh-agent" -e SSH_AUTH_SOCK=/ssh-agent \ + -e ENABLE_HYPRE="${ENABLE_HYPRE}" \ + -e ENABLE_TRILINOS="${ENABLE_TRILINOS}" \ + -e GEOS_BUILD_SHARED_LIBS=ON \ + --volume /Users/settgast1/Codes/geos/GEOS_Develop:/src/geosx \ + "$BASE_IMAGE" + + + + # # Build & install using your existing CI script + /src/geosx/scripts/ci_build_and_test_in_container.sh --repository /src/geosx --cmake-build-type Release --host-config /spack-generated.cmake --enable-hypre ON --enable-trilinos OFF --geos-enable-bounds-check OFF --install-dir-basename geosx-install --no-run-unit-tests --nproc 4 --ninja + + # # Hygiene: drop git metadata so creds aren't baked into the committed image + # rm -rf /src/geosx/.git /src/geosx/.gitmodules || true + # " + +# # Grab the short sha that the container wrote +# docker cp "$NAME":/tmp/shortsha ./shortsha || true +# if [ -s ./shortsha ]; then +# SHORT_SHA="$(cat ./shortsha)" +# else +# # Fallback if file missing: use the ref or container ID tail +# SHORT_SHA="${GIT_REF:-$(docker inspect --format='{{.Id}}' "$NAME" | cut -c1-7)}" +# fi +# rm -f ./shortsha + +# TAG="${APP_IMAGE_REPO}:${SHORT_SHA}" + +# echo "Logging into Docker Hub to push ${TAG} ..." +# docker login +# docker commit --change='ENTRYPOINT []' --change='CMD ["/bin/bash"]' "$NAME" "$TAG" +# docker push "$TAG" +# docker rm "$NAME" || true + +# echo "Pushed ${TAG}" diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index 8d72026fcea..f725a44fafd 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -77,7 +77,7 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c { localIndex isFieldNameFound = 0; // map from set name to a flag (1 if targetSet has been created, 0 otherwise) - map< string, localIndex > isTargetSetCreated; + stdMap< string, localIndex > isTargetSetCreated; MeshObjectPath::SetNameToTypesMap setTypesMap; // The fieldSpecification target objectType MeshObjectPath::ObjectTypes const targetElementType = fs.getMeshObjectPaths().getObjectType(); @@ -88,8 +88,8 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c string_array const & setNames = fs.getSetNames(); for( size_t i = 0; i < setNames.size(); ++i ) { - isTargetSetCreated[setNames[i]] = 0; - setTypesMap[setNames[i]][targetElementType] = 1; + isTargetSetCreated.get_inserted( setNames[i] ) = 0; + setTypesMap.get_inserted( setNames[i] ).get_inserted( targetElementType ) = 1; } // We have to make sure that the meshLevel is in the target of the boundary conditions @@ -129,7 +129,10 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c } if( targetSet.size() > 0 ) - setTypesMap[setName][targetElementType] = 0; + { + // Use the single set name provided by the callback (setName), not the outer array (setNames) + setTypesMap.get_inserted( setName ).get_inserted( targetElementType ) = 0; + } } ); // Step 3: MPI synchronization @@ -216,7 +219,7 @@ void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) c NodeManager >( mesh, setName, [&setTypesMap]( MeshObjectPath::ObjectTypes managerType, string const & capturedSetName ){ - setTypesMap[capturedSetName][managerType] = 0; + setTypesMap.get_inserted( capturedSetName ).get_inserted( managerType ) = 0; } ); string_array capturedTypes; for( auto const & [element, isExisting] : elementsType ) diff --git a/src/coreComponents/mesh/MeshObjectPath.hpp b/src/coreComponents/mesh/MeshObjectPath.hpp index 0c8d5f2b5f7..704ce03c41f 100644 --- a/src/coreComponents/mesh/MeshObjectPath.hpp +++ b/src/coreComponents/mesh/MeshObjectPath.hpp @@ -60,7 +60,7 @@ class MeshObjectPath /// @brief alias for the map allowing to know the existance of given element types (node, edge, cell...) /// with localIndex = 0 | 1 ( exist / not existing) - using SetNameToTypesMap = std::map< std::string, std::map< MeshObjectPath::ObjectTypes, localIndex > >; + using SetNameToTypesMap = stdMap< string, stdMap< MeshObjectPath::ObjectTypes, localIndex > >; /** * @brief Construct a new Mesh Object Path object diff --git a/src/coreComponents/schema/schemaUtilities.cpp b/src/coreComponents/schema/schemaUtilities.cpp index d39b1af77f3..9d447842c09 100644 --- a/src/coreComponents/schema/schemaUtilities.cpp +++ b/src/coreComponents/schema/schemaUtilities.cpp @@ -96,35 +96,38 @@ void AppendSimpleType( xmlWrapper::xmlNode & schemaRoot, { string const advanced_match_string = ".*[\\[\\]`$].*|"; + // Create simpleType node xmlWrapper::xmlNode newNode = schemaRoot.append_child( "xsd:simpleType" ); + GEOS_ERROR_IF( ( !newNode ), GEOS_FMT( "Failed to create xsd:simpleType node for {}", name ) ); newNode.append_attribute( "name" ) = name.c_str(); + + // Create restriction node xmlWrapper::xmlNode restrictionNode = newNode.append_child( "xsd:restriction" ); + GEOS_ERROR_IF( ( !restrictionNode ), GEOS_FMT( "Failed to create xsd:restriction node for {}", name ) ); restrictionNode.append_attribute( "base" ) = "xsd:string"; + + // Create pattern node xmlWrapper::xmlNode patternNode = restrictionNode.append_child( "xsd:pattern" ); + GEOS_ERROR_IF( ( !patternNode ), GEOS_FMT( "Failed to create xsd:pattern node for {}", name ) ); - // Handle the default regex - if( regex.empty() ) - { - GEOS_WARNING( "schema regex not defined for " << name ); - patternNode.append_attribute( "value" ) = "(?s).*"; - } - else - { - string const patternString = advanced_match_string + regex; - patternNode.append_attribute( "value" ) = patternString.c_str(); - } + // Determine pattern string + GEOS_WARNING_IF( regex.empty(), GEOS_FMT( "schema regex not defined for {}", name ) ); + string const patternString = regex.empty() ? "(?s).*" : advanced_match_string + regex; + + // Set attribute + patternNode.append_attribute( "value" ) = patternString.c_str(); } void BuildSimpleSchemaTypes( xmlWrapper::xmlNode schemaRoot ) { auto const regexes = rtTypes::createBasicTypesRegexMap(); + for( auto const & [typeName, regex] : regexes ) { AppendSimpleType( schemaRoot, getSchemaTypeName( typeName ), regex.m_regexStr ); } } - void SchemaConstruction( Group & group, xmlWrapper::xmlNode schemaRoot, xmlWrapper::xmlNode schemaParent,