# 1 "/home/admin/SimulationCore2/Test/write_vars.f90" module writevarsmodule use Simulator use RedisInterface contains subroutine InitDummyData() print *,"Initialize Dummy StringConfiguration ..." allocate(data%Configuration%StringConfiguration%StringConfigurations(2)) data%Configuration%StringConfiguration%StringConfigurationCount =2 data%Configuration%StringConfiguration%StringConfigurations(1)%Grade='A' data%Configuration%StringConfiguration%StringConfigurations(2)%Grade='B' print *,"Initialize Dummy Data ..." allocate(data%Configuration%Formation%Formations(2)) data%Configuration%Formation%Count = 2 data%Configuration%Formation%Formations(1)%Top = 0 data%Configuration%Formation%Formations(2)%Top = 1000 print *,"Initialize Dummy Data ..." allocate(data%Configuration%Path%Items(2)) data%Configuration%Path%ItemCount = 2 data%Configuration%Path%Items(1)%Length =1000 data%Configuration%Path%Items(2)%Length =2000 print *,"Initialize Dummy Data ..." end subroutine subroutine write_input_variables() use CAccumulator use json_module implicit none type(json_value),pointer :: jsonroot character(len=20)::fn ! integer::n_children call InitDummyData() ! ! allocate(data%Configuration%Path%DataPoints(3)) ! allocate(data) call jsoncore%initialize() call jsoncore%create_object(jsonroot,'') call jsoncore%add(jsonroot,'status',simulationStatus) call jsoncore%add(jsonroot,'speed',simulationSpeed) call jsoncore%add(jsonroot,'endstep',simulationEnd) call ConfigurationToJson(jsonroot) ! call WarningsToJson(jsonroot) call ProblemsToJson(jsonroot) call EquipmentsToJson(jsonroot) ! call json%print(jsonroot,trim(fn)//".json") call jsoncore%serialize(jsonroot,redisInput) ! print *,"Writing to redis:",len(redisInput) ! nullify(redisContent) ! deallocate(redisContent) ! call json%destroy(pval) call setInput(redisInput) call jsoncore%print(jsonroot,'test.json') call jsoncore%destroy(jsonroot) print *,"write ends" end subroutine end module writevarsmodule program writeWars use json_module use writevarsmodule use RedisInterface implicit none character(len=50)::configFilename = "config-local.json" if(command_argument_count()>0) then call get_command_argument(1, configFilename) endif call initSimulation(configFilename) call initConnection(configFilename) ! call init_modules() call write_input_variables() end program writeWars