40int test_publisher(std::shared_ptr<adc::publisher_api> pi, std::shared_ptr< adc::builder_api> b, std::map<std::string, std::string>& pconfig ) {
41 std::cout <<
"------------------- begin --------------------" << std::endl;
44 err = pi->config(pconfig);
46 std::cout <<
"config failed " <<
47 std::strerror(err) << std::endl;
51 err = pi->initialize();
53 std::cout <<
"initialize failed " <<
54 std::strerror(err) << std::endl;
60 std::cout <<
"publish 1 failed " <<
61 std::strerror(err) << std::endl;
68 std::cout <<
"publish 2 failed " <<
69 std::strerror(err) << std::endl;
76 std::cout <<
"publish 3 failed " <<
77 std::strerror(err) << std::endl;
82 std::cout <<
"------------------- end --------------------" << std::endl;
89 std::shared_ptr< adc::builder_api > app_data = f.
get_builder();
90#if ADC_BOOST_JSON_PUBLIC
91 boost::json::object jo = {{
"a",
"b"},{
"C",
"d"},{
"n",1}};
94 MPI_Comm comm = MPI_COMM_WORLD;
95 void *commptr = &comm;
101 std::vector<std::string> children = {
"uuid1",
"uuid2",
"uuid3"};
102 b->add_workflow_section();
103 b->add_workflow_children(children);
105 app_data->add(
"bool0",
false);
106 app_data->add(
"bool1",
true);
107 app_data->add(
"char1",
'A');
108 app_data->add(
"c16", u
'¢');
110 app_data->add(
"c32", U
'猫');
111 const std::string ccppstr(
"ccppstr");
112 app_data->add(
"ccppstr", ccppstr);
113 std::string cppstr(
"cppstr");
114 app_data->add(
"cppstr", cppstr);
116 const char *cstr =
"cstr_nul";
117 app_data->add(
"cstr1", cstr);
119 app_data->add_json_string(
"jstr1", std::string (
"{\"a\":\"b\", \"c\":[1,2, 3]}"));
120#if ADC_BOOST_JSON_PUBLIC
121 app_data->add(
"jsonobj", jo);
123 uint8_t u8 = std::numeric_limits<uint8_t>::max();
124 uint16_t u16 = std::numeric_limits<uint16_t>::max();
125 uint32_t u32 = std::numeric_limits<uint32_t>::max();
126 uint64_t u64 = std::numeric_limits<uint64_t>::max();
127 app_data->add(
"u8", u8);
128 app_data->add(
"u16", u16);
129 app_data->add(
"u32", u32);
130 app_data->add(
"u64", u64);
131 int8_t i8 = std::numeric_limits<int8_t>::max();
132 int16_t i16 = std::numeric_limits<int16_t>::max();
133 int32_t i32 = std::numeric_limits<int32_t>::max();
134 int64_t i64 = std::numeric_limits<int64_t>::max();
135 app_data->add(
"i8", i8);
136 app_data->add(
"i16", i16);
137 app_data->add(
"i32", i32);
138 app_data->add(
"i64", i64);
139 app_data->add(
"flt", std::numeric_limits<float>::max());
140 app_data->add(
"dbl", std::numeric_limits<double>::max() );
141 app_data->add(
"fcplx", std::complex<float>(
142 std::numeric_limits<float>::max(),std::numeric_limits<float>::max()));
143 app_data->add(
"dcplx", std::complex<double>(
144 std::numeric_limits<double>::max(),std::numeric_limits<double>::max()));
145 const char *cstrings[] = {
"a",
"B",
"c2"};
152 for (
int i = 0; i < 4; i++) {
153 vcstrings[i] =
new char[2];
154 snprintf(vcstrings[i], 2,
"%d", i);
156 ua64[i] = std::numeric_limits<uint64_t>::max() - i;
161 std::string cppstrings[] = {
"ap",
"Bp",
"c2p"};
162 app_data->add_array(
"nulembed",
"a\0b", 3);
163 app_data->add_array(
"cstrs", cstrings, 3);
164 app_data->add_array(
"cppstrs", cppstrings, 3);
165 app_data->add_array(
"vcstrs", vcstrings, 4);
166 for (
int i = 0; i < 4; i++) {
167 delete [] vcstrings[i];
169 app_data->add_array(
"ia", ia, 4);
170 app_data->add_array(
"ua", ua, 4);
171 app_data->add_array(
"ua64", ua64, 4);
172 app_data->add_array(
"fa", fa, 4);
173 app_data->add_array(
"da", da, 4);
175 b->add_header_section(
"cxx_demo_1");
179 b->add_app_data_section(app_data);
181 b->add_memory_usage_section();
183 std::shared_ptr< adc::builder_api > code_details = f.
get_builder();
186 std::shared_ptr< adc::builder_api > version = f.
get_builder();
187 version->add(
"version",
"1.1.3");
188 const char* tags[] = {
"boca_raton",
"saronida_2",
"mpi"};
189 version->add_array(
"tags", tags ,2);
190 version->add(
"mesh_version",
"5.0.0");
192 b->add_code_section(
"repartitioner", version, code_details);
194 std::shared_ptr< adc::builder_api > build_details = f.
get_builder();
195 b->add_code_configuration_section(build_details);
197 std::shared_ptr< adc::builder_api > model_data = f.
get_builder();
198 model_data->add(
"nx", 3);
199 model_data->add(
"ny", 10);
200 model_data->add(
"step", 0);
201 b->add_model_data_section(model_data);
203 std::shared_ptr< adc::builder_api > status_details = f.
get_builder();
204 status_details->add(
"tmax", 15000.25);
205 status_details->add(
"tmax_loc", 10325);
206 status_details->add(
"step", 234);
207 b->add_exit_data_section(1,
"we didn't succeed due to high temperatures", status_details);
210 std::string ss = b->serialize();
211 std::cout <<
"-------------------------------" << std::endl;
212 std::cout << ss << std::endl;
213 std::cout <<
"-------------------------------" << std::endl;