Merge branch 'main' into feature/pointwisePolytrope

This commit is contained in:
2025-03-26 11:38:07 -04:00
86 changed files with 15850 additions and 2170 deletions

View File

@@ -1,47 +1,22 @@
Poly:
Gaussian:
Sigma: 0.1
Solver:
ViewInitialGuess: false
Debug:
Global:
GLVis:
Keyset: ''
View: 'false'
Exit: 'false'
F_gf_View:
Keyset: defaultKeyset
EOS:
Helm:
LogFile: "log"
Network:
Approx8:
NonStiff:
AbsTol: 1.0e-06
RelTol: 1.0e-06
Stiff:
AbsTol: 1.0e-06
RelTol: 1.0e-06
Probe:
GLVis:
Visualization: true
Host: localhost
Port: 19916
LogManager:
DefaultLogName: 4DSSE.log
# This file was auto-generated by generateDefaultConfig.py
# Do not modify this file directly.
#=================================== TYPE HINTS ===================================
# Poly:
# Gaussian:
# Sigma: double
# Solver:
# ViewInitialGuess: bool
# Debug:
# Global:
# GLVis:
# Keyset: sd:string
# View: bo
# Exit: bo
# F_gf_View:
# Keyset: std:string
# Probe:
# GLVis:
# Visualization: bool
# Host: std::string
# Port: int
# LogManager:
# DefaultLogName: std::string
#
GLVis:
Host: "localhost"
Port: 19916
Visualization: true
LogManager:
DefaultLogName: "4DSSE.log"
opac:
lowTemp:
numeric:
maxIter: 10

View File

@@ -31,6 +31,9 @@ def parse_value(value, type_hint):
if type_hint in {"int", "long"}:
return (int(value), type_hint)
elif type_hint in {"float", "double"}:
return float(value)
elif value == "defaultDataDir":
return "data" # special case for defaultDataDir
return (float(value), type_hint)
elif type_hint == "bool":
return (value.lower() in {"true", "1"}, type_hint)
@@ -38,6 +41,9 @@ def parse_value(value, type_hint):
return (value.strip('"'), type_hint) # Remove quotes for string literals
elif value.startswith("'") and value.endswith("'"):
return (value.strip("'"), type_hint) # Remove single quotes
return value.strip("'") # Remove single quotes
elif value.startswith('"') and value.endswith('"'):
return (value.strip('"'). type_hint)# Remove quotes for string literals
return (value, type_hint) # Return as-is if unsure
@@ -66,10 +72,19 @@ def scan_files(directory):
print(f"Match: {match.group()}")
type_hint, hierarchy, value = match.groups()
keys = hierarchy.split(":")
if keys[0] == "Data" and keys[1] == "Dir":
continue # Skip Data:Dir as it is a special case
insert_into_dict(hierarchy_dict, keys, value, type_hint)
return hierarchy_dict
class QuotedString(str):
pass
def represent_quoted_string(dumper, data):
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='"')
def split_dict_recursive(originalDict):
dataDict = {}
typeDict = {}
@@ -87,6 +102,19 @@ def split_dict_recursive(originalDict):
def save_yaml(data, output_file):
"""Saves the nested dictionary to a YAML file."""
yaml.add_representer(QuotedString, represent_quoted_string)
def quote_strings(data):
if isinstance(data, dict):
return {k: quote_strings(v) for k, v in data.items()}
elif isinstance(data, list):
return [quote_strings(item) for item in data]
elif isinstance(data, str):
return QuotedString(data)
else:
return data
data = quote_strings(data)
options, types = split_dict_recursive(data)
with open(output_file, 'w', encoding='utf-8') as f:
yaml.dump(options, f, default_flow_style=False, sort_keys=False, indent=4)