support single and double quotes in key value pairs also
escape characters not supported in double quotes
This commit is contained in:
parent
a5c4e7232c
commit
ae49920256
|
@ -6,29 +6,29 @@ homogenization:
|
||||||
|
|
||||||
phase:
|
phase:
|
||||||
Aluminum:
|
Aluminum:
|
||||||
lattice: "cF"
|
"lattice": 'cF'
|
||||||
mechanical:
|
mechanical:
|
||||||
output: [F, P, F_e, F_p, L_p, O]
|
output: [F, P, F_e, F_p, L_p, O]
|
||||||
elastic: {type: "Hooke", C_11: 106.75e+9, C_12: 60.41e+9, C_44: 28.34e+9}
|
elastic: {type: "Hooke", C_11: 106.75e+9, C_12: 60.41e+9, C_44: 28.34e+9}
|
||||||
plastic:
|
plastic:
|
||||||
type: phenopowerlaw
|
'type': "phenopowerlaw"
|
||||||
N_sl: [12]
|
"N_sl": [12]
|
||||||
a_sl: 2.25
|
a_sl: 2.25
|
||||||
atol_xi: 1.0
|
atol_xi: 1.0
|
||||||
dot_gamma_0_sl: 0.001
|
dot_gamma_0_sl: 0.001
|
||||||
h_0_sl-sl: 75.e+6
|
h_0_sl-sl: 75.e+6
|
||||||
h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
|
h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
|
||||||
n_sl: 20
|
n_sl: 20
|
||||||
output: ["xi_sl"]
|
'output': ['xi_sl']
|
||||||
xi_0_sl: [31.e+6]
|
xi_0_sl: [31.e+6]
|
||||||
xi_inf_sl: [63.e+6]
|
xi_inf_sl: [63.e+6]
|
||||||
|
|
||||||
material:
|
material:
|
||||||
- homogenization: SX
|
- homogenization: SX
|
||||||
constituents:
|
constituents:
|
||||||
- phase: Aluminum
|
- 'phase': "Aluminum"
|
||||||
v: 1.0
|
'v': 1.0
|
||||||
O: [1.0, 0.0, 0.0, 0.0]
|
"O": [1.0, 0.0, 0.0, 0.0]
|
||||||
- homogenization: SX
|
- homogenization: SX
|
||||||
constituents:
|
constituents:
|
||||||
- phase: Aluminum
|
- phase: Aluminum
|
||||||
|
|
|
@ -71,8 +71,8 @@ recursive function parse_flow(YAML_flow) result(node)
|
||||||
s = e
|
s = e
|
||||||
d = s + scan(flow_string(s+1:),':')
|
d = s + scan(flow_string(s+1:),':')
|
||||||
e = d + find_end(flow_string(d+1:),'}')
|
e = d + find_end(flow_string(d+1:),'}')
|
||||||
|
|
||||||
key = trim(adjustl(flow_string(s+1:d-1)))
|
key = trim(adjustl(flow_string(s+1:d-1)))
|
||||||
|
if (key(1:1) == '"' .or. key(1:1) == "'" ) key = key(2:len(key)-1)
|
||||||
myVal => parse_flow(flow_string(d+1:e-1)) ! parse items (recursively)
|
myVal => parse_flow(flow_string(d+1:e-1)) ! parse items (recursively)
|
||||||
|
|
||||||
select type (node)
|
select type (node)
|
||||||
|
@ -97,7 +97,7 @@ recursive function parse_flow(YAML_flow) result(node)
|
||||||
allocate(tScalar::node)
|
allocate(tScalar::node)
|
||||||
select type (node)
|
select type (node)
|
||||||
class is (tScalar)
|
class is (tScalar)
|
||||||
if(flow_string(1:1) == '"') then
|
if (flow_string(1:1) == '"' .or. flow_string(1:1) == "'") then
|
||||||
node = trim(adjustl(flow_string(2:len(flow_string)-1)))
|
node = trim(adjustl(flow_string(2:len(flow_string)-1)))
|
||||||
else
|
else
|
||||||
node = trim(adjustl(flow_string))
|
node = trim(adjustl(flow_string))
|
||||||
|
@ -125,7 +125,7 @@ integer function find_end(str,e_char)
|
||||||
N_cu = 0
|
N_cu = 0
|
||||||
i = 1
|
i = 1
|
||||||
do while(i<=len_trim(str))
|
do while(i<=len_trim(str))
|
||||||
if (str(i:i) == '"') i = i + scan(str(i+1:),'"')
|
if (str(i:i) == '"' .or. str(i:i) == "'") i = i + scan(str(i+1:),str(i:i))
|
||||||
if (N_sq==0 .and. N_cu==0 .and. scan(str(i:i),e_char//',') == 1) exit
|
if (N_sq==0 .and. N_cu==0 .and. scan(str(i:i),e_char//',') == 1) exit
|
||||||
N_sq = N_sq + merge(1,0,str(i:i) == '[')
|
N_sq = N_sq + merge(1,0,str(i:i) == '[')
|
||||||
N_cu = N_cu + merge(1,0,str(i:i) == '{')
|
N_cu = N_cu + merge(1,0,str(i:i) == '{')
|
||||||
|
|
Loading…
Reference in New Issue