Download data/bin/foamUnMergeCase from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 2.84 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/bin/foamUnMergeCase
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/bin/foamUnMergeCase
-
curl -L -o foamUnMergeCase https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/bin/foamUnMergeCase
2.84 kB
| #------------------------------------------------------------------------------ | |
| # ========= | | |
| # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| # \\ / O peration | Website: https://openfoam.org | |
| # \\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation | |
| # \\/ M anipulation | | |
| #------------------------------------------------------------------------------ | |
| # License | |
| # This file is part of OpenFOAM. | |
| # | |
| # OpenFOAM is free software: you can redistribute it and/or modify it | |
| # under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | |
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| # for more details. | |
| # | |
| # You should have received a copy of the GNU General Public License | |
| # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | |
| # | |
| # Script | |
| # foamUnMergeCase | |
| # | |
| # Description | |
| # Reverse a merge operation performed with foamMergeCase. This should be | |
| # called with exactly the same arguments as foamMergeCase. | |
| # | |
| #------------------------------------------------------------------------------ | |
| usage() { | |
| cat<<USAGE | |
| Usage: ${0##*/} <source case> <variant case 1> ... <variant case N> | |
| Reverse a merge operation performed with foamMergeCase. This should be called | |
| with exactly the same arguments as foamMergeCase. For further information, run: | |
| foamMergeCase -help | |
| USAGE | |
| } | |
| error() { | |
| exec 1>&2 | |
| while [ "$#" -ge 1 ]; do echo; echo "*** Error: $1"; shift; done | |
| usage | |
| exit 1 | |
| } | |
| while [ "$#" -gt 0 ] | |
| do | |
| case "$1" in | |
| -h | -help) | |
| usage && exit 0 | |
| ;; | |
| -*) | |
| error "Unknown option: '$*'" | |
| ;; | |
| *) | |
| break | |
| ;; | |
| esac | |
| done | |
| [ $# -ge 1 ] || error "Incorrect arguments specified" | |
| # Set the source directory | |
| srcDir="$1" | |
| [ -d "$srcDir" ] || error "Directory '$srcDir' not found" | |
| shift | |
| # Set the variant directories | |
| varDirs=() | |
| while [ "$#" -gt 0 ] | |
| do | |
| [ -d "$1" ] || error "'Directory $1' not found" | |
| varDirs+=("$1") | |
| shift | |
| done | |
| # Remove all non-orig files that exist in the source and variant directories | |
| while read -r file | |
| do | |
| for varOrSrcDir in "${varDirs[@]}" "$srcDir" | |
| do | |
| [ -f "$varOrSrcDir/$file" ] || \ | |
| [ -f "$varOrSrcDir/$file.orig" ] && \ | |
| rm -f "$file" | |
| done | |
| done < <(find ./[-0-9]* constant system -type f ! -name "*.orig" 2>/dev/null) | |
| # Remove any empty directories | |
| find . -type d -empty -delete 2>/dev/null | |
| #------------------------------------------------------------------------------ | |