Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap for shp2msh and msh2vtu #66

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
29da0c5
wrap for msh2vtu
tStehling Oct 8, 2024
0fc4cc6
.
tStehling Oct 8, 2024
95dceab
shp2msh wrap
tStehling Oct 11, 2024
76842bb
...
tStehling Oct 23, 2024
005f107
...
tStehling Oct 23, 2024
31e00b8
finalization of shp2msh and msh2vtu wraps
tStehling Oct 30, 2024
ef2d9e4
Delete tools/ogs_tools directory
tStehling Oct 30, 2024
cd1871f
Delete tools/msh2vtu.xml
tStehling Oct 30, 2024
ad88581
Update msh2vtu.xml
tStehling Oct 30, 2024
b5abddd
Update shp2msh.xml
tStehling Oct 30, 2024
e6c40dd
Added macros
tStehling Nov 27, 2024
c881e3d
Wrapped AddLayer tool
tStehling Dec 7, 2024
0d225d8
fixes according to comments
tStehling Dec 9, 2024
9577071
fixes on shed.yml
tStehling Dec 9, 2024
0caf414
. deleted
tStehling Dec 9, 2024
bee79e7
remove work in progress tools
tStehling Dec 11, 2024
0d21443
removed work in progress files
tStehling Dec 11, 2024
ebf243b
wrap for generateStructuredMesh
tStehling Dec 11, 2024
10388a1
cleaned
tStehling Dec 11, 2024
4a6ca30
cleaned
tStehling Dec 11, 2024
c1a151c
changed .shed.yml
tStehling Dec 11, 2024
4124587
Added directory structure
tStehling Dec 11, 2024
0795e6a
directory struct
tStehling Dec 11, 2024
6d18ae3
changed requirements
tStehling Dec 11, 2024
a1e1d82
.
tStehling Dec 11, 2024
dcf8b1d
.
tStehling Dec 11, 2024
5dd6479
Move creator
bernt-matthias Dec 12, 2024
6484643
Simplify requirements
bernt-matthias Dec 12, 2024
140ccdb
updated category to Geo Science
tStehling Jan 6, 2025
e11ff66
Merge branch 'ogsTools' of github.com:tStehling/galaxy-tools into ogs…
tStehling Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tools/ogstools/Converter/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: suite_ogs_tools
owner: ufz
description: A suite of tools for OpenGeoSys (ogs)
long_description: |
A suite of tools for ogs.
categories:
- Ecology
tStehling marked this conversation as resolved.
Show resolved Hide resolved
remote_repository_url: https://gitlab.opengeosys.org/ogs/tools/ogstools
homepage_url: https://www.opengeosys.org/
type: unrestricted
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: A suite of tools for OpenGeoSys (ogs)
suite:
name: suite_ogs_tools
description: A suite of tools for ogs.
long_description: |
A suite of tools for ogs.
24 changes: 24 additions & 0 deletions tools/ogstools/Converter/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<macros>
<token name="@TOOL_VERSION@">0.4.0</token>
<token name="@PROFILE@">23.0</token>
<token name="@VERSION_SUFFIX@">0</token>

<xml name="requirements">
<requirements>
<requirement type="package" version="@TOOL_VERSION@">ogstools</requirement>
<yield/>
</requirements>
</xml>

<xml name="ogs_citation">
<citations>
<citation type="doi">10.5281/zenodo.13685289</citation>
</citations>
</xml>

<xml name="creator">
<creator>
<organization name="Helmholtz Centre for Environmental Research - UFZ" url ="https://www.ufz.de/"/>
</creator>
</xml>
</macros>
97 changes: 97 additions & 0 deletions tools/ogstools/Converter/msh2vtu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

<tool id="msh2vtu" name="ogstools msh2vtu" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>
Convert msh to UnstructuredGrid (vtk)
</description>
<macros>
<import>macros.xml</import>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<expand macro="creator"/>
<expand macro="requirements"/>
<command detect_errors="exit_code"><![CDATA[
ln -s '$input_file' input_file.msh &&
msh2vtu input_file.msh
-d '$dim'
$delz $swapxy $reindex $keep_ids $ascii
-l '$log_level'
]]></command>
<inputs>
<param name="input_file" type="data" format="GMSH" label="Input GMSH File"/>
<param name="dim" type="select" label="Set dimensionality of the mesh" argument="-d">
<option value="1">1D</option>
<option value="2">2D</option>
<option value="3">3D</option>
</param>
<param name="delz" type="boolean" value="false" truevalue="-z" falsevalue="" label="Delete Z Coordinate" optional="true" argument="-z"/>
<param name="swapxy" type="boolean" value="false" truevalue="-s" falsevalue="" label="Swap XY Coordinates" optional="true" argument="-s"/>
<param name="reindex" type="boolean" value="false" truevalue="-r" falsevalue="" label="Reindex" optional="true" argument="-r"/>
<param name="keep_ids" type="boolean" value="false" truevalue="-k" falsevalue="" label="Keep IDs" optional="true" argument="-k"/>
<param name="ascii" type="boolean" value="false" truevalue="-a" falsevalue="" label="ASCII Output" optional="true" argument="-a"/>
<param name="log_level" type="select" label="Log Level" argument="-l">
<option value="ERROR" selected="true">ERROR</option>
<option value="DEBUG">DEBUG</option>
<option value="INFO">INFO</option>
<option value="WARNING">WARNING</option>
</param>
</inputs>
<outputs>
<data name="boundary" format="xml" label="${tool.name}: boundary" from_work_dir="input_file_boundary.vtu" />
<data name="domain" format="xml" label="${tool.name}: domain" from_work_dir="input_file_domain.vtu" />
<data name="physical_group_Bottom" format="xml" label="${tool.name}: physical_group_Bottom" from_work_dir="input_file_physical_group_Bottom.vtu" />
<data name="physical_group_Left" format="xml" label="${tool.name}: physical_group_Left" from_work_dir="input_file_physical_group_Left.vtu" />
<data name="physical_group_Right" format="xml" label="${tool.name}: physical_group_Right" from_work_dir="input_file_physical_group_Right.vtu" />
<data name="physical_group_RockBed" format="xml" label="${tool.name}: physical_group_RockBed" from_work_dir="input_file_physical_group_RockBed.vtu" />
<data name="physical_group_SedimentLayer1" format="xml" label="${tool.name}: physical_group_SedimentLayer1" from_work_dir="input_file_physical_group_SedimentLayer1.vtu" />
<data name="physical_group_SedimentLayer2" format="xml" label="${tool.name}: physical_group_SedimentLayer2" from_work_dir="input_file_physical_group_SedimentLayer2.vtu" />
<data name="physical_group_SedimentLayer3" format="xml" label="${tool.name}: physical_group_SedimentLayer3" from_work_dir="input_file_physical_group_SedimentLayer3.vtu" />
<data name="physical_group_Top" format="xml" label="${tool.name}: physical_group_Top" from_work_dir="input_file_physical_group_Top.vtu" />
</outputs>
<tests>
<test>
<param name="input_file" value="geolayers_2d.msh"/>
<param name="dim" value="2"/>
<param name="delz" value="True"/>
<param name="swapxy" value="True"/>
<param name="reindex" value="True"/>
<param name="keep_ids" value="True"/>
<param name="ascii" value="True"/>
<param name="log_level" value="DEBUG"/>
<output name="boundary" file="input_file_boundary.vtu"/>
<output name="domain" file="input_file_domain.vtu"/>
<output name="physical_group_Bottom" file="input_file_physical_group_Bottom.vtu"/>
<output name="physical_group_Left" file="input_file_physical_group_Left.vtu"/>
<output name="physical_group_Right" file="input_file_physical_group_Right.vtu"/>
<output name="physical_group_RockBed" file="input_file_physical_group_RockBed.vtu"/>
<output name="physical_group_SedimentLayer1" file="input_file_physical_group_SedimentLayer1.vtu"/>
<output name="physical_group_SedimentLayer2" file="input_file_physical_group_SedimentLayer2.vtu"/>
<output name="physical_group_SedimentLayer3" file="input_file_physical_group_SedimentLayer3.vtu"/>
<output name="physical_group_Top" file="input_file_physical_group_Top.vtu"/>
</test>
</tests>
<help><![CDATA[
**Overview:**

msh2vtu is a application that converts a Gmsh (.msh) file for use in OGS by extracting domain-, boundary- and physical group-submeshes and saves them in a set of files in the vtu format.
Supported element types:
- lines (linear and quadratic) in 1D
- triangles and quadrilaterals (linear and quadratic) in 2D
- tetra- and hexahedrons (linear and quadratic) in 3D

**Inputs:**

1. **Input GMSH File:** The GMSH (.msh) file to be converted.
2. **Mesh Dimension (dim):** Select the desired mesh dimension (1, 2, or 3).
3. **Delete Z Coordinate (delz):** Boolean flag to remove the Z coordinate from the mesh (for 2D meshes with z=0).
4. **Swap XY Coordinates (swapxy):** Boolean flag to swap the X and Y coordinates.
5. **Reindex (reindex):** Renumber physical group / region / Material IDs to be renumbered beginning with zero.
6. **Keep IDs (keep_ids):** By default, rename gmsh:physical to MaterialIDs and change type of corresponding cell data to INT32. If True, this is skipped.
7. **ASCII Output (ascii):** Boolean flag to output the file in ASCII format instead of binary.
8. **Log Level (log_level):** Set the level of logging details (DEBUG, INFO, WARNING, ERROR).

**Outputs:**

**Output VTU Files:** The converted mesh file as a set of files with VTU format.
]]></help>
<expand macro="ogs_citation"/>
</tool>
69 changes: 69 additions & 0 deletions tools/ogstools/Converter/shp2msh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<tool id="shp2msh" name="ogstools shp2msh" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>
Convert shp to msh
</description>
<macros>
<import>macros.xml</import>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<expand macro="creator"/>
<expand macro="requirements"/>
<command detect_errors="exit_code"><![CDATA[
export SHAPE_RESTORE_SHX=YES &&
ln -s '$input_shp' input.shp &&
shp2msh --input input.shp --output output.vtu
#if str($cellsize)!="":
--cellsize '$cellsize'
#end if
'$meshing'
'$simplify'
]]></command>
<inputs>
<param name="input_shp" type="data" format="shp" label="Input SHP File" argument="-i"/>
<param name="cellsize" type="float" min="40" optional="true" label="cellsize" argument="-c"/>
<param name="meshing" type="select" label="meshing">
<option value="triangle" selected="true">Triangle</option>
<option value="gmsh">Gmsh</option>
</param>
<param name="simplify" type="select" label="simplify">
<option value="simplified">Simplified</option>
<option value="original" selected="true">Original</option>
</param>
</inputs>
<outputs>
<data name="output" format="xml" from_work_dir="output.vtu"/>
</outputs>
<tests>
<test>
<param name="input_shp" value="circle.shp"/>
<param name="cellsize" value="500.0"/>
<param name="meshing" value= "triangle"/>
<param name="simplify" value="simplified"/>
<output name="output" value="output.vtu"/>
</test>
<test>
<param name="input_shp" value="circle.shp"/>
<param name="meshing" value= "gmsh"/>
<param name="simplify" value="original"/>
<output name="output" value="output2.vtu"/>
</test>
</tests>
<help><![CDATA[
**Overview:**
This tool takes a shapefile (.shp) as input and creates a mesh using either the Triangle or GMSH method.
The cellsize can be optionally specified, and the shapefile can be simplified before meshing.
Output data has the format .vtu/ .vtk.

**Inputs:**

1. **Input Shape File:** The .shp file to be converted.
2. **Cellsize:** Select the desired cellsize min=40.
3. **Meshing:** Choose either triangle or gmsh.
4. **Simplify:** Either the shapefiles are kept unchanged or they can be simplified. Choose between original and simplified.

**Outputs:**

**Output VTU Files:** The converted mesh as a VTU file.
]]></help>
<expand macro="ogs_citation"/>
</tool>
Binary file added tools/ogstools/Converter/test-data/circle.shp
Binary file not shown.
Loading
Loading