瀏覽代碼

before merge with najafi

master
mahmood19227 1 年之前
父節點
當前提交
ced7b02378
共有 4 個文件被更改,包括 50 次插入57 次删除
  1. +1
    -1
      CSharp/BasicInputs/Bha/CStringConfiguration.f90
  2. +1
    -1
      Simulator.f90
  3. +21
    -28
      helper.ipynb
  4. +27
    -27
      testjson.f90

+ 1
- 1
CSharp/BasicInputs/Bha/CStringConfiguration.f90 查看文件

@@ -48,7 +48,7 @@ module CStringConfiguration
call json%get(pval,val)
data%Configuration%StringConfiguration%StringConfigurations(i)%Grade = val
end do
call json%get(p,'StringConfigurationItems',pbit)
call json%get(p,'BitDefenition',pbit)
call json%get(pbit,'BitType',pval)
call json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitType)
call json%get(pbit,'BitSize',pval)


+ 1
- 1
Simulator.f90 查看文件

@@ -491,7 +491,7 @@ module Simulator
call json%add(parent,p)
end subroutine

subroutine ConfigurationFromJson(parent)
subroutine ConfigurationFromJson(parent)
type(json_value),pointer :: parent
type(json_core) :: json
type(json_value),pointer :: p


+ 21
- 28
helper.ipynb 查看文件

@@ -913,40 +913,33 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\t\t\tcall json%get(pitem,\"ComponentType\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%ComponentType)\n",
"\n",
"\t\t\tcall json%get(pitem,\"NumberOfJoint\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%NumberOfJoint)\n",
"\n",
"\t\t\tcall json%get(pitem,\"LengthPerJoint\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%LengthPerJoint)\n",
"\n",
"\t\t\tcall json%get(pitem,\"NominalOd\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%NominalOd)\n",
"\n",
"\t\t\tcall json%get(pitem,\"NominalId\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%NominalId)\n",
"\n",
"\t\t\tcall json%get(pitem,\"WeightPerLength\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%WeightPerLength)\n",
"\n",
"\t\t\tcall json%get(pitem,\"ComponentLength\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%ComponentLength)\n",
"\n",
"\t\t\tcall json%get(pitem,\"NominalToolJointOd\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%NominalToolJointOd)\n",
"\n",
"\t\t\tcall json%get(pitem,\"Grade\",pval)\n",
"\t\t\tcall json%get(pval,data%Configuration%StringConfiguration%StringConfigurations(i)%Grade)\n",
"\n"
"\t\tcall json%get(pbit,'BitType',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitType)\n",
"\t\tcall json%get(pbit,'BitSize',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitSize)\n",
"\t\tcall json%get(pbit,'BitCodeHundreds',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitCodeHundreds)\n",
"\t\tcall json%get(pbit,'BitCodeTens',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitCodeTens)\n",
"\t\tcall json%get(pbit,'BitCodeOnes',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitCodeOnes)\n",
"\t\tcall json%get(pbit,'BitNozzleSize',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitNozzleSize)\n",
"\t\tcall json%get(pbit,'BitLength',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitLength)\n",
"\t\tcall json%get(pbit,'BitWeightPerLength',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitWeightPerLength)\n",
"\t\tcall json%get(pbit,'BitNozzleNo',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%BitNozzleNo)\n",
"\t\tcall json%get(pbit,'FloatValve',pval)\n",
"\t\tcall json%get(pval,data%Configuration%StringConfiguration%BitDefinition%FloatValve)\n"
]
}
],


+ 27
- 27
testjson.f90 查看文件

@@ -1,28 +1,28 @@
program RedisInterface
use json_module
use CStringConfigurationVariables
type(json_file) :: jsonfile
type(json_value),pointer :: jsonvalue,jsonvalue2,child,child2,jsonvalue3
type(json_core) :: jsoncore
logical :: is_found
integer ::n_children,i,j
type(CStringItem), allocatable :: StringConfigurations(:)
call jsonfile%initialize()
call jsonfile%load_file('data-witharray.json'); if (jsonfile%failed()) stop
call jsonfile%json_file_get_root(jsonvalue)
call jsoncore%get(jsonvalue,'Configuration',jsonvalue2)
call jsoncore%get(jsonvalue2,'StringConfiguration',jsonvalue)
call jsoncore%get(jsonvalue,'StringConfigurationItems',jsonvalue2)
call jsoncore%info(jsonvalue2, n_children=n_children)
do i=1,n_children
call jsoncore%get_child(jsonvalue2, i, child, found=is_found)
if (.not. is_found) print *,"not found"
call jsoncore%get(child,"BitCodeHundreds",child2)
call jsoncore%get(child2,j)
print *,"BitCodeHundreds=",j
end do
print *,"n_children=",n_children
call jsonfile%destroy()
program RedisInterface
use json_module
use CStringConfigurationVariables
type(json_file) :: jsonfile
type(json_value),pointer :: jsonvalue,jsonvalue2,child,child2,jsonvalue3
type(json_core) :: jsoncore
logical :: is_found
integer ::n_children,i,j
type(CStringItem), allocatable :: StringConfigurations(:)
call jsonfile%initialize()
call jsonfile%load_file('data-witharray.json'); if (jsonfile%failed()) stop
call jsonfile%json_file_get_root(jsonvalue)
call jsoncore%get(jsonvalue,'Configuration',jsonvalue2)
call jsoncore%get(jsonvalue2,'StringConfiguration',jsonvalue)
call jsoncore%get(jsonvalue,'StringConfigurationItems',jsonvalue2)
call jsoncore%info(jsonvalue2, n_children=n_children)
do i=1,n_children
call jsoncore%get_child(jsonvalue2, i, child, found=is_found)
if (.not. is_found) print *,"not found"
call jsoncore%get(child,"BitCodeHundreds",child2)
call jsoncore%get(child2,j)
print *,"BitCodeHundreds=",j
end do
print *,"n_children=",n_children
call jsonfile%destroy()
end program

Loading…
取消
儲存