44int test_publisher(std::shared_ptr<adc::publisher_api> pi, std::shared_ptr< adc::builder_api> b, std::map<std::string, std::string>& pconfig ) {
45 std::cout <<
"------------------- begin --------------------" << std::endl;
48 err = pi->config(pconfig);
50 std::cout <<
"config failed " <<
51 std::strerror(err) << std::endl;
55 err = pi->initialize();
57 std::cout <<
"initialize failed " <<
58 std::strerror(err) << std::endl;
64 std::cout <<
"publish 1 failed " <<
65 std::strerror(err) << std::endl;
72 std::cout <<
"publish 2 failed " <<
73 std::strerror(err) << std::endl;
80 std::cout <<
"publish 3 failed " <<
81 std::strerror(err) << std::endl;
86 std::cout <<
"------------------- end --------------------" << std::endl;
93 std::shared_ptr< adc::builder_api > app_data = f.
get_builder();
94#if ADC_BOOST_JSON_PUBLIC
95 boost::json::object jo = {{
"a",
"b"},{
"C",
"d"},{
"n",1}};
98 MPI_Comm comm = MPI_COMM_WORLD;
99 void *commptr = &comm;
101 void *commptr = NULL;
105 std::vector<std::string> children = {
"uuid1",
"uuid2",
"uuid3"};
106 b->add_workflow_section();
107 b->add_workflow_children(children);
109 app_data->add(
"bool0",
false);
110 app_data->add(
"bool1",
true);
111 app_data->add(
"char1",
'A');
112 app_data->add(
"c16", u
'¢');
114 app_data->add(
"c32", U
'猫');
115 const std::string ccppstr(
"ccppstr");
116 app_data->add(
"ccppstr", ccppstr);
117 std::string cppstr(
"cppstr");
118 app_data->add(
"cppstr", cppstr);
120 const char *cstr =
"cstr_nul";
121 app_data->add(
"cstr1", cstr);
123 app_data->add_json_string(
"jstr1", std::string (
"{\"a\":\"b\", \"c\":[1,2, 3]}"));
124#if ADC_BOOST_JSON_PUBLIC
125 app_data->add(
"jsonobj", jo);
127 uint8_t u8 = std::numeric_limits<uint8_t>::max();
128 uint16_t u16 = std::numeric_limits<uint16_t>::max();
129 uint32_t u32 = std::numeric_limits<uint32_t>::max();
130 uint64_t u64 = std::numeric_limits<uint64_t>::max();
131 app_data->add(
"u8", u8);
132 app_data->add(
"u16", u16);
133 app_data->add(
"u32", u32);
134 app_data->add(
"u64", u64);
135 int8_t i8 = std::numeric_limits<int8_t>::max();
136 int16_t i16 = std::numeric_limits<int16_t>::max();
137 int32_t i32 = std::numeric_limits<int32_t>::max();
138 int64_t i64 = std::numeric_limits<int64_t>::max();
139 app_data->add(
"i8", i8);
140 app_data->add(
"i16", i16);
141 app_data->add(
"i32", i32);
142 app_data->add(
"i64", i64);
143 app_data->add(
"flt", std::numeric_limits<float>::max());
144 app_data->add(
"dbl", std::numeric_limits<double>::max() );
145 app_data->add(
"fcplx", std::complex<float>(
146 std::numeric_limits<float>::max(),std::numeric_limits<float>::max()));
147 app_data->add(
"dcplx", std::complex<double>(
148 std::numeric_limits<double>::max(),std::numeric_limits<double>::max()));
149 const char *cstrings[] = {
"a",
"B",
"c2"};
156 for (
int i = 0; i < 4; i++) {
157 vcstrings[i] =
new char[2];
158 snprintf(vcstrings[i], 2,
"%d", i);
160 ua64[i] = std::numeric_limits<uint64_t>::max() - i;
165 std::string cppstrings[] = {
"ap",
"Bp",
"c2p"};
166 app_data->add_array(
"nulembed",
"a\0b", 3);
167 app_data->add_array(
"cstrs", cstrings, 3);
168 app_data->add_array(
"cppstrs", cppstrings, 3);
169 app_data->add_array(
"vcstrs", vcstrings, 4);
170 for (
int i = 0; i < 4; i++) {
171 delete [] vcstrings[i];
173 app_data->add_array(
"ia", ia, 4);
174 app_data->add_array(
"ua", ua, 4);
175 app_data->add_array(
"ua64", ua64, 4);
176 app_data->add_array(
"fa", fa, 4);
177 app_data->add_array(
"da", da, 4);
179 b->add_header_section(
"cxx_demo_1");
183 b->add_app_data_section(app_data);
185 b->add_memory_usage_section();
187 std::shared_ptr< adc::builder_api > code_details = f.
get_builder();
190 std::shared_ptr< adc::builder_api > version = f.
get_builder();
191 version->add(
"version",
"1.1.3");
192 const char* tags[] = {
"boca_raton",
"saronida_2",
"mpi"};
193 version->add_array(
"tags", tags ,2);
194 version->add(
"mesh_version",
"5.0.0");
196 b->add_code_section(
"repartitioner", version, code_details);
198 std::shared_ptr< adc::builder_api > build_details = f.
get_builder();
199 b->add_code_configuration_section(build_details);
201 std::shared_ptr< adc::builder_api > model_data = f.
get_builder();
202 model_data->add(
"nx", 3);
203 model_data->add(
"ny", 10);
204 model_data->add(
"step", 0);
205 b->add_model_data_section(model_data);
207 std::shared_ptr< adc::builder_api > status_details = f.
get_builder();
208 status_details->add(
"tmax", 15000.25);
209 status_details->add(
"tmax_loc", 10325);
210 status_details->add(
"step", 234);
211 b->add_exit_data_section(1,
"we didn't succeed due to high temperatures", status_details);
214 std::string ss = b->serialize();
215 std::cout <<
"-------------------------------" << std::endl;
216 std::cout << ss << std::endl;
217 std::cout <<
"-------------------------------" << std::endl;