Simulation Core
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

write_vars.i90 2.7 KiB

pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # 1 "/home/admin/SimulationCore2/Test/write_vars.f90"
  2. module writevarsmodule
  3. use Simulator
  4. use RedisInterface
  5. contains
  6. subroutine InitDummyData()
  7. print *,"Initialize Dummy StringConfiguration ..."
  8. allocate(data%Configuration%StringConfiguration%StringConfigurations(2))
  9. data%Configuration%StringConfiguration%StringConfigurationCount =2
  10. data%Configuration%StringConfiguration%StringConfigurations(1)%Grade='A'
  11. data%Configuration%StringConfiguration%StringConfigurations(2)%Grade='B'
  12. print *,"Initialize Dummy Data ..."
  13. allocate(data%Configuration%Formation%Formations(2))
  14. data%Configuration%Formation%Count = 2
  15. data%Configuration%Formation%Formations(1)%Top = 0
  16. data%Configuration%Formation%Formations(2)%Top = 1000
  17. print *,"Initialize Dummy Data ..."
  18. allocate(data%Configuration%Path%Items(2))
  19. data%Configuration%Path%ItemCount = 2
  20. data%Configuration%Path%Items(1)%Length =1000
  21. data%Configuration%Path%Items(2)%Length =2000
  22. print *,"Initialize Dummy Data ..."
  23. end subroutine
  24. subroutine write_input_variables()
  25. use CAccumulator
  26. use json_module
  27. implicit none
  28. type(json_value),pointer :: jsonroot
  29. character(len=20)::fn
  30. ! integer::n_children
  31. call InitDummyData()
  32. ! ! allocate(data%Configuration%Path%DataPoints(3))
  33. ! allocate(data)
  34. call jsoncore%initialize()
  35. call jsoncore%create_object(jsonroot,'')
  36. call jsoncore%add(jsonroot,'status',simulationStatus)
  37. call jsoncore%add(jsonroot,'speed',simulationSpeed)
  38. call jsoncore%add(jsonroot,'endstep',simulationEnd)
  39. call ConfigurationToJson(jsonroot)
  40. ! call WarningsToJson(jsonroot)
  41. call ProblemsToJson(jsonroot)
  42. call EquipmentsToJson(jsonroot)
  43. ! call json%print(jsonroot,trim(fn)//".json")
  44. call jsoncore%serialize(jsonroot,redisInput)
  45. ! print *,"Writing to redis:",len(redisInput)
  46. ! nullify(redisContent)
  47. ! deallocate(redisContent)
  48. ! call json%destroy(pval)
  49. call setInput(redisInput)
  50. call jsoncore%print(jsonroot,'test.json')
  51. call jsoncore%destroy(jsonroot)
  52. print *,"write ends"
  53. end subroutine
  54. end module writevarsmodule
  55. program writeWars
  56. use json_module
  57. use writevarsmodule
  58. use RedisInterface
  59. implicit none
  60. character(len=50)::configFilename = "config-local.json"
  61. if(command_argument_count()>0) then
  62. call get_command_argument(1, configFilename)
  63. endif
  64. call initSimulation(configFilename)
  65. call initConnection(configFilename)
  66. ! call init_modules()
  67. call write_input_variables()
  68. end program writeWars